Project
Loading...
Searching...
No Matches
Geometry.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_FOCAL_GEOMETRY_H_
13#define ALICEO2_FOCAL_GEOMETRY_H_
14
15#include <string>
16#include <vector>
17#include <array>
18#include <list>
19#include <tuple>
20
22
23namespace o2
24{
25namespace focal
26{
27
29{
30
31 public:
33 {
34 }
35
37 {
38 if (this != &segment) {
39 mMinLayer = segment.mMinLayer;
40 mMaxLayer = segment.mMaxLayer;
41 mPadSize = segment.mPadSize;
42 mRelativeSensitiveThickness = segment.mRelativeSensitiveThickness;
43 mIsPixel = segment.mIsPixel;
44 mPixelTreshold = segment.mPixelTreshold;
45 }
46 return *this;
47 }
48
50
51 int mMinLayer = -1;
52 int mMaxLayer = -1;
53 float mPadSize = -1.0;
55 int mIsPixel = 0; // 0: pad or strip; 1: pixel; 2: HCAL
56 float mPixelTreshold = -1.0;
57}; // class VirtualSegment
58
60{
61 public:
63 Sandwich = 0, // Sandwich HCAL design
64 Spaghetti = 1, // Spaghetti design
65 Sheets = 2 // Sheets design
66 };
67
68 Geometry() = default;
69 Geometry(Geometry* geo);
70 Geometry(const Geometry& geo) = default;
71 Geometry& operator=(const Geometry& geo) = default;
72 ~Geometry() = default;
73
74 static Geometry* getInstance();
75 static Geometry* getInstance(const std::string name);
76
77 void init(const std::string geoFile);
78 void init();
79 void buildComposition();
80 void setParameters(const std::string geoFile);
81 void setParameters();
82
83 // geometry helper functions
84 // TODO: return tuples instead of using references
85 std::tuple<double /*x*/, double /*y*/, double /*z*/> getGeoPadCenter(int tower, int layer, int stack, int row, int col) const;
86 std::tuple<double /*x*/, double /*y*/> getGeoPadCenterLocal(int towerX, int towerY, int row, int col) const;
87 std::tuple<double /*x*/, double /*y*/> getGeoPixCenterLocal(int row, int col) const;
88 std::tuple<double /*x*/, double /*y*/, double /*z*/> getGeoPixelCenter(int pixel_id, int tower, int layer, int stack, int row, int col) const;
89 std::tuple<double /*x*/, double /*y*/, double /*z*/> getGeoCompositionCenter(int tower, int layer, int stack) const;
90 std::tuple<int /*row*/, int /*col*/, int /*stack*/, int /*layer*/, int /*seg*/, int /*waferx*/, int /*wafery*/> getPadPositionId2RowColStackLayer(int id) const;
91 int getPixelNumber(int vol0, int vol1, int vol2, double x, double y) const;
92 std::tuple<double /*x*/, double /*y*/, double /*z*/> getGeoTowerCenter(int tower, int segment = -1) const;
93 bool disabledTower(int tower);
94 std::tuple<bool /*statusCode*/, int /*col*/, int /*row*/, int /*layer*/, int /*segment*/> getVirtualInfo(double x, double y, double z) const;
95 std::tuple<bool /*statusCode*/, double /*x*/, double /*y*/, double /*z*/> getXYZFromColRowSeg(int col, int row, int segment) const;
96 std::tuple<bool /*statusCode*/, int /*nCol*/, int /*nRow*/> getVirtualNColRow(int segment) const;
97 std::tuple<bool /*statusCode*/, int /*layer*/, int /*segment*/> getVirtualLayerSegment(float z) const;
98 std::tuple<bool /*statusCode*/, int /*segment*/> getVirtualSegmentFromLayer(int layer) const;
99 int getVirtualSegment(float z) const;
100
101 // getters
110 int getNumberOfSegments() const { return mNumberOfSegments; } // NOTE: These are not the virtual segments, but just total number of layers as read from the geometry file. Need to disambiguate
111 int getNumberOfPadLayers() const { return mNPadLayers; }
112 int getNumberOfPixelLayers() const { return mNPixelLayers; }
113 int getNumberOfHCalLayers() const { return mNHCalLayers; }
115 int getNumberOfLayerSeg() const { return mLayerSeg; }
116
117 double getFOCALSizeX() const;
118 double getFOCALSizeY() const;
119 double getTowerSize() const { return mTowerSizeX; }
120 double getTowerSizeX() const;
121 double getTowerSizeY() const;
122 double getFOCALSizeZ() const;
123 double getECALSizeZ() const;
124 double getECALCenterZ() const;
125 double getHCALSizeZ() const;
126 double getHCALCenterZ() const;
127 double getFOCALSegmentZ(int seg) const;
128 double getFOCALZ0() const { return mGlobal_FOCAL_Z0; }
131 double getTowerGapSize() const { return mGlobal_TOWER_TOLX; }
132 double getTowerGapSizeX() const { return mGlobal_TOWER_TOLX; }
133 double getTowerGapSizeY() const { return mGlobal_TOWER_TOLY; }
134 double getGlobalPixelSize() const { return mGlobal_Pixel_Size; }
137 double getGlobalPixelSkin() const { return mGlobal_PIX_SKIN; }
139 double getGlobalPadSize() const { return mGlobal_Pad_Size; }
145
148
149 std::vector<const Composition*> getFOCALMicroModule(int layer) const;
150 const Composition* getComposition(int layer, int stack) const;
151 std::string_view getTowerGapMaterial() const { return mGlobal_Gap_Material; }
152
153 int getVirtualNSegments() const;
154
155 float getVirtualPadSize(int segment) const;
157 float getVirtualPixelTreshold(int segment) const;
158 float getVirtualSegmentSizeZ(int segment) const;
159 float getVirtualSegmentZ(int segment) const;
160 bool getVirtualIsPixel(int segment) const;
161 bool getVirtualIsHCal(int segment) const;
162 int getVirtualNLayersInSegment(int segment) const;
165
167 void setUpTowerWaferSize();
168
170
171 protected:
172 std::vector<Composition> mGeometryComposition;
173 std::vector<Composition> mFrontMatterCompositionBase;
174 std::vector<Composition> mPadCompositionBase;
175 std::vector<Composition> mPixelCompositionBase;
176 std::vector<Composition> mHCalCompositionBase;
177
178 // PAD setup
179 float mGlobal_Pad_Size = 0.0; // pad size
180 int mGlobal_PAD_NX = 0; // number of X pads in wafer
181 int mGlobal_PAD_NY = 0; // number of Y pads in wafer
182 int mGlobal_PAD_NX_Tower = 0; // number of X wafers in tower
183 int mGlobal_PAD_NY_Tower = 0; // number of Y wafers in tower
184 float mGlobal_PPTOL = 0.0; // tolerance between the wafers
185 float mGlobal_PAD_SKIN = 0.0; // dead area (guard ring) on the wafer
186 float mWaferSizeX = 0.0; // Wafer X size
187 float mWaferSizeY = 0.0; // Wafer Y size
188
189 float mGlobal_DetectorOpening_Right = 0.0; // detector opening in X
190 float mGlobal_DetectorOpening_Left = 0.0; // detector opening in Y
191
192 // PIX setup
193 float mGlobal_Pixel_Size = 0.0; // pixel size
194 float mGlobal_PIX_SizeX = 0.0; // sensor size X
195 float mGlobal_PIX_SizeY = 0.0; // sensor size Y
196 float mGlobal_PIX_OffsetX = 0.0; // offset for pixel layers in X
197 float mGlobal_PIX_OffsetY = 0.0; // offset for pixel layers in Y
198 float mGlobal_PIX_SKIN = 0.0;
199 int mGlobal_PIX_NX_Tower = 0; // number of sensors in X
200 int mGlobal_PIX_NY_Tower = 0; // number of sensors in Y
201 bool mGlobal_Pixel_Readout = false; // readout on
202
203 // Tower setup
204 int mNPadLayers = 0; // total number of pad layers
205 int mNPixelLayers = 0; // number of pixel layers
206 std::array<int, 20> mPixelLayerLocations; // location of the pixel layers
207 int mGlobal_Tower_NX = 0; // How many towers in X
208 int mGlobal_Tower_NY = 0; // How many towers in Y
209 float mTowerSizeX = 0.0; // X size of tower
210 float mTowerSizeY = 0.0; // Y size of tower
211 float mGlobal_TOWER_TOLX = 0.0; // X - tolarance around tower
212 float mGlobal_TOWER_TOLY = 0.0; // Y - tolarance around tower
213 float mGlobal_Middle_Tower_Offset = 0.0; // if odd layers, the middle tower is offset due to the beampipe
214 std::string mGlobal_Gap_Material; // gap filling material NOTE: currently not used
215
217 int mGlobal_HCAL_Tower_NX = 0; // Number of HCAL towers on X
218 int mGlobal_HCAL_Tower_NY = 0; // Number of HCAL towers on Y
219 float mGlobal_HCAL_Pitch_Size = 0.0; // Distance between two fibers
220 float mGlobal_HCAL_BeamPipeHole_Size = 0.0; // beam pipe hole size in HCAL
221 HCALDesgin mHCALDesign = Sandwich; // HCAL design type
222
223 float mGlobal_FOCAL_Z0 = 0.0;
224
225 bool mInsertFrontPadLayers = false; // Have 2 pad layers in front of ECAL for charged particle veto
226 bool mInsertFrontHCalReadoutMaterial = false; // if true, insert an 1cm thick aluminium layer at 2cm behind HCal to simulate the material introduced by the readout
227
228 int mLayerSeg = 0;
229 int mNHCalLayers = 0; // number of HCalLayers
230 std::array<int, 100> mSegments; // which layer belongs to which segment
231 std::array<int, 100> mNumberOfLayersInSegments; // nymber of layers in each segment
232 int mNumberOfSegments = 0; // number of long. segements
234 std::array<float, 100> mLocalLayerZ;
235 std::array<float, 100> mLocalSegmentsZ;
240 std::array<float, 100> mLayerThickness; // thickenss of the layers
241 std::list<int> mDisableTowers;
242
244 std::vector<VirtualSegment> mVirtualSegmentComposition;
245
246 private:
247 static Geometry* sGeom;
248 static bool sInit;
249}; // Geometry
250
251} // namespace focal
252} // namespace o2
253#endif
o2::mch::mapping::CathodeSegmentation seg
uint32_t col
Definition RawData.h:4
uint32_t stack
Definition RawData.h:1
double getTowerGapSizeY() const
Definition Geometry.h:133
double getFOCALSizeY() const
Definition Geometry.cxx:860
std::vector< VirtualSegment > mVirtualSegmentComposition
Definition Geometry.h:244
float mHCalLayerThickness
Definition Geometry.h:239
std::tuple< int, int, int, int, int, int, int > getPadPositionId2RowColStackLayer(int id) const
Definition Geometry.cxx:922
float getDetectorOpeningRight() const
Definition Geometry.h:146
int getNumberOfTowersInX() const
Definition Geometry.h:129
std::tuple< bool, double, double, double > getXYZFromColRowSeg(int col, int row, int segment) const
bool getInsertFrontPadLayers() const
Definition Geometry.h:141
HCALDesgin getHCALDesign() const
Definition Geometry.h:169
bool getInsertHCalReadoutMaterial() const
Definition Geometry.h:142
double getTowerGapSizeX() const
Definition Geometry.h:132
double getHCALSizeZ() const
Definition Geometry.cxx:899
std::array< float, 100 > mLocalSegmentsZ
Definition Geometry.h:235
int getNumberOfTowersInY() const
Definition Geometry.h:130
Geometry(const Geometry &geo)=default
float getDetectorOpeningLeft() const
Definition Geometry.h:147
float mFrontMatterLayerThickness
segment location in z
Definition Geometry.h:236
double getGlobalPixelWaferSizeY() const
Definition Geometry.h:136
double getECALSizeZ() const
Definition Geometry.cxx:878
int getHCALTowersInY() const
Definition Geometry.h:109
std::vector< Composition > mFrontMatterCompositionBase
Definition Geometry.h:173
float getVirtualPadSize(int segment) const
bool getVirtualIsHCal(int segment) const
float mGlobal_DetectorOpening_Left
Definition Geometry.h:190
int getVirtualNSegments() const
float getHCALPitchSize() const
Definition Geometry.h:143
double getTowerSize() const
Definition Geometry.h:119
std::tuple< bool, int, int, int, int > getVirtualInfo(double x, double y, double z) const
std::list< int > mDisableTowers
Definition Geometry.h:241
std::array< float, 100 > mLayerThickness
Definition Geometry.h:240
float mGlobal_DetectorOpening_Right
Definition Geometry.h:189
double getGlobalPixelWaferSizeX() const
Definition Geometry.h:135
double getFOCALSizeZ() const
Definition Geometry.cxx:866
std::tuple< double, double > getGeoPadCenterLocal(int towerX, int towerY, int row, int col) const
this gives local position of the pad with respect to the wafer
Definition Geometry.cxx:796
std::tuple< double, double, double > getGeoPixelCenter(int pixel_id, int tower, int layer, int stack, int row, int col) const
this gives global position of the pixel
int getNumberOfHCalLayers() const
Definition Geometry.h:113
int getPixelNumber(int vol0, int vol1, int vol2, double x, double y) const
float getHCALTowerSize() const
Definition Geometry.h:107
double getGlobalPadSize() const
Definition Geometry.h:139
static Geometry * getInstance()
Definition Geometry.cxx:41
int getNumberOfPixelLayers() const
Definition Geometry.h:112
int getNumberOfLayerSeg() const
Definition Geometry.h:115
float getVirtualRelativeSensitiveThickness(int segment) const
std::tuple< bool, int, int > getVirtualNColRow(int segment) const
float mGlobal_PIX_OffsetX
Definition Geometry.h:196
std::array< float, 100 > mLocalLayerZ
Definition Geometry.h:234
Geometry & operator=(const Geometry &geo)=default
int getNumberOfLayers() const
Definition Geometry.h:114
int getNumberOfSegments() const
Definition Geometry.h:110
int getNumberOfPads() const
Definition Geometry.h:102
float mGlobal_PIX_OffsetY
Definition Geometry.h:197
int getVirtualSegment(float z) const
int getVirtualMaxLayerInSegment(int segment) const
int getHCALTowersInX() const
Definition Geometry.h:108
std::vector< Composition > mPixelCompositionBase
Definition Geometry.h:175
double getGlobalPixelSkin() const
Definition Geometry.h:137
double getHCALCenterZ() const
Definition Geometry.cxx:910
int getNumberOfPADsInY() const
Definition Geometry.h:104
std::tuple< double, double, double > getGeoCompositionCenter(int tower, int layer, int stack) const
Definition Geometry.cxx:767
std::tuple< double, double, double > getGeoTowerCenter(int tower, int segment=-1) const
this gives global position of the center of tower
Definition Geometry.cxx:694
double getTowerSizeX() const
Definition Geometry.cxx:840
std::vector< const Composition * > getFOCALMicroModule(int layer) const
Definition Geometry.cxx:673
std::vector< Composition > mPadCompositionBase
Definition Geometry.h:174
float mGlobal_HCAL_Pitch_Size
Definition Geometry.h:219
std::array< int, 20 > mPixelLayerLocations
Definition Geometry.h:206
const Composition * getComposition(int layer, int stack) const
Definition Geometry.cxx:661
void setUpLayerSegmentMap()
Definition Geometry.cxx:987
std::array< int, 100 > mNumberOfLayersInSegments
Definition Geometry.h:231
std::string_view getTowerGapMaterial() const
Definition Geometry.h:151
float getHCALBeamPipeHoleSize() const
Definition Geometry.h:144
int getNumberOfPADsInX() const
Definition Geometry.h:103
HCALDesgin mHCALDesign
Definition Geometry.h:221
double getFOCALZ0() const
Definition Geometry.h:128
bool getVirtualIsPixel(int segment) const
float getMiddleTowerOffset() const
Definition Geometry.h:140
std::tuple< bool, int, int > getVirtualLayerSegment(float z) const
std::vector< Composition > mHCalCompositionBase
Definition Geometry.h:176
double getFOCALSizeX() const
Definition Geometry.cxx:854
float mGlobal_HCAL_BeamPipeHole_Size
Definition Geometry.h:220
int getNumberOfPadLayers() const
Definition Geometry.h:111
double getTowerSizeY() const
Definition Geometry.cxx:847
int getNumberOfPIXsInX() const
Definition Geometry.h:105
float getVirtualSegmentSizeZ(int segment) const
std::vector< Composition > mGeometryComposition
Definition Geometry.h:172
int getVirtualMinLayerInSegment(int segment) const
int getNumberOfPIXsInY() const
Definition Geometry.h:106
double getGlobalPixelSize() const
Definition Geometry.h:134
bool disabledTower(int tower)
double getTowerGapSize() const
Definition Geometry.h:131
std::tuple< bool, int > getVirtualSegmentFromLayer(int layer) const
float mGlobal_Middle_Tower_Offset
Definition Geometry.h:213
int mNFrontMatterCompositionBase
Definition Geometry.h:233
float getVirtualSegmentZ(int segment) const
std::tuple< double, double, double > getGeoPadCenter(int tower, int layer, int stack, int row, int col) const
this gives global position of the pad
Definition Geometry.cxx:784
double getECALCenterZ() const
Definition Geometry.cxx:890
float mGlobal_HCAL_Tower_Size
Definition Geometry.h:216
std::array< int, 100 > mSegments
Definition Geometry.h:230
double getGlobalPixelOffsetX() const
Definition Geometry.h:138
int getVirtualNLayersInSegment(int segment) const
float getVirtualPixelTreshold(int segment) const
std::tuple< double, double > getGeoPixCenterLocal(int row, int col) const
this gives local position of the pad with respect to the wafer
Definition Geometry.cxx:818
double getFOCALSegmentZ(int seg) const
Definition Geometry.cxx:968
float mPixelLayerThickness
Definition Geometry.h:238
bool mInsertFrontHCalReadoutMaterial
Definition Geometry.h:226
std::string mGlobal_Gap_Material
Definition Geometry.h:214
VirtualSegment & operator=(const VirtualSegment &segment)
Definition Geometry.h:36
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint segment
Definition glcorearb.h:4945
GLuint const GLchar * name
Definition glcorearb.h:781
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< int > row