Project
Loading...
Searching...
No Matches
GeometryTGeo.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef ALICEO2_TRK_GEOMETRYTGEO_H
13#define ALICEO2_TRK_GEOMETRYTGEO_H
14
15#include <memory>
19
20namespace o2
21{
22namespace trk
23{
25{
26 public:
28 using DetMatrixCache::getMatrixL2G;
29 using DetMatrixCache::getMatrixT2GRot;
30 using DetMatrixCache::getMatrixT2L;
31 // this method is not advised for ITS: for barrel detectors whose tracking frame is just a rotation
32 // it is cheaper to use T2GRot
33 using DetMatrixCache::getMatrixT2G;
34 GeometryTGeo(bool build = false, int loadTrans = 0);
36 void Build(int loadTrans);
37 void fillMatrixCache(int mask);
39 {
40 if (!sInstance) {
41 sInstance = std::make_unique<GeometryTGeo>(true, 0);
42 }
43 return sInstance.get();
44 };
45
46 static const char* getFT3VolPattern() { return sFT3VolumeName.c_str(); }
47 static const char* getFT3InnerVolPattern() { return sFT3InnerVolumeName.c_str(); }
48 static const char* getFT3LayerPattern() { return sFT3LayerName.c_str(); }
49 static const char* getFT3ChipPattern() { return sFT3ChipName.c_str(); }
50 static const char* getFT3PassivePattern() { return sFT3PassiveName.c_str(); }
51 static const char* getFT3SensorPattern() { return sFT3SensorName.c_str(); }
52 static const char* getTRKVolPattern() { return sVolumeName.c_str(); }
53 static const char* getTRKServiceVolPattern() { return sServiceVolName.c_str(); }
54 static const char* getTRKLayerPattern() { return sLayerName.c_str(); }
55 static const char* getTRKPetalAssemblyPattern() { return sPetalAssemblyName.c_str(); }
56 static const char* getTRKPetalPattern() { return sPetalName.c_str(); }
57 static const char* getTRKPetalDiskPattern() { return sPetalDiskName.c_str(); }
58 static const char* getTRKPetalLayerPattern() { return sPetalLayerName.c_str(); }
59 static const char* getTRKStavePattern() { return sStaveName.c_str(); }
60 static const char* getTRKHalfStavePattern() { return sHalfStaveName.c_str(); }
61 static const char* getTRKModulePattern() { return sModuleName.c_str(); }
62 static const char* getTRKChipPattern() { return sChipName.c_str(); }
63 static const char* getTRKSensorPattern() { return sSensorName.c_str(); }
64 static const char* getTRKDeadzonePattern() { return sDeadzoneName.c_str(); }
65 static const char* getTRKMetalStackPattern() { return sMetalStackName.c_str(); }
66
67 static const char* getTRKWrapVolPattern() { return sWrapperVolumeName.c_str(); }
68
69 int getNumberOfChips() const { return mSize; }
70
72 int extractNumberOfDisksMLOT(int dir) const;
74 int extractNumberOfLayersVD() const;
75 int extractNumberOfPetalsVD() const;
77 int extractNumberOfDisksVD() const;
79 int extractNumberOfStavesMLOT(int lay) const;
80 int extractNumberOfHalfStavesMLOT(int lay) const;
81 int extractNumberOfModulesMLOT(int lay) const;
82 int extractNumberOfChipsMLOT(int lay) const;
83
85 void extractChipIdsFT3(std::string const volName, int& layer, int& stave, int& chip) const;
86 int extractVolumeCopy(const char* name, const char* prefix) const;
87
90 int getNumberOfHalfStaves(int lay) const { return mNumberOfHalfStaves[lay]; }
91
93 int getNumberOfStavesInDisk(int lay) const { return mFirstStaveIndexDisc[lay + 1] - mFirstStaveIndexDisc[lay]; }
94 bool isOwner() const { return mOwner; }
95 void setOwner(bool v) { mOwner = v; }
96
97 void Print(Option_t* opt = "") const;
98 void PrintChipID(int index, int subDetID, int petalcase, int disk, int lay, int stave, int halfstave, int mod, int chip) const;
99
100 int getSubDetID(int index) const;
101 int getPetalCase(int index) const;
102 int getDisk(int index) const;
103 int getLayer(int index) const;
104 int getLayerTRK(int index) const;
105 int getStave(int index) const;
106 int getHalfStave(int index) const;
107 int getModule(int index) const;
108 int getChip(int index) const;
109
110 void defineMLOTSensors();
111 int getBarrelLayer(int) const;
112
113 // sensor ref X and alpha for ML & OT
114 void extractSensorXAlphaMLOT(int, float&, float&);
115
116 // cache for tracking frames (ML & OT)
117 bool isTrackingFrameCachedMLOT() const { return !mCacheRefXMLOT.empty(); }
119
120 float getSensorRefAlphaMLOT(int chipId) const
121 {
122 if (getSubDetID(chipId) == 0) {
123 LOG(error) << "getSensorRefAlphaMLOT(): VD layers are not supported yet! chipID = " << chipId
124 << "please provide chipId for ML/OT! ";
125 return std::numeric_limits<float>::quiet_NaN();
126 }
127 const int local = chipId - getNumberOfActivePartsVD();
128 return mCacheRefAlphaMLOT[local];
129 }
130
131 float getSensorXMLOT(int chipId) const
132 {
133 if (getSubDetID(chipId) == 0) {
134 LOG(error) << "getSensorXMLOT(): VD layers are not supported yet! chipID = " << chipId
135 << "please provide chipId for ML/OT! ";
136 return std::numeric_limits<float>::quiet_NaN();
137 }
138 const int local = chipId - getNumberOfActivePartsVD();
139 return mCacheRefXMLOT[local];
140 }
141
142 // create matrix for tracking to local frame for MLOT
143 TGeoHMatrix& createT2LMatrixMLOT(int);
144
156 unsigned short getChipIndex(int subDetID, int petalcase, int disk, int lay, int stave, int halfstave, int mod, int chip) const;
157
166 unsigned short getChipIndex(int subDetID, int volume, int lay, int stave, int halfstave, int mod, int chip) const;
167
178 bool getChipID(int index, int& subDetID, int& petalcase, int& disk, int& lay, int& stave, int& halfstave, int& mod, int& chip) const;
179
180 unsigned short getLastChipIndex(int lay) const { return mLastChipIndex[lay]; }
181 unsigned short getFirstChipIndex(int lay, int petalcase, int subDetID) const
182 {
184 if (subDetID == 0) { // VD
185 return (petalcase == 0) ? 0 : mLastChipIndexVD[petalcase - 1] + 1;
186 } else if (subDetID == 1) { // MLOT
187 return mLastChipIndex[lay + mNumberOfPetalsVD - 1] + 1;
188 } else if (subDetID == 2) {
189 return mFirstChipIndexMLOTDisc[lay];
190 }
191 return -1; // not found
192 }
193
196 TGeoHMatrix* extractMatrixSensor(int index) const;
197
198 TString getMatrixPath(int index) const;
199
200#ifdef ENABLE_UPGRADES
201 static const char* composeSymNameTRK(int d)
202 {
203 return Form("%s_%d", o2::detectors::DetID(o2::detectors::DetID::TRK).getName(), d);
204 }
205#endif
206
207 static const char* composeSymNameLayer(int d, int layer);
208 static const char* composeSymNameLayerFT3(int dir, int layer);
209 static const char* composeSymNameStave(int d, int layer);
210 static const char* composeSymNameModule(int d, int layer);
211 static const char* composeSymNameChip(int d, int layer);
212 static const char* composeSymNameSensor(int d, int layer);
213
214 protected:
215 static constexpr int MAXLAYERS = 25;
216
217 static std::string sVolumeName;
218 static std::string sServiceVolName;
219 static std::string sLayerName;
220 static std::string sPetalAssemblyName;
221 static std::string sPetalName;
222 static std::string sPetalDiskName;
223 static std::string sPetalLayerName;
224 static std::string sStaveName;
225 static std::string sHalfStaveName;
226 static std::string sModuleName;
227 static std::string sChipName;
228 static std::string sSensorName;
229 static std::string sDeadzoneName;
230 static std::string sMetalStackName;
231
232 static std::string sWrapperVolumeName;
233
234 static std::string sFT3InnerVolumeName;
235 static std::string sFT3VolumeName;
236 static std::string sFT3LayerName;
237 static std::string sFT3ChipName;
238 static std::string sFT3PassiveName;
239 static std::string sFT3SensorName;
240
247 std::vector<int> mNumberOfStaves;
248 std::vector<int> mNumberOfStavesMLOTDDiscs;
249 std::vector<int> mNumberOfHalfStaves;
250 std::vector<int> mNumberOfModules;
251 std::vector<int> mNumberOfChips;
252 std::vector<int> mNumberOfChipsPerLayerVD;
253 std::vector<int> mNumberOfChipsPerLayerMLOT;
254 std::vector<int> mNumberOfChipPerDiskMLOT;
255 std::vector<int> mNumbersOfChipPerDiskVD;
256 std::vector<int> mNumberOfChipsPerPetalVD;
257 // std::vector<int> mNumberOfChipsPerStave; ///< number of chips per stave in ML/OT
258 // std::vector<int> mNumberOfChipsPerHalfStave; ///< number of chips per half stave in ML/OT
259 // std::vector<int> mNumberOfChipsPerModule; ///< number of chips per module in ML/OT
260 std::vector<unsigned short> mLastChipIndex;
261 std::vector<unsigned short> mLastChipIndexVD;
262 // std::vector<unsigned short> mLastChipIndexMLOT; ///< max ID of the detector in the layer for the MLOT
263 std::vector<unsigned short> mFirstChipIndexMLOTDisc;
264 std::vector<unsigned short> mFirstStaveIndexDisc;
265 std::vector<unsigned short> mFirstChipIndexStave;
266 std::array<char, MAXLAYERS> mLayerToWrapper;
267
268 bool mOwner = true;
269
270 std::vector<int> sensorsMLOT;
271 std::vector<float> mCacheRefXMLOT;
272 std::vector<float> mCacheRefAlphaMLOT;
273
274 eMLOTLayout mLayoutMLOT; // ML and OT detector layout design
275
276 private:
277 static std::unique_ptr<o2::trk::GeometryTGeo> sInstance;
278};
279
280} // namespace trk
281} // namespace o2
282#endif
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
const char * getName() const
int mSize
prebooked number of sensors
static const char * composeSymNameModule(int d, int layer)
int extractNumberOfDisksMLOT(int dir) const
Determines the number of active parts in the Geometry.
static const char * getTRKPetalDiskPattern()
int getModule(int index) const
std::vector< int > mNumberOfChipPerDiskMLOT
number of chips per disc in MLOT
static std::string sPetalAssemblyName
static const char * getTRKStavePattern()
int getPetalCase(int index) const
static const char * getTRKChipPattern()
std::vector< int > mNumberOfChipsPerLayerVD
number of chips per layer VD ( = number of petals)
static std::string sVolumeName
int getSubDetID(int index) const
std::array< char, MAXLAYERS > mLayerToWrapper
Layer to wrapper correspondence, not implemented yet.
static const char * composeSymNameChip(int d, int layer)
static std::string sPetalLayerName
static const char * getTRKSensorPattern()
static std::string sStaveName
static constexpr int MAXLAYERS
max number of active layers
bool getChipID(int index, int &subDetID, int &petalcase, int &disk, int &lay, int &stave, int &halfstave, int &mod, int &chip) const
std::vector< int > mNumberOfHalfStaves
Number Of Half staves in each stave of the layer in ML/OT.
int extractNumberOfChipsPerPetalVD() const
int getNumberOfDisksMLOT() const
bool isTrackingFrameCachedMLOT() const
int extractNumberOfHalfStavesMLOT(int lay) const
static const char * getFT3SensorPattern()
static const char * getTRKPetalLayerPattern()
int getChip(int index) const
static std::string sFT3ChipName
Chip name.
int extractNumberOfChipsMLOT(int lay) const
std::vector< int > mNumbersOfChipPerDiskVD
numbersOfChipPerDiskVD
std::vector< int > mNumberOfStaves
Number Of Staves per layer in ML/OT barrels.
static const char * getFT3ChipPattern()
static const char * getFT3LayerPattern()
Int_t mNumberOfPetalsVD
number of Petals = chip in each VD layer
static std::string sFT3PassiveName
Passive material name.
std::vector< int > mNumberOfModules
Number Of Modules per stave (half stave) in ML/OT.
static std::string sPetalName
int extractNumberOfStavesMLOT(int lay) const
static std::string sPetalDiskName
static const char * getTRKServiceVolPattern()
void Print(Option_t *opt="") const
float getSensorRefAlphaMLOT(int chipId) const
int getLayer(int index) const
local layer index within the sub-detector (0-based per VD/MLOT)
static const char * getFT3VolPattern()
std::vector< unsigned short > mLastChipIndexVD
max ID of the detector in the layer for the VD
static const char * getTRKWrapVolPattern()
static const char * getFT3InnerVolPattern()
std::vector< float > mCacheRefXMLOT
TString getMatrixPath(int index) const
static const char * getTRKDeadzonePattern()
static const char * getTRKPetalAssemblyPattern()
static std::string sFT3VolumeName
Mother volume name.
int getNumberOfChips() const
static const char * getTRKLayerPattern()
static std::string sHalfStaveName
std::vector< unsigned short > mFirstChipIndexStave
Index of first chip on stave (Discs)
unsigned short getFirstChipIndex(int lay, int petalcase, int subDetID) const
std::vector< int > mNumberOfChips
number of chips per module in ML/OT
static std::string sFT3SensorName
Sensor name.
std::vector< unsigned short > mFirstStaveIndexDisc
Index of first stave (abs ID) in each MLOT Disc.
static std::string sWrapperVolumeName
Wrapper volume name, not implemented at the moment.
static std::string sServiceVolName
TGeoHMatrix & createT2LMatrixMLOT(int)
std::vector< float > mCacheRefAlphaMLOT
cache for X of ML and OT
static const char * getFT3PassivePattern()
static const char * getTRKHalfStavePattern()
int extractNumberOfLayersVD() const
std::vector< int > mNumberOfChipsPerPetalVD
numbersOfChipPerPetalVD
static std::string sMetalStackName
static std::string sChipName
static std::string sSensorName
static const char * composeSymNameLayerFT3(int dir, int layer)
void fillMatrixCache(int mask)
std::vector< int > sensorsMLOT
is it owned by the singleton?
static std::string sDeadzoneName
void extractChipIdsFT3(std::string const volName, int &layer, int &stave, int &chip) const
Extract number following the prefix in the name string.
static std::string sLayerName
unsigned short getChipIndex(int subDetID, int petalcase, int disk, int lay, int stave, int halfstave, int mod, int chip) const
int extractNumberOfActivePartsVD() const
void PrintChipID(int index, int subDetID, int petalcase, int disk, int lay, int stave, int halfstave, int mod, int chip) const
static const char * composeSymNameSensor(int d, int layer)
void setOwner(bool v)
int extractNumberOfModulesMLOT(int lay) const
static std::string sFT3InnerVolumeName
Mother inner volume name.
int extractNumberOfDisksVD() const
static std::string sFT3LayerName
Layer name.
int getLayerTRK(int index) const
global layer index across the full TRK (VD layers 0..nVD-1, MLOT layers nVD..nTotal-1)
int getNumberOfHalfStaves(int lay) const
static const char * getTRKPetalPattern()
int getNumberOfLayersMLOT() const
Int_t mNumberOfActivePartsVD
number of layers
int getNumberOfActivePartsVD() const
std::vector< int > mNumberOfChipsPerLayerMLOT
number of chips per layer MLOT
static const char * getTRKMetalStackPattern()
Int_t mNumberOfDisksVD
number of Disks = 6
Int_t mNumberOfLayersMLOT
number of layers
std::vector< unsigned short > mFirstChipIndexMLOTDisc
ID of the first sensor chip in the layer for the MLOT; array size is one larger than the number of di...
static const char * composeSymNameLayer(int d, int layer)
int getStave(int index) const
int getBarrelLayer(int) const
static const char * getTRKVolPattern()
std::vector< int > mNumberOfStavesMLOTDDiscs
Number Of Staves per layer in ML/OT discs.
static const char * getTRKModulePattern()
float getSensorXMLOT(int chipId) const
static const char * composeSymNameStave(int d, int layer)
int getDisk(int index) const
int extractNumberOfPetalsVD() const
int extractVolumeCopy(const char *name, const char *prefix) const
std::vector< unsigned short > mLastChipIndex
max ID of the detector in the petal(VD) or layer(MLOT)
void extractSensorXAlphaMLOT(int, float &, float &)
Int_t mNumberOfDisksMLOT
number of ML/OT disks (12 for v3)
int getNumberOfStavesInDisk(int lay) const
void Build(int loadTrans)
eMLOTLayout mLayoutMLOT
cache for sensor ref alpha ML and OT
Int_t mNumberOfLayersVD
number of layers
static GeometryTGeo * Instance()
int getHalfStave(int index) const
TGeoHMatrix * extractMatrixSensor(int index) const
static std::string sModuleName
unsigned short getLastChipIndex(int lay) const
const GLdouble * v
Definition glcorearb.h:832
GLuint index
Definition glcorearb.h:781
GLuint const GLchar * name
Definition glcorearb.h:781
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLint GLuint mask
Definition glcorearb.h:291
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"