diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index a12cd94ff93f0850cd7a244b583977a9ebc4df6e..08d01adadc939922281ed970683e0601762020e2 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -239,6 +239,8 @@ InitStatus CbmL1::Init() //fInitManager.DevSetIsMatchDoubletsViaMc(true); //fInitManager.DevSetIsMatchTripletsViaMc(true); + //fInitManager.DevSetIsExtendTracksViaMc(true); + //fInitManager.DevSetIsSuppressOverlapHitsViaMc(true); CheckDetectorPresence(); diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 8aa411d92218f3d801df08a4f6e60a5c8f7f485b..cfa69f01720f356da147de0cac6681c181f4566a 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -277,7 +277,7 @@ public: /// Find the doublets. Reformat data in the portion of doublets. void findDoubletsStep0( // input - Tindex n1, const L1Station& stal, const L1Station& stam, L1HitPoint* vHits_m, L1TrackPar* T_1, + Tindex n1, const L1Station& stal, L1HitPoint* vHits_l, const L1Station& stam, L1HitPoint* vHits_m, L1TrackPar* T_1, L1HitIndex_t* hitsl_1, // output Tindex& n2, L1Vector<L1HitIndex_t>& i1_2, diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx index b8d85f96bdaee541290eff1a692d99180c9938ec..1997988406dd51813319cd7eafaaffde5353c996 100644 --- a/reco/L1/L1Algo/L1CATrackFinder.cxx +++ b/reco/L1/L1Algo/L1CATrackFinder.cxx @@ -311,7 +311,8 @@ inline void L1Algo::findSingletsStep1( /// input 1st stage of singlet search inline void L1Algo::findDoubletsStep0( /// input - Tindex n1, const L1Station& stal, const L1Station& stam, L1HitPoint* vHits_m, L1TrackPar* T_1, L1HitIndex_t* hitsl_1, + Tindex n1, const L1Station& stal, L1HitPoint* vHits_l, const L1Station& stam, L1HitPoint* vHits_m, L1TrackPar* T_1, + L1HitIndex_t* hitsl_1, /// output Tindex& n2, L1Vector<L1HitIndex_t>& i1_2, #ifdef DOUB_PERFORMANCE @@ -342,6 +343,8 @@ inline void L1Algo::findDoubletsStep0( // if make it bigger the found hits will be rejected later because of the chi2 cut. // Pick_m22 is not used, search for mean squared, 2nd version + unsigned int indFirstDoublet = hitsm_2.size(); + // -- collect possible doublets -- const fscal iz = 1.f / (T1.z[i1_4] - fParameters.GetTargetPositionZ()[0]); const fscal timeError2 = T1.C55[i1_4]; @@ -361,12 +364,16 @@ inline void L1Algo::findDoubletsStep0( if (!areaTime.GetNext(imh)) { break; } } - const L1HitPoint& hitm = vHits_m[imh]; + L1HitPoint& hitm = vHits_m[imh]; + if (hitm.IsSuppressed()) continue; + + const L1HitPoint& hitl = vHits_l[hitsl_1[i1]]; if (fParameters.DevIsMatchDoubletsViaMc()) { // trd2d int indL = HitsUnusedStartIndex[iStaL] + hitsl_1[i1]; int indM = HitsUnusedStartIndex[iStaM] + imh; - if (GetMcTrackIdForUnusedHit(indL) != GetMcTrackIdForUnusedHit(indM)) { continue; } + int iMC = GetMcTrackIdForUnusedHit(indL); + if (iMC < 0 || iMC != GetMcTrackIdForUnusedHit(indM)) { continue; } } // check y-boundaries @@ -432,6 +439,46 @@ inline void L1Algo::findDoubletsStep0( if (chi2[i1_4] > fDoubletChi2Cut) continue; } + // check if there is a second hit on the same station + { + bool isOtherHit = 0; + fscal dz = hitm.Z() - hitl.Z(); + fscal tu = (hitm.U() - hitl.U()) / dz; + fscal tv = (hitm.V() - hitl.V()) / dz; + fscal tt = (hitm.T() - hitl.T()) / dz; + + for (unsigned int imh1 = indFirstDoublet; imh1 < hitsm_2.size(); imh1++) { + const L1HitPoint& hitm1 = vHits_m[hitsm_2[imh1]]; + + if ((stam.timeInfo) && (stal.timeInfo)) { + fscal dt = hitm.T() + tt * (hitm1.Z() - hitm.Z()) - hitm1.T(); + if (dt * dt > 30. * (hitm.dT2() + hitm1.dT2())) { continue; } + } + + fscal du = hitm.U() + tu * (hitm1.Z() - hitm.Z()) - hitm1.U(); + if (du * du > 20. * (hitm.dU2() + hitm1.dU2())) { continue; } + + fscal dv = hitm.V() + tv * (hitm1.Z() - hitm.Z()) - hitm1.V(); + if (dv * dv > 30. * (hitm.dV2() + hitm1.dV2())) { continue; } + + if (fParameters.DevIsSuppressOverlapHitsViaMc()) { + int indL = HitsUnusedStartIndex[iStaL] + hitsl_1[i1]; + int indM = HitsUnusedStartIndex[iStaM] + imh; + int indM1 = HitsUnusedStartIndex[iStaM] + hitsm_2[imh1]; + int iMC = GetMcTrackIdForUnusedHit(indL); + if ((iMC != GetMcTrackIdForUnusedHit(indM)) || (iMC != GetMcTrackIdForUnusedHit(indM1))) { continue; } + } + + isOtherHit = true; + break; + } + + if (isOtherHit) { + hitm.SetIsSuppresed(1); + continue; + } + } + i1_2.push_back(i1); #ifdef DOUB_PERFORMANCE hitsl_2.push_back(hitsl_1[i1]); @@ -616,11 +663,14 @@ inline void L1Algo::findTripletsStep0( // input // while (area.GetNext(irh)) { //for (int irh = 0; irh < ( HitsUnusedStopIndex[iStaR] - HitsUnusedStartIndex[iStaR] ); irh++){ const L1HitPoint& hitr = vHits_r[irh]; + if (hitr.IsSuppressed()) continue; if (fParameters.DevIsMatchTripletsViaMc()) { + int indL = HitsUnusedStartIndex[iStaL] + hitsl_2[i2_4]; int indM = HitsUnusedStartIndex[iStaM] + hitsm_2_tmp[i2_4]; int indR = HitsUnusedStartIndex[iStaR] + irh; - if (GetMcTrackIdForUnusedHit(indM) != GetMcTrackIdForUnusedHit(indR)) { continue; } + int mcL = GetMcTrackIdForUnusedHit(indL); + if (mcL < 0 || mcL != GetMcTrackIdForUnusedHit(indM) || mcL != GetMcTrackIdForUnusedHit(indR)) { continue; } } const fscal zr = hitr.Z(); @@ -727,6 +777,10 @@ inline void L1Algo::findTripletsStep0( // input n3_V = n3 / fvec::size(); n3_4 = n3 % fvec::size(); + assert(n3 == (int) hitsl_3.size()); + assert(n3 == (int) hitsm_3.size()); + assert(n3 == (int) hitsr_3.size()); + if (0 == n3_4) { T_3.push_back(L1TrackPar_0); u_front_3.push_back(fvec::Zero()); @@ -1241,7 +1295,7 @@ inline void L1Algo::CreatePortionOfDoublets( #endif // DOUB_PERFORMANCE findDoubletsStep0( // input - singletPortionSize, stal, stam, vHits_m, T_1, hitsl_1, + singletPortionSize, stal, vHits_l, stam, vHits_m, T_1, hitsl_1, // output n_2, i1_2, #ifdef DOUB_PERFORMANCE @@ -2216,6 +2270,19 @@ void L1Algo::CATrackFinder() } } // firstTripletLevel + // suppress strips of suppressed hits + for (int ista = 0; ista < fParameters.GetNstationsActive(); ++ista) { + for (L1HitIndex_t ih = HitsUnusedStartIndex[ista]; ih < HitsUnusedStopIndex[ista]; ih++) { + const L1HitPoint& hp = (*vHitPointsUnused)[ih]; + if (hp.IsSuppressed()) { + int hitId = (*RealIHitP)[ih]; + const L1Hit& hit = fInputData.GetHit(hitId); + fvHitKeyFlags[hit.f] = 1; + fvHitKeyFlags[hit.b] = 1; + } + } + } + #ifdef XXX c_timer.Stop(); ti[isec]["tracks"] = c_timer; diff --git a/reco/L1/L1Algo/L1InitManager.cxx b/reco/L1/L1Algo/L1InitManager.cxx index dfd1e5eda6f56113924e872588b38f07d7235ab8..31e340060754a18032f700e6e4a837bbe0df5b56 100644 --- a/reco/L1/L1Algo/L1InitManager.cxx +++ b/reco/L1/L1Algo/L1InitManager.cxx @@ -130,10 +130,12 @@ void L1InitManager::ClearSetupInfo() fInitController.SetFlag(EInitKey::kGhostSuppression, false); fInitController.SetFlag(EInitKey::kMomentumCutOff, false); - fParameters.fDevIsIgnoreHitSearchAreas = false; - fParameters.fDevIsUseOfOriginalField = false; - fParameters.fDevIsMatchDoubletsViaMc = false; - fParameters.fDevIsMatchTripletsViaMc = false; + fParameters.fDevIsIgnoreHitSearchAreas = false; + fParameters.fDevIsUseOfOriginalField = false; + fParameters.fDevIsMatchDoubletsViaMc = false; + fParameters.fDevIsMatchTripletsViaMc = false; + fParameters.fDevIsExtendTracksViaMc = false; + fParameters.fDevIsSuppressOverlapHitsViaMc = false; } // ---------------------------------------------------------------------------------------------------------------------- diff --git a/reco/L1/L1Algo/L1InitManager.h b/reco/L1/L1Algo/L1InitManager.h index 796877548c86cc9677a02ac3dfbcae845211d371..1a314f40596ce2efb7818f754035e986a0b9ef15 100644 --- a/reco/L1/L1Algo/L1InitManager.h +++ b/reco/L1/L1Algo/L1InitManager.h @@ -19,13 +19,12 @@ #include "L1Vector.h" //#include <string> -#include <type_traits> - #include <array> #include <bitset> #include <memory> //unique_ptr #include <numeric> #include <set> +#include <type_traits> class L1ConfigRW; class L1Algo; @@ -266,6 +265,12 @@ public: /// Flag to match triplets using Mc information void DevSetIsMatchTripletsViaMc(bool value = true) { fParameters.fDevIsMatchTripletsViaMc = value; } + /// Flag to match triplets using Mc information + void DevSetIsExtendTracksViaMc(bool value = true) { fParameters.fDevIsExtendTracksViaMc = value; } + + /// Flag to match triplets using Mc information + void DevSetIsSuppressOverlapHitsViaMc(bool value = true) { fParameters.fDevIsSuppressOverlapHitsViaMc = value; } + /// Flag to use estimated hit search windows /// true: estimated search windows will be used in track finder /// false: Kalman filter will be used in track finder @@ -285,7 +290,6 @@ private: void CheckStationsInfoInit(); - // ***************** // ** Data fields ** // ***************** diff --git a/reco/L1/L1Algo/L1Parameters.cxx b/reco/L1/L1Algo/L1Parameters.cxx index 2b98dcc874a827a358ff522e7cbfdd227681de7d..443b6660e6765e7c6c14dc2e322949a0de87e254 100644 --- a/reco/L1/L1Algo/L1Parameters.cxx +++ b/reco/L1/L1Algo/L1Parameters.cxx @@ -274,10 +274,13 @@ std::string L1Parameters::ToString(int verbosity, int indentLevel) const } aStream << indent << kCLb << "DEV FLAGS:" << kCL << " (for debug only)\n"; - aStream << indent << indentChar << "Hits search area is ignored: " << fDevIsIgnoreHitSearchAreas << '\n'; - aStream << indent << indentChar << "Non-approx. field is used: " << fDevIsMatchDoubletsViaMc << '\n'; - aStream << indent << indentChar << "Doublets vs. MC matching: " << fDevIsMatchDoubletsViaMc << '\n'; - aStream << indent << indentChar << "Triplets vs. MC matching: " << fDevIsMatchTripletsViaMc << '\n'; + aStream << indent << indentChar << "Hits search area is ignored: " << fDevIsIgnoreHitSearchAreas << '\n'; + aStream << indent << indentChar << "Non-approx. field is used: " << fDevIsMatchDoubletsViaMc << '\n'; + aStream << indent << indentChar << "Doublets matching via MC: " << fDevIsMatchDoubletsViaMc << '\n'; + aStream << indent << indentChar << "Triplets matching via MC: " << fDevIsMatchTripletsViaMc << '\n'; + aStream << indent << indentChar << "Extend tracks with MC matching: " << fDevIsExtendTracksViaMc << '\n'; + aStream << indent << indentChar << "Overlap hits matching via MC: " << fDevIsSuppressOverlapHitsViaMc << '\n'; + aStream << indent << indentChar << "Use hit search windows: " << fDevIsParSearchWUsed << '\n'; if (fDevIsParSearchWUsed) { diff --git a/reco/L1/L1Algo/L1Parameters.h b/reco/L1/L1Algo/L1Parameters.h index e49462ed83b4f5e9718a5015628b9d838705d95d..bfe7ba29142d5da28b9a899771d436a77c8b8f7d 100644 --- a/reco/L1/L1Algo/L1Parameters.h +++ b/reco/L1/L1Algo/L1Parameters.h @@ -209,6 +209,12 @@ public: /// Flag to match triplets using Mc information bool DevIsMatchTripletsViaMc() const { return fDevIsMatchTripletsViaMc; } + /// Flag to extend tracks using Mc information + bool DevIsExtendTracksViaMc() const { return fDevIsExtendTracksViaMc; } + + /// Flag to match hits in overlaps using Mc information + bool DevIsSuppressOverlapHitsViaMc() const { return fDevIsSuppressOverlapHitsViaMc; } + private: unsigned int fMaxDoubletsPerSinglet {150}; ///< Upper-bound cut on max number of doublets per one singlet unsigned int fMaxTripletPerDoublets {15}; ///< Upper-bound cut on max number of triplets per one doublet @@ -267,10 +273,13 @@ private: // ** Flags for development ** // *************************** - bool fDevIsIgnoreHitSearchAreas = false; ///< Process all hits on the station ignoring hit search area - bool fDevIsUseOfOriginalField = false; ///< Force use of original field - bool fDevIsMatchDoubletsViaMc = false; ///< Flag to match doublets using MC information - bool fDevIsMatchTripletsViaMc = false; ///< Flag to match triplets using MC information + bool fDevIsIgnoreHitSearchAreas {false}; ///< Process all hits on the station ignoring hit search area + bool fDevIsUseOfOriginalField {false}; ///< Force use of original field + bool fDevIsMatchDoubletsViaMc {false}; ///< Flag to match doublets using MC information + bool fDevIsMatchTripletsViaMc {false}; ///< Flag to match triplets using Mc information + bool fDevIsExtendTracksViaMc {false}; ///< Flag to extend tracks using Mc information + bool fDevIsSuppressOverlapHitsViaMc {false}; ///< Flag to match hits in overlaps using Mc information + bool fDevIsParSearchWUsed = false; ///< Flag: when true, the parametrized search windows are used in track ///< finder; when false, the Kalman filter is used instead @@ -306,6 +315,8 @@ private: ar& fDevIsUseOfOriginalField; ar& fDevIsMatchDoubletsViaMc; ar& fDevIsMatchTripletsViaMc; + ar& fDevIsExtendTracksViaMc; + ar& fDevIsSuppressOverlapHitsViaMc; } };