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>
18
19namespace o2
20{
21namespace trk
22{
24{
25 public:
27 using DetMatrixCache::getMatrixL2G;
28 using DetMatrixCache::getMatrixT2GRot;
29 using DetMatrixCache::getMatrixT2L;
30 // this method is not advised for ITS: for barrel detectors whose tracking frame is just a rotation
31 // it is cheaper to use T2GRot
32 using DetMatrixCache::getMatrixT2G;
33 GeometryTGeo(bool build = false, int loadTrans = 0);
35 void Build(int loadTrans);
36 void fillMatrixCache(int mask);
38 {
39 if (!sInstance) {
40 sInstance = std::make_unique<GeometryTGeo>(true, 0);
41 }
42 return sInstance.get();
43 };
44 static const char* getTRKVolPattern() { return sVolumeName.c_str(); }
45 static const char* getTRKLayerPattern() { return sLayerName.c_str(); }
46 static const char* getTRKPetalAssemblyPattern() { return sPetalAssemblyName.c_str(); }
47 static const char* getTRKPetalPattern() { return sPetalName.c_str(); }
48 static const char* getTRKPetalDiskPattern() { return sPetalDiskName.c_str(); }
49 static const char* getTRKPetalLayerPattern() { return sPetalLayerName.c_str(); }
50 static const char* getTRKStavePattern() { return sStaveName.c_str(); }
51 static const char* getTRKHalfStavePattern() { return sHalfStaveName.c_str(); }
52 static const char* getTRKModulePattern() { return sModuleName.c_str(); }
53 static const char* getTRKChipPattern() { return sChipName.c_str(); }
54 static const char* getTRKSensorPattern() { return sSensorName.c_str(); }
55 static const char* getTRKDeadzonePattern() { return sDeadzoneName.c_str(); }
56 static const char* getTRKMetalStackPattern() { return sMetalStackName.c_str(); }
57
58 static const char* getTRKWrapVolPattern() { return sWrapperVolumeName.c_str(); }
59
60 int getNumberOfChips() const { return mSize; }
61
64 int extractNumberOfLayersVD() const;
65 int extractNumberOfPetalsVD() const;
67 int extractNumberOfDisksVD() const;
69 int extractNumberOfStavesMLOT(int lay) const;
70 int extractNumberOfHalfStavesMLOT(int lay) const;
71 int extractNumberOfModulesMLOT(int lay) const;
72 int extractNumberOfChipsMLOT(int lay) const;
73
75 int extractVolumeCopy(const char* name, const char* prefix) const;
76
79 int getNumberOfHalfStaves(int lay) const { return mNumberOfHalfStaves[lay]; }
80
81 bool isOwner() const { return mOwner; }
82 void setOwner(bool v) { mOwner = v; }
83
84 void Print(Option_t* opt = "") const;
85 void PrintChipID(int index, int subDetID, int petalcase, int disk, int lay, int stave, int halfstave, int mod, int chip) const;
86
87 int getSubDetID(int index) const;
88 int getPetalCase(int index) const;
89 int getDisk(int index) const;
90 int getLayer(int index) const;
91 int getStave(int index) const;
92 int getHalfStave(int index) const;
93 int getModule(int index) const;
94 int getChip(int index) const;
95
96 void defineMLOTSensors();
97 int getBarrelLayer(int) const;
98
99 // sensor ref X and alpha for ML & OT
100 void extractSensorXAlphaMLOT(int, float&, float&);
101
102 // cache for tracking frames (ML & OT)
103 bool isTrackingFrameCachedMLOT() const { return !mCacheRefXMLOT.empty(); }
105
107 float getSensorXMLOT(int index) const { return mCacheRefXMLOT[index]; }
108
109 // create matrix for tracking to local frame for MLOT
110 TGeoHMatrix& createT2LMatrixMLOT(int);
111
122 unsigned short getChipIndex(int subDetID, int petalcase, int disk, int lay, int stave, int halfstave, int mod, int chip) const;
123
132 unsigned short getChipIndex(int subDetID, int volume, int lay, int stave, int halfstave, int mod, int chip) const;
133
144 bool getChipID(int index, int& subDetID, int& petalcase, int& disk, int& lay, int& stave, int& halfstave, int& mod, int& chip) const;
145
146 unsigned short getLastChipIndex(int lay) const { return mLastChipIndex[lay]; }
147 unsigned short getFirstChipIndex(int lay, int petalcase, int subDetID) const
148 {
150 if (subDetID == 0) { // VD
151 return (petalcase == 0) ? 0 : mLastChipIndexVD[petalcase - 1] + 1;
152 } else if (subDetID == 1) { // MLOT
153 return mLastChipIndex[lay + mNumberOfPetalsVD - 1] + 1;
154 }
155 return -1; // not found
156 }
157
160 TGeoHMatrix* extractMatrixSensor(int index) const;
161
162 TString getMatrixPath(int index) const;
163
164#ifdef ENABLE_UPGRADES
165 static const char* composeSymNameTRK(int d)
166 {
167 return Form("%s_%d", o2::detectors::DetID(o2::detectors::DetID::TRK).getName(), d);
168 }
169#endif
170
171 static const char* composeSymNameLayer(int d, int layer);
172 static const char* composeSymNameStave(int d, int layer);
173 static const char* composeSymNameModule(int d, int layer);
174 static const char* composeSymNameChip(int d, int layer);
175 static const char* composeSymNameSensor(int d, int layer);
176
177 protected:
178 static constexpr int MAXLAYERS = 20;
179
180 static std::string sVolumeName;
181 static std::string sLayerName;
182 static std::string sPetalAssemblyName;
183 static std::string sPetalName;
184 static std::string sPetalDiskName;
185 static std::string sPetalLayerName;
186 static std::string sStaveName;
187 static std::string sHalfStaveName;
188 static std::string sModuleName;
189 static std::string sChipName;
190 static std::string sSensorName;
191 static std::string sDeadzoneName;
192 static std::string sMetalStackName;
193
194 static std::string sWrapperVolumeName;
195
201 std::vector<int> mNumberOfStaves;
202 std::vector<int> mNumberOfHalfStaves;
203 std::vector<int> mNumberOfModules;
204 std::vector<int> mNumberOfChips;
205 std::vector<int> mNumberOfChipsPerLayerVD;
206 std::vector<int> mNumberOfChipsPerLayerMLOT;
207 std::vector<int> mNumbersOfChipPerDiskVD;
208 std::vector<int> mNumberOfChipsPerPetalVD;
209 // std::vector<int> mNumberOfChipsPerStave; ///< number of chips per stave in ML/OT
210 // std::vector<int> mNumberOfChipsPerHalfStave; ///< number of chips per half stave in ML/OT
211 // std::vector<int> mNumberOfChipsPerModule; ///< number of chips per module in ML/OT
212 std::vector<unsigned short> mLastChipIndex;
213 std::vector<unsigned short> mLastChipIndexVD;
214 std::vector<unsigned short> mLastChipIndexMLOT;
215
216 std::array<char, MAXLAYERS> mLayerToWrapper;
217
218 bool mOwner = true;
219
220 std::vector<int> sensorsMLOT;
221 std::vector<float> mCacheRefXMLOT;
222 std::vector<float> mCacheRefAlphaMLOT;
223
224 private:
225 static std::unique_ptr<o2::trk::GeometryTGeo> sInstance;
226};
227
228} // namespace trk
229} // namespace o2
230#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)
static const char * getTRKPetalDiskPattern()
int getModule(int index) const
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
bool isTrackingFrameCachedMLOT() const
int extractNumberOfHalfStavesMLOT(int lay) const
static const char * getTRKPetalLayerPattern()
int getChip(int index) const
int extractNumberOfLayersMLOT()
Determines the number of active parts in the Geometry.
int extractNumberOfChipsMLOT(int lay) const
std::vector< int > mNumbersOfChipPerDiskVD
numbersOfChipPerDiskVD
std::vector< int > mNumberOfStaves
Number Of Staves per layer in ML/OT.
float getSensorXMLOT(int index) const
Int_t mNumberOfPetalsVD
number of Petals = chip in each VD layer
std::vector< int > mNumberOfModules
Number Of Modules per stave (half stave) in ML/OT.
static std::string sPetalName
int extractNumberOfStavesMLOT(int lay) const
float getSensorRefAlphaMLOT(int index) const
static std::string sPetalDiskName
void Print(Option_t *opt="") const
int getLayer(int index) const
std::vector< unsigned short > mLastChipIndexVD
max ID of the detctor in the layer for the VD
static const char * getTRKWrapVolPattern()
std::vector< float > mCacheRefXMLOT
TString getMatrixPath(int index) const
static const char * getTRKDeadzonePattern()
static const char * getTRKPetalAssemblyPattern()
int getNumberOfChips() const
static const char * getTRKLayerPattern()
static std::string sHalfStaveName
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 sWrapperVolumeName
Wrapper volume name, not implemented at the moment.
TGeoHMatrix & createT2LMatrixMLOT(int)
std::vector< float > mCacheRefAlphaMLOT
cache for X of ML and OT
static const char * getTRKHalfStavePattern()
int extractNumberOfLayersVD() const
std::vector< int > mNumberOfChipsPerPetalVD
numbersOfChipPerPetalVD
static std::string sMetalStackName
static std::string sChipName
static std::string sSensorName
void fillMatrixCache(int mask)
std::vector< int > sensorsMLOT
is it owned by the singleton?
static std::string sDeadzoneName
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
int extractNumberOfDisksVD() const
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
std::vector< unsigned short > mLastChipIndexMLOT
max ID of the detctor in the layer for the MLOT
Int_t mNumberOfLayersMLOT
number of layers
static const char * composeSymNameLayer(int d, int layer)
int getStave(int index) const
int getBarrelLayer(int) const
static const char * getTRKVolPattern()
static const char * getTRKModulePattern()
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
Extract number following the prefix in the name string.
std::vector< unsigned short > mLastChipIndex
max ID of the detctor in the petal(VD) or layer(MLOT)
void extractSensorXAlphaMLOT(int, float &, float &)
void Build(int loadTrans)
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 ...