diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index 917d7882dab58a0bc3a583db5f78025f48d2b507..148b618fa2e40d0377bc31a56c71437aea8b6505 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 70574c349dd1b5ce0719b4d1664ee66bdaa9492f..90bec5be142d9725845f0d350cf81868f7d99c0d 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 54e65b5db0b04994514f4570f8f4005a9bffc8a2..22f447e9b41c1fba7f58bf293f0cdf00b95de8e1 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 be625c35462b23f2a08c79e0a30344249096e14a..7db48bd4a5fb9b244a95d60a0d31ccfdbb186111 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 47191c1a6407af06d713454ed40bc9442c766dcb..7fa5ff021b20c07f9b51abb0208bd22f37a5c9ec 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 3eccb8d896e3f5d01fe6ad444aa4c69495e4eecc..27b307f376140b8d506b5dcf52c086b3454ae4b4 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);