Skip to content

Commit 1dedd32

Browse files
committed
ALICE3: prepare IOTOF geometry for including TOF in tracking
Initialise GeometryTGeo members, add isValidIOTOFChipIndex helper, guard against repeated sensor definition, and link MathUtils.
1 parent d661c23 commit 1dedd32

3 files changed

Lines changed: 39 additions & 10 deletions

File tree

Detectors/Upgrades/ALICE3/IOTOF/base/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
o2_add_library(IOTOFBase
1313
SOURCES src/GeometryTGeo.cxx
1414
src/IOTOFBaseParam.cxx
15-
PUBLIC_LINK_LIBRARIES O2::DetectorsBase)
15+
PUBLIC_LINK_LIBRARIES O2::DetectorsBase
16+
O2::MathUtils)
1617

1718
o2_target_root_dictionary(IOTOFBase
1819
HEADERS include/IOTOFBase/GeometryTGeo.h
19-
include/IOTOFBase/IOTOFBaseParam.h)
20+
include/IOTOFBase/IOTOFBaseParam.h)

Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/GeometryTGeo.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
#define ALICEO2_IOTOF_GEOMETRYTGEO_H
1414

1515
#include <memory>
16+
#include <string>
17+
#include <vector>
1618
#include <DetectorsCommonDataFormats/DetMatrixCache.h>
19+
#include <IOTOFBase/IOTOFBaseParam.h>
20+
#include <MathUtils/Cartesian.h>
1721

1822
namespace o2
1923
{
@@ -88,8 +92,11 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
8892

8993
int getIOTOFFirstChipIndex(int lay) const;
9094
int getIOTOFLayer(int index) const;
95+
bool isValidIOTOFChipIndex(int index) const { return index >= 0 && index <= mLastChipIndex[1]; }
9196
int getIOTOFChipIndex(int lay, int sta, int mod, int chip) const;
9297
bool getIOTOFChipId(int index, int& lay, int& sta, int& mod, int& chip) const;
98+
o2::math_utils::Point3D<float> detectorToLocal(int row, int col, int chipId) const;
99+
static const ChipSpecifics& getChipSpecifics(int iotofLayer);
93100

94101
/// Get the transformation matrix of the SENSOR (not necessary the same as the chip)
95102
/// for a given chip 'index' by querying the TGeoManager
@@ -156,18 +163,18 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
156163
static std::string sBTOFSensorName;
157164

158165
// Inner/outer TOF
159-
int mNumberOfStavesIOTOF[2];
160-
int mNumberOfModulesIOTOF[2];
161-
int mNumberOfChipsPerModuleIOTOF[2];
162-
int mNumberOfChipsPerStaveIOTOF[2];
163-
int mNumberOfChipsIOTOF[2];
164-
int mLastChipIndex[2];
166+
int mNumberOfStavesIOTOF[2]{};
167+
int mNumberOfModulesIOTOF[2]{};
168+
int mNumberOfChipsPerModuleIOTOF[2]{};
169+
int mNumberOfChipsPerStaveIOTOF[2]{};
170+
int mNumberOfChipsIOTOF[2]{};
171+
int mLastChipIndex[2]{-1, -1};
165172

166173
// Forward TOF
167-
int mNumberOfChipsFTOF;
174+
int mNumberOfChipsFTOF = 0;
168175

169176
// Backward TOF
170-
int mNumberOfChipsBTOF;
177+
int mNumberOfChipsBTOF = 0;
171178

172179
std::vector<int> sensors;
173180
std::vector<float> mCacheRefX; /// cache for X of IOTOF

Detectors/Upgrades/ALICE3/IOTOF/base/src/GeometryTGeo.cxx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <IOTOFBase/GeometryTGeo.h>
1313
#include <IOTOFBase/IOTOFBaseParam.h>
14+
#include <MathUtils/Utils.h>
1415
#include <TGeoManager.h>
1516
#include <TMath.h>
1617

@@ -166,6 +167,24 @@ bool GeometryTGeo::getIOTOFChipId(int index, int& lay, int& sta, int& mod, int&
166167
return true;
167168
}
168169

170+
const ChipSpecifics& GeometryTGeo::getChipSpecifics(int iotofLayer)
171+
{
172+
if (iotofLayer == 0) {
173+
return ITOFChipSpecificParam::Instance();
174+
}
175+
return OTOFChipSpecificParam::Instance();
176+
}
177+
178+
o2::math_utils::Point3D<float> GeometryTGeo::detectorToLocal(int row, int col, int chipId) const
179+
{
180+
const auto& specs = getChipSpecifics(getIOTOFLayer(chipId));
181+
o2::math_utils::Point3D<float> loc;
182+
loc.SetCoordinates(0.5f * ((specs.ActiveMatrixSizeRows() - specs.PassiveEdgeTop + specs.PassiveEdgeReadOut) - specs.PitchRow) - row * specs.PitchRow,
183+
0.f,
184+
col * specs.PitchCol + 0.5f * (specs.PitchCol - specs.ActiveMatrixSizeCols()));
185+
return loc;
186+
}
187+
169188
TString GeometryTGeo::getMatrixPath(int index) const
170189
{
171190
int lay, sta, mod, chip;
@@ -276,6 +295,8 @@ void GeometryTGeo::Build(int loadTrans)
276295

277296
void GeometryTGeo::defineSensors()
278297
{
298+
sensors.clear();
299+
sensors.reserve(mSize);
279300
for (int i = 0; i < mSize; i++) {
280301
sensors.push_back(i);
281302
}

0 commit comments

Comments
 (0)