-
Notifications
You must be signed in to change notification settings - Fork 508
Expand file tree
/
Copy pathGeometryTGeo.h
More file actions
185 lines (151 loc) · 6.28 KB
/
Copy pathGeometryTGeo.h
File metadata and controls
185 lines (151 loc) · 6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef ALICEO2_IOTOF_GEOMETRYTGEO_H
#define ALICEO2_IOTOF_GEOMETRYTGEO_H
#include <memory>
#include <DetectorsCommonDataFormats/DetMatrixCache.h>
#include "DetectorsCommonDataFormats/DetID.h"
namespace o2
{
namespace iotof
{
class GeometryTGeo : public o2::detectors::DetMatrixCache
{
public:
using DetMatrixCache::getMatrixL2G;
using DetMatrixCache::getMatrixT2L;
GeometryTGeo(bool build = false, int loadTrans = 0);
void Build(int loadTrans);
void fillMatrixCache(int mask);
static GeometryTGeo* Instance();
// Common i/o/f/bTOF
static const char* getIOTOFVolPattern() { return sIOTOFVolumeName.c_str(); }
// Inner TOF
const int getITOFNumberOfChips() { return mNumberOfChipsIOTOF[0]; }
static const char* getITOFLayerPattern() { return sITOFLayerName.c_str(); }
static const char* getITOFStavePattern() { return sITOFStaveName.c_str(); }
static const char* getITOFModulePattern() { return sITOFModuleName.c_str(); }
static const char* getITOFChipPattern() { return sITOFChipName.c_str(); }
static const char* getITOFSensorPattern() { return sITOFSensorName.c_str(); }
// Outer TOF
const int getOTOFNumberOfChips() { return mNumberOfChipsIOTOF[1]; }
static const char* getOTOFLayerPattern() { return sOTOFLayerName.c_str(); }
static const char* getOTOFStavePattern() { return sOTOFStaveName.c_str(); }
static const char* getOTOFModulePattern() { return sOTOFModuleName.c_str(); }
static const char* getOTOFChipPattern() { return sOTOFChipName.c_str(); }
static const char* getOTOFSensorPattern() { return sOTOFSensorName.c_str(); }
// Forward TOF
const int getFTOFNumberOfChips() { return mNumberOfChipsFTOF; }
static const char* getFTOFLayerPattern() { return sFTOFLayerName.c_str(); }
static const char* getFTOFChipPattern() { return sFTOFChipName.c_str(); }
static const char* getFTOFSensorPattern() { return sFTOFSensorName.c_str(); }
// Backward TOF
const int getBTOFNumberOfChips() { return mNumberOfChipsBTOF; }
static const char* getBTOFLayerPattern() { return sBTOFLayerName.c_str(); }
static const char* getBTOFChipPattern() { return sBTOFChipName.c_str(); }
static const char* getBTOFSensorPattern() { return sBTOFSensorName.c_str(); }
#ifdef ENABLE_UPGRADES
static const char* composeSymNameIOTOF(int d)
{
return Form("%s_%d", o2::detectors::DetID(o2::detectors::DetID::TF3).getName(), d);
}
#endif
// Inner TOF
static const char* composeITOFSymNameLayer(int d, int layer);
static const char* composeITOFSymNameChip(int d, int lr);
static const char* composeITOFSymNameSensor(int d, int layer);
// Outer TOF
static const char* composeOTOFSymNameLayer(int d, int layer);
static const char* composeOTOFSymNameChip(int d, int lr);
static const char* composeOTOFSymNameSensor(int d, int layer);
// Forward TOF
static const char* composeFTOFSymNameLayer(int d, int layer);
static const char* composeFTOFSymNameChip(int d, int lr);
static const char* composeFTOFSymNameSensor(int d, int layer);
// Backward TOF
static const char* composeBTOFSymNameLayer(int d, int layer);
static const char* composeBTOFSymNameChip(int d, int lr);
static const char* composeBTOFSymNameSensor(int d, int layer);
int getIOTOFFirstChipIndex(int lay) const;
int getIOTOFLayer(int index) const;
int getIOTOFChipIndex(int lay, int sta, int mod, int chip) const;
bool getIOTOFChipId(int index, int& lay, int& sta, int& mod, int& chip) const;
/// Get the transformation matrix of the SENSOR (not necessary the same as the chip)
/// for a given chip 'index' by querying the TGeoManager
TGeoHMatrix* extractMatrixSensor(int index) const;
// sensor ref X and alpha
void extractSensorXAlpha(int, float&, float&);
// create matrix for tracking to local frame for IOTOF
TGeoHMatrix& createT2LMatrix(int);
TString getMatrixPath(int index) const;
// cache for tracking frames
void defineSensors();
bool isTrackingFrameCached() const { return !mCacheRefX.empty(); }
void fillTrackingFramesCache();
float getSensorRefAlpha(int chipId) const
{
const int local = chipId;
return mCacheRefAlpha[local];
}
float getSensorX(int chipId) const
{
const int local = chipId;
return mCacheRefX[local];
}
protected:
// Determine the number of active parts in the geometry
int extractNumberOfStavesIOTOF(int lay) const;
int extractNumberOfModulesIOTOF(int lay) const;
int extractNumberOfChipsPerModuleIOTOF(int lay) const;
int extractNumberOfChipsFTOF() const;
int extractNumberOfChipsBTOF() const;
// i/oTOF mother volume
static std::string sIOTOFVolumeName;
// Inner TOF
static std::string sITOFLayerName;
static std::string sITOFStaveName;
static std::string sITOFModuleName;
static std::string sITOFChipName;
static std::string sITOFSensorName;
// Outer TOF
static std::string sOTOFLayerName;
static std::string sOTOFStaveName;
static std::string sOTOFModuleName;
static std::string sOTOFChipName;
static std::string sOTOFSensorName;
// Forward TOF
static std::string sFTOFLayerName;
static std::string sFTOFChipName;
static std::string sFTOFSensorName;
// Backward TOF
static std::string sBTOFLayerName;
static std::string sBTOFChipName;
static std::string sBTOFSensorName;
// Inner/outer TOF
int mNumberOfStavesIOTOF[2];
int mNumberOfModulesIOTOF[2];
int mNumberOfChipsPerModuleIOTOF[2];
int mNumberOfChipsPerStaveIOTOF[2];
int mNumberOfChipsIOTOF[2];
int mLastChipIndex[2];
// Forward TOF
int mNumberOfChipsFTOF;
// Backward TOF
int mNumberOfChipsBTOF;
std::vector<int> sensors;
std::vector<float> mCacheRefX; /// cache for X of IOTOF
std::vector<float> mCacheRefAlpha; /// cache for sensor ref alpha IOTOF
private:
static std::unique_ptr<o2::iotof::GeometryTGeo> sInstance;
};
} // namespace iotof
} // namespace o2
#endif