@@ -129,34 +129,36 @@ GPUdii() o2::track::TrackParCov buildTrackSeed(const Cluster& cluster1,
129129 const float bz,
130130 const bool reverse = false )
131131{
132- const float ca = o2::gpu::CAMath::Cos (tf3.alphaTrackingFrame ), sa = o2::gpu::CAMath::Sin (tf3.alphaTrackingFrame );
132+ const float sign = reverse ? -1 .f : 1 .f ;
133+
134+ float ca, sa;
135+ o2::gpu::CAMath::SinCos (tf3.alphaTrackingFrame , sa, ca);
136+
133137 const float x1 = cluster1.xCoordinate * ca + cluster1.yCoordinate * sa;
134138 const float y1 = -cluster1.xCoordinate * sa + cluster1.yCoordinate * ca;
135- const float z1 = cluster1.zCoordinate ;
136139 const float x2 = cluster2.xCoordinate * ca + cluster2.yCoordinate * sa;
137140 const float y2 = -cluster2.xCoordinate * sa + cluster2.yCoordinate * ca;
138- const float z2 = cluster2.zCoordinate ;
139141 const float x3 = tf3.xTrackingFrame ;
140142 const float y3 = tf3.positionTrackingFrame [0 ];
141- const float z3 = tf3. positionTrackingFrame [ 1 ];
142-
143- const bool zeroField{ o2::gpu::CAMath::Abs (bz) < o2::constants::math::Almost0};
144- const float sign = (reverse) ? - 1 . f : 1 . f ;
145- const float tgp = zeroField ? sign * o2::gpu::CAMath::ATan2 (y3 - y1, x3 - x1) : 1 . f ;
146- const float crv = sign * (zeroField ? 1 . f : math_utils::computeCurvature (x3, y3, x2, y2, x1, y1)) ;
147- const float snp = (zeroField ? tgp / o2::gpu::CAMath::Sqrt ( 1 .f + tgp * tgp) : crv * (x3 - math_utils::computeCurvatureCentreX (x3, y3, x2, y2, x1, y1))) ;
148- const float tgl12 = math_utils::computeTanDipAngle (x1, y1, x2, y2, z1, z2);
149- const float tgl23 = math_utils::computeTanDipAngle (x2, y2, x3, y3, z2, z3 );
150- const float q2pt = zeroField ? sign / o2::track:: kMostProbablePt : crv / (bz * o2::constants::math::B2C );
151- const float q2pt2 = crv * crv;
152- const float sg2q2pt = o2::track:: kC1Pt2max * (q2pt2 > 0.0005 ? (q2pt2 < 1 ? q2pt2 : 1 ) : 0.0005 ) ;
153- return track::TrackParCov (tf3. xTrackingFrame , tf3. alphaTrackingFrame ,
154- {y3, z3, snp, 0 . 5f * (tgl12 + tgl23), q2pt},
155- {tf3. covarianceTrackingFrame [ 0 ],
156- tf3. covarianceTrackingFrame [ 1 ] , tf3.covarianceTrackingFrame [ 2 ],
157- 0 . f , 0 . f , track:: kCSnp2max ,
158- 0 . f , 0 . f , 0 . f , track:: kCTgl2max ,
159- 0 .f , 0 .f , 0 .f , 0 .f , sg2q2pt}) ;
143+
144+ float snp, q2pt, q2pt2;
145+ if ( o2::gpu::CAMath::Abs (bz) < 0 . 01f ) {
146+ const float tgp = o2::gpu::CAMath::ATan2 (y3 - y1, x3 - x1) ;
147+ snp = sign * tgp / o2::gpu::CAMath::Sqrt ( 1 . f + tgp * tgp) ;
148+ q2pt = sign / track:: kMostProbablePt ;
149+ q2pt2 = 1 .f ;
150+ } else {
151+ const float crv = math_utils::computeCurvature (x3, y3, x2, y2, x1, y1 );
152+ snp = sign * crv * (x3 - math_utils::computeCurvatureCentreX (x3, y3, x2, y2, x1, y1) );
153+ q2pt = sign * crv / (bz * o2::constants::math::B2C) ;
154+ q2pt2 = crv * crv ;
155+ }
156+
157+ const float tgl = 0 . 5f * ( math_utils::computeTanDipAngle (x1, y1, x2, y2, cluster1. zCoordinate , cluster2. zCoordinate ) +
158+ math_utils::computeTanDipAngle (x2, y2, x3, y3, cluster2. zCoordinate , tf3.positionTrackingFrame [ 1 ]));
159+ const float sg2q2pt = track:: kC1Pt2max * (q2pt2 > 0 . 0005f ? (q2pt2 < 1 . f ? q2pt2 : 1 . f ) : 0 . 0005f );
160+
161+ return {x3, tf3. alphaTrackingFrame , {y3, tf3. positionTrackingFrame [ 1 ], snp, tgl, q2pt}, {tf3. covarianceTrackingFrame [ 0 ], tf3. covarianceTrackingFrame [ 1 ], tf3. covarianceTrackingFrame [ 2 ], 0 . f , 0 . f , track:: kCSnp2max , 0 . f , 0 . f , 0 . f , track:: kCTgl2max , 0 .f , 0 .f , 0 .f , 0 .f , sg2q2pt}} ;
160162}
161163
162164template <int nLayers>
0 commit comments