From de187e0ab1df1c55d9091e82cc21986a78451743 Mon Sep 17 00:00:00 2001 From: "s.zharko@gsi.de" <s.zharko@gsi.de> Date: Wed, 25 May 2022 16:29:49 +0200 Subject: [PATCH] L1Algo: Changed the fRecThick from L1Vector to std::array and made it private --- reco/L1/CbmL1.h | 54 +++++++++++++++++++++++++++++++ reco/L1/L1Algo/L1Algo.cxx | 1 - reco/L1/L1Algo/L1Algo.h | 12 +++---- reco/L1/L1Algo/L1InitManager.cxx | 6 ++-- reco/L1/L1Algo/L1InitManager.h | 4 ++- reco/L1/L1Algo/L1MaterialInfo.cxx | 4 --- 6 files changed, 66 insertions(+), 15 deletions(-) diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index 917d7882da..148b618fa2 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -182,6 +182,60 @@ public: if (fileName != "") fMatBudgetFileName[L1DetectorID::kTof] = fileName; } + /// Correction function for the material budget map + template<L1DetectorID detID> + void ApplyCorrectionToMaterialMap(L1Material& material, const L1MaterialInfo& homogenious) + { + float hole = 0.; + if constexpr (detID == L1DetectorID::kMuch || detID == L1DetectorID::kTrd) { + hole = 0.15f; + } + else if constexpr (detID == L1DetectorID::kTof) { + hole = 0.0015f; + } + + // A bit ugly solution, but so can we avoid dependency on input maps file + std::vector<float> keepRow {}; + if constexpr (detID != L1DetectorID::kSts) { keepRow.resize(material.GetNbins()); } + + for (int iBinX = 0; iBinX < material.GetNbins(); ++iBinX) { + if constexpr (detID == L1DetectorID::kTof) { hole = 0.0015f; } + if constexpr (detID != L1DetectorID::kSts) { + for (int iBinY = 0; iBinY < material.GetNbins(); ++iBinY) { + keepRow[iBinY] = material.GetRadThick(iBinX, iBinY); + } + } + for (int iBinY = 0; iBinY < material.GetNbins(); ++iBinY) { + if constexpr (detID == L1DetectorID::kMvd) { + // Correction for holes in the material map + if (material.GetRadThick(iBinX, iBinY) < homogenious.RadThick[0]) { + if (iBinY > 0 && iBinY < material.GetNbins() - 1) { + material.SetRadThick(iBinX, iBinY, TMath::Min(keepRow[iBinY - 1], keepRow[iBinY + 1])); + } + } + + // Correction for the hardcodded value of RadThick of MVD stations + if (material.GetRadThick(iBinX, iBinY) < 0.0015) { material.SetRadThick(iBinX, iBinY, 0.0015); } + } + else if constexpr (detID == L1DetectorID::kSts) { + if (material.GetRadThick(iBinX, iBinY) < homogenious.RadThick[0]) { + material.SetRadThick(iBinX, iBinY, homogenious.RadThick[0]); + } + } + else if constexpr (detID == L1DetectorID::kMuch || detID == L1DetectorID::kTrd || detID == L1DetectorID::kTof) { + // Correction for holes in the material map + if (iBinY > 0 && iBinY < material.GetNbins() - 1) { + material.SetRadThick(iBinX, iBinY, TMath::Min(keepRow[iBinY - 1], keepRow[iBinY + 1])); + } + // Correction for hardcoded values + if (material.GetRadThick(iBinX, iBinY) > 0.0015) { hole = material.GetRadThick(iBinX, iBinY); } + if (material.GetRadThick(iBinX, iBinY) < 0.0015) { material.SetRadThick(iBinX, iBinY, hole); } + } + } + } + } + + /// Utility to map the L1DetectorID items into detector names constexpr const char* GetDetectorName(L1DetectorID detectorID) { diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index 70574c349d..90bec5be14 100644 --- a/reco/L1/L1Algo/L1Algo.cxx +++ b/reco/L1/L1Algo/L1Algo.cxx @@ -108,7 +108,6 @@ void L1Algo::Init(const bool UseHitErrors, const TrackingMode mode, const bool M // Fill L1Station array fInitManager.TransferL1StationArray(fStations); - fRadThick.reset(fNstations); fInitManager.TransferL1MaterialArray(fRadThick); fTrackingLevel = fInitManager.GetTrackingLevel(); diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 54e65b5db0..22f447e9b4 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -80,6 +80,7 @@ class L1AlgoEfficiencyPerformance; typedef int Tindex; using L1StationsArray_t = std::array<L1Station, L1Parameters::kMaxNstations>; +using L1MaterialArray_t = std::array<L1Material, L1Parameters::kMaxNstations>; /// Central class of L1 tracking /// @@ -222,12 +223,11 @@ public: void SetNThreads(unsigned int n); private: - int fNstations {0}; ///< number of all detector stations - int fNstationsBeforePipe {0}; ///< number of stations before pipe (MVD stations in CBM) - int fNfieldStations {0}; ///< number of stations in the field region - alignas(16) L1StationsArray_t fStations; ///< array of L1Station objects - - L1Vector<L1Material> fRadThick {"fRadThick"}; // material for each station + int fNstations {0}; ///< number of all detector stations + int fNstationsBeforePipe {0}; ///< number of stations before pipe (MVD stations in CBM) + int fNfieldStations {0}; ///< number of stations in the field region + alignas(16) L1StationsArray_t fStations {}; ///< array of L1Station objects + alignas(16) L1MaterialArray_t fRadThick {}; ///< material for each station public: /// Gets total number of stations used in tracking diff --git a/reco/L1/L1Algo/L1InitManager.cxx b/reco/L1/L1Algo/L1InitManager.cxx index be625c3546..7db48bd4a5 100644 --- a/reco/L1/L1Algo/L1InitManager.cxx +++ b/reco/L1/L1Algo/L1InitManager.cxx @@ -333,7 +333,7 @@ void L1InitManager::TransferL1StationArray(std::array<L1Station, L1Parameters::k //----------------------------------------------------------------------------------------------------------------------- // -void L1InitManager::TransferL1MaterialArray(L1Vector<L1Material>& destinationArray) +void L1InitManager::TransferL1MaterialArray(std::array<L1Material, L1Parameters::kMaxNstations>& destinationArray) { // // 1) Check, if all fields of this were initialized @@ -350,9 +350,9 @@ void L1InitManager::TransferL1MaterialArray(L1Vector<L1Material>& destinationArr { int nStationsTotal = this->GetNstationsActive(); std::stringstream aStream; - aStream << "Destination array size (" << destinationArray.capacity() + aStream << "Destination array size (" << destinationArray.size() << ") is smaller then the actual number of active tracking stations (" << nStationsTotal << ")"; - L1MASSERT(0, nStationsTotal <= static_cast<int>(destinationArray.capacity()), aStream.str().c_str()); + L1MASSERT(0, nStationsTotal <= static_cast<int>(destinationArray.size()), aStream.str().c_str()); } auto destinationArrayIterator = destinationArray.begin(); diff --git a/reco/L1/L1Algo/L1InitManager.h b/reco/L1/L1Algo/L1InitManager.h index 47191c1a64..7fa5ff021b 100644 --- a/reco/L1/L1Algo/L1InitManager.h +++ b/reco/L1/L1Algo/L1InitManager.h @@ -234,10 +234,12 @@ public: void SetTargetPosition(double x, double y, double z); /// Transfers an array of L1Stations formed inside a set of L1BaseStationInfo to a destination std::array + /// \param destinationArray Reference to the destination array of L1Station objects in the L1Algo core void TransferL1StationArray(std::array<L1Station, L1Parameters::kMaxNstations>& destinationArray); /// Transfers an array of L1Material tables formed inside a set of L1BaseStationInfo to a destination std::array - void TransferL1MaterialArray(L1Vector<L1Material>& destinationVector); + /// \param destinationArray Reference to the destination array of L1Material objects in the L1Algo core + void TransferL1MaterialArray(std::array<L1Material, L1Parameters::kMaxNstations>& destinationArray); private: diff --git a/reco/L1/L1Algo/L1MaterialInfo.cxx b/reco/L1/L1Algo/L1MaterialInfo.cxx index 3eccb8d896..27b307f376 100644 --- a/reco/L1/L1Algo/L1MaterialInfo.cxx +++ b/reco/L1/L1Algo/L1MaterialInfo.cxx @@ -43,7 +43,6 @@ L1Material::L1Material(const L1Material& other) , fFactor(other.fFactor) , fTable(other.fTable) { - std::cout << "L1Material copy constructor was called\n"; } //------------------------------------------------------------------------------------------------------------------------------------ @@ -51,7 +50,6 @@ L1Material::L1Material(const L1Material& other) L1Material& L1Material::operator=(const L1Material& other) { - std::cout << "L1Material copy assignment operator was called\n"; if (this != &other) { fNbins = other.fNbins; fRmax = other.fRmax; @@ -69,7 +67,6 @@ L1Material& L1Material::operator=(const L1Material& other) // L1Material::L1Material(L1Material&& other) noexcept { - std::cout << "L1Material move constructor was called\n"; this->Swap(other); } @@ -77,7 +74,6 @@ L1Material::L1Material(L1Material&& other) noexcept // L1Material& L1Material::operator=(L1Material&& other) noexcept { - std::cout << "L1Material move assignment operator was called\n"; if (this != &other) { L1Material tmp(std::move(other)); this->Swap(tmp); -- GitLab