From 1dedd32dfce13c0c73ddbac1d4818dddf9691d55 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Mon, 8 Jun 2026 23:26:25 +0200 Subject: [PATCH] ALICE3: prepare IOTOF geometry for including TOF in tracking Initialise GeometryTGeo members, add isValidIOTOFChipIndex helper, guard against repeated sensor definition, and link MathUtils. --- .../Upgrades/ALICE3/IOTOF/base/CMakeLists.txt | 5 ++-- .../base/include/IOTOFBase/GeometryTGeo.h | 23 ++++++++++++------- .../ALICE3/IOTOF/base/src/GeometryTGeo.cxx | 21 +++++++++++++++++ 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/base/CMakeLists.txt b/Detectors/Upgrades/ALICE3/IOTOF/base/CMakeLists.txt index 77750c1e9a5fc..3b47b9451916d 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/base/CMakeLists.txt +++ b/Detectors/Upgrades/ALICE3/IOTOF/base/CMakeLists.txt @@ -12,8 +12,9 @@ o2_add_library(IOTOFBase SOURCES src/GeometryTGeo.cxx src/IOTOFBaseParam.cxx - PUBLIC_LINK_LIBRARIES O2::DetectorsBase) + PUBLIC_LINK_LIBRARIES O2::DetectorsBase + O2::MathUtils) o2_target_root_dictionary(IOTOFBase HEADERS include/IOTOFBase/GeometryTGeo.h - include/IOTOFBase/IOTOFBaseParam.h) \ No newline at end of file + include/IOTOFBase/IOTOFBaseParam.h) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/GeometryTGeo.h b/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/GeometryTGeo.h index 8aaa9c5e31bb8..5fcbc190b74af 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/GeometryTGeo.h +++ b/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/GeometryTGeo.h @@ -13,7 +13,11 @@ #define ALICEO2_IOTOF_GEOMETRYTGEO_H #include +#include +#include #include +#include +#include namespace o2 { @@ -88,8 +92,11 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache int getIOTOFFirstChipIndex(int lay) const; int getIOTOFLayer(int index) const; + bool isValidIOTOFChipIndex(int index) const { return index >= 0 && index <= mLastChipIndex[1]; } int getIOTOFChipIndex(int lay, int sta, int mod, int chip) const; bool getIOTOFChipId(int index, int& lay, int& sta, int& mod, int& chip) const; + o2::math_utils::Point3D detectorToLocal(int row, int col, int chipId) const; + static const ChipSpecifics& getChipSpecifics(int iotofLayer); /// Get the transformation matrix of the SENSOR (not necessary the same as the chip) /// for a given chip 'index' by querying the TGeoManager @@ -156,18 +163,18 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache static std::string sBTOFSensorName; // Inner/outer TOF - int mNumberOfStavesIOTOF[2]; - int mNumberOfModulesIOTOF[2]; - int mNumberOfChipsPerModuleIOTOF[2]; - int mNumberOfChipsPerStaveIOTOF[2]; - int mNumberOfChipsIOTOF[2]; - int mLastChipIndex[2]; + int mNumberOfStavesIOTOF[2]{}; + int mNumberOfModulesIOTOF[2]{}; + int mNumberOfChipsPerModuleIOTOF[2]{}; + int mNumberOfChipsPerStaveIOTOF[2]{}; + int mNumberOfChipsIOTOF[2]{}; + int mLastChipIndex[2]{-1, -1}; // Forward TOF - int mNumberOfChipsFTOF; + int mNumberOfChipsFTOF = 0; // Backward TOF - int mNumberOfChipsBTOF; + int mNumberOfChipsBTOF = 0; std::vector sensors; std::vector mCacheRefX; /// cache for X of IOTOF diff --git a/Detectors/Upgrades/ALICE3/IOTOF/base/src/GeometryTGeo.cxx b/Detectors/Upgrades/ALICE3/IOTOF/base/src/GeometryTGeo.cxx index df09a53677152..7b4711d8d3272 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/base/src/GeometryTGeo.cxx +++ b/Detectors/Upgrades/ALICE3/IOTOF/base/src/GeometryTGeo.cxx @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -166,6 +167,24 @@ bool GeometryTGeo::getIOTOFChipId(int index, int& lay, int& sta, int& mod, int& return true; } +const ChipSpecifics& GeometryTGeo::getChipSpecifics(int iotofLayer) +{ + if (iotofLayer == 0) { + return ITOFChipSpecificParam::Instance(); + } + return OTOFChipSpecificParam::Instance(); +} + +o2::math_utils::Point3D GeometryTGeo::detectorToLocal(int row, int col, int chipId) const +{ + const auto& specs = getChipSpecifics(getIOTOFLayer(chipId)); + o2::math_utils::Point3D loc; + loc.SetCoordinates(0.5f * ((specs.ActiveMatrixSizeRows() - specs.PassiveEdgeTop + specs.PassiveEdgeReadOut) - specs.PitchRow) - row * specs.PitchRow, + 0.f, + col * specs.PitchCol + 0.5f * (specs.PitchCol - specs.ActiveMatrixSizeCols())); + return loc; +} + TString GeometryTGeo::getMatrixPath(int index) const { int lay, sta, mod, chip; @@ -276,6 +295,8 @@ void GeometryTGeo::Build(int loadTrans) void GeometryTGeo::defineSensors() { + sensors.clear(); + sensors.reserve(mSize); for (int i = 0; i < mSize; i++) { sensors.push_back(i); }