diff --git a/algo/ca/core/CMakeLists.txt b/algo/ca/core/CMakeLists.txt index 62e882c040da3ab6d2397b70048d85769ba20386..6504c0ec84a05b735730b71ae00ff5c043e0eb87 100644 --- a/algo/ca/core/CMakeLists.txt +++ b/algo/ca/core/CMakeLists.txt @@ -9,6 +9,7 @@ set(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/data/CaTrackParam.cxx ${CMAKE_CURRENT_SOURCE_DIR}/data/CaTrack.cxx ${CMAKE_CURRENT_SOURCE_DIR}/data/CaField.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/data/CaMaterialMap.cxx ) add_library(CaCore SHARED ${SRCS}) @@ -40,6 +41,7 @@ install( data/CaTrack.h data/CaHit.h data/CaField.h + data/CaMaterialMap.h pars/CaConstants.h utils/CaSimd.h utils/CaSimdVc.h diff --git a/reco/L1/L1Algo/L1Material.cxx b/algo/ca/core/data/CaMaterialMap.cxx similarity index 73% rename from reco/L1/L1Algo/L1Material.cxx rename to algo/ca/core/data/CaMaterialMap.cxx index b6cee6fb3522800233a9c90ccb4685d9047917d2..dbabf6e1f154fb0c8c38baaa2572b340e132c207 100644 --- a/reco/L1/L1Algo/L1Material.cxx +++ b/algo/ca/core/data/CaMaterialMap.cxx @@ -2,40 +2,37 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Sergey Gorbunov, Sergei Zharko [committer] */ -#include "L1Material.h" - -#include <Logger.h> +#include "CaMaterialMap.h" #include <iomanip> #include <sstream> #include <vector> -#include "L1Utils.h" - +#include "AlgoFairloggerCompat.h" /******************** - * L1Material class * + * MaterialMap class * ********************/ using namespace cbm::algo::ca; //------------------------------------------------------------------------------------------------------------------------------------ // -L1Material::L1Material(L1Material&& other) noexcept { this->Swap(other); } +MaterialMap::MaterialMap(MaterialMap&& other) noexcept { this->Swap(other); } //------------------------------------------------------------------------------------------------------------------------------------ // -L1Material& L1Material::operator=(L1Material&& other) noexcept +MaterialMap& MaterialMap::operator=(MaterialMap&& other) noexcept { if (this != &other) { - L1Material tmp(std::move(other)); + MaterialMap tmp(std::move(other)); this->Swap(tmp); } return *this; } //------------------------------------------------------------------------------------------------------------------------------------ -int L1Material::GetBin(float x, float y) const +int MaterialMap::GetBin(float x, float y) const { int i = static_cast<int>((x + fXYmax) * fFactor); int j = static_cast<int>((y + fXYmax) * fFactor); @@ -45,7 +42,7 @@ int L1Material::GetBin(float x, float y) const //------------------------------------------------------------------------------------------------------------------------------------ // -float L1Material::GetRadThickScal(float x, float y) const +float MaterialMap::GetRadThickScal(float x, float y) const { x = (x < fXYmax && x >= -fXYmax) ? x : 0; y = (y < fXYmax && y >= -fXYmax) ? y : 0; @@ -58,7 +55,7 @@ float L1Material::GetRadThickScal(float x, float y) const //------------------------------------------------------------------------------------------------------------------------------------ // -fvec L1Material::GetRadThickVec(fvec x, fvec y) const +fvec MaterialMap::GetRadThickVec(fvec x, fvec y) const { fvec r; for (size_t i = 0; i < fvec::size(); i++) @@ -68,28 +65,28 @@ fvec L1Material::GetRadThickVec(fvec x, fvec y) const //------------------------------------------------------------------------------------------------------------------------------------ // -void L1Material::CheckConsistency() const +void MaterialMap::CheckConsistency() const { /* (i) Check, if the object was initialized */ - if (IsNaN()) { throw std::logic_error("L1Material: class was not initialized"); } + if (IsNaN()) { throw std::logic_error("MaterialMap: class was not initialized"); } /* (ii) Check if the thickness values correct (non-negative) */ bool isThicknessOk = true; for (int i = 0; i < int(fTable.size()); ++i) { if (fTable[i] < 0) { isThicknessOk = false; - LOG(error) << "L1Material: found illegal negative station thickness value " << fTable[i] + LOG(error) << "MaterialMap: found illegal negative station thickness value " << fTable[i] << " at iBinX = " << (i % fNbins) << ", iBin = " << (i / fNbins); } } if (!isThicknessOk) { - throw std::logic_error("L1Material: incorrect station thickness values found in the thickness map"); + throw std::logic_error("MaterialMap: incorrect station thickness values found in the thickness map"); } } //------------------------------------------------------------------------------------------------------------------------------------ // -void L1Material::Initialize(int nBins, float xyMax, float zRef, float zMin, float zMax) +void MaterialMap::Initialize(int nBins, float xyMax, float zRef, float zMin, float zMax) { fNbins = nBins; fXYmax = xyMax; @@ -99,19 +96,19 @@ void L1Material::Initialize(int nBins, float xyMax, float zRef, float zMin, floa if (fNbins < 1) { std::stringstream aStream; - aStream << "L1Material: object cannot be initialized with non-positive nBins = " << fNbins; + aStream << "MaterialMap: object cannot be initialized with non-positive nBins = " << fNbins; throw std::logic_error(aStream.str()); } if (fXYmax < 0.) { std::stringstream aStream; - aStream << "L1Material: object cannot be initialized with non-positive XYmax = " << fXYmax << " [cm]"; + aStream << "MaterialMap: object cannot be initialized with non-positive XYmax = " << fXYmax << " [cm]"; throw std::logic_error(aStream.str()); } if (!((fZmin <= fZref) && (fZref <= zMax))) { std::stringstream aStream; - aStream << "L1Material: object cannot be initialized with inconsistent Z: min " << fZmin << " ref " << fZref + aStream << "MaterialMap: object cannot be initialized with inconsistent Z: min " << fZmin << " ref " << fZref << " max " << fZmax << " [cm]"; throw std::logic_error(aStream.str()); } @@ -122,7 +119,7 @@ void L1Material::Initialize(int nBins, float xyMax, float zRef, float zMin, floa //------------------------------------------------------------------------------------------------------------------------------------ // -void L1Material::Swap(L1Material& other) noexcept +void MaterialMap::Swap(MaterialMap& other) noexcept { std::swap(fNbins, other.fNbins); std::swap(fXYmax, other.fXYmax); diff --git a/algo/ca/core/data/CaMaterialMap.h b/algo/ca/core/data/CaMaterialMap.h new file mode 100644 index 0000000000000000000000000000000000000000..136875954c2f3336f9c5aa7ecf815daf715ca706 --- /dev/null +++ b/algo/ca/core/data/CaMaterialMap.h @@ -0,0 +1,134 @@ +/* Copyright (C) 2007-2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Igor Kulakov, Sergey Gorbunov [committer], Andrey Lebedev, Sergei Zharko */ + +#ifndef CaMaterialMap_h +#define CaMaterialMap_h 1 + +#include <boost/serialization/vector.hpp> + +#include <iomanip> +#include <sstream> +#include <string> +#include <vector> + +#include "CaSimd.h" +#include "CaUtils.h" + +namespace cbm::algo::ca +{ + + /// Class MaterialMap describes a map of station thickness in units of radiation length (X0) to the specific point in XY plane + class MaterialMap { + public: + /// Constructor + MaterialMap() = default; + + /// Copy constructor + MaterialMap(const MaterialMap& other) = default; + + /// Copy assignment operator + MaterialMap& operator=(const MaterialMap& other) = default; + + /// Move constructor + MaterialMap(MaterialMap&& other) noexcept; + + /// Move assignment operator + MaterialMap& operator=(MaterialMap&& other) noexcept; + + /// Destructor + ~MaterialMap() noexcept = default; + + /// Gets number of bins (rows or columns) of the material table + int GetNbins() const { return fNbins; } + + /// Gets radius in cm of the material table + float GetXYmax() const { return fXYmax; } + + /// Gets reference Z of the material in cm + float GetZref() const { return fZref; } + + /// Gets minimal Z of the collected material in cm + float GetZmin() const { return fZmin; } + + /// Gets maximal Z of the collected material in cm + float GetZmax() const { return fZmax; } + + /// Gets value of X/X0 in a given cell of the material table by the indeces of the row and column + /// \param iBinX Index of table column + /// \param iBinY Index of table row + float GetRadThickBin(int iBinX, int iBinY) const { return fTable[iBinX + fNbins * iBinY]; } + + /// Gets value of X/X0 in a given cell of the material table by the index of the bin + /// \param iBin Index of the bin in 2d table + float GetRadThickBin(int iBin) const { return fTable[iBin]; } + + /// Gets material thickness in units of X0 in (x,y) point of the station + /// \param x X coordinate of the point [cm] + /// \param y Y coordinate of the point [cm] + float GetRadThickScal(float x, float y) const; + + /// Gets material thickness in units of X0 in (x,y) point of the station + /// cbm::algo::ca::fvec type can be float, that is why "Vec" and "Scal" specifications + /// \param x X coordinate of the point [cm] (SIMDized vector) + /// \param y Y coordinate of the point [cm] (SIMDized veotor) + fvec GetRadThickVec(fvec x, fvec y) const; + + /// Checks, if the fields are NaN + bool IsNaN() const + { + return utils::IsUndefined(fNbins) || utils::IsUndefined(fXYmax) || utils::IsUndefined(fFactor) + || utils::IsUndefined(fZref) || utils::IsUndefined(fZmin) || utils::IsUndefined(fZmax); + } + + /// Verifies class invariant consistency + void CheckConsistency() const; + + /// Sets value of material thickness in units of X0 for a given cell of the material table + /// WARNING: Indeces of rows and columns in the table runs from 0 to nBins-1 inclusively, where nBins is the number both of rows + /// and columns. One should be carefull reading and storing the table from ROOT-file, because iBinX = 0 and iBinY = 0 in the + /// SetBinContent method of a ROOT histogram usually defines underflow bin + /// \param iBinX Index of table column + /// \param iBinY Index of table row + /// \param thickness Thickness of the material in units of X0 + void SetRadThickBin(int iBinX, int iBinY, float thickness) { fTable[iBinX + fNbins * iBinY] = thickness; } + + /// Sets properties of the material table -- number of rows or columnts and the size of station in XY plane + /// \param nBins Number of rows or columns + /// \param xyMax Size of station in x and y dimensions [cm] + void Initialize(int nBins, float xyMax, float zRef, float zMin, float zMax); + + /// Swap method + void Swap(MaterialMap& other) noexcept; + + /// Get bin index for (x,y). Returns -1 when outside of the map + int GetBin(float x, float y) const; + + private: + int fNbins = constants::Undef<int>; ///< Number of rows (== N columns) in the material budget table + float fXYmax = constants::Undef<float>; ///< Size of the station in x and y dimensions [cm] + float fFactor = + constants::Undef<float>; ///< Factor used in the recalculation of point coordinates to row/column id + float fZref = constants::Undef<float>; ///< Reference Z of the collected material [cm] + float fZmin = constants::Undef<float>; ///< Minimal Z of the collected material [cm] + float fZmax = constants::Undef<float>; ///< Minimal Z of the collected material [cm] + std::vector<float> fTable {}; ///< Material budget table + + /// Serialization function + friend class boost::serialization::access; + template<class Archive> + void serialize(Archive& ar, const unsigned int) + { + ar& fNbins; + ar& fXYmax; + ar& fFactor; + ar& fZref; + ar& fZmin; + ar& fZmax; + ar& fTable; + } + } _fvecalignment; + +} // namespace cbm::algo::ca + +#endif diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt index 885b80f460a737f74d6b0690fcbe4dade1f598ba..21d50382c8bcb0027a45577a2ef237761392358f 100644 --- a/reco/L1/CMakeLists.txt +++ b/reco/L1/CMakeLists.txt @@ -47,7 +47,6 @@ set(SRCS L1Algo/L1MCEvent.cxx CbmL1MCTrack.cxx CbmL1Track.cxx - L1Algo/L1Material.cxx L1Algo/L1MaterialMonitor.cxx L1Algo/L1UMeasurementInfo.cxx L1Algo/L1XYMeasurementInfo.cxx diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index b5893002d8235d75cf3a3a345c1b6f24eb357eb0..6777ec06c952d23cd16ddc9de00dbe3016e91406 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -991,7 +991,7 @@ void CbmL1::GenerateMaterialMaps() if (nBins < 1) { LOG(fatal) << " material nBins " << nBins << " is not positive, something is wrong"; } if (nBins > fMatBudgetNbins) { nBins = fMatBudgetNbins; } - L1Material matBudget = matHelper.GenerateMaterialMap(station.GetZref(), zLast, zNew, maxXY, nBins); + ca::MaterialMap matBudget = matHelper.GenerateMaterialMap(station.GetZref(), zLast, zNew, maxXY, nBins); station.SetMaterialMap(matBudget); @@ -1267,7 +1267,7 @@ void CbmL1::DumpMaterialToFile(TString fileName) const L1MaterialContainer_t& map = param.GetThicknessMaps(); for (int ist = 0; ist < param.GetNstationsActive(); ist++) { //const L1Station& st = param.GetStation(ist); - const L1Material& mat = map[ist]; + const ca::MaterialMap& mat = map[ist]; TString name = Form("tracking_station%d", ist); TString title = Form("Tracking station %d: Rad. thickness in [%s]. Z region [%.2f,%.2f] cm.", ist, "%", diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 48e32fc97dd7a269576341fb995c815e631ccbcf..3ad4e384acacd13a918e9350738427e53f7a3b4e 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -60,7 +60,7 @@ namespace // ******************************* using L1StationsArray_t = std::array<L1Station, constants::size::MaxNstations>; -using L1MaterialArray_t = std::array<L1Material, constants::size::MaxNstations>; +using L1MaterialArray_t = std::array<ca::MaterialMap, constants::size::MaxNstations>; using Tindex = int; // TODO: Replace with ca::HitIndex_t, if suitable #ifdef PULLS diff --git a/reco/L1/L1Algo/L1BaseStationInfo.cxx b/reco/L1/L1Algo/L1BaseStationInfo.cxx index fa94eeb27e6ac66280bf3c4e5cd928da5f2442ba..3b46f6c30cac05796963614889a331ac5f03e7b6 100644 --- a/reco/L1/L1Algo/L1BaseStationInfo.cxx +++ b/reco/L1/L1Algo/L1BaseStationInfo.cxx @@ -89,7 +89,7 @@ const L1Station& L1BaseStationInfo::GetL1Station() const //------------------------------------------------------------------------------------------------------------------------ // -const L1Material& L1BaseStationInfo::GetMaterialMap() const +const ca::MaterialMap& L1BaseStationInfo::GetMaterialMap() const { if (!fInitController.IsFinalized()) { LOG(fatal) << "L1BaseStationInfo::GetMaterialMap: attempt of getting the material map object from uninitialized " @@ -221,7 +221,7 @@ void L1BaseStationInfo::SetFieldStatus(int fieldStatus) //------------------------------------------------------------------------------------------------------------------------ // -void L1BaseStationInfo::SetMaterialMap(const L1Material& thicknessMap) +void L1BaseStationInfo::SetMaterialMap(const ca::MaterialMap& thicknessMap) { if (!fInitController.GetFlag(EInitKey::kThicknessMap)) { fThicknessMap = thicknessMap; @@ -235,7 +235,7 @@ void L1BaseStationInfo::SetMaterialMap(const L1Material& thicknessMap) //------------------------------------------------------------------------------------------------------------------------ // -void L1BaseStationInfo::SetMaterialMap(L1Material&& thicknessMap) noexcept +void L1BaseStationInfo::SetMaterialMap(ca::MaterialMap&& thicknessMap) noexcept { if (!fInitController.GetFlag(EInitKey::kThicknessMap)) { fThicknessMap = std::move(thicknessMap); @@ -352,7 +352,7 @@ void L1BaseStationInfo::Swap(L1BaseStationInfo& other) noexcept //------------------------------------------------------------------------------------------------------------------------ // -L1Material&& L1BaseStationInfo::TakeMaterialMap() +ca::MaterialMap&& L1BaseStationInfo::TakeMaterialMap() { if (!fInitController.IsFinalized()) { LOG(fatal) << "L1BaseStationInfo::GetMaterialMap: attempt of getting the material map object from uninitialized " diff --git a/reco/L1/L1Algo/L1BaseStationInfo.h b/reco/L1/L1Algo/L1BaseStationInfo.h index 2d79889236311d962d739b27da3aba9f54fc3f3e..5f9cc4110cfd2729b3dc535fe0abeb32f947adc6 100644 --- a/reco/L1/L1Algo/L1BaseStationInfo.h +++ b/reco/L1/L1Algo/L1BaseStationInfo.h @@ -16,7 +16,7 @@ #define L1BaseStationInfo_h 1 // L1 Core -#include "L1Material.h" +#include "CaMaterialMap.h" #include "L1ObjectInitController.h" #include "L1Station.h" // C++ std @@ -110,8 +110,8 @@ public: /// Gets a reference to L1Station info field of the L1BaseStation info const L1Station& GetL1Station() const; - /// Gets a reference to L1Material map - const L1Material& GetMaterialMap() const; + /// Gets a reference to ca::MaterialMap map + const ca::MaterialMap& GetMaterialMap() const; /// Gets station ID int GetStationID() const { return fStationID; } @@ -162,11 +162,11 @@ public: /// Sets station thickness in units of radiation length mapped vs. position in XY plane (copy semantics) /// \param thicknessMap Map of station thickness in units of radiation length - void SetMaterialMap(const L1Material& thicknessMap); + void SetMaterialMap(const ca::MaterialMap& thicknessMap); /// Sets station thickness in units of radiation length mapped vs. position in XY plane (move semantics) /// \param thicknessMap Map of station thickness in units of radiation length - void SetMaterialMap(L1Material&& thicknessMap) noexcept; + void SetMaterialMap(ca::MaterialMap&& thicknessMap) noexcept; /// Sets station ID [[deprecated("Please, use constructor to set station ID")]] void SetStationID(int inID); @@ -199,10 +199,10 @@ public: /// Swap method for easy implementation of move constructor and copy and move assignment operator void Swap(L1BaseStationInfo& other) noexcept; - /// Takes an instance of L1Material map - /// This method can be called only once. It will catch the content of L1Material map (using move semantics), and after the warning will be generated + /// Takes an instance of ca::MaterialMap map + /// This method can be called only once. It will catch the content of ca::MaterialMap map (using move semantics), and after the warning will be generated /// both for GetMaterialMap and TakeMaterialMap - L1Material&& TakeMaterialMap(); + ca::MaterialMap&& TakeMaterialMap(); /// String representation of class contents /// \param indentLevel Number of indent characters in the output @@ -218,7 +218,7 @@ private: double fZmin {0}; ///< min z double fZmax {0}; ///< max z L1Station fL1Station {}; ///< L1Station structure, describes a station in L1Algo - L1Material fThicknessMap {}; ///< Map of station thickness in units of radiation length + ca::MaterialMap fThicknessMap {}; ///< Map of station thickness in units of radiation length InitController_t fInitController {}; ///< Class fileds initialization flags ManagementFlags_t fManagementFlags {}; ///< bitset flags to manage internal behaviour of the class }; diff --git a/reco/L1/L1Algo/L1InitManager.cxx b/reco/L1/L1Algo/L1InitManager.cxx index 0b931ce4a749fa7c9fa17d029036d7bb3192f069..93ed5c670a5365b901b41eb8a039e8b2109ec14c 100644 --- a/reco/L1/L1Algo/L1InitManager.cxx +++ b/reco/L1/L1Algo/L1InitManager.cxx @@ -50,7 +50,7 @@ void L1InitManager::ClearSetupInfo() { // Clear stations set and a thickness map fvStationInfo.clear(); - fParameters.fThickMap.fill(L1Material()); + fParameters.fThickMap.fill(ca::MaterialMap()); fInitController.SetFlag(EInitKey::kStationsInfo, false); // Set number of stations do default values diff --git a/reco/L1/L1Algo/L1Material.h b/reco/L1/L1Algo/L1Material.h deleted file mode 100644 index 55433989da73cae3aaefda10fbc6b441a37d48e0..0000000000000000000000000000000000000000 --- a/reco/L1/L1Algo/L1Material.h +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright (C) 2007-2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Igor Kulakov, Sergey Gorbunov [committer], Andrey Lebedev, Sergei Zharko */ - -#ifndef L1Material_h -#define L1Material_h - -#include <boost/serialization/vector.hpp> - -#include <iomanip> -#include <sstream> -#include <string> -#include <vector> - -#include "CaSimd.h" -#include "CaUtils.h" - -using namespace cbm::algo::ca; - -/// Class L1Material describes a map of station thickness in units of radiation length (X0) to the specific point in XY plane -class L1Material { -public: - /// Constructor - L1Material() = default; - - /// Copy constructor - L1Material(const L1Material& other) = default; - - /// Copy assignment operator - L1Material& operator=(const L1Material& other) = default; - - /// Move constructor - L1Material(L1Material&& other) noexcept; - - /// Move assignment operator - L1Material& operator=(L1Material&& other) noexcept; - - /// Destructor - ~L1Material() noexcept = default; - - /// Gets number of bins (rows or columns) of the material table - int GetNbins() const { return fNbins; } - - /// Gets radius in cm of the material table - float GetXYmax() const { return fXYmax; } - - /// Gets reference Z of the material in cm - float GetZref() const { return fZref; } - - /// Gets minimal Z of the collected material in cm - float GetZmin() const { return fZmin; } - - /// Gets maximal Z of the collected material in cm - float GetZmax() const { return fZmax; } - - /// Gets value of X/X0 in a given cell of the material table by the indeces of the row and column - /// \param iBinX Index of table column - /// \param iBinY Index of table row - float GetRadThickBin(int iBinX, int iBinY) const { return fTable[iBinX + fNbins * iBinY]; } - - /// Gets value of X/X0 in a given cell of the material table by the index of the bin - /// \param iBin Index of the bin in 2d table - float GetRadThickBin(int iBin) const { return fTable[iBin]; } - - /// Gets material thickness in units of X0 in (x,y) point of the station - /// \param x X coordinate of the point [cm] - /// \param y Y coordinate of the point [cm] - float GetRadThickScal(float x, float y) const; - - /// Gets material thickness in units of X0 in (x,y) point of the station - /// cbm::algo::ca::fvec type can be float, that is why "Vec" and "Scal" specifications - /// \param x X coordinate of the point [cm] (SIMDized vector) - /// \param y Y coordinate of the point [cm] (SIMDized veotor) - cbm::algo::ca::fvec GetRadThickVec(cbm::algo::ca::fvec x, cbm::algo::ca::fvec y) const; - - /// Checks, if the fields are NaN - bool IsNaN() const - { - using namespace cbm::algo::ca; - return utils::IsUndefined(fNbins) || utils::IsUndefined(fXYmax) || utils::IsUndefined(fFactor) - || utils::IsUndefined(fZref) || utils::IsUndefined(fZmin) || utils::IsUndefined(fZmax); - } - - /// Verifies class invariant consistency - void CheckConsistency() const; - - /// Sets value of material thickness in units of X0 for a given cell of the material table - /// WARNING: Indeces of rows and columns in the table runs from 0 to nBins-1 inclusively, where nBins is the number both of rows - /// and columns. One should be carefull reading and storing the table from ROOT-file, because iBinX = 0 and iBinY = 0 in the - /// SetBinContent method of a ROOT histogram usually defines underflow bin - /// \param iBinX Index of table column - /// \param iBinY Index of table row - /// \param thickness Thickness of the material in units of X0 - void SetRadThickBin(int iBinX, int iBinY, float thickness) { fTable[iBinX + fNbins * iBinY] = thickness; } - - /// Sets properties of the material table -- number of rows or columnts and the size of station in XY plane - /// \param nBins Number of rows or columns - /// \param xyMax Size of station in x and y dimensions [cm] - void Initialize(int nBins, float xyMax, float zRef, float zMin, float zMax); - - /// Swap method - void Swap(L1Material& other) noexcept; - - /// Get bin index for (x,y). Returns -1 when outside of the map - int GetBin(float x, float y) const; - -private: - int fNbins = constants::Undef<int>; ///< Number of rows (== N columns) in the material budget table - float fXYmax = constants::Undef<float>; ///< Size of the station in x and y dimensions [cm] - float fFactor = constants::Undef<float>; ///< Factor used in the recalculation of point coordinates to row/column id - float fZref = constants::Undef<float>; ///< Reference Z of the collected material [cm] - float fZmin = constants::Undef<float>; ///< Minimal Z of the collected material [cm] - float fZmax = constants::Undef<float>; ///< Minimal Z of the collected material [cm] - std::vector<float> fTable {}; ///< Material budget table - - /// Serialization function - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive& ar, const unsigned int) - { - ar& fNbins; - ar& fXYmax; - ar& fFactor; - ar& fZref; - ar& fZmin; - ar& fZmax; - ar& fTable; - } -} _fvecalignment; - -#endif diff --git a/reco/L1/L1Algo/L1MaterialMonitor.cxx b/reco/L1/L1Algo/L1MaterialMonitor.cxx index d2591d4226ab38ee774d00a30d860d339a642728..9faa29bf3e19684b45ef3118e033586f94c36768 100644 --- a/reco/L1/L1Algo/L1MaterialMonitor.cxx +++ b/reco/L1/L1Algo/L1MaterialMonitor.cxx @@ -10,7 +10,7 @@ #include <sstream> -void L1MaterialMonitor::SetMaterial(const L1Material* materialMap) +void L1MaterialMonitor::SetMaterial(const ca::MaterialMap* materialMap) { /// construction /// \param materialMap Matareial map to be monitored diff --git a/reco/L1/L1Algo/L1MaterialMonitor.h b/reco/L1/L1Algo/L1MaterialMonitor.h index b4d5a92a18484648ad7fd39668a57a5f0b1e108b..285d7db5699967dc3b9b89d6596d5eb0e8dc50b0 100644 --- a/reco/L1/L1Algo/L1MaterialMonitor.h +++ b/reco/L1/L1Algo/L1MaterialMonitor.h @@ -11,11 +11,12 @@ #include <vector> #include "CaConstants.h" -#include "L1Material.h" +#include "CaMaterialMap.h" using namespace cbm::algo::ca; +using namespace cbm::algo; -/// Class to collect statistics for L1Material +/// Class to collect statistics for ca::MaterialMap /// class L1MaterialMonitor { public: @@ -25,11 +26,11 @@ public: /// constructor /// \param materialMap Matareial map to be monitored /// \param name Name of the material map - L1MaterialMonitor(const L1Material* materialMap, TString name = "") : fName(name) { SetMaterial(materialMap); } + L1MaterialMonitor(const ca::MaterialMap* materialMap, TString name = "") : fName(name) { SetMaterial(materialMap); } /// construction /// \param materialMap Matareial map to be monitored - void SetMaterial(const L1Material* materialMap); + void SetMaterial(const ca::MaterialMap* materialMap); /// construction /// \param name Name of the material map @@ -85,7 +86,7 @@ public: double GetNhits() const { return fNhitsTotal; } private: - const L1Material* fMaterial {nullptr}; ///< Pointer to L1Material + const ca::MaterialMap* fMaterial {nullptr}; ///< Pointer to ca::MaterialMap TString fName {}; ///< Name of the material map std::vector<char> fActiveBinMap {}; ///< Map of active bins in the material map (bins where hits appear) diff --git a/reco/L1/L1Algo/L1Parameters.cxx b/reco/L1/L1Algo/L1Parameters.cxx index ef04298fc1267e77a7e92eea2b55cfd6004e68e9..59c5e842fb7924f0639bd88c327223289d98e0de 100644 --- a/reco/L1/L1Algo/L1Parameters.cxx +++ b/reco/L1/L1Algo/L1Parameters.cxx @@ -123,7 +123,7 @@ void L1Parameters::CheckConsistency() const /* * Check thickness maps - * NOTE: If a L1Material map was not set up, it is accounted inconsistent (uninitialized). In the array of thickness maps for each + * NOTE: If a ca::MaterialMap map was not set up, it is accounted inconsistent (uninitialized). In the array of thickness maps for each * there are uninitialized elements possible (with id > NstationsActiveTotal), thus one should NOT run the loop above over * all the stations in array but only until *(fNstationsActive.cend() - 1) (== NstationsActiveTotal). */ diff --git a/reco/L1/L1Algo/L1Parameters.h b/reco/L1/L1Algo/L1Parameters.h index 2e450c97b205dace586c63bcfa93270f62dfc906..3a5a24d623ea1442b5d0e44ace96b7e93817daa2 100644 --- a/reco/L1/L1Algo/L1Parameters.h +++ b/reco/L1/L1Algo/L1Parameters.h @@ -20,9 +20,9 @@ #include "CaConstants.h" #include "CaField.h" +#include "CaMaterialMap.h" #include "CaVector.h" #include "L1CAIteration.h" -#include "L1Material.h" #include "L1SearchWindow.h" #include "L1Station.h" #include "L1Utils.h" // IS DEPRECATED? @@ -35,7 +35,7 @@ enum class L1DetectorID; /// Type definitions for used containers using L1IterationsContainer_t = cbm::algo::ca::Vector<L1CAIteration>; using L1StationsContainer_t = std::array<L1Station, constants::size::MaxNstations>; -using L1MaterialContainer_t = std::array<L1Material, constants::size::MaxNstations>; +using L1MaterialContainer_t = std::array<ca::MaterialMap, constants::size::MaxNstations>; /// Class L1Parameters represents a container for all external parameters of the L1 tracking algorithm, diff --git a/reco/L1/L1Algo/L1Station.cxx b/reco/L1/L1Algo/L1Station.cxx index 69febba3b58ebe997158fdfcf723d47028806bff..d0b2c3cafb5f6497ed81458011bd901ed50f3d10 100644 --- a/reco/L1/L1Algo/L1Station.cxx +++ b/reco/L1/L1Algo/L1Station.cxx @@ -9,6 +9,8 @@ #include <iomanip> #include <sstream> +#include "CaUtils.h" + //------------------------------------------------------------------------------------------------------------------------------------ // void L1Station::CheckConsistency() const @@ -41,9 +43,9 @@ void L1Station::CheckConsistency() const * SIMD vector checks: all the words in a SIMD vector must be equal */ - L1Utils::CheckSimdVectorEquality(fZ, "L1Station::fZ"); - L1Utils::CheckSimdVectorEquality(Xmax, "L1Station::Xmax"); - L1Utils::CheckSimdVectorEquality(Ymax, "L1Station::Ymax"); + cbm::algo::ca::utils::CheckSimdVectorEquality(fZ, "L1Station::fZ"); + cbm::algo::ca::utils::CheckSimdVectorEquality(Xmax, "L1Station::Xmax"); + cbm::algo::ca::utils::CheckSimdVectorEquality(Ymax, "L1Station::Ymax"); /* * Inner and outer radia checks: diff --git a/reco/L1/L1Algo/L1Station.h b/reco/L1/L1Algo/L1Station.h index 22ceb1ed726c0878155a76eea96704e8a91b4145..4836928169cc8d06a9cede5ec1af5489e43b770a 100644 --- a/reco/L1/L1Algo/L1Station.h +++ b/reco/L1/L1Algo/L1Station.h @@ -11,7 +11,6 @@ #include "CaConstants.h" #include "CaField.h" #include "CaSimd.h" -#include "L1Utils.h" using namespace cbm::algo; // TODO: Remove this line using namespace cbm::algo::ca; // TODO: Remove this line diff --git a/reco/L1/catools/CaToolsMaterialHelper.cxx b/reco/L1/catools/CaToolsMaterialHelper.cxx index 18a854e7d94e920880f2434a632b5ed0af65eba7..151eb1008d7a5b2db8cb8c02242950fc60a54880 100644 --- a/reco/L1/catools/CaToolsMaterialHelper.cxx +++ b/reco/L1/catools/CaToolsMaterialHelper.cxx @@ -19,6 +19,8 @@ using cbm::ca::tools::MaterialHelper; +using cbm::algo::ca::MaterialMap; + ClassImp(MaterialHelper); MaterialHelper::MaterialHelper() @@ -199,7 +201,7 @@ void MaterialHelper::InitThreads() } -L1Material MaterialHelper::GenerateMaterialMap(double zRef, double zMin, double zMax, double xyMax, int nBinsDim) +MaterialMap MaterialHelper::GenerateMaterialMap(double zRef, double zMin, double zMax, double xyMax, int nBinsDim) { if (fDoRadialProjection) { if (fTargetZ >= zRef - 1.) { @@ -215,7 +217,7 @@ L1Material MaterialHelper::GenerateMaterialMap(double zRef, double zMin, double << " <= zRef " << zRef << " <= zMax " << zMax; } - L1Material matBudget; + MaterialMap matBudget; matBudget.Initialize(nBinsDim, xyMax, zRef, zMin, zMax); double binSizeX = 2. * xyMax / nBinsDim; double binSizeY = 2. * xyMax / nBinsDim; diff --git a/reco/L1/catools/CaToolsMaterialHelper.h b/reco/L1/catools/CaToolsMaterialHelper.h index 99a0d7ee6a5bed307f7093df7720dfd5410598aa..f07251931568ab8b8fa2e379f6f6a418f3f50788 100644 --- a/reco/L1/catools/CaToolsMaterialHelper.h +++ b/reco/L1/catools/CaToolsMaterialHelper.h @@ -15,7 +15,7 @@ #include "Rtypes.h" #include "TObject.h" -#include "L1Material.h" +#include "CaMaterialMap.h" class TGeoNavigator; @@ -24,7 +24,7 @@ namespace cbm::ca::tools /// Class ca::tools::Debugger helps to debug CA tracking /// /// - /// class to create L1Material material maps form the ROOT geometry + /// class to create ca::MaterialMap material maps form the ROOT geometry /// class MaterialHelper : public TObject { public: @@ -62,7 +62,7 @@ namespace cbm::ca::tools /// /// When doRadialProjection==false the rays are shoot horisontally along the Z axis /// - L1Material GenerateMaterialMap(double zRef, double zMin, double zMax, double xyMax, int nBinsDim); + cbm::algo::ca::MaterialMap GenerateMaterialMap(double zRef, double zMin, double zMax, double xyMax, int nBinsDim); void SetSafeMaterialInitialization(bool val = true) { fDoSafeInitialization = val; } @@ -89,7 +89,7 @@ namespace cbm::ca::tools ClassDef(MaterialHelper, 0); }; -} // namespace ca +} // namespace cbm::ca::tools #endif