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_IOTOF_GEOMETRYTGEO_H
13#define ALICEO2_IOTOF_GEOMETRYTGEO_H
14
15#include <memory>
16#include <string>
17#include <vector>
21#include <MathUtils/Cartesian.h>
22
23namespace o2
24{
25namespace iotof
26{
28{
29 public:
30 using DetMatrixCache::getMatrixL2G;
31 using DetMatrixCache::getMatrixT2L;
32
33 GeometryTGeo(bool build = false, int loadTrans = 0);
34 void Build(int loadTrans);
35 void fillMatrixCache(int mask);
36 static GeometryTGeo* Instance();
37
38 // Common i/o/f/bTOF
39 static const char* getIOTOFVolPattern() { return sIOTOFVolumeName.c_str(); }
40
41 // Inner TOF
42 const int getITOFNumberOfChips() { return mNumberOfChipsIOTOF[0]; }
43 static const char* getITOFLayerPattern() { return sITOFLayerName.c_str(); }
44 static const char* getITOFStavePattern() { return sITOFStaveName.c_str(); }
45 static const char* getITOFModulePattern() { return sITOFModuleName.c_str(); }
46 static const char* getITOFChipPattern() { return sITOFChipName.c_str(); }
47 static const char* getITOFSensorPattern() { return sITOFSensorName.c_str(); }
48
49 // Outer TOF
50 const int getOTOFNumberOfChips() { return mNumberOfChipsIOTOF[1]; }
51 static const char* getOTOFLayerPattern() { return sOTOFLayerName.c_str(); }
52 static const char* getOTOFStavePattern() { return sOTOFStaveName.c_str(); }
53 static const char* getOTOFModulePattern() { return sOTOFModuleName.c_str(); }
54 static const char* getOTOFChipPattern() { return sOTOFChipName.c_str(); }
55 static const char* getOTOFSensorPattern() { return sOTOFSensorName.c_str(); }
56
57 // Forward TOF
59 static const char* getFTOFLayerPattern() { return sFTOFLayerName.c_str(); }
60 static const char* getFTOFChipPattern() { return sFTOFChipName.c_str(); }
61 static const char* getFTOFSensorPattern() { return sFTOFSensorName.c_str(); }
62
63 // Backward TOF
65 static const char* getBTOFLayerPattern() { return sBTOFLayerName.c_str(); }
66 static const char* getBTOFChipPattern() { return sBTOFChipName.c_str(); }
67 static const char* getBTOFSensorPattern() { return sBTOFSensorName.c_str(); }
68
69#ifdef ENABLE_UPGRADES
70 static const char* composeSymNameIOTOF(int d)
71 {
72 return Form("%s_%d", o2::detectors::DetID(o2::detectors::DetID::TF3).getName(), d);
73 }
74#endif
75
76 // Inner TOF
77 static const char* composeITOFSymNameLayer(int d, int layer);
78 static const char* composeITOFSymNameChip(int d, int lr);
79 static const char* composeITOFSymNameSensor(int d, int layer);
80
81 // Outer TOF
82 static const char* composeOTOFSymNameLayer(int d, int layer);
83 static const char* composeOTOFSymNameChip(int d, int lr);
84 static const char* composeOTOFSymNameSensor(int d, int layer);
85
86 // Forward TOF
87 static const char* composeFTOFSymNameLayer(int d, int layer);
88 static const char* composeFTOFSymNameChip(int d, int lr);
89 static const char* composeFTOFSymNameSensor(int d, int layer);
90
91 // Backward TOF
92 static const char* composeBTOFSymNameLayer(int d, int layer);
93 static const char* composeBTOFSymNameChip(int d, int lr);
94 static const char* composeBTOFSymNameSensor(int d, int layer);
95
96 int getIOTOFFirstChipIndex(int lay) const;
97 int getIOTOFLayer(int index) const;
98 bool isValidIOTOFChipIndex(int index) const { return index >= 0 && index <= mLastChipIndex[1]; }
99 int getIOTOFChipIndex(int lay, int sta, int mod, int chip) const;
100 bool getIOTOFChipId(int index, int& lay, int& sta, int& mod, int& chip) const;
101 o2::math_utils::Point3D<float> detectorToLocal(int row, int col, int chipId) const;
102 static const ChipSpecifics& getChipSpecifics(int iotofLayer);
103
106 TGeoHMatrix* extractMatrixSensor(int index) const;
107
108 // sensor ref X and alpha
109 void extractSensorXAlpha(int, float&, float&);
110
111 // create matrix for tracking to local frame for IOTOF
112 TGeoHMatrix& createT2LMatrix(int);
113
114 TString getMatrixPath(int index) const;
115
116 // cache for tracking frames
117 void defineSensors();
118 bool isTrackingFrameCached() const { return !mCacheRefX.empty(); }
120
121 float getSensorRefAlpha(int chipId) const
122 {
123 const int local = chipId;
124 return mCacheRefAlpha[local];
125 }
126
127 float getSensorX(int chipId) const
128 {
129 const int local = chipId;
130 return mCacheRefX[local];
131 }
132
133 protected:
134 // Determine the number of active parts in the geometry
135 int extractNumberOfStavesIOTOF(int lay) const;
136 int extractNumberOfModulesIOTOF(int lay) const;
137 int extractNumberOfChipsPerModuleIOTOF(int lay) const;
138 int extractNumberOfChipsFTOF() const;
139 int extractNumberOfChipsBTOF() const;
140
141 // i/oTOF mother volume
142 static std::string sIOTOFVolumeName;
143
144 // Inner TOF
145 static std::string sITOFLayerName;
146 static std::string sITOFStaveName;
147 static std::string sITOFModuleName;
148 static std::string sITOFChipName;
149 static std::string sITOFSensorName;
150
151 // Outer TOF
152 static std::string sOTOFLayerName;
153 static std::string sOTOFStaveName;
154 static std::string sOTOFModuleName;
155 static std::string sOTOFChipName;
156 static std::string sOTOFSensorName;
157
158 // Forward TOF
159 static std::string sFTOFLayerName;
160 static std::string sFTOFChipName;
161 static std::string sFTOFSensorName;
162
163 // Backward TOF
164 static std::string sBTOFLayerName;
165 static std::string sBTOFChipName;
166 static std::string sBTOFSensorName;
167
168 // Inner/outer TOF
174 int mLastChipIndex[2]{-1, -1};
175
176 // Forward TOF
178
179 // Backward TOF
181
182 std::vector<int> sensors;
183 std::vector<float> mCacheRefX;
184 std::vector<float> mCacheRefAlpha;
185
186 private:
187 static std::unique_ptr<o2::iotof::GeometryTGeo> sInstance;
188};
189
190} // namespace iotof
191} // namespace o2
192#endif
uint32_t col
Definition RawData.h:4
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
const char * getName() const
static const char * getITOFChipPattern()
static std::string sFTOFSensorName
TString getMatrixPath(int index) const
static const char * composeOTOFSymNameSensor(int d, int layer)
static const char * getFTOFLayerPattern()
static std::string sOTOFLayerName
static const char * getIOTOFVolPattern()
static const ChipSpecifics & getChipSpecifics(int iotofLayer)
static const char * getOTOFLayerPattern()
static const char * getFTOFSensorPattern()
static const char * getFTOFChipPattern()
static const char * getBTOFChipPattern()
bool getIOTOFChipId(int index, int &lay, int &sta, int &mod, int &chip) const
static const char * getOTOFModulePattern()
static std::string sOTOFSensorName
static std::string sIOTOFVolumeName
o2::math_utils::Point3D< float > detectorToLocal(int row, int col, int chipId) const
const int getITOFNumberOfChips()
static const char * getITOFModulePattern()
static const char * composeBTOFSymNameLayer(int d, int layer)
void fillMatrixCache(int mask)
void extractSensorXAlpha(int, float &, float &)
bool isTrackingFrameCached() const
static const char * getOTOFSensorPattern()
static std::string sITOFStaveName
static const char * composeFTOFSymNameSensor(int d, int layer)
static std::string sFTOFChipName
int extractNumberOfModulesIOTOF(int lay) const
static const char * composeBTOFSymNameSensor(int d, int layer)
static const char * composeFTOFSymNameChip(int d, int lr)
static std::string sOTOFChipName
static const char * composeITOFSymNameLayer(int d, int layer)
const int getBTOFNumberOfChips()
static std::string sITOFModuleName
static const char * composeFTOFSymNameLayer(int d, int layer)
static const char * getITOFStavePattern()
static std::string sFTOFLayerName
int extractNumberOfChipsFTOF() const
static const char * getITOFSensorPattern()
static const char * getOTOFStavePattern()
int getIOTOFLayer(int index) const
int getIOTOFFirstChipIndex(int lay) const
bool isValidIOTOFChipIndex(int index) const
static std::string sBTOFSensorName
static const char * composeOTOFSymNameChip(int d, int lr)
static std::string sBTOFChipName
std::vector< float > mCacheRefAlpha
cache for X of IOTOF
float getSensorX(int chipId) const
static const char * getOTOFChipPattern()
static const char * composeITOFSymNameSensor(int d, int layer)
static const char * getBTOFLayerPattern()
static std::string sITOFChipName
const int getFTOFNumberOfChips()
int extractNumberOfChipsPerModuleIOTOF(int lay) const
void Build(int loadTrans)
static std::string sOTOFModuleName
std::vector< float > mCacheRefX
const int getOTOFNumberOfChips()
int extractNumberOfStavesIOTOF(int lay) const
std::vector< int > sensors
static const char * composeOTOFSymNameLayer(int d, int layer)
TGeoHMatrix & createT2LMatrix(int)
static std::string sOTOFStaveName
static std::string sITOFSensorName
static GeometryTGeo * Instance()
static const char * getITOFLayerPattern()
TGeoHMatrix * extractMatrixSensor(int index) const
static std::string sITOFLayerName
int getIOTOFChipIndex(int lay, int sta, int mod, int chip) const
int extractNumberOfChipsBTOF() const
static std::string sBTOFLayerName
static const char * composeITOFSymNameChip(int d, int lr)
static const char * getBTOFSensorPattern()
float getSensorRefAlpha(int chipId) const
static const char * composeBTOFSymNameChip(int d, int lr)
GLuint index
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 ...
std::vector< int > row