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>
17
18namespace o2
19{
20namespace trk
21{
23{
24 public:
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;
32 GeometryTGeo(bool build = false, int loadTrans = 0);
34 void Build(int loadTrans);
35 void fillMatrixCache(int mask);
37 {
38 if (!sInstance) {
39 sInstance = std::make_unique<GeometryTGeo>(true, 0);
40 }
41 return sInstance.get();
42 };
43 static const char* getTRKVolPattern() { return sVolumeName.c_str(); }
44 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(); }
48 static const char* getTRKStavePattern() { return sStaveName.c_str(); }
49 static const char* getTRKChipPattern() { return sChipName.c_str(); }
50 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
57 int extractNumberOfLayersVD() const;
58 int extractNumberOfPetalsVD() const;
60 int extractNumberOfDisksVD() const;
62 int extractNumberOfStavesMLOT(int lay) const;
63 int extractNumberOfHalfStavesMLOT(int lay) const;
64
66 int extractVolumeCopy(const char* name, const char* prefix) const;
67
70 int getNumberOfHalfStaves(int lay) const { return mNumberOfHalfStaves[lay]; }
71
72 bool isOwner() const { return mOwner; }
73 void setOwner(bool v) { mOwner = v; }
74
75 void Print(Option_t* opt = "") const;
76 void PrintChipID(int index, int subDetID, int petalcase, int disk, int lay, int stave, int halfstave, int indexRetrieved) const;
77
78 int getLayer(int index) const;
79 int getStave(int index) const;
80 int getHalfStave(int index) const;
81 int getSubDetID(int index) const;
82 int getPetalCase(int index) const;
83 int getDisk(int index) const;
84
92 int getChipIndex(int subDetID, int petalcase, int disk, int lay, int stave, int halfstave) const;
93
100 int getChipIndex(int subDetID, int volume, int lay, int stave, int halfstave) const;
101
110 bool getChipID(int index, int& subDetID, int& petalcase, int& disk, int& lay, int& stave, int& halfstave) const;
111
112 int getLastChipIndex(int lay) const { return mLastChipIndex[lay]; }
113 int getFirstChipIndex(int lay, int petalcase, int subDetID) const
114 {
116 if (subDetID == 0) { // VD
117 return (petalcase == 0) ? 0 : mLastChipIndexVD[petalcase - 1] + 1;
118 } else if (subDetID == 1) { // MLOT
119 return mLastChipIndex[lay + mNumberOfPetalsVD - 1] + 1;
120 }
121 return -1; // not found
122 }
123
126 TGeoHMatrix* extractMatrixSensor(int index) const;
127
128 TString getMatrixPath(int index) const;
129
130 static const char* composeSymNameTRK(int d)
131 {
132 return Form("%s_%d", o2::detectors::DetID(o2::detectors::DetID::TRK).getName(), d);
133 }
134 static const char* composeSymNameLayer(int d, int layer);
135 static const char* composeSymNameStave(int d, int layer);
136 static const char* composeSymNameChip(int d, int lr);
137 static const char* composeSymNameSensor(int d, int layer);
138
139 protected:
140 static constexpr int MAXLAYERS = 20;
141
142 static std::string sVolumeName;
143 static std::string sLayerName;
144 static std::string sPetalName;
145 static std::string sPetalDiskName;
146 static std::string sPetalLayerName;
147 static std::string sStaveName;
148 static std::string sChipName;
149 static std::string sSensorName;
150 static std::string sWrapperVolumeName;
151
157 std::vector<int> mLastChipIndex;
158 std::vector<int> mLastChipIndexVD;
159 std::vector<int> mLastChipIndexMLOT;
160 std::vector<int> mNumberOfChipsPerLayerVD;
161 std::vector<int> mNumberOfChipsPerLayerMLOT;
162 std::vector<int> mNumbersOfChipPerDiskVD;
163 std::vector<int> mNumberOfChipsPerPetalVD;
164 std::vector<int> mNumberOfStaves;
165 std::vector<int> mNumberOfHalfStaves;
166 std::array<char, MAXLAYERS> mLayerToWrapper;
167
168 bool mOwner = true;
169
170 private:
171 static std::unique_ptr<o2::trk::GeometryTGeo> sInstance;
172};
173
174} // namespace trk
175} // namespace o2
176#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 * getTRKPetalDiskPattern()
static const char * composeSymNameLayer(int d, int layer)
static const char * getTRKStavePattern()
int getPetalCase(int index) const
static const char * getTRKChipPattern()
void PrintChipID(int index, int subDetID, int petalcase, int disk, int lay, int stave, int halfstave, int indexRetrieved) const
std::vector< int > mNumberOfChipsPerLayerVD
number of chips per layer VD ( = number of petals)
int getLastChipIndex(int lay) const
static std::string sVolumeName
int getSubDetID(int index) const
std::array< char, MAXLAYERS > mLayerToWrapper
Layer to wrapper correspondence.
static std::string sPetalLayerName
static const char * getTRKSensorPattern()
static std::string sStaveName
static constexpr int MAXLAYERS
max number of active layers
std::vector< int > mNumberOfHalfStaves
Number Of Staves in each stave of the layer in ML/OT.
int extractNumberOfChipsPerPetalVD() const
int extractNumberOfHalfStavesMLOT(int lay) const
static const char * getTRKPetalLayerPattern()
int getChipIndex(int subDetID, int petalcase, int disk, int lay, int stave, int halfstave) const
int extractNumberOfLayersMLOT()
Determines the number of active parts in the Geometry.
std::vector< int > mNumbersOfChipPerDiskVD
numbersOfChipPerDiskVD
std::vector< int > mNumberOfStaves
Number Of Staves per layer in ML/OT.
Int_t mNumberOfPetalsVD
number of Petals = chip in each VD layer
std::vector< int > mLastChipIndexVD
max ID of the detctor in the layer for the VD
static std::string sPetalName
int extractNumberOfStavesMLOT(int lay) const
static const char * composeSymNameChip(int d, int lr)
static std::string sPetalDiskName
void Print(Option_t *opt="") const
int getLayer(int index) const
static const char * getTRKWrapVolPattern()
TString getMatrixPath(int index) const
int getNumberOfChips() const
static const char * getTRKLayerPattern()
int getFirstChipIndex(int lay, int petalcase, int subDetID) const
static std::string sWrapperVolumeName
Wrapper volume name.
int extractNumberOfLayersVD() const
std::vector< int > mNumberOfChipsPerPetalVD
numbersOfChipPerPetalVD
std::vector< int > mLastChipIndex
max ID of the detctor in the petal(VD) or layer(MLOT)
static std::string sChipName
static std::string sSensorName
bool getChipID(int index, int &subDetID, int &petalcase, int &disk, int &lay, int &stave, int &halfstave) const
std::vector< int > mLastChipIndexMLOT
max ID of the detctor in the layer for the MLOT
void fillMatrixCache(int mask)
static std::string sLayerName
int extractNumberOfActivePartsVD() const
static const char * composeSymNameSensor(int d, int layer)
void setOwner(bool v)
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 ( = 1 for the moment)
Int_t mNumberOfDisksVD
number of Disks = 6
Int_t mNumberOfLayersMLOT
number of layers
int getStave(int index) const
static const char * getTRKVolPattern()
static const char * composeSymNameStave(int d, int layer)
int getDisk(int index) const
static const char * composeSymNameTRK(int d)
int extractNumberOfPetalsVD() const
int extractVolumeCopy(const char *name, const char *prefix) const
Extract number following the prefix in the name string.
void Build(int loadTrans)
Int_t mNumberOfLayersVD
number of layers
static GeometryTGeo * Instance()
int getHalfStave(int index) const
TGeoHMatrix * extractMatrixSensor(int index) 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 ...