An efficient algorithm for charged tracks pattern recognition