@@ -765,15 +765,14 @@ void TrackerTraits<nLayers>::findRoads(const int iteration)
765765 auto forSeed = [&](auto Tag, int iSeed, int offset = 0 ) {
766766 TrackITSExt temporaryTrack = seedTrackForRefit (trackSeeds[iSeed]);
767767 o2::track::TrackPar linRef{temporaryTrack};
768- o2::track::TrackParCov savTr = temporaryTrack; // REMOVE
769768 bool fitSuccess = fitTrack (temporaryTrack, 0 , mTrkParams [0 ].NLayers , 1 , mTrkParams [0 ].MaxChi2ClusterAttachment , mTrkParams [0 ].MaxChi2NDF , o2::constants::math::VeryBig, 0 , &linRef);
770769 if (!fitSuccess) {
771770 return 0 ;
772771 }
773772 temporaryTrack.getParamOut () = temporaryTrack.getParamIn ();
774773 linRef = temporaryTrack.getParamOut (); // use refitted track as lin.reference
775774 temporaryTrack.resetCovariance ();
776- temporaryTrack.setCov (temporaryTrack.getQ2Pt () * temporaryTrack.getQ2Pt () * temporaryTrack.getCov ()[14 ], 14 );
775+ temporaryTrack.setCov (temporaryTrack.getQ2Pt () * temporaryTrack.getQ2Pt () * temporaryTrack.getCov ()[o2::track::CovLabels:: kSigQ2Pt2 ], o2::track::CovLabels:: kSigQ2Pt2 );
777776 temporaryTrack.setChi2 (0 );
778777 fitSuccess = fitTrack (temporaryTrack, mTrkParams [0 ].NLayers - 1 , -1 , -1 , mTrkParams [0 ].MaxChi2ClusterAttachment , mTrkParams [0 ].MaxChi2NDF , 50 .f , 0 , &linRef);
779778 if (!fitSuccess || temporaryTrack.getPt () < mTrkParams [iteration].MinPt [mTrkParams [iteration].NLayers - temporaryTrack.getNClusters ()]) {
@@ -1082,7 +1081,7 @@ bool TrackerTraits<nLayers>::fitTrack(TrackITSExt& track, int start, int end, in
10821081 if (!track.o2 ::track::TrackParCov::update (trackingHit.positionTrackingFrame , trackingHit.covarianceTrackingFrame )) {
10831082 return false ;
10841083 }
1085- if (linRef && mTrkParams [0 ].shiftRefToCluster ) { // displace the reference to the last updated cluster
1084+ if (linRef && mTrkParams [0 ].ShiftRefToCluster ) { // displace the reference to the last updated cluster
10861085 linRef->setY (trackingHit.positionTrackingFrame [0 ]);
10871086 linRef->setZ (trackingHit.positionTrackingFrame [1 ]);
10881087 }
@@ -1208,27 +1207,22 @@ template <int nLayers>
12081207TrackITSExt TrackerTraits<nLayers>::seedTrackForRefit(const CellSeedN& seed)
12091208{
12101209 TrackITSExt temporaryTrack (seed);
1210+ int lrMin = nLayers, lrMax = 0 , lrMid = 0 ;
12111211 for (int iL = 0 ; iL < nLayers; ++iL) {
1212- temporaryTrack.setExternalClusterIndex (iL, seed.getCluster (iL), seed.getCluster (iL) != constants::UnusedIndex);
1212+ const int idx = seed.getCluster (iL);
1213+ temporaryTrack.setExternalClusterIndex (iL, idx, idx != constants::UnusedIndex);
1214+ if (idx != constants::UnusedIndex) {
1215+ lrMin = o2::gpu::CAMath::Min (lrMin, iL);
1216+ lrMax = o2::gpu::CAMath::Max (lrMax, iL);
1217+ }
12131218 }
12141219 int ncl = temporaryTrack.getNClusters ();
1215- if (ncl < mTrkParams [0 ].reseedIfShorter ) { // reseed with circle passing via edges and the midpoint
1216- int lrMin = 999 , lrMax = 0 , lrMid = 0 ;
1220+ if (ncl < mTrkParams [0 ].ReseedIfShorter ) { // reseed with circle passing via edges and the midpoint
12171221 if (ncl == mTrkParams [0 ].NLayers ) {
12181222 lrMin = 0 ;
12191223 lrMax = mTrkParams [0 ].NLayers - 1 ;
12201224 lrMid = (lrMin + lrMax) / 2 ;
12211225 } else {
1222- for (int iL = 0 ; iL < nLayers; ++iL) {
1223- if (seed.getCluster (iL) != constants::UnusedIndex) {
1224- if (iL < lrMin) {
1225- lrMin = iL;
1226- }
1227- if (iL > lrMax) {
1228- lrMax = iL;
1229- }
1230- }
1231- }
12321226 lrMid = lrMin + 1 ;
12331227 float midR = 0.5 * (mTrkParams [0 ].LayerRadii [lrMax] + mTrkParams [0 ].LayerRadii [lrMin]), dstMidR = o2::gpu::GPUCommonMath::Abs (midR - mTrkParams [0 ].LayerRadii [lrMid]);
12341228 for (int iL = lrMid + 1 ; iL < lrMax; ++iL) { // find the midpoint as closest to the midR
@@ -1242,45 +1236,48 @@ TrackITSExt TrackerTraits<nLayers>::seedTrackForRefit(const CellSeedN& seed)
12421236 const auto & cluster0_tf = mTimeFrame ->getTrackingFrameInfoOnLayer (lrMin)[seed.getCluster (lrMin)]; // if the sensor frame!
12431237 const auto & cluster1_gl = mTimeFrame ->getUnsortedClusters ()[lrMid][seed.getCluster (lrMid)]; // global frame
12441238 const auto & cluster2_gl = mTimeFrame ->getUnsortedClusters ()[lrMax][seed.getCluster (lrMax)]; // global frame
1245- temporaryTrack.getParamIn () = buildTrackSeed (cluster2_gl, cluster1_gl, cluster0_tf);
1246- temporaryTrack.setQ2Pt (-temporaryTrack.getQ2Pt ()); // we are calling buildTrackSeed with the clusters order opposite to what it expects
1247- temporaryTrack.setSnp (-temporaryTrack.getSnp ()); // we are calling buildTrackSeed with the clusters order opposite to what it expects
1239+ temporaryTrack.getParamIn () = buildTrackSeed (cluster2_gl, cluster1_gl, cluster0_tf, true );
12481240 }
12491241 temporaryTrack.resetCovariance ();
1250- temporaryTrack.setCov (temporaryTrack.getQ2Pt () * temporaryTrack.getQ2Pt () * temporaryTrack.getCov ()[14 ], 14 );
1242+ temporaryTrack.setCov (temporaryTrack.getQ2Pt () * temporaryTrack.getQ2Pt () * temporaryTrack.getCov ()[o2::track::CovLabels:: kSigQ2Pt2 ], o2::track::CovLabels:: kSigQ2Pt2 );
12511243 return temporaryTrack;
12521244}
12531245
12541246// / Clusters are given from inside outward (cluster3 is the outermost). The outermost cluster is given in the tracking
12551247// / frame coordinates whereas the others are referred to the global frame.
12561248template <int nLayers>
1257- track::TrackParCov TrackerTraits<nLayers>::buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3)
1249+ track::TrackParCov TrackerTraits<nLayers>::buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3, bool reverse )
12581250{
1259- float ca{-999 .f }, sa{-999 .f };
1251+ const float sign = reverse ? -1 .f : 1 .f ;
1252+
1253+ float ca, sa;
12601254 o2::gpu::CAMath::SinCos (tf3.alphaTrackingFrame , sa, ca);
1255+
12611256 const float x1 = cluster1.xCoordinate * ca + cluster1.yCoordinate * sa;
12621257 const float y1 = -cluster1.xCoordinate * sa + cluster1.yCoordinate * ca;
1263- const float z1 = cluster1.zCoordinate ;
12641258 const float x2 = cluster2.xCoordinate * ca + cluster2.yCoordinate * sa;
12651259 const float y2 = -cluster2.xCoordinate * sa + cluster2.yCoordinate * ca;
1266- const float z2 = cluster2.zCoordinate ;
12671260 const float x3 = tf3.xTrackingFrame ;
12681261 const float y3 = tf3.positionTrackingFrame [0 ];
1269- const float z3 = tf3. positionTrackingFrame [ 1 ];
1270- float tgp{ 1 . f }, crv{ 1 . f }, snp{- 999 . f }, tgl12{- 999 . f }, tgl23{- 999 . f }, q2pt{ 1 . f / track:: kMostProbablePt } , q2pt2{ 1 . f }, sg2q2pt{- 999 . f } ;
1262+
1263+ float snp, q2pt, q2pt2;
12711264 if (mIsZeroField ) {
1272- tgp = o2::gpu::CAMath::ATan2 (y3 - y1, x3 - x1);
1273- snp = tgp / o2::gpu::CAMath::Sqrt (1 .f + tgp * tgp);
1265+ const float tgp = o2::gpu::CAMath::ATan2 (y3 - y1, x3 - x1);
1266+ snp = sign * tgp / o2::gpu::CAMath::Sqrt (1 .f + tgp * tgp);
1267+ q2pt = sign / track::kMostProbablePt ;
1268+ q2pt2 = 1 .f ;
12741269 } else {
1275- crv = math_utils::computeCurvature (x3, y3, x2, y2, x1, y1);
1276- snp = crv * (x3 - math_utils::computeCurvatureCentreX (x3, y3, x2, y2, x1, y1));
1277- q2pt = crv / (mBz * o2::constants::math::B2C);
1270+ const float crv = math_utils::computeCurvature (x3, y3, x2, y2, x1, y1);
1271+ snp = sign * crv * (x3 - math_utils::computeCurvatureCentreX (x3, y3, x2, y2, x1, y1));
1272+ q2pt = sign * crv / (mBz * o2::constants::math::B2C);
12781273 q2pt2 = crv * crv;
12791274 }
1280- tgl12 = math_utils::computeTanDipAngle (x1, y1, x2, y2, z1, z2);
1281- tgl23 = math_utils::computeTanDipAngle (x2, y2, x3, y3, z2, z3);
1282- sg2q2pt = track::kC1Pt2max * (q2pt2 > 0 .0005f ? (q2pt2 < 1 .f ? q2pt2 : 1 .f ) : 0 .0005f );
1283- return {tf3.xTrackingFrame , tf3.alphaTrackingFrame , {y3, z3, snp, 0 .5f * (tgl12 + tgl23), 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}};
1275+
1276+ const float tgl = 0 .5f * (math_utils::computeTanDipAngle (x1, y1, x2, y2, cluster1.zCoordinate , cluster2.zCoordinate ) +
1277+ math_utils::computeTanDipAngle (x2, y2, x3, y3, cluster2.zCoordinate , tf3.positionTrackingFrame [1 ]));
1278+ const float sg2q2pt = track::kC1Pt2max * (q2pt2 > 0 .0005f ? (q2pt2 < 1 .f ? q2pt2 : 1 .f ) : 0 .0005f );
1279+
1280+ 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}};
12841281}
12851282
12861283template <int nLayers>
0 commit comments