diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/include/TRKBase/SegmentationChip.h b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/include/TRKBase/SegmentationChip.h index fac5198966fd6..117a2a2c2c590 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/include/TRKBase/SegmentationChip.h +++ b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/include/TRKBase/SegmentationChip.h @@ -72,6 +72,20 @@ class SegmentationChip static constexpr std::array radiiVD = constants::VD::petal::layer::radii; + static inline int sNPetalsVD = -1; // not set + static void setNumberOfPetalsVD(int n) { sNPetalsVD = n; } + static float getWidthVD(int layer) // get the width of the petal according to the simulated geometry (supported: kIRIS4 (4 petals), kIRIS4a (3 petals), kIRISFullCyl) + { + if (sNPetalsVD < 1) { + LOGP(fatal, "SegmentationChip: VD number of petals not set. GeometryTGeo::Build() must be called before using the VD segmentation"); + } + if (sNPetalsVD == 1) { // FullCyl: 360°, no gap + return 2 * M_PI * constants::VD::petal::layer::radii[layer]; + } + return constants::VD::petal::layer::radii[layer] * 2 * M_PI / sNPetalsVD - constants::VD::petal::layer::gaps[layer]; + } + static int getNRowsVD(int layer) { return static_cast(getWidthVD(layer) / PitchRowVD); } + /// Transformation from Geant detector centered local coordinates (cm) to /// Pixel cell numbers iRow and iCol. /// Returns kTRUE if point x,z is inside sensitive volume, kFALSE otherwise. @@ -113,7 +127,7 @@ class SegmentationChip if (subDetID == 0) { pitchRow = PitchRowVD; pitchCol = PitchColVD; - maxWidth = constants::VD::petal::layer::width[layer]; + maxWidth = getWidthVD(layer); maxLength = constants::VD::petal::layer::length; // TODO: change this to use the layer and disk } else if (subDetID == 1 || subDetID == 2) { @@ -128,11 +142,11 @@ class SegmentationChip }; // Check local coordinates (cm) validity. - static constexpr bool isValidLoc(float x, float z, int subDetID, int layer) noexcept + static bool isValidLoc(float x, float z, int subDetID, int layer) noexcept { float maxWidth(0), maxLength(0); if (subDetID == 0) { - maxWidth = constants::VD::petal::layer::width[layer]; + maxWidth = getWidthVD(layer); maxLength = constants::VD::petal::layer::length; // TODO: change this to use the layer and disk } else if (subDetID == 1 || subDetID == 2) { // ML/OT @@ -143,12 +157,12 @@ class SegmentationChip } // Check detector coordinates validity. - static constexpr bool isValidDet(int row, int col, int subDetID, int layer) noexcept + static bool isValidDet(int row, int col, int subDetID, int layer) noexcept { // Check if the row and column are within the valid range int nRows(0), nCols(0); if (subDetID == 0) { - nRows = constants::VD::petal::layer::nRows[layer]; + nRows = getNRowsVD(layer); nCols = constants::VD::petal::layer::nCols; // TODO: change this to use the layer and disk } else if (subDetID == 1 || subDetID == 2) { @@ -171,7 +185,7 @@ class SegmentationChip /// \param int subDetID Sub-detector ID (0 for VD, 1 for ML/OT) /// \param int layer Layer number (0 to 2 for VD, 0 to 7 for ML/OT) /// \param int disk Disk number (0 to 5 for VD) - static constexpr bool detectorToLocal(int iRow, int iCol, float& xRow, float& zCol, int subDetID, int layer, int disk) noexcept + static bool detectorToLocal(int iRow, int iCol, float& xRow, float& zCol, int subDetID, int layer, int disk) noexcept { if (!isValidDet(iRow, iCol, subDetID, layer)) { LOGP(debug, "Detector coordinates not valid: iRow = {}, iCol = {}", iRow, iCol); @@ -194,7 +208,7 @@ class SegmentationChip /// xRow = half chip width - iRow(center) * pitch /// zCol = iCol * pitch - half chip lenght if (subDetID == 0) { - xRow = 0.5 * (constants::VD::petal::layer::width[layer] - PitchRowVD) - (row * PitchRowVD); + xRow = 0.5 * (getWidthVD(layer) - PitchRowVD) - (row * PitchRowVD); zCol = col * PitchColVD + 0.5 * (PitchColVD - constants::VD::petal::layer::length); } else if (subDetID == 1 || subDetID == 2) { // ML/OT xRow = 0.5 * (constants::moduleMLOT::chip::width - constants::moduleMLOT::chip::passiveEdgeReadOut - PitchRowMLOT) - (row * PitchRowMLOT); @@ -251,9 +265,9 @@ class SegmentationChip /// Print segmentation info static void Print() noexcept { - LOG(info) << "Number of rows:\nVD L0: " << constants::VD::petal::layer::nRows[0] - << "\nVD L1: " << constants::VD::petal::layer::nRows[1] - << "\nVD L2: " << constants::VD::petal::layer::nRows[2] + LOG(info) << "Number of rows:\nVD L0: " << getNRowsVD(0) + << "\nVD L1: " << getNRowsVD(1) + << "\nVD L2: " << getNRowsVD(2) << "\nML/OT chip: " << constants::moduleMLOT::chip::nRows; LOG(info) << "Number of cols:\nVD: " << constants::VD::petal::layer::nCols diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/include/TRKBase/Specs.h b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/include/TRKBase/Specs.h index 9ac1f789d43ba..866178f820231 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/include/TRKBase/Specs.h +++ b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/include/TRKBase/Specs.h @@ -48,15 +48,13 @@ constexpr int nLayers{3}; // number of layers in each VD petal constexpr int nDisks{6}; // number of disks in each VD petal namespace layer { -constexpr double pitchX{10 * mu}; // pitch of the row -constexpr double pitchZ{10 * mu}; // pitch of the column -constexpr double totalThickness{silicon::thickness + metalstack::thickness}; // total thickness of the chip -constexpr std::array gaps{1.63 * mm, 1.2 * mm, 1.2 * mm}; // gaps between two consecutive petals -constexpr std::array radii{0.5 * cm, 1.2 * cm, 2.5 * cm}; // radius of layer in cm -constexpr std::array width{radii[0] * 2 * M_PI / 4 - gaps[0], radii[1] * 2 * M_PI / 4 - gaps[1], radii[2] * 2 * M_PI / 4 - gaps[2]}; // width of the quarter of layer in cm -constexpr double length{50 * cm}; // length of the layer -constexpr int nCols{static_cast(length / pitchZ)}; // number of columns in the chip -constexpr std::array nRows{static_cast(width[0] / pitchX), static_cast(width[1] / pitchX), static_cast(width[2] / pitchX)}; // number of rows in the chip. For the moment is different for each layer since a siner segmentation in repetitive units is stil to be implemented +constexpr double pitchX{10 * mu}; // pitch of the row +constexpr double pitchZ{10 * mu}; // pitch of the column +constexpr double totalThickness{silicon::thickness + metalstack::thickness}; // total thickness of the chip +constexpr std::array gaps{1.63 * mm, 1.2 * mm, 1.2 * mm}; // gaps between two consecutive petals +constexpr std::array radii{0.5 * cm, 1.2 * cm, 2.5 * cm}; // radius of layer in cm +constexpr double length{50 * cm}; // length of the layer +constexpr int nCols{static_cast(length / pitchZ)}; // number of columns in the chip } // namespace layer namespace disk @@ -223,6 +221,14 @@ constexpr double responseYShift{5 * mu}; /// center of the epitaxial layer constexpr double thickness{20 * mu}; } // namespace alice3resp +namespace alpideresp /// parameters for the alpide chip response +{ +constexpr double pitchX{26.88 * mu}; +constexpr double pitchZ{29.24 * mu}; +constexpr double responseYShift{5 * mu}; /// center of the epitaxial layer +constexpr double thickness{45 * mu}; +} // namespace alpideresp + namespace MLOTDisks { constexpr int nLayers{12}; // number of disks in the ML and OT diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/src/GeometryTGeo.cxx b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/src/GeometryTGeo.cxx index ddfc844cc964d..699b65dd31df6 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/src/GeometryTGeo.cxx +++ b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/src/GeometryTGeo.cxx @@ -84,6 +84,9 @@ void GeometryTGeo::Build(int loadTrans) mNumberOfLayersMLOT = extractNumberOfLayersMLOT(); mNumberOfPetalsVD = extractNumberOfPetalsVD(); + SegmentationChip::setNumberOfPetalsVD(mNumberOfPetalsVD); + LOGP(info, "VD segmentation set for {} petals", mNumberOfPetalsVD); + mNumberOfActivePartsVD = extractNumberOfActivePartsVD(); mNumberOfLayersVD = extractNumberOfLayersVD(); mNumberOfDisksVD = extractNumberOfDisksVD(); diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/common/macros/CheckTopologyDictionary.C b/Detectors/Upgrades/ALICE3/TRKFT3/common/macros/CheckTopologyDictionary.C index f97a586373308..04e4a5ab686da 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/common/macros/CheckTopologyDictionary.C +++ b/Detectors/Upgrades/ALICE3/TRKFT3/common/macros/CheckTopologyDictionary.C @@ -39,6 +39,7 @@ #include "SimulationDataFormat/MCCompLabel.h" #include "SimulationDataFormat/MCTruthContainer.h" #include "TRKBase/GeometryTGeo.h" +#include "TRKBase/SegmentationChip.h" #include "TRKBase/Specs.h" #include "TRKReconstruction/BuildTopologyDictionary.h" #include @@ -190,7 +191,7 @@ void forEachCluster(const std::string& directory, F&& f) const auto* pattern = candidate.pattern; // Left out: at the matrix's edge, or one of several pieces of a crossing. const bool vd = cluster.subDetID == 0; - const int nRows = vd ? o2::trk::constants::VD::petal::layer::nRows[cluster.layer] : o2::trk::constants::moduleMLOT::chip::nRows; + const int nRows = vd ? o2::trk::SegmentationChip::getNRowsVD(cluster.layer) : o2::trk::constants::moduleMLOT::chip::nRows; const int nCols = vd ? o2::trk::constants::VD::petal::layer::nCols : o2::trk::constants::moduleMLOT::chip::nCols; if (cluster.row == 0 || cluster.col == 0 || cluster.row + pattern[0] >= nRows || cluster.col + pattern[1] >= nCols || nClusters[candidate.key] > static_cast(candidate.segments.size())) { diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/common/reconstruction/src/Clusterer.cxx b/Detectors/Upgrades/ALICE3/TRKFT3/common/reconstruction/src/Clusterer.cxx index 03e7e5285a31f..8e37df7bfe10f 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/common/reconstruction/src/Clusterer.cxx +++ b/Detectors/Upgrades/ALICE3/TRKFT3/common/reconstruction/src/Clusterer.cxx @@ -181,7 +181,7 @@ void Clusterer::ClustererThread::initChip(gsl::span digits, if (geom) { if (geom->getSubDetID(chipID) == 0) { // VD const int layer = geom->getLayer(chipID); - size = constants::VD::petal::layer::nRows[layer] + 2; + size = SegmentationChip::getNRowsVD(layer) + 2; } } diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/common/simulation/include/TRKFT3Simulation/ChipDigitsContainer.h b/Detectors/Upgrades/ALICE3/TRKFT3/common/simulation/include/TRKFT3Simulation/ChipDigitsContainer.h index 680e83410c205..6281a2f070fd7 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/common/simulation/include/TRKFT3Simulation/ChipDigitsContainer.h +++ b/Detectors/Upgrades/ALICE3/TRKFT3/common/simulation/include/TRKFT3Simulation/ChipDigitsContainer.h @@ -96,7 +96,7 @@ void o2::trkft3::ChipDigitsContainer::addNoise(UInt_t rofMin, UInt_t rofMax, con int maxCols = 0; if (subDetID == 0) { - maxRows = o2::trk::constants::VD::petal::layer::nRows[layer]; + maxRows = o2::trk::SegmentationChip::getNRowsVD(layer); maxCols = o2::trk::constants::VD::petal::layer::nCols; } else { maxRows = o2::trk::constants::moduleMLOT::chip::nRows; diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/common/simulation/include/TRKFT3Simulation/Digitizer.h b/Detectors/Upgrades/ALICE3/TRKFT3/common/simulation/include/TRKFT3Simulation/Digitizer.h index d0cf085d971a0..65629cf7de6fc 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/common/simulation/include/TRKFT3Simulation/Digitizer.h +++ b/Detectors/Upgrades/ALICE3/TRKFT3/common/simulation/include/TRKFT3Simulation/Digitizer.h @@ -130,7 +130,7 @@ class Digitizer int getNRows(int subDetID, int layer) { if (subDetID == 0) { // VD - return o2::trk::constants::VD::petal::layer::nRows[layer]; + return o2::trk::SegmentationChip::getNRowsVD(layer); } else if (subDetID == 1 || subDetID == 2) { // ML/OT return o2::trk::constants::moduleMLOT::chip::nRows; }