Skip to content

Commit 6bb3383

Browse files
authored
ALICE3-TRK: add GeometryTGeo methods to get volumes from the geometry (#14344)
1 parent e1f9cdc commit 6bb3383

File tree

3 files changed

+702
-10
lines changed

3 files changed

+702
-10
lines changed

Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/GeometryTGeo.h

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,98 @@ namespace trk
2222
class GeometryTGeo : public o2::detectors::DetMatrixCache
2323
{
2424
public:
25+
using Mat3D = o2::math_utils::Transform3D;
26+
using DetMatrixCache::getMatrixL2G;
27+
using DetMatrixCache::getMatrixT2GRot;
28+
using DetMatrixCache::getMatrixT2L;
29+
// this method is not advised for ITS: for barrel detectors whose tracking frame is just a rotation
30+
// it is cheaper to use T2GRot
31+
using DetMatrixCache::getMatrixT2G;
2532
GeometryTGeo(bool build = false, int loadTrans = 0);
33+
~GeometryTGeo();
2634
void Build(int loadTrans);
2735
void fillMatrixCache(int mask);
28-
static GeometryTGeo* Instance();
29-
36+
static GeometryTGeo* Instance()
37+
{
38+
if (!sInstance) {
39+
sInstance = std::make_unique<GeometryTGeo>(true, 0);
40+
}
41+
return sInstance.get();
42+
};
3043
static const char* getTRKVolPattern() { return sVolumeName.c_str(); }
3144
static const char* getTRKLayerPattern() { return sLayerName.c_str(); }
45+
static const char* getTRKPetalPattern() { return sPetalName.c_str(); }
46+
static const char* getTRKPetalDiskPattern() { return sPetalDiskName.c_str(); }
47+
static const char* getTRKPetalLayerPattern() { return sPetalLayerName.c_str(); }
3248
static const char* getTRKStavePattern() { return sStaveName.c_str(); }
3349
static const char* getTRKChipPattern() { return sChipName.c_str(); }
3450
static const char* getTRKSensorPattern() { return sSensorName.c_str(); }
51+
static const char* getTRKWrapVolPattern() { return sWrapperVolumeName.c_str(); }
52+
53+
int getNumberOfChips() const { return mSize; }
54+
55+
/// Determines the number of active parts in the Geometry
56+
int extractNumberOfLayersMLOT();
57+
int extractNumberOfLayersVD() const;
58+
int extractNumberOfPetalsVD() const;
59+
int extractNumberOfActivePartsVD() const;
60+
int extractNumberOfDisksVD() const;
61+
int extractNumberOfChipsPerPetalVD() const;
62+
int extractNumberOfStavesMLOT(int lay) const;
63+
64+
/// Extract number following the prefix in the name string
65+
int extractVolumeCopy(const char* name, const char* prefix) const;
66+
67+
int getNumberOfLayersMLOT() const { return mNumberOfLayersMLOT; }
68+
int getNumberOffActivePartsVD() const { return mNumberOfActivePartsVD; }
69+
70+
bool isOwner() const { return mOwner; }
71+
void setOwner(bool v) { mOwner = v; }
72+
73+
void Print(Option_t* opt = "") const;
74+
void PrintChipID(int index, int subDetID, int petalcase, int disk, int lay, int stave, int indexRetrieved) const;
75+
76+
int getLayer(int index) const;
77+
int getStave(int index) const;
78+
int getSubDetID(int index) const;
79+
int getPetalCase(int index) const;
80+
int getDisk(int index) const;
81+
82+
/// This routine computes the chip index number from the subDetID, petal, disk, layer, stave /// TODO: retrieve also from chip when chips will be available
83+
/// in substave
84+
/// \param int subDetID The subdetector ID, 0 for VD, 1 for MLOT
85+
/// \param int petalcase The petal case number for VD, from 0 to 3
86+
/// \param int disk The disk number for VD, from 0 to 5
87+
/// \param int lay The layer number. Starting from 0 both for VD and MLOT
88+
/// \param int stave The stave number for MLOT. Starting from 0
89+
int getChipIndex(int subDetID, int petalcase, int disk, int lay, int stave) const;
90+
91+
/// This routine computes subDetID, petal, disk, layer, stave given the chip index number /// TODO: copute also from chip when chips will be available
92+
/// \param int index The chip index number, starting from 0
93+
/// \param int subDetID The subdetector ID, 0 for VD, 1 for MLOT
94+
/// \param int petalcase The petal case number for VD, from 0 to 3
95+
/// \param int disk The disk number for VD, from 0 to 5
96+
/// \param int lay The layer number. Starting from 0 both for VD and MLOT
97+
/// \param int stave The stave number for MLOT. Starting from 0
98+
bool getChipID(int index, int& subDetID, int& petalcase, int& disk, int& lay, int& stave) const;
99+
100+
int getLastChipIndex(int lay) const { return mLastChipIndex[lay]; }
101+
int getFirstChipIndex(int lay, int petalcase, int subDetID) const
102+
{
103+
/// Get the first chip index of the active petal (VD) or layer (MLOT)
104+
if (subDetID == 0) { // VD
105+
return (petalcase == 0) ? 0 : mLastChipIndexVD[petalcase - 1] + 1;
106+
} else if (subDetID == 1) { // MLOT
107+
return mLastChipIndex[lay + mNumberOfPetalsVD - 1] + 1;
108+
}
109+
return -1; // not found
110+
}
111+
112+
/// Get the transformation matrix of the SENSOR (not necessary the same as the chip)
113+
/// for a given chip 'index' by quering the TGeoManager
114+
TGeoHMatrix* extractMatrixSensor(int index) const;
115+
116+
TString getMatrixPath(int index) const;
35117

36118
static const char* composeSymNameTRK(int d)
37119
{
@@ -43,11 +125,34 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
43125
static const char* composeSymNameSensor(int d, int layer);
44126

45127
protected:
128+
static constexpr int MAXLAYERS = 20; ///< max number of active layers
129+
46130
static std::string sVolumeName;
47131
static std::string sLayerName;
132+
static std::string sPetalName;
133+
static std::string sPetalDiskName;
134+
static std::string sPetalLayerName;
48135
static std::string sStaveName;
49136
static std::string sChipName;
50137
static std::string sSensorName;
138+
static std::string sWrapperVolumeName; ///< Wrapper volume name
139+
140+
Int_t mNumberOfLayersMLOT; ///< number of layers
141+
Int_t mNumberOfActivePartsVD; ///< number of layers
142+
Int_t mNumberOfLayersVD; ///< number of layers
143+
Int_t mNumberOfPetalsVD; ///< number of Petals = chip in each VD layer
144+
Int_t mNumberOfDisksVD; ///< number of Disks = 6
145+
std::vector<int> mLastChipIndex; ///< max ID of the detctor in the petal(VD) or layer(MLOT)
146+
std::vector<int> mLastChipIndexVD; ///< max ID of the detctor in the layer for the VD
147+
std::vector<int> mLastChipIndexMLOT; ///< max ID of the detctor in the layer for the MLOT
148+
std::vector<int> mNumberOfChipsPerLayerVD; ///< number of chips per layer VD ( = number of petals)
149+
std::vector<int> mNumberOfChipsPerLayerMLOT; ///< number of chips per layer MLOT ( = 1 for the moment)
150+
std::vector<int> mNumbersOfChipPerDiskVD; ///< numbersOfChipPerDiskVD
151+
std::vector<int> mNumberOfChipsPerPetalVD; ///< numbersOfChipPerPetalVD
152+
std::vector<int> mNumberOfStaves; ///< Number Of Staves per layer in ML/OT
153+
std::array<char, MAXLAYERS> mLayerToWrapper; ///< Layer to wrapper correspondence
154+
155+
bool mOwner = true; //! is it owned by the singleton?
51156

52157
private:
53158
static std::unique_ptr<o2::trk::GeometryTGeo> sInstance;

0 commit comments

Comments
 (0)