diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 5f92db9b6f641369696ed4e35909324addabd940..176671c5fe9a37d6b1b34165c56d2b050d95b12a 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -199,7 +199,7 @@ InitStatus CbmL1::Init() fUseMUCH = 1; fUseTRD = 1; fUseTOF = 1; - fpInitManager->SetIgnoreHitSearchAreas(true); + fpInitManager->DevSetIgnoreHitSearchAreas(true); } @@ -210,8 +210,9 @@ InitStatus CbmL1::Init() fUseMUCH = 0; fUseTRD = 1; fUseTOF = 0; - fpInitManager->SetIgnoreHitSearchAreas(true); - fpInitManager->SetFitSingletsFromTarget(true); + fpInitManager->DevSetIgnoreHitSearchAreas(true); + fpInitManager->DevSetFitSingletsFromTarget(true); + //fpInitManager->DevSetIsMatchDoubletsViaMc(true); } CheckDetectorPresence(); diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index 27a6e2b0c80661a13ea9ccd725f925761a3dcf80..ec00fbcb897b81e325f727f2c251ff580efc08d0 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -382,6 +382,10 @@ public: L1Vector<CbmL1HitStore> vHitStore {"CbmL1::vHitStore"}; // diff hit information + const L1Vector<CbmL1MCPoint>& GetMcPoints() const { return vMCPoints; } + + const L1Vector<int>& GetHitMCRefs() const { return vHitMCRef; } + private: double LoadMaterialMap(L1Material& mat, const TProfile2D* prof); diff --git a/reco/L1/CbmL1Hit.h b/reco/L1/CbmL1Hit.h index 13c9e9ed263c2011316e4410427237d26971251c..cf8294588b0f62740647765a735060f104cdcd63 100644 --- a/reco/L1/CbmL1Hit.h +++ b/reco/L1/CbmL1Hit.h @@ -16,7 +16,7 @@ struct CbmL1Hit { CbmL1Hit(int hitId_, int extIndex_, int Det_) : hitId(hitId_), extIndex(extIndex_), Det(Det_) {}; - int hitId = 0; ///> index of L1Hit in algo->vStsHits array. Should be equal to index of this in L1->vStsHits + int hitId = 0; ///> index of L1Hit in algo->vHits array. Should be equal to index of this in L1->vHits int extIndex = 0; ///> index of hit in the TClonesArray array int Det = 0; ///> station index float x = 0.f; ///> measured X coordinate diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index 86b242569c21329a02729b329882b578cc22c6be..e357801033ff1c79bf9eea14d7f144572375a340 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -1923,7 +1923,7 @@ void CbmL1::InputPerformance() for (unsigned int iH = 0; iH < vHits.size(); iH++) { const CbmL1Hit& h = vHits[iH]; - if (h.Det != 1) continue; // mvd hit + if (h.Det != 1) continue; // not sts hit const CbmStsHit* sh = L1_DYNAMIC_CAST<CbmStsHit*>(listStsHits->At(h.extIndex)); // int iMCPoint = -1; diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index 88268ca1bb59c393ef9a915c24e4717689fba125..cbc8feb44ddaa9e184fb9b478685969afb75b1ee 100644 --- a/reco/L1/L1Algo/L1Algo.cxx +++ b/reco/L1/L1Algo/L1Algo.cxx @@ -4,6 +4,8 @@ #include "L1Algo.h" +#include "CbmL1.h" + #include "L1Grid.h" #include "L1HitPoint.h" @@ -245,6 +247,15 @@ void L1Algo::CreateHitPoint(const L1Hit& hit, L1HitPoint& point) point.Set(hit.z, hit.u, hit.v, hit.du, hit.dv, hit.t, hit.dt); } +int L1Algo::GetMcTrackIdForHit(int iHit) +{ + int hitId = (*RealIHitP)[iHit]; + int iMcPoint = CbmL1::Instance()->GetHitMCRefs()[hitId]; + if (iMcPoint < 0) return -1; + return CbmL1::Instance()->GetMcPoints()[iMcPoint].ID; +} + + // bool L1Algo::SortTrip(TripSort const& a, TripSort const& b) { // return ( a.trip.GetLevel() > b.trip.GetLevel() ); // } diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 0f59d2ca8353241f4e3ca8715551f5932ceb17db..ee87dc9cffda2695cfbaa4598d9b47573cb57438 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -239,6 +239,9 @@ public: /// Gets number of stations situated in field region (MVD + STS in CBM) int GetNfieldStations() const { return fNfieldStations; } + /// Get mc track ID for a hit (debug tool) + int GetMcTrackIdForHit(int iHit); + public: int fNstrips {0}; ///> number of strips L1Vector<L1Hit>* vHits {nullptr}; ///> hits as a combination of front-, backstrips and z-position diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx index 80b7f17093e0fd150a5f4a9bb2afad03fd575afe..0799c88db2146cbba49df8a2ad337700beaabe6a 100644 --- a/reco/L1/L1Algo/L1CATrackFinder.cxx +++ b/reco/L1/L1Algo/L1CATrackFinder.cxx @@ -73,8 +73,6 @@ using std::cout; using std::endl; -/// Prepare the portion of data of left hits of a triplet: all hits except the last and the second last station will be procesesed in the algorythm, -/// the data is orginesed in order to be used by SIMD inline void L1Algo::findSingletsStep0( // input Tindex start_lh, Tindex n1_l, L1HitPoint* Hits_l, // output @@ -82,6 +80,11 @@ inline void L1Algo::findSingletsStep0( // input // comment unused parameters, FU, 18.01.21 fvec* /*Event_l*/, fvec* /*d_x*/, fvec* /*d_y*/, fvec* /*d_xy*/, fvec* d_u, fvec* d_v) { + + /// Prepare the portion of data of left hits of a triplet: + /// all hits except the last and the second last station will be procesesed in the algorithm, + /// the data is orginesed in order to be used by SIMD + const Tindex end_lh = start_lh + n1_l; @@ -115,7 +118,6 @@ inline void L1Algo::findSingletsStep0( // input } -/// Get the field approximation. Add the target to parameters estimation. Propagaete to the middle station of a triplet. inline void L1Algo::findSingletsStep1( /// input 1st stage of singlet search int istal, int istam, /// indexes of left and middle stations of a triplet @@ -128,6 +130,10 @@ inline void L1Algo::findSingletsStep1( /// input 1st stage of singlet search // comment unused parameters, FU, 18.01.21 fvec* /*d_x*/, fvec* /*d_y*/, fvec* /*d_xy*/, fvec* d_u, fvec* d_v) { + + /// Get the field approximation. Add the target to parameters estimation. + /// Propagaete to the middle station of a triplet. + const L1Station& stal = fParameters.GetStation(istal); const L1Station& stam = fParameters.GetStation(istam); fvec zstal = stal.z; @@ -241,7 +247,7 @@ inline void L1Algo::findSingletsStep1( /// input 1st stage of singlet search T.C55 = timeEr * timeEr; - if (fParameters.IsFitSingletsFromTarget()) { // TODO: doesn't work. Why? + if (fParameters.DevIsFitSingletsFromTarget()) { // TODO: doesn't work. Why? T.x = fTargX; T.y = fTargY; @@ -349,7 +355,6 @@ inline void L1Algo::findSingletsStep1( /// input 1st stage of singlet search } -/// Find the doublets. Reformat data in the portion of doublets. inline void L1Algo::findDoubletsStep0( /// input Tindex n1, const L1Station& stal, const L1Station& stam, L1HitPoint* vHits_m, L1TrackPar* T_1, L1HitIndex_t* hitsl_1, @@ -360,6 +365,11 @@ inline void L1Algo::findDoubletsStep0( #endif // DOUB_PERFORMANCE L1Vector<L1HitIndex_t>& hitsm_2, fvec* /*Event*/, L1Vector<char>& lmDuplets) { + /// Find the doublets. Reformat data in the portion of doublets. + + int iStaL = &stal - fParameters.GetStations().begin(); + int iStaM = &stam - fParameters.GetStations().begin(); + n2 = 0; // number of doublet for (Tindex i1 = 0; i1 < n1; ++i1) // for each singlet { @@ -370,8 +380,8 @@ inline void L1Algo::findDoubletsStep0( const int n2Saved = n2; - const fvec Pick_m22 = - (fDoubletChi2Cut - T1.chi2); // if make it bigger the found hits will be rejected later because of the chi2 cut. + const fvec Pick_m22 = (fDoubletChi2Cut - T1.chi2); + // 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 // -- collect possible doublets -- @@ -379,7 +389,7 @@ inline void L1Algo::findDoubletsStep0( const float& timeError = T1.C55[i1_4]; const float& time = T1.t[i1_4]; - L1HitAreaTime areaTime(vGridTime[&stam - fParameters.GetStations().begin()], T1.x[i1_4] * iz, T1.y[i1_4] * iz, + L1HitAreaTime areaTime(vGridTime[iStaM], T1.x[i1_4] * iz, T1.y[i1_4] * iz, (sqrt(Pick_m22 * (T1.C00 + stam.XYInfo.C00)) + fMaxDZ * fabs(T1.tx))[i1_4] * iz, (sqrt(Pick_m22 * (T1.C11 + stam.XYInfo.C11)) + fMaxDZ * fabs(T1.ty))[i1_4] * iz, time, sqrt(timeError) * 5); @@ -388,11 +398,9 @@ inline void L1Algo::findDoubletsStep0( L1HitIndex_t imh = 0; int irm1 = -1; while (true) { - if (fParameters.IsIgnoreHitSearchAreas()) { + if (fParameters.DevIsIgnoreHitSearchAreas()) { irm1++; - if ((L1HitIndex_t) irm1 >= (HitsUnusedStopIndex[&stam - fParameters.GetStations().begin()] - - HitsUnusedStartIndex[&stam - fParameters.GetStations().begin()])) - break; + if ((L1HitIndex_t) irm1 >= (HitsUnusedStopIndex[iStaM] - HitsUnusedStartIndex[iStaM])) break; imh = irm1; } else { @@ -401,11 +409,17 @@ inline void L1Algo::findDoubletsStep0( const L1HitPoint& hitm = vHits_m[imh]; + if (fParameters.DevIsMatchDoubletsViaMc()) { // trd2d + int indL = HitsUnusedStartIndex[iStaL] + hitsl_1[i1]; + int indM = HitsUnusedStartIndex[iStaM] + imh; + if (GetMcTrackIdForHit(indL) != GetMcTrackIdForHit(indM)) { continue; } + } + // check y-boundaries - if ((stam.timeInfo) && (stal.timeInfo)) + if ((stam.timeInfo) && (stal.timeInfo)) { if (fabs(time - hitm.time) > sqrt(timeError + hitm.timeEr * hitm.timeEr) * 5) continue; - if ((stam.timeInfo) && (stal.timeInfo)) if (fabs(time - hitm.time) > 30) continue; + } #ifdef USE_EVENT_NUMBER if ((Event[i1_V][i1_4] != hitm.n)) continue; @@ -686,7 +700,7 @@ inline void L1Algo::findTripletsStep0( // input L1HitIndex_t Ntriplets = 0; int irh1 = -1; while (true) { - if (fParameters.IsIgnoreHitSearchAreas()) { + if (fParameters.DevIsIgnoreHitSearchAreas()) { irh1++; if ((L1HitIndex_t) irh1 >= (HitsUnusedStopIndex[istar] - HitsUnusedStartIndex[istar])) break; irh = irh1; @@ -1608,10 +1622,10 @@ void L1Algo::CATrackFinder() * CATrackFinder routine setting ***********************************/ - RealIHitP = &RealIHit_v; - RealIHitPBuf = &RealIHit_v_buf; - vHitsUnused = &vDontUsedHits_B; /// array of hits used on current iteration - L1Vector<L1Hit>* vHitsUnused_buf = &vDontUsedHits_A; /// buffer for copy + RealIHitP = &RealIHit_v; + RealIHitPBuf = &RealIHit_v_buf; + vHitsUnused = &vDontUsedHits_B; /// array of hits used on current iteration + L1Vector<L1Hit>* vHitsUnused_buf = &vDontUsedHits_A; /// buffer for copy vHitPointsUnused = &vDontUsedHitsxy_B; /// array of info for hits used on current iteration L1Vector<L1HitPoint>* vHitPointsUnused_buf = &vDontUsedHitsxy_A; diff --git a/reco/L1/L1Algo/L1InitManager.h b/reco/L1/L1Algo/L1InitManager.h index bf575539a7da83578ada1031a292e1a7d226fed0..271a9cd96d4d8ea611ef2d64ce2eec070e8357e8 100644 --- a/reco/L1/L1Algo/L1InitManager.h +++ b/reco/L1/L1Algo/L1InitManager.h @@ -204,18 +204,21 @@ public: /// Sets target poisition void SetTargetPosition(double x, double y, double z); + /// Transfers L1Parameters object to the destination + void TransferParametersContainer(L1Parameters& destination); + /// *************************** /// ** Flags for development ** /// *************************** /// Ignopre hit search areas - void SetIgnoreHitSearchAreas(bool value = true) { fParameters.fIsIgnoreHitSearchAreas = value; } + void DevSetIgnoreHitSearchAreas(bool value = true) { fParameters.fDevIsIgnoreHitSearchAreas = value; } /// Start singlets fit at the target - void SetFitSingletsFromTarget(bool value = true) { fParameters.fIsFitSingletsFromTarget = value; } + void DevSetFitSingletsFromTarget(bool value = true) { fParameters.fDevIsFitSingletsFromTarget = value; } - /// Transfers L1Parameters object to the destination - void TransferParametersContainer(L1Parameters& destination); + /// Flag to match doublets using Mc information + void DevSetIsMatchDoubletsViaMc(bool value = true) { fParameters.fDevIsMatchDoubletsViaMc = value; } private: /// Checker for L1CAIteration container initialization (sets EInitKey::kCAIterations) diff --git a/reco/L1/L1Algo/L1Parameters.h b/reco/L1/L1Algo/L1Parameters.h index 5a32731e637eaa62852cd65142b89a3a982483b3..1a67b24fc184b6c4918d513e0a16d23c62f2ead9 100644 --- a/reco/L1/L1Algo/L1Parameters.h +++ b/reco/L1/L1Algo/L1Parameters.h @@ -158,14 +158,21 @@ public: /// Gets L1FieldValue object at primary vertex const L1FieldValue& GetVertexFieldValue() const { return fVertexFieldValue; } + /// Class invariant checker + void CheckConsistency() const; + + /// *************************** + /// ** Flags for development ** + /// *************************** + /// Are the hit search areas ignored - bool IsIgnoreHitSearchAreas() const { return fIsIgnoreHitSearchAreas; } + bool DevIsIgnoreHitSearchAreas() const { return fDevIsIgnoreHitSearchAreas; } /// Is singlets fit starts at the target - bool IsFitSingletsFromTarget() const { return fIsFitSingletsFromTarget; } + bool DevIsFitSingletsFromTarget() const { return fDevIsFitSingletsFromTarget; } - /// Class invariant checker - void CheckConsistency() const; + /// Flag to match doublets using Mc information + bool DevIsMatchDoubletsViaMc() const { return fDevIsMatchDoubletsViaMc; } private: unsigned int fMaxDoubletsPerSinglet {150}; ///< Upper-bound cut on max number of doublets per one singlet @@ -212,9 +219,11 @@ private: /// ** Flags for development ** /// *************************** - bool fIsIgnoreHitSearchAreas {false}; ///< Process all hits on the station ignoring hit search area + bool fDevIsIgnoreHitSearchAreas {false}; ///< Process all hits on the station ignoring hit search area + + bool fDevIsFitSingletsFromTarget {false}; ///< Fit singlet starting from the target with the KF - bool fIsFitSingletsFromTarget {false}; ///< Fit singlet starting from the target with the KF + bool fDevIsMatchDoubletsViaMc {false}; ///< Flag to match doublets using Mc information /******************************** ** Friend classes declaration **