diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt index e3d4cc9299dc3d392338d2b425e0ac23591b3d69..a4a5479deccdd0251df40a1c16daa50371407217 100644 --- a/reco/L1/CMakeLists.txt +++ b/reco/L1/CMakeLists.txt @@ -144,6 +144,7 @@ CbmL1MCTrack.cxx L1Algo/L1CAIteration.cxx L1Algo/L1BaseStationInfo.cxx L1Algo/L1InitManager.cxx +L1Algo/L1Parameters.cxx L1Algo/utils/L1AlgoDraw.cxx L1Algo/utils/L1AlgoEfficiencyPerformance.cxx L1Algo/utils/L1AlgoPulls.cxx diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index c1e8fdb281f2bd915a33666add5ad14d492117af..d04bafadd323f47662b808c890a5a767775f475f 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -851,7 +851,7 @@ InitStatus CbmL1::Init() // Step 6: setup station info - // Setup MVD stations info + /*** Setup MVD stations info ***/ for (int iSt = 0; iSt < NMvdStations; ++iSt) { // NOTE: example using in-stack defined objects CbmMvdDetector* mvdDetector = CbmMvdDetector::Instance(); CbmMvdStationPar* mvdStationPar = mvdDetector->GetParameterFile(); @@ -970,15 +970,147 @@ InitStatus CbmL1::Init() fscal tofBackSigma = 1.; stationInfo.SetFrontBackStripsGeometry(tofFrontPhi, tofFrontSigma, tofBackPhi, tofBackSigma); } - initMan->PrintStations(/*vebosity = */ 1); + + // Step 7: initialize iterations and form a vector of them + { + // TODO: Possible, it will be more convenient to create a vector of these iterations, access its elements + // by the enumeration item + // TODO: Need to provide a selection: default iterations input (these hardcoded ones), input from file or input + // from runing macro + auto trackingIterFastPrim = L1CAIteration("FastPrimIter"); + trackingIterFastPrim.SetTrackChi2Cut(10.f); + trackingIterFastPrim.SetTripletChi2Cut(23.4450f); // = 7.815 * 3; // prob = 0.05 + trackingIterFastPrim.SetDoubletChi2Cut(7.56327f); // = 1.3449 * 2.f / 3.f; // prob = 0.1 + trackingIterFastPrim.SetPickGather(3.0f); + trackingIterFastPrim.SetPickNeighbour(5.0f); + trackingIterFastPrim.SetMaxInvMom(1.0 / 0.5); + trackingIterFastPrim.SetMaxSlopePV(1.1f); + trackingIterFastPrim.SetMaxSlope(2.748f); + + auto trackingIterAllPrim = L1CAIteration("AllPrimIter"); + trackingIterAllPrim.SetTrackChi2Cut(10.f); + trackingIterAllPrim.SetTripletChi2Cut(23.4450f); + trackingIterAllPrim.SetDoubletChi2Cut(7.56327f); + trackingIterAllPrim.SetPickGather(4.0f); + trackingIterAllPrim.SetPickNeighbour(5.0f); + trackingIterAllPrim.SetMaxInvMom(1.0 / 0.5); + trackingIterAllPrim.SetMaxSlopePV(1.1f); + trackingIterAllPrim.SetMaxSlope(2.748f); + + auto trackingIterFastPrim2 = L1CAIteration("FastPrim2Iter"); + trackingIterFastPrim2.SetTrackChi2Cut(10.f); + trackingIterFastPrim2.SetTripletChi2Cut(21.1075f); + trackingIterFastPrim2.SetDoubletChi2Cut(7.56327f); + trackingIterFastPrim2.SetPickGather(3.0f); + trackingIterFastPrim2.SetPickNeighbour(5.0f); + trackingIterFastPrim2.SetMaxInvMom(1.0 / 0.5); + trackingIterFastPrim2.SetMaxSlopePV(1.1f); + trackingIterFastPrim2.SetMaxSlope(2.748f); + + auto trackingIterAllSec = L1CAIteration("AllSecIter"); + trackingIterAllSec.SetTrackChi2Cut(10.f); + trackingIterAllSec.SetTripletChi2Cut(18.7560f); // = 6.252 * 3; // prob = 0.1 + trackingIterAllSec.SetDoubletChi2Cut(7.56327f); + trackingIterAllSec.SetPickGather(4.0f); + trackingIterAllSec.SetPickNeighbour(5.0f); + trackingIterAllSec.SetMaxInvMom(1.0 / 0.5); + trackingIterAllSec.SetMaxSlopePV(1.5f); + trackingIterAllSec.SetMaxSlope(2.748f); + + auto trackingIterFastPrimJump = L1CAIteration("FastPrimJumpIter"); + trackingIterFastPrimJump.SetTrackChi2Cut(10.f); + trackingIterFastPrimJump.SetTripletChi2Cut(21.1075f); // prob = 0.01 + trackingIterFastPrimJump.SetDoubletChi2Cut(7.56327f); + trackingIterFastPrimJump.SetPickGather(3.0f); + trackingIterFastPrimJump.SetPickNeighbour(5.0f); + trackingIterFastPrimJump.SetMaxInvMom(1.0 / 0.5); + trackingIterFastPrimJump.SetMaxSlopePV(1.1f); + trackingIterFastPrimJump.SetMaxSlope(2.748f); + + auto trackingIterAllPrimJump = L1CAIteration("AllPrimJumpIter"); + trackingIterAllPrimJump.SetTrackChi2Cut(10.f); + trackingIterAllPrimJump.SetTripletChi2Cut(18.7560f); + trackingIterAllPrimJump.SetDoubletChi2Cut(7.56327f); + trackingIterAllPrimJump.SetPickGather(4.0f); + trackingIterAllPrimJump.SetPickNeighbour(5.0f); + trackingIterAllPrimJump.SetMaxInvMom(1.0 / 0.5); + trackingIterAllPrimJump.SetMaxSlopePV(1.1f); + trackingIterAllPrimJump.SetMaxSlope(2.748f); + + auto trackingIterAllSecJump = L1CAIteration("AllSecJumpIter"); + trackingIterAllSecJump.SetTrackChi2Cut(10.f); + trackingIterAllSecJump.SetTripletChi2Cut(21.1075f); + trackingIterAllSecJump.SetDoubletChi2Cut(7.56327f); + trackingIterAllSecJump.SetPickGather(4.0f); + trackingIterAllSecJump.SetPickNeighbour(5.0f); + trackingIterAllSecJump.SetMaxInvMom(1.0 / 0.5); + trackingIterAllSecJump.SetMaxSlopePV(1.5f); + trackingIterAllSecJump.SetMaxSlope(2.748f); + + auto trackingIterAllPrimE = L1CAIteration("AllPrimEIter"); + trackingIterAllPrimE.SetTrackChi2Cut(10.f); + trackingIterAllPrimE.SetTripletChi2Cut(23.4450f); + trackingIterAllPrimE.SetDoubletChi2Cut(7.56327f); + trackingIterAllPrimE.SetPickGather(4.0f); + trackingIterAllPrimE.SetPickNeighbour(5.0f); + trackingIterAllPrimE.SetMaxInvMom(1.0 / 0.5); + trackingIterAllPrimE.SetMaxSlopePV(1.1f); + trackingIterAllPrimE.SetMaxSlope(2.748f); + + auto trackingIterAllSecE = L1CAIteration("AllSecEIter"); + trackingIterAllSecE.SetTrackChi2Cut(10.f); + trackingIterAllSecE.SetTripletChi2Cut(18.7560f); + trackingIterAllSecE.SetDoubletChi2Cut(7.56327f); + trackingIterAllSecE.SetPickGather(4.0f); + trackingIterAllSecE.SetPickNeighbour(5.0f); + trackingIterAllSecE.SetMaxInvMom(1.0 / 0.5); + trackingIterAllSecE.SetMaxSlopePV(1.5f); + trackingIterAllSecE.SetMaxSlope(2.748f); + + // Select default track finder + if (fTrackingMode == L1Algo::TrackingMode::kMcbm) { + trackingIterAllPrim.SetMaxInvMom(1. / 0.1); + trackingIterAllPrimE.SetMaxInvMom(1. / 0.1); + trackingIterAllSecE.SetMaxInvMom(1. / 0.1); + + trackingIterFastPrim.SetMaxInvMom(1.0 / 0.3); + trackingIterAllSec.SetMaxInvMom(1.0 / 0.3); + trackingIterFastPrimJump.SetMaxInvMom(1.0 / 0.3); + trackingIterAllPrimJump.SetMaxInvMom(1.0 / 0.3); + trackingIterAllSecJump.SetMaxInvMom(1.0 / 0.3); + + initMan->SetCAIterationsNumberCrosscheck(4); + // Initialize CA track finder iterations sequence + initMan->PushBackCAIteration(trackingIterFastPrim); + initMan->PushBackCAIteration(trackingIterAllPrim); + initMan->PushBackCAIteration(trackingIterAllPrimJump); + initMan->PushBackCAIteration(trackingIterAllSec); + } + else { + std::cout << "HERE"; + initMan->SetCAIterationsNumberCrosscheck(9); + // Initialize CA track finder iterations sequence + initMan->PushBackCAIteration(trackingIterFastPrim); + initMan->PushBackCAIteration(trackingIterAllPrim); + initMan->PushBackCAIteration(trackingIterAllPrimJump); + initMan->PushBackCAIteration(trackingIterAllSec); + initMan->PushBackCAIteration(trackingIterAllPrimE); + initMan->PushBackCAIteration(trackingIterAllSecE); + initMan->PushBackCAIteration(trackingIterFastPrimJump); + initMan->PushBackCAIteration(trackingIterFastPrim2); + initMan->PushBackCAIteration(trackingIterAllSecJump); + } + initMan->PrintCAIterations(); + + // Set special cuts + } } // L1Algo new init: end /******************************************************************************************************************** ********************************************************************************************************************/ #endif // FEATURING_L1ALGO_INIT - algo->Init(geo, fUseHitErrors, fTrackingMode, fMissingHits); geo.clear(); diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index 20075dc30046baf9f88711db0b458438b414bcf8..30f6ded6cf850fcc4ca5343389e99aabb8da296b 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -98,6 +98,21 @@ enum class L1DetectorID kTrd }; +/// Enumeration for the CA Track finder iterations +/// NOTE: L1CAItrationType +enum class L1CAIterationType +{ + kFastPrim, ///< primary fast tracks + kAllPrim, ///< primary all tracks + kAllPrimJump, ///< primary all tracks with jumped triplets + kAllSec, ///< secondary all tracks + kAllPrimE, ///< primary all electron tracks + kAllSecE, ///< secondary all electron tracks + kFastPrimJump, ///< primary fast tracks with jumped triplets + kAllSecJump, ///< secondary all tracks with jumped triplets + kEND ///< dummy item, represents number of iterations +}; + // TODO: insert documentation! (S.Zh.) // diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 03ac49f01dc330318de18e64593d6c7d6b6f34cf..6513fa82e1a3740cc2e02931723ac7feb83420d4 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -612,7 +612,7 @@ private: { fNFindIterations = TRACKS_FROM_TRIPLETS_ITERATION + 1 }; // TODO investigate kAllPrimJumpIter & kAllSecJumpIter -#else +#else // not TRACKS_FROM_TRIPLETS enum { @@ -620,8 +620,8 @@ private: }; // TODO investigate kAllPrimJumpIter & kAllSecJumpIter -#endif -#else +#endif // TRACKS_FROM_TRIPLETS +#else // not FIND_GAPED_TRACKS enum { kFastPrimIter = 0, // primary fast tracks diff --git a/reco/L1/L1Algo/L1CAIteration.cxx b/reco/L1/L1Algo/L1CAIteration.cxx index a42e89b7d4b950bc4588005a84470f11ef32c1cc..b96eacd1a36aafb4a75d50f77035cc3d9d8468d3 100644 --- a/reco/L1/L1Algo/L1CAIteration.cxx +++ b/reco/L1/L1Algo/L1CAIteration.cxx @@ -6,19 +6,98 @@ #include <FairLogger.h> -L1CAIteration::L1CAIteration(const std::string& name, L1CAIterationType type) : fName(name), fType(type) +//---------------------------------------------------------------------------------------------------------------------- +// +L1CAIteration::L1CAIteration() noexcept { LOG(debug) << "L1CAIteration: Default constructor called for " << this; } + +//---------------------------------------------------------------------------------------------------------------------- +// +L1CAIteration::~L1CAIteration() noexcept { LOG(debug) << "L1CAIteration: Destructor called for " << this; } + +//---------------------------------------------------------------------------------------------------------------------- +// +L1CAIteration::L1CAIteration(const L1CAIteration& other) noexcept + // Basic fields + : fName(other.fName) + // Cuts + , fTrackChi2Cut(other.fTrackChi2Cut) + , fTripletChi2Cut(other.fTripletChi2Cut) + , fDoubletChi2Cut(other.fDoubletChi2Cut) + , fPickGather(other.fPickGather) + , fPickNeighbour(other.fPickNeighbour) + , fMaxInvMom(other.fMaxInvMom) + , fMaxSlopePV(other.fMaxSlopePV) + , fMaxSlope(other.fMaxSlope) +{ + LOG(debug) << "L1CAIteration: Copy constructor called: " << &other << " was copied into " << this; +} + +//---------------------------------------------------------------------------------------------------------------------- +// +L1CAIteration::L1CAIteration(L1CAIteration&& other) noexcept +{ + this->Swap(other); + LOG(debug) << "L1CAIteration: Move constructor called: " << &other << " was moved into " << this; +} + +//---------------------------------------------------------------------------------------------------------------------- +// +L1CAIteration& L1CAIteration::operator=(const L1CAIteration& other) noexcept +{ + if (this != &other) { L1CAIteration(other).Swap(*this); } + LOG(debug) << "L1CAIteration: Copy operator= called: " << &other << " was copied into " << this; + return *this; +} + +//---------------------------------------------------------------------------------------------------------------------- +// +L1CAIteration& L1CAIteration::operator=(L1CAIteration&& other) noexcept +{ + if (this != &other) { + L1CAIteration tmp(std::move(other)); + this->Swap(tmp); + } + LOG(debug) << "L1CAIteration: Move operator= called: " << &other << " was moved into " << this; + return *this; +} + +//---------------------------------------------------------------------------------------------------------------------- +// +void L1CAIteration::Swap(L1CAIteration& other) noexcept +{ + // Basic fields + std::swap(fName, other.fName); + // Cuts + std::swap(fTrackChi2Cut, other.fTrackChi2Cut); + std::swap(fTripletChi2Cut, other.fTripletChi2Cut); + std::swap(fDoubletChi2Cut, other.fDoubletChi2Cut); + std::swap(fPickGather, other.fPickGather); + std::swap(fPickNeighbour, other.fPickNeighbour); + std::swap(fMaxInvMom, other.fMaxInvMom); + std::swap(fMaxSlopePV, other.fMaxSlopePV); + std::swap(fMaxSlope, other.fMaxSlope); +} + +//---------------------------------------------------------------------------------------------------------------------- +// +L1CAIteration::L1CAIteration(const std::string& name) noexcept : fName(name) { - this->Print(); + LOG(debug) << "L1CAIteration: Constructor from name called for " << this; } -void L1CAIteration::Print() const +//---------------------------------------------------------------------------------------------------------------------- +// +void L1CAIteration::Print(int verbosityLevel) const { - LOG(INFO) << "CA Track Finder Iteration: " << fName; - LOG(INFO) << "\t\t-type" << static_cast<int>(fType); - LOG(INFO) << "\tTrack cuts:"; - LOG(INFO) << "\t\t- chi2 cut" << fTrackChi2Cut; - LOG(INFO) << "\tTriplet cuts:"; - LOG(INFO) << "\t\t- chi2 cut" << fTripletChi2Cut; - LOG(INFO) << "\tDoublet cuts:"; - LOG(INFO) << "\t\t- chi2 cut" << fDoubletChi2Cut; + LOG(info) << "CA Track Finder Iteration: " << fName; + if (verbosityLevel > 0) { + LOG(info) << "\tTrack chi2 cut: " << fTrackChi2Cut; + LOG(info) << "\tTriplet chi2 cut: " << fTripletChi2Cut; + LOG(info) << "\tDoublet chi2 cut: " << fDoubletChi2Cut; + LOG(info) << "\tPick gather: " << fPickGather; + LOG(info) << "\tPick neighbour: " << fPickNeighbour; + LOG(info) << "\tMax invariant momentum: " << fMaxInvMom; + LOG(info) << "\tMax slope at primary vertex: " << fMaxSlopePV; + LOG(info) << "\tMax slope: " << fMaxSlope; + } } diff --git a/reco/L1/L1Algo/L1CAIteration.h b/reco/L1/L1Algo/L1CAIteration.h index 8e496d3680d7624ff4aef637fd73c8bf05fba53b..e81bd35272e7e3097627adbe6f7877499ba7b708 100644 --- a/reco/L1/L1Algo/L1CAIteration.h +++ b/reco/L1/L1Algo/L1CAIteration.h @@ -17,38 +17,49 @@ /// All possible iteration types of Track Finder algorithm to select /// -enum class L1CAIterationType -{ - kFastPrim, ///< primary fast tracks - kAllPrim, ///< primary all tracks - kAllPrimJump, ///< primary all tracks with jumped triplets - kAllSec, ///< secondary all tracks - kAllPrimE, ///< primary all electron tracks - kAllSecE, ///< secondary all electron tracks - kFastPrimJump, ///< primary fast tracks with jumped triplets - kAllSecJump ///< secondary all tracks with jumped triplets -}; - +//enum class L1CAIterationType; // definition in CbmL1/BmnL1 +//{ +// kFastPrim, ///< primary fast tracks +// kAllPrim, ///< primary all tracks +// kAllPrimJump, ///< primary all tracks with jumped triplets +// kAllSec, ///< secondary all tracks +// kAllPrimE, ///< primary all electron tracks +// kAllSecE, ///< secondary all electron tracks +// kFastPrimJump, ///< primary fast tracks with jumped triplets +// kAllSecJump, ///< secondary all tracks with jumped triplets +// kEND ///< dummy item, represents number of iterations +//}; + +// TODO: insert names into separate structure /// Class describes L1 Track finder iteration /// +/// The class contains different for class L1CAIteration { public: - L1CAIteration() = default; - ~L1CAIteration() = default; - L1CAIteration(const L1CAIteration& /*other*/) = default; - L1CAIteration(L1CAIteration&& /*other*/) = default; - L1CAIteration& operator=(const L1CAIteration& /*other*/) = default; - L1CAIteration& operator=(L1CAIteration&& /*other*/) = default; - - L1CAIteration(const std::string& /*name*/, L1CAIterationType /*type*/); + /// Default constructor + L1CAIteration() noexcept; + /// Destructor + ~L1CAIteration() noexcept; + /// Copy constructor + L1CAIteration(const L1CAIteration& other) noexcept; + /// Move constructor + L1CAIteration(L1CAIteration&& other) noexcept; + /// Copy operator= + L1CAIteration& operator=(const L1CAIteration& other) noexcept; + /// Move operator= + L1CAIteration& operator=(L1CAIteration&& other) noexcept; + /// Constructor from L1CAIteration type + L1CAIteration(const std::string& name) noexcept; + /// Swap method + void Swap(L1CAIteration& other) noexcept; // // BASIC METHODS // /// Prints iteration options - void Print() const; + void Print(int verbosityLevel = 0) const; // // SETTERS @@ -58,11 +69,10 @@ public: // Basic fields setters //------------------------------------------------------------------------------------------------------------------- - /// Sets name for this iteration, the name should be unique - // TODO: develope naming system and checkers - void SetName(const std::string& name) { fName = name; } /// Sets type of the iteration - void SetType(L1CAIterationType type) { fType = type; } + //void SetType(L1CAIterationType type) { fType = type; } + /// Sets name of the iteration + void SetName(const std::string& name) { fName = name; } //------------------------------------------------------------------------------------------------------------------- // Cuts setters @@ -74,7 +84,16 @@ public: void SetTripletChi2Cut(float input) { fTripletChi2Cut = input; } /// Sets doublet chi2 upper cut void SetDoubletChi2Cut(float input) { fDoubletChi2Cut = input; } - + /// + void SetPickGather(float input) { fPickGather = input; } + /// + void SetPickNeighbour(float input) { fPickNeighbour = input; } + /// + void SetMaxInvMom(float input) { fMaxInvMom = input; } + /// + void SetMaxSlopePV(float input) { fMaxSlopePV = input; } + /// + void SetMaxSlope(float input) { fMaxSlope = input; } // // GETTERS @@ -84,10 +103,10 @@ public: // Basic fields getters //------------------------------------------------------------------------------------------------------------------- - /// Gets the name of the iteration - std::string GetName() const { return fName; } /// Gets the type of the iteration - L1CAIterationType GetType() { return fType; } + //L1CAIterationType GetType() const { return fType; } + /// Gets the name of the iteration + const std::string& GetName() const { return fName; } //------------------------------------------------------------------------------------------------------------------- // Cuts getters @@ -99,22 +118,39 @@ public: float GetTripletChi2Cut() const { return fTripletChi2Cut; } /// Gets doublet chi2 upper cut float GetDoubletChi2Cut() const { return fDoubletChi2Cut; } + /// + float GetPickGather() const { return fPickGather; } + /// + float GetPickNeighbour() const { return fPickNeighbour; } + /// + float GetMaxInvMom() const { return fMaxInvMom; } + /// + float GetMaxSlopePV() const { return fMaxSlopePV; } + /// + float GetMaxSlope() const { return fMaxSlope; } private: //------------------------------------------------------------------------------------------------------------------- // Basic fields //------------------------------------------------------------------------------------------------------------------- - std::string fName; ///< Iteration name - L1CAIterationType fType; ///< Iteration type + //L1CAIterationType fType {static_cast<L1CAIterationType>(0)}; ///< Iteration type + std::string fName {""}; ///< Iteration name //------------------------------------------------------------------------------------------------------------------- // Track finder dependent cuts //------------------------------------------------------------------------------------------------------------------- - float fTrackChi2Cut; ///> track chi2 upper cut - float fTripletChi2Cut; ///> triplet chi2 upper cut - float fDoubletChi2Cut; ///> doublet chi2 upper cut + // TODO: Iteratively change the literals to floats + // TODO: Change the names of variables + float fTrackChi2Cut {10.f}; ///> track chi2 upper cut + float fTripletChi2Cut {21.1075f}; ///> triplet chi2 upper cut + float fDoubletChi2Cut {11.3449 * 2.f / 3.f}; ///> doublet chi2 upper cut + float fPickGather {3.0}; ///> size of region to attach new hits to the created track + float fPickNeighbour {5.0}; + float fMaxInvMom {1.0 / 0.5}; + float fMaxSlopePV {1.1}; + float fMaxSlope {2.748}; }; #endif // L1CAIteration_h diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx index 2c67a326287a5e5cf39de86821e497e4d49035c4..56dff8798412053eff3ae5bbb99e6db5b832b247 100644 --- a/reco/L1/L1Algo/L1CATrackFinder.cxx +++ b/reco/L1/L1Algo/L1CATrackFinder.cxx @@ -35,7 +35,7 @@ #ifdef _OPENMP #include "omp.h" #include "pthread.h" -#endif +#endif // _OPENMP #include "TRandom.h" @@ -43,20 +43,20 @@ #include "L1Timer.h" #ifdef DRAW #include "utils/L1AlgoDraw.h" -#endif +#endif // DRAW #ifdef PULLS #include "utils/L1AlgoPulls.h" -#endif +#endif // PULLS #ifdef TRIP_PERFORMANCE #include "utils/L1AlgoEfficiencyPerformance.h" -#endif +#endif // TRIP_PERFORMANCE #ifdef DOUB_PERFORMANCE #include "utils/L1AlgoEfficiencyPerformance.h" -#endif +#endif // DOUB_PERFORMANCE #ifdef TBB #include "L1AlgoTBB.h" -#endif +#endif // TBB #include <algorithm> #include <fstream> @@ -92,7 +92,7 @@ inline void L1Algo::f10( // input #ifdef USE_EVENT_NUMBER Event_l[i1_V][i1_4] = hitl.track; -#endif +#endif // USE_EVENT_NUMBER HitTime_l[i1_V][i1_4] = hitl.time; HitTimeEr[i1_V][i1_4] = hitl.timeEr; @@ -207,7 +207,7 @@ inline void L1Algo::f11( /// input 1st stage of singlet search fld0.Set(l_B, zstal, targB, fTargZ); // estimate field for the next extrapolations stam.fieldSlice.GetFieldValue(fTargX + tx * (zstam - fTargZ), fTargY + ty * (zstam - fTargZ), m_B); -#define USE_3HITS +#define USE_3HITS // TODO: move this directive to more suitable place #ifndef USE_3HITS if (istac != istal) fld1.Set(m_B, zstam, l_B, zstal, centB, zstac); else @@ -301,7 +301,7 @@ inline void L1Algo::f11( /// input 1st stage of singlet search } -#else // TODO: doesn't work. Why? +#else // not BEGIN_FROM_TARGET // TODO: doesn't work. Why? T.x = fTargX; T.y = fTargY; @@ -324,9 +324,9 @@ inline void L1Algo::f11( /// input 1st stage of singlet search for (int ista = 0; ista <= istal - 1; ista++) { #ifdef USE_RL_TABLE fit.L1AddMaterial(T, fRadThick[ista].GetRadThick(T.x, T.y), MaxInvMom, 1); -#else +#else // not USE_RL_TABLE fit.L1AddMaterial(T, vStations[ista].materialInfo, MaxInvMom, 1); -#endif +#endif // USE_RL_TABLE if (ista == NMvdStations - 1) fit.L1AddPipeMaterial(T, MaxInvMom, 1); } @@ -355,16 +355,16 @@ inline void L1Algo::f11( /// input 1st stage of singlet search else L1Filter(T, info, v); -#endif +#endif // BEGIN_FROM_TARGET #ifdef USE_RL_TABLE if (fTrackingMode != kMcbm) fit.L1AddMaterial(T, fRadThick[istal].GetRadThick(T.x, T.y), MaxInvMom, 1); if (fTrackingMode == kGlobal || fTrackingMode == kMcbm) fit.L1AddThickMaterial(T, fRadThick[istal].GetRadThick(T.x, T.y), MaxInvMom, 1, stal.materialInfo.thick, 1); -#else +#else // not USE_RL_TABLE fit.L1AddMaterial(T, stal.materialInfo, MaxInvMom, 1); -#endif +#endif // USE_RL_TABLE if ((istam >= NMvdStations) && (istal <= NMvdStations - 1)) { fit.L1AddPipeMaterial(T, MaxInvMom, 1); } fvec dz = zstam - zl; @@ -444,7 +444,7 @@ inline void L1Algo::f20( #ifdef USE_EVENT_NUMBER if ((Event[i1_V][i1_4] != hitm.n)) continue; -#endif +#endif // USE_EVENT_NUMBER // - check whether hit belong to the window ( track position +\- errors ) - const fscal zm = hitm.Z(); // L1TrackPar T1_new = T1; @@ -506,13 +506,13 @@ inline void L1Algo::f20( L1FilterChi2XYC00C10C11(info, x, y, C00, C10, C11, chi2, hitm.U()); #ifdef DO_NOT_SELECT_TRIPLETS if (isec != TRACKS_FROM_TRIPLETS_ITERATION) -#endif +#endif // DO_NOT_SELECT_TRIPLETS if (chi2[i1_4] > DOUBLET_CHI2_CUT) continue; // T1.t[i1_4] = hitm.time; #ifdef USE_EVENT_NUMBER T1.n[i1_4] = hitm.n; -#endif +#endif // USE_EVENT_NUMBER info = stam.backInfo; @@ -525,7 +525,7 @@ inline void L1Algo::f20( #ifdef DO_NOT_SELECT_TRIPLETS if (isec != TRACKS_FROM_TRIPLETS_ITERATION) -#endif +#endif // DO_NOT_SELECT_TRIPLETS if (chi2[i1_4] > DOUBLET_CHI2_CUT) continue; i1_2.push_back(i1); @@ -540,7 +540,7 @@ inline void L1Algo::f20( #ifndef FAST_CODE //TODO: optimise triplet portion limit and put a warning // assert(Ndoublets < fL1Parameters.GetMaxDoubletsPerSinglet()); -#endif +#endif // FAST_CODE if (Ndoublets >= fL1Parameters.GetMaxDoubletsPerSinglet()) { n2 = n2 - Ndoublets; @@ -682,9 +682,9 @@ inline void L1Algo::f30( // input if (fTrackingMode == kGlobal || fTrackingMode == kMcbm) fit.L1AddThickMaterial(T2, fRadThick[istam].GetRadThick(T2.x, T2.y), MaxInvMom, 1, stam.materialInfo.thick, 1); -#else +#else // not USE_RL_TABLE fit.L1AddMaterial(T2, stam.materialInfo, T2.qp, 1); -#endif +#endif // USE_RL_TABLE if ((istar >= NMvdStations) && (istam <= NMvdStations - 1)) { fit.L1AddPipeMaterial(T2, T2.qp, 1); } fvec dz2 = star.z - T2.z; @@ -717,7 +717,7 @@ inline void L1Algo::f30( // input #ifdef DO_NOT_SELECT_TRIPLETS if (isec == TRACKS_FROM_TRIPLETS_ITERATION) Pick_r22 = Pick_r2 + 1; -#endif +#endif // DO_NOT_SELECT_TRIPLETS const fscal iz = 1.f / (T2.z[i2_4] - fCbmTargetZ[0]); L1HitAreaTime area(vGridTime[&star - vStations], T2.x[i2_4] * iz, T2.y[i2_4] * iz, (sqrt(Pick_r22 * (T2.C00 + stam.XYInfo.C00)) + MaxDZ * fabs(T2.tx))[i2_4] * iz, @@ -743,7 +743,7 @@ inline void L1Algo::f30( // input #ifdef USE_EVENT_NUMBER if ((T2.n[i2_4] != hitr.n)) continue; -#endif +#endif // USE_EVENT_NUMBER const fscal zr = hitr.Z(); // const fscal yr = hitr.Y(); @@ -823,7 +823,7 @@ inline void L1Algo::f30( // input #ifdef DO_NOT_SELECT_TRIPLETS if (isec != TRACKS_FROM_TRIPLETS_ITERATION) -#endif +#endif // DO_NOT_SELECT_TRIPLETS if (chi2[i2_4] > TRIPLET_CHI2_CUT || C00[i2_4] < 0 || C11[i2_4] < 0 || T_cur.C55[i2_4] < 0) continue; // chi2_triplet < CHI2_CUT @@ -868,7 +868,7 @@ inline void L1Algo::f30( // input #ifndef FAST_CODE //TODO: optimise triplet portion limit and put a warning // assert(Ntriplets < fL1Parameters.GetMaxTripletPerDoublets()); -#endif +#endif // FAST_CODE if (Ntriplets >= fL1Parameters.GetMaxTripletPerDoublets()) { n3 = n3 - Ntriplets; @@ -1026,9 +1026,9 @@ inline void L1Algo::f32( // input // TODO not updated after gaps introduction L1Extrapolate(T, z[ih], T.qp, fld); #ifdef USE_RL_TABLE fit.L1AddMaterial(T, fRadThick[ista[ih]].GetRadThick(T.x, T.y), T.qp, 1); -#else +#else // not USE_RL_TABLE fit.L1AddMaterial(T, sta[ih].materialInfo, T.qp, 1); -#endif +#endif // USE_RL_TABLE if (ista[ih] == NMvdStations - 1) fit.L1AddPipeMaterial(T, T.qp, 1); L1Filter(T, sta[ih].frontInfo, u[ih]); @@ -1061,9 +1061,9 @@ inline void L1Algo::f32( // input // TODO not updated after gaps introduction L1Extrapolate(T, z[ih], T.qp, fld); #ifdef USE_RL_TABLE fit.L1AddMaterial(T, fRadThick[ista[ih]].GetRadThick(T.x, T.y), T.qp, 1); -#else +#else // not USE_RL_TABLE fit.L1AddMaterial(T, sta[ih].materialInfo, T.qp, 1); -#endif +#endif // USE_RL_TABLE if (ista[ih] == NMvdStations) fit.L1AddPipeMaterial(T, T.qp, 1); L1Filter(T, sta[ih].frontInfo, u[ih]); @@ -1092,9 +1092,9 @@ inline void L1Algo::f32( // input // TODO not updated after gaps introduction L1Extrapolate(T, z[ih], T.qp, fld); #ifdef USE_RL_TABLE fit.L1AddMaterial(T, fRadThick[ista[ih]].GetRadThick(T.x, T.y), T.qp, 1); -#else +#else // not USE_RL_TABLE fit.L1AddMaterial(T, sta[ih].materialInfo, T.qp, 1); -#endif +#endif // USE_RL_TABLE if (ista[ih] == NMvdStations + 1) fit.L1AddPipeMaterial(T, T.qp, 1); L1Filter(T, sta[ih].frontInfo, u[ih]); @@ -1119,9 +1119,9 @@ inline void L1Algo::f4( // input #ifdef _OPENMP unsigned int Thread = omp_get_thread_num(); -#else +#else // not _OPENMP unsigned int Thread = 0; -#endif +#endif // _OPENMP THitI ihitl_priv = 0; @@ -1152,7 +1152,7 @@ inline void L1Algo::f4( // input #ifdef DO_NOT_SELECT_TRIPLETS if (isec != TRACKS_FROM_TRIPLETS_ITERATION) -#endif +#endif // DO_NOT_SELECT_TRIPLETS if (!finite(chi2) || chi2 < 0 || chi2 > TRIPLET_CHI2_CUT) continue; fscal qp = T3.qp[i3_4]; @@ -1764,6 +1764,7 @@ void L1Algo::CATrackFinder() // ---- Loop over Track Finder iterations ----------------------------------------------------------------// for (isec = 0; isec < fNFindIterations; ++isec) // all finder { + std::cout << "CA Track Finder Iteration!!" << isec << '\n'; if (fTrackingMode == kMcbm) { if (isec > 3) { continue; } } diff --git a/reco/L1/L1Algo/L1InitManager.cxx b/reco/L1/L1Algo/L1InitManager.cxx index 8ab9f5c7e3d0a259b78d52258cafd38ee0c6dd80..d3ebf080e44c9571961ecb47d45d8ffb31fe2e81 100644 --- a/reco/L1/L1Algo/L1InitManager.cxx +++ b/reco/L1/L1Algo/L1InitManager.cxx @@ -87,20 +87,33 @@ void L1InitManager::Init() const // void L1InitManager::PrintStations(int verbosityLevel) const { - if (verbosityLevel < 1) { - for (auto& station : fStationsInfo) { - LOG(info) << "----------- station: "; - LOG(info) << "\ttype = " << station.GetStationType(); // TMP - LOG(info) << "\tz = " << station.GetZdouble(); - } + for (const auto& station : fStationsInfo) { + station.Print(verbosityLevel); } - else { - for (auto& station : fStationsInfo) { - station.Print(); - } +} + +//----------------------------------------------------------------------------------------------------------------------- +// +void L1InitManager::PrintCAIterations(int verbosityLevel) const +{ + for (const auto& iteration : fCAIterationsContainer) { + iteration.Print(verbosityLevel); } } +//----------------------------------------------------------------------------------------------------------------------- +// +void L1InitManager::PushBackCAIteration(const L1CAIteration& iteration) +{ + // TODO: probably some checks must be inserted here + if (!fInitFlags[L1InitManager::kECAIterationsNumberCrosscheck]) { + LOG(error) << "L1InitManager::PushBackCAIteration: attempt to push back a CA track finder iteration before the " + << "number of iterations was defined"; + assert((fInitFlags[L1InitManager::kECAIterationsNumberCrosscheck])); + } + fCAIterationsContainer.push_back(iteration); +} + //----------------------------------------------------------------------------------------------------------------------- // void L1InitManager::TransferL1StationArray(std::array<L1Station, L1Parameters::kMaxNstations>& destinationArray) @@ -131,6 +144,19 @@ void L1InitManager::TransferL1StationArray(std::array<L1Station, L1Parameters::k LOG(info) << "L1InitManager: L1Station vector was successfully transfered to L1Algo core :)"; } +//----------------------------------------------------------------------------------------------------------------------- +// +void L1InitManager::TransferCAIterationsContainer(L1Vector<L1CAIteration>& destinationVector) +{ + bool ifCAIterationsInitialized = CheckCAIterations(); + if (!ifCAIterationsInitialized) { + LOG(error) << "L1InitManager::TransferCAIterationsContainer: the CA track finder iterations container was not " + << "initialized properly"; + assert((ifCAIterationsInitialized)); + } + std::copy(fCAIterationsContainer.begin(), fCAIterationsContainer.end(), destinationVector.begin()); +} + // // GETTERS // @@ -167,7 +193,7 @@ void L1InitManager::SetFieldFunction(const std::function<void(const double (&xyz fInitFlags[L1InitManager::keFieldFunction] = true; } else { - LOG(warn) << "L1InitManager::SetFieldFunction: attemt to reinitialize the field function. Ignored"; + LOG(warn) << "L1InitManager::SetFieldFunction: attempt to reinitialize the field function. Ignored"; } } @@ -199,6 +225,14 @@ void L1InitManager::SetStationsNumberCrosscheck(L1DetectorID detectorID, int nSt LOG(debug) << "InitResult: " << fInitFlags[L1InitManager::keStationsNumberCrosscheck]; } +//----------------------------------------------------------------------------------------------------------------------- +// +void L1InitManager::SetCAIterationsNumberCrosscheck(int nIterations) +{ + fCAIterationsNumberCrosscheck = nIterations; + fInitFlags[L1InitManager::kECAIterationsNumberCrosscheck] = true; +} + //----------------------------------------------------------------------------------------------------------------------- // void L1InitManager::SetTargetPosition(double x, double y, double z) @@ -306,3 +340,24 @@ bool L1InitManager::CheckStationsInfo() // to be consistent with other class fields initialization rules return fInitFlags[L1InitManager::keStationsInfo]; } + +//----------------------------------------------------------------------------------------------------------------------- +// +bool L1InitManager::CheckCAIterations() +{ + // Check number of iterations + if (!fInitFlags[L1InitManager::kECAIterations]) { + int actualIterationsNumber = fCAIterationsContainer.size(); + int expectedIterationsNumber = fCAIterationsNumberCrosscheck; + if (actualIterationsNumber != expectedIterationsNumber) { + LOG(warn) << "L1InitManager::CheckCAIterations: incorrect number of iterations registered: " + << actualIterationsNumber << " of " << expectedIterationsNumber << " expected"; + fInitFlags[L1InitManager::kECAIterations] = false; + } + else { + fInitFlags[L1InitManager::kECAIterations] = true; + } + } + + return fInitFlags[L1InitManager::kECAIterations]; +} diff --git a/reco/L1/L1Algo/L1InitManager.h b/reco/L1/L1Algo/L1InitManager.h index 4038e725accf7fe9067e21718f2e6d069cc44e3e..e88a58a22c867396939b8448c1a237292836bd20 100644 --- a/reco/L1/L1Algo/L1InitManager.h +++ b/reco/L1/L1Algo/L1InitManager.h @@ -12,6 +12,7 @@ #define L1InitManager_h 1 #include "L1BaseStationInfo.h" +#include "L1CAIteration.h" #include "L1Field.h" #include "L1Parameters.h" #include "L1Utils.h" @@ -25,7 +26,7 @@ /// determined in the concrete setup class (i.e. CbmL1/BmnL1) enum class L1DetectorID; -/// Initialization manager for L1Aglo +/// Initialization manager for L1Algo /// /// ==== Expected initialization steps ==== (TODO: keep this instruction up-to-date) /// @@ -60,14 +61,16 @@ class L1InitManager { private: enum { - keActiveDetectorIDs, ///< If the detector sequence is set - keStationsNumberCrosscheck, ///< If the crosscheck station numbers were setup - keFieldFunction, ///< If magnetic field getter funciton is set - keTargetPos, ///< If target position was defined - kePrimaryVertexField, ///< If magnetic field value and region defined at primary vertex - keIfStationNumbersChecked, ///< If the station number was already checked - keStationsInfo, ///< If all the planned stations were added to the manager - keL1StationTransfered, ///< If the L1Station vector was already transfered to destination array + keActiveDetectorIDs, ///< If the detector sequence is set + keStationsNumberCrosscheck, ///< If the crosscheck station numbers were setup + keFieldFunction, ///< If magnetic field getter funciton is set + keTargetPos, ///< If target position was defined + kePrimaryVertexField, ///< If magnetic field value and region defined at primary vertex + keIfStationNumbersChecked, ///< If the station number was already checked + keStationsInfo, ///< If all the planned stations were added to the manager + keL1StationTransfered, ///< If the L1Station vector was already transfered to destination array + keCAIterationsNumberCrosscheck, ///< If the CA trackfinder iterations were initialized + keCAIterations, ///< If the CA trackfinder iterations were initialized keEnd }; @@ -98,16 +101,28 @@ public: /// Adds another station of a given type using reference to a L1BaseStationInfo object void AddStation(const L1BaseStationInfo& inStation); /// Adds another station of a given type using pointer to a L1BaseStationInfo object - void AddStation(const L1BaseStationInfo* inStationPtr) { AddStation(*inStationPtr); } + void AddStation(const L1BaseStationInfo* inStationRawPtr) { AddStation(*inStationRawPtr); } /// Adds another station of a given type using std::unique_ptr-wraped pointer to L1BaseStationInfo - void AddStation(const std::unique_ptr<L1BaseStationInfo>& inStationUniquePtr) { AddStation(*inStationUniquePtr); } + void AddStation(const std::unique_ptr<L1BaseStationInfo>& inStationUPtr) { AddStation(*inStationUPtr); } + /// Initializes L1Algo: transfers all caputred data to the L1 tracking core void Init() const; /// Prints a list of stations void PrintStations(int verbosityLevel = 0) const; + /// Prints a list of CA track finder iterations + void PrintCAIterations(int verbosityLevel = 0) const; + + /// Pushes an CA track finder iteration into a sequence of iteration using reference + void PushBackCAIteration(const L1CAIteration& iteration); + /// Pushes an CA track finder iteration into a sequence of iteration using raw pointer + void PushBackCAIteration(const L1CAIteration* iterationRawPtr) { PushBackCAIteration(*iterationRawPtr); } + /// Pushes an CA track finder iteration into a sequence of iteration using std::unique_ptr + void PushBackCAIteration(const std::unique_ptr<L1CAIteration>& iterationUPtr) { PushBackCAIteration(*iterationUPtr); } - /// Transfer an array of L1Stations formed inside a set of L1BaseStationInfo to a destination std::array + /// Transfers an array of L1Stations formed inside a set of L1BaseStationInfo to a destination std::array void TransferL1StationArray(std::array<L1Station, L1Parameters::kMaxNstations>& destinationArray); + /// Transfers a vector of the CA track finder iterations + void TransferCAIterationsContainer(L1Vector<L1CAIteration>& destinationVector); // // GETTERS @@ -137,6 +152,8 @@ public: void SetFieldFunction(const std::function<void(const double (&xyz)[3], double (&B)[3])>& fieldFcn); /// Sets a number of stations for a particular tracking detector ID to provide initialization cross-check void SetStationsNumberCrosscheck(L1DetectorID detectorID, int nStations); + /// Sets a number of CA track finder iterations to provide initialization cross-check + void SetCAIterationsNumberCrosscheck(int nIterations); /// Sets target poisition void SetTargetPosition(double x, double y, double z); @@ -147,10 +164,13 @@ public: private: - /// Checker for L1BaseStationInfo set - /// \return true if all L1BaseStationInfo objects were initialized properly. Similar effect can be achieved by + /// Checker for L1BaseStationInfo set initialization + /// \return true If all L1BaseStationInfo objects were initialized properly. Similar effect can be achieved by /// calling the fInitFlags[L1InitManager::keStationsInfo] flag bool CheckStationsInfo(); + /// Checker for L1CAIteration container initialization + /// \return true If all L1CAIteration objects were initialized properly + bool CheckCAIterations(); /* Basic fields */ @@ -173,8 +193,14 @@ private: // NOTE: fTotalNumberOfStations is excess field for logic, but it's imortant to track L1Algo initialization /* Vertex related fields */ + L1FieldValue fTargetFieldValue {}; ///> L1FieldValue object at target L1FieldRegion fTargetFieldRegion {}; ///> L1FieldRegion object at target + + /* CA track finder iterations related */ + + L1Vector<L1CAIteration> fCAIterationsContainer {}; ///> Container for CA track finder iterations + int fCAIterationsNumberCrosscheck {-1}; ///> Number of iterations to be passed (must be used for cross-checks) }; #endif diff --git a/reco/L1/L1Algo/L1Parameters.cxx b/reco/L1/L1Algo/L1Parameters.cxx new file mode 100644 index 0000000000000000000000000000000000000000..03c56812868d171705a334e960fe11214ac6567c --- /dev/null +++ b/reco/L1/L1Algo/L1Parameters.cxx @@ -0,0 +1,32 @@ +/* Copyright (C) 2016-2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergey Gorbunov, Sergei Zharko [committer] */ + +/************************************************************************************************************ + * @file L1Parameters.cxx + * @brief Parameter container for the L1Algo library + * @since 10.02.2022 + ***********************************************************************************************************/ +#include "L1Parameters.h" + +#include <FairLogger.h> + +void L1Parameters::Print() const +{ + LOG(info) << "== L1Algo parameters =============================================================="; + LOG(info) << ""; + LOG(info) << " COMPILE TIME CONSTANTS"; + LOG(info) << " Bits to code one station: " << kStationBits; + LOG(info) << " Bits to code one thread: " << kThreadBits; + LOG(info) << " Bits to code one triplet: " << kTripletBits; + LOG(info) << " Max number of stations: " << kMaxNstations; + LOG(info) << " Max number of threads: " << kMaxNthreads; + LOG(info) << " Max number of triplets: " << kMaxNtriplets; + LOG(info) << ""; + LOG(info) << " RUNTIME CONSTANTS (CUTS)"; + LOG(info) << " Max number of doublets per singlet: " << fMaxDoubletsPerSinglet; + LOG(info) << " Max number of triplets per doublet: " << fMaxTripletPerDoublets; + LOG(info) << ""; + LOG(info) << " TRACK FINDER ITERATION DEPENDENT CONSTANTS"; + LOG(info) << "==================================================================================="; +} diff --git a/reco/L1/L1Algo/L1Parameters.h b/reco/L1/L1Algo/L1Parameters.h index da5ba6cb1a0f49faeb26e1bc65bad36e310db4ee..539325cf455d3e180b18719eb3eaeff4f0ea45b0 100644 --- a/reco/L1/L1Algo/L1Parameters.h +++ b/reco/L1/L1Algo/L1Parameters.h @@ -12,64 +12,11 @@ #ifndef L1Parameters_h #define L1Parameters_h 1 -#include <FairLogger.h> - -//#include <iomanip> -//#include <sstream> -//#include <string> -//#include <unordered_map> +#include "L1CAIteration.h" #include "L1Vector.h" -//#include "utils/L1Utils.h" - -//#define L1ALGODEV - -//---------------------------------------------------------------------------------------------------------// -// Track finder iterations definition -//---------------------------------------------------------------------------------------------------------// +//#include "utils/L1AlgoFunctions.h" -// TODO: Create independent class of L1CATrackFinderIterations ??? - - -/////// > Will be moved to a separate class -/// All possible iteration species of Track Finder algorithm -// enum class L1CATrackFinderIter { -// kFastPrim, ///< primary fast tracks -// kAllPrim, ///< primary all tracks -// kAllPrimJump, ///< primary all tracks with jumped triplets -// kAllSec, ///< secondary all tracks -// kAllPrimE, ///< primary all electron tracks -// kAllSecE, ///< secondary all electron tracks -// kFastPrimJump, ///< primary fast tracks with jumped triplets -// kAllSecJump ///< secondary all tracks with jumped triplets -// }; -// -// // Type for mapping L1CATrackFinder parameters, which are dependent from the current track finder iteration -// template <typename T> -// using L1CATrackFinderIterParameterMap_t = std::unordered_map<L1CATrackFinderIter, T, L1Utils::EnumClassHash>; -// -// ////// > Will be moved to separate class -// const L1CATrackFinderIterParameterMap_t<std::string> kTrackFinderIterNames = { -// { L1CATrackFinderIter::kFastPrim, "Primary tracks, fast" }, -// { L1CATrackFinderIter::kAllPrim, "Primary tracks, all" }, -// { L1CATrackFinderIter::kAllPrimJump, "Primary tracks with jumped triplets, all" }, -// { L1CATrackFinderIter::kAllSec, "Secondary tracks, all" }, -// { L1CATrackFinderIter::kAllPrimE, "Primary electron tracks, all" }, -// { L1CATrackFinderIter::kAllSecE, "Secondary electron tracks, all" }, -// { L1CATrackFinderIter::kFastPrimJump, "Primary tracks with jumped triplets, fast" }, -// { L1CATrackFinderIter::kAllSecJump, "Secondary tracks with jumped triplets, all" } -// }; -// -// const L1CATrackFinderIterParameterMap_t<std::string> kTrackFinderIterNamesShort = { -// { L1CATrackFinderIter::kFastPrim, "FastPrim" }, -// { L1CATrackFinderIter::kAllPrim, "AllPrim" }, -// { L1CATrackFinderIter::kAllPrimJump, "AllPrimJump" }, -// { L1CATrackFinderIter::kAllSec, "AllSec" }, -// { L1CATrackFinderIter::kAllPrimE, "AllPrimE" }, -// { L1CATrackFinderIter::kAllSecE, "AllSecE" }, -// { L1CATrackFinderIter::kFastPrimJump, "FastPrimJump" }, -// { L1CATrackFinderIter::kAllSecJump, "AllSecJump" } -// }; class L1Parameters { public: @@ -79,8 +26,8 @@ public: /// Amount of coefficients in field approximations static constexpr int kMaxNFieldApproxCoefficients {21}; // TODO: May be it is better to use the polynomial // order instead of this? - static constexpr int kMaxFieldApproxPolynomialOrder { - 5}; ///> Order of polynomial to approximate field in the vicinity of station plane + /// Order of polynomial to approximate field in the vicinity of station plane + static constexpr int kMaxFieldApproxPolynomialOrder {5}; static constexpr unsigned int kStationBits {6u}; ///> Amount of bits to code one station static constexpr unsigned int kThreadBits {6u}; ///> Amount of bits to code one thread @@ -95,180 +42,58 @@ public: static constexpr int kAssertionLevel {0}; ///> Assertion level public: - //-------------------------------------------------------------------------------------------------------// - // Basic methods // - //-------------------------------------------------------------------------------------------------------// /// Default constructor L1Parameters() = default; /// Destructor ~L1Parameters() = default; /// Copy constructor - L1Parameters(const L1Parameters& /*other*/) = default; + L1Parameters(const L1Parameters& other) = default; /// Copy assignment operator - L1Parameters& operator=(const L1Parameters& /*other*/) = default; + L1Parameters& operator=(const L1Parameters& other) = default; /// Move constructor - L1Parameters(L1Parameters&& /*other*/) = default; + L1Parameters(L1Parameters&& other) = default; /// Move assignment operator - L1Parameters& operator=(L1Parameters&& /*other*/) = default; - /// Prints configuration - void Print() - { - LOG(INFO) << "== L1Algo parameters =============================================================="; - LOG(INFO) << ""; - LOG(INFO) << " COMPILE TIME CONSTANTS"; - LOG(INFO) << " Bits to code one station: " << kStationBits; - LOG(INFO) << " Bits to code one thread: " << kThreadBits; - LOG(INFO) << " Bits to code one triplet: " << kTripletBits; - LOG(INFO) << " #endif // L1ALGODEV Max number of stations: " << kMaxNstations; - LOG(INFO) << " Max number of threads: " << kMaxNthreads; - LOG(INFO) << " Max number of triplets: " << kMaxNtriplets; - LOG(INFO) << ""; - LOG(INFO) << " RUNTIME CONSTANTS (CUTS)"; - LOG(INFO) << " Max number of doublets per singlet: " << fMaxDoubletsPerSinglet; - LOG(INFO) << " Max number of triplets per doublet: " << fMaxTripletPerDoublets; - LOG(INFO) << ""; - LOG(INFO) << " TRACK FINDER ITERATION DEPENDENT CONSTANTS"; + L1Parameters& operator=(L1Parameters&& other) = default; + // + // BASIC METHODS + // - LOG(INFO) << "==================================================================================="; - } + /// Prints configuration + void Print() const; // TODO: change constant names with actual (human) names -public: //-------------------------------------------------------------------------------------------------------// // Runtime constants // //-------------------------------------------------------------------------------------------------------// - // ***** Setters ***** // + // + // SETTERS + // /// Sets upper-bound cut on max number of doublets per one singlet void SetMaxDoubletsPerSinglet(unsigned int value) { fMaxDoubletsPerSinglet = value; } /// Sets upper-bound cut on max number of triplets per one doublet void SetMaxTripletPerDoublets(unsigned int value) { fMaxTripletPerDoublets = value; } + /// Sets the vector of track finder iterations + void SetCAIterations(const L1Vector<L1CAIteration>& input) { fCAIterationsContainer = input; } - // /// Sets track finder iteration sequence - // void SetTrackFinderIterSequence(const L1Vector<L1CATrackFinderIter>& iterations) { - // fTrackFinderIterSequence = iterations; - // } // - // /// Sets track Chi2 upper cut - // /// \param tfIteration Track Finder iteration of the L1 algorithm run - // /// \param chi2Cut Upper cut on track chi2 during selected iteration - // void SetTrackChi2Cut(L1CATrackFinderIter tfIteration, float chi2Cut) { fTrackChi2Cut[tfIteration] = chi2Cut; } - // void SetTrackChi2Cut(float chi2Cut) { SetSameValueToMap(chi2Cut, fTrackChi2Cut); } - // void SetTrackChi2Cut(const L1CATrackFinderIterParameterMap_t<float>& newValues) - // { - // SetMappedValuesToMap(newValues, fTrackChi2Cut); - // } - // /// Sets triplet Chi2 upper cut - // /// \param tfIteration Track Finder iteration of the L1 algorithm run - // /// \param chi2Cut Upper cut on triplet chi2 during selected iteration - // void SetTripletChi2Cut(L1CATrackFinderIter tfIteration, float chi2Cut) { fTripletChi2Cut[tfIteration] = chi2Cut; } - // void SetTripletChi2Cut(float chi2Cut) { SetSameValueToMap(chi2Cut, fTripletChi2Cut); } - // void SetTripletChi2Cut(const L1CATrackFinderIterParameterMap_t<float>& newValues) - // { - // SetMappedValuesToMap(newValues, fTripletChi2Cut); - // } - // /// Sets triplet Chi2 upper cut - // /// \param tfIteration Track Finder iteration of the L1 algorithm run - // /// \param chi2Cut Upper cut on triplet chi2 during selected iteration - // void SetDoubletChi2Cut(L1CATrackFinderIter tfIteration, float chi2Cut) { fDoubletChi2Cut[tfIteration] = chi2Cut; } - // void SetDoubletChi2Cut(float chi2Cut) { SetSameValueToMap(chi2Cut, fDoubletChi2Cut); } - // void SetDoubletChi2Cut(const L1CATrackFinderIterParameterMap_t<float>& newValues) - // { - // SetMappedValuesToMap(newValues, fDoubletChi2Cut); - // } + // GETTERS // - - // ***** Getters ***** // + /// Gets upper-bound cut on max number of doublets per one singlet unsigned int GetMaxDoubletsPerSinglet() const { return fMaxDoubletsPerSinglet; } + /// Gets upper-bound cut on max number of triplets per one doublet unsigned int GetMaxTripletPerDoublets() const { return fMaxTripletPerDoublets; } + /// Gets track finder iteration vector + const L1Vector<L1CAIteration>& GetCAIterations() const { return fCAIterationsContainer; } - // /// Gets track Chi2 upper cut - // /// \param tfIteration Track Finder iteration of the L1 algorithm run - // /// \return Upper cut on track chi2 during selected iteration - // float GetTrackChi2Cut(L1CATrackFinderIter tfIteration) const { return fTrackChi2Cut.at(tfIteration); } - // /// Gets triplet Chi2 upper cut - // /// \param tfIteration Track Finder iteration of the L1 algorithm run - // /// \return Upper cut on triplet chi2 during selected iteration - // float GetTripletChi2Cut(L1CATrackFinderIter tfIteration) const { return fTripletChi2Cut.at(tfIteration); } - // /// Gets triplet Chi2 upper cut - // /// \param tfIteration Track Finder iteration of the L1 algorithm run - // /// \return Upper cut on triplet chi2 during selected iteration - // float GetDoubletChi2Cut(L1CATrackFinderIter tfIteration) const { return fDoubletChi2Cut.at(tfIteration); } - - - //-------------------------------------------------------------------------------------------------------// - // Auxilary methods // - //-------------------------------------------------------------------------------------------------------// -public: - //void PrintTrackFinderIterSequence() const - //{ - // LOG(INFO) << "== L1Algo track finder iterations sequence =========="; - // LOG(INFO) << ""; - // int idx = 0; - // for (auto& iteration: fTrackFinderIterSequence) { - // LOG(INFO) << " " << std::setw(2) << std::setfill(' ') << idx << ") " << kTrackFinderIterNames.at(iteration); - // ++idx; - // } - // LOG(INFO) << ""; - // LOG(INFO) << "====================================================="; - //} - -private: - /// Aux method for printing mapped Track Finder parameters - ///template <typename T> // NOTE: moved to L1Utils.h - ///void PrintTrackFinderIterParameters(const std::string& parName, const L1CATrackFinderIterParameterMap_t<T>& parMap) - ///{ - /// std::stringstream token; // Is used because LOG() automatically sets '\n' to the end of the string - /// token << "\t\t"; - /// token << std::setw(35) << std::setfill(' ') << parName << ' '; - /// for () - ///} private: - unsigned int fMaxDoubletsPerSinglet {150}; ///< - unsigned int fMaxTripletPerDoublets {15}; ///< - - // L1Vector<L1CATrackFinderIter> fTrackFinderIterSequence {}; ///< Sequence of iterations in the track finder algorithm - - // // TODO: Develope naming system for these constants - // L1CATrackFinderIterParameterMap_t<float> fTrackChi2Cut { - // { L1CATrackFinderIter::kFastPrim, 10.f }, - // { L1CATrackFinderIter::kAllPrim, 10.f }, - // { L1CATrackFinderIter::kAllPrimJump, 10.f }, - // { L1CATrackFinderIter::kAllSec, 10.f }, - // { L1CATrackFinderIter::kAllPrimE, 10.f }, - // { L1CATrackFinderIter::kAllSecE, 10.f }, - // { L1CATrackFinderIter::kFastPrimJump, 10.f }, - // { L1CATrackFinderIter::kAllSecJump, 10.f } - // }; - // // TODO: What is the meaning of the following numbers? - // // 23.4450 <- 7.815 * 3 - // // 18.7560 <- 6.252 * 3 - // // 11.3449 * 2. / 3. - // // - // L1CATrackFinderIterParameterMap_t<float> fTripletChi2Cut { - // { L1CATrackFinderIter::kFastPrim, 23.4450f }, // kFastPrimIter - // { L1CATrackFinderIter::kAllPrim, 23.4450f }, - // { L1CATrackFinderIter::kAllPrimE, 23.4450f }, - // { L1CATrackFinderIter::kAllPrimJump, 18.7560f }, - // { L1CATrackFinderIter::kAllSec, 18.7560f }, - // { L1CATrackFinderIter::kAllSecE, 18.7560f }, - // { L1CATrackFinderIter::kFastPrimJump, 21.1075f }, - // { L1CATrackFinderIter::kAllSecJump, 21.1075f } - // }; + 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 - // L1CATrackFinderIterParameterMap_t<float> fDoubletChi2Cut { - // { L1CATrackFinderIter::kFastPrim, 11.3449 * 2.f / 3.f }, - // { L1CATrackFinderIter::kAllPrim, 11.3449 * 2.f / 3.f }, - // { L1CATrackFinderIter::kAllPrimJump, 11.3449 * 2.f / 3.f }, - // { L1CATrackFinderIter::kAllSec, 11.3449 * 2.f / 3.f }, - // { L1CATrackFinderIter::kAllPrimE, 11.3449 * 2.f / 3.f }, - // { L1CATrackFinderIter::kAllSecE, 11.3449 * 2.f / 3.f }, - // { L1CATrackFinderIter::kFastPrimJump, 11.3449 * 2.f / 3.f }, - // { L1CATrackFinderIter::kAllSecJump, 11.3449 * 2.f / 3.f } - // }; + L1Vector<L1CAIteration> fCAIterationsContainer {}; ///< L1 Track finder iterations vector }; #endif // L1Parameters_h