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:
62 Geometry() = default;
63 Geometry(Geometry* geo);
64 Geometry(const Geometry& geo) = default;
65 Geometry& operator=(const Geometry& geo) = default;
66 ~Geometry() = default;
67
68 static Geometry* getInstance();
69 static Geometry* getInstance(const std::string name);
70
71 void init(const std::string geoFile);
72 void init();
73 void buildComposition();
74 void setParameters(const std::string geoFile);
75 void setParameters();
76
77 // geometry helper functions
78 // TODO: return tuples instead of using references
79 std::tuple<double /*x*/, double /*y*/, double /*z*/> getGeoPadCenter(int tower, int layer, int stack, int row, int col) const;
80 std::tuple<double /*x*/, double /*y*/> getGeoPadCenterLocal(int towerX, int towerY, int row, int col) const;
81 std::tuple<double /*x*/, double /*y*/> getGeoPixCenterLocal(int row, int col) const;
82 std::tuple<double /*x*/, double /*y*/, double /*z*/> getGeoPixelCenter(int pixel_id, int tower, int layer, int stack, int row, int col) const;
83 std::tuple<double /*x*/, double /*y*/, double /*z*/> getGeoCompositionCenter(int tower, int layer, int stack) const;
84 std::tuple<int /*row*/, int /*col*/, int /*stack*/, int /*layer*/, int /*seg*/, int /*waferx*/, int /*wafery*/> getPadPositionId2RowColStackLayer(int id) const;
85 int getPixelNumber(int vol0, int vol1, int vol2, double x, double y) const;
86 std::tuple<double /*x*/, double /*y*/, double /*z*/> getGeoTowerCenter(int tower, int segment = -1) const;
87 bool disabledTower(int tower);
88 std::tuple<bool /*statusCode*/, int /*col*/, int /*row*/, int /*layer*/, int /*segment*/> getVirtualInfo(double x, double y, double z) const;
89 std::tuple<bool /*statusCode*/, double /*x*/, double /*y*/, double /*z*/> getXYZFromColRowSeg(int col, int row, int segment) const;
90 std::tuple<bool /*statusCode*/, int /*nCol*/, int /*nRow*/> getVirtualNColRow(int segment) const;
91 std::tuple<bool /*statusCode*/, int /*layer*/, int /*segment*/> getVirtualLayerSegment(float z) const;
92 std::tuple<bool /*statusCode*/, int /*segment*/> getVirtualSegmentFromLayer(int layer) const;
93 int getVirtualSegment(float z) const;
94
95 // getters
104 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
105 int getNumberOfPadLayers() const { return mNPadLayers; }
106 int getNumberOfPixelLayers() const { return mNPixelLayers; }
107 int getNumberOfHCalLayers() const { return mNHCalLayers; }
109 int getNumberOfLayerSeg() const { return mLayerSeg; }
110
111 double getFOCALSizeX() const;
112 double getFOCALSizeY() const;
113 double getTowerSize() const { return mTowerSizeX; }
114 double getTowerSizeX() const;
115 double getTowerSizeY() const;
116 double getFOCALSizeZ() const;
117 double getECALSizeZ() const;
118 double getECALCenterZ() const;
119 double getHCALSizeZ() const;
120 double getHCALCenterZ() const;
121 double getFOCALSegmentZ(int seg) const;
122 double getFOCALZ0() const { return mGlobal_FOCAL_Z0; }
125 double getTowerGapSize() const { return mGlobal_TOWER_TOLX; }
126 double getTowerGapSizeX() const { return mGlobal_TOWER_TOLX; }
127 double getTowerGapSizeY() const { return mGlobal_TOWER_TOLY; }
128 double getGlobalPixelSize() const { return mGlobal_Pixel_Size; }
131 double getGlobalPixelSkin() const { return mGlobal_PIX_SKIN; }
133 double getGlobalPadSize() const { return mGlobal_Pad_Size; }
137
138 std::vector<const Composition*> getFOCALMicroModule(int layer) const;
139 const Composition* getComposition(int layer, int stack) const;
140 std::string_view getTowerGapMaterial() const { return mGlobal_Gap_Material; }
141
142 int getVirtualNSegments() const;
143
144 float getVirtualPadSize(int segment) const;
146 float getVirtualPixelTreshold(int segment) const;
147 float getVirtualSegmentSizeZ(int segment) const;
148 float getVirtualSegmentZ(int segment) const;
149 bool getVirtualIsPixel(int segment) const;
150 bool getVirtualIsHCal(int segment) const;
151 int getVirtualNLayersInSegment(int segment) const;
154
156 void setUpTowerWaferSize();
157
159
160 protected:
161 std::vector<Composition> mGeometryComposition;
162 std::vector<Composition> mFrontMatterCompositionBase;
163 std::vector<Composition> mPadCompositionBase;
164 std::vector<Composition> mPixelCompositionBase;
165 std::vector<Composition> mHCalCompositionBase;
166
167 // PAD setup
168 float mGlobal_Pad_Size = 0.0; // pad size
169 int mGlobal_PAD_NX = 0; // number of X pads in wafer
170 int mGlobal_PAD_NY = 0; // number of Y pads in wafer
171 int mGlobal_PAD_NX_Tower = 0; // number of X wafers in tower
172 int mGlobal_PAD_NY_Tower = 0; // number of Y wafers in tower
173 float mGlobal_PPTOL = 0.0; // tolerance between the wafers
174 float mGlobal_PAD_SKIN = 0.0; // dead area (guard ring) on the wafer
175 float mWaferSizeX = 0.0; // Wafer X size
176 float mWaferSizeY = 0.0; // Wafer Y size
177
178 // PIX setup
179 float mGlobal_Pixel_Size = 0.0; // pixel size
180 float mGlobal_PIX_SizeX = 0.0; // sensor size X
181 float mGlobal_PIX_SizeY = 0.0; // sensor size Y
182 float mGlobal_PIX_OffsetX = 0.0; // offset for pixel layers in X
183 float mGlobal_PIX_OffsetY = 0.0; // offset for pixel layers in Y
184 float mGlobal_PIX_SKIN = 0.0;
185 int mGlobal_PIX_NX_Tower = 0; // number of sensors in X
186 int mGlobal_PIX_NY_Tower = 0; // number of sensors in Y
187 bool mGlobal_Pixel_Readout = false; // readout on
188
189 // Tower setup
190 int mNPadLayers = 0; // total number of pad layers
191 int mNPixelLayers = 0; // number of pixel layers
192 std::array<int, 20> mPixelLayerLocations; // location of the pixel layers
193 int mGlobal_Tower_NX = 0; // How many towers in X
194 int mGlobal_Tower_NY = 0; // How many towers in Y
195 float mTowerSizeX = 0.0; // X size of tower
196 float mTowerSizeY = 0.0; // Y size of tower
197 float mGlobal_TOWER_TOLX = 0.0; // X - tolarance around tower
198 float mGlobal_TOWER_TOLY = 0.0; // Y - tolarance around tower
199 float mGlobal_Middle_Tower_Offset = 0.0; // if odd layers, the middle tower is offset due to the beampipe
200 std::string mGlobal_Gap_Material; // gap filling material NOTE: currently not used
201
203 int mGlobal_HCAL_Tower_NX = 0; // Number of HCAL towers on X
204 int mGlobal_HCAL_Tower_NY = 0; // Number of HCAL towers on Y
205 bool mUseSandwichHCAL = false;
206
207 float mGlobal_FOCAL_Z0 = 0.0;
208
209 bool mInsertFrontPadLayers = false; // Have 2 pad layers in front of ECAL for charged particle veto
210 bool mInsertFrontHCalReadoutMaterial = false; // if true, insert an 1cm thick aluminium layer at 2cm behind HCal to simulate the material introduced by the readout
211
212 int mLayerSeg = 0;
213 int mNHCalLayers = 0; // number of HCalLayers
214 std::array<int, 100> mSegments; // which layer belongs to which segment
215 std::array<int, 100> mNumberOfLayersInSegments; // nymber of layers in each segment
216 int mNumberOfSegments = 0; // number of long. segements
218 std::array<float, 100> mLocalLayerZ;
219 std::array<float, 100> mLocalSegmentsZ;
224 std::array<float, 100> mLayerThickness; // thickenss of the layers
225 std::list<int> mDisableTowers;
226
228 std::vector<VirtualSegment> mVirtualSegmentComposition;
229
230 private:
231 static Geometry* sGeom;
232 static bool sInit;
233}; // Geometry
234
235} // namespace focal
236} // namespace o2
237#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:127
double getFOCALSizeY() const
Definition Geometry.cxx:830
std::vector< VirtualSegment > mVirtualSegmentComposition
Definition Geometry.h:228
float mHCalLayerThickness
Definition Geometry.h:223
std::tuple< int, int, int, int, int, int, int > getPadPositionId2RowColStackLayer(int id) const
Definition Geometry.cxx:892
int getNumberOfTowersInX() const
Definition Geometry.h:123
std::tuple< bool, double, double, double > getXYZFromColRowSeg(int col, int row, int segment) const
bool getInsertFrontPadLayers() const
Definition Geometry.h:135
bool getInsertHCalReadoutMaterial() const
Definition Geometry.h:136
double getTowerGapSizeX() const
Definition Geometry.h:126
double getHCALSizeZ() const
Definition Geometry.cxx:869
std::array< float, 100 > mLocalSegmentsZ
Definition Geometry.h:219
int getNumberOfTowersInY() const
Definition Geometry.h:124
Geometry(const Geometry &geo)=default
float mFrontMatterLayerThickness
segment location in z
Definition Geometry.h:220
double getGlobalPixelWaferSizeY() const
Definition Geometry.h:130
double getECALSizeZ() const
Definition Geometry.cxx:848
int getHCALTowersInY() const
Definition Geometry.h:103
std::vector< Composition > mFrontMatterCompositionBase
Definition Geometry.h:162
float getVirtualPadSize(int segment) const
bool getVirtualIsHCal(int segment) const
int getVirtualNSegments() const
double getTowerSize() const
Definition Geometry.h:113
std::tuple< bool, int, int, int, int > getVirtualInfo(double x, double y, double z) const
std::list< int > mDisableTowers
Definition Geometry.h:225
std::array< float, 100 > mLayerThickness
Definition Geometry.h:224
double getGlobalPixelWaferSizeX() const
Definition Geometry.h:129
double getFOCALSizeZ() const
Definition Geometry.cxx:836
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:766
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:107
int getPixelNumber(int vol0, int vol1, int vol2, double x, double y) const
Definition Geometry.cxx:998
float getHCALTowerSize() const
Definition Geometry.h:101
double getGlobalPadSize() const
Definition Geometry.h:133
static Geometry * getInstance()
Definition Geometry.cxx:41
int getNumberOfPixelLayers() const
Definition Geometry.h:106
int getNumberOfLayerSeg() const
Definition Geometry.h:109
float getVirtualRelativeSensitiveThickness(int segment) const
std::tuple< bool, int, int > getVirtualNColRow(int segment) const
float mGlobal_PIX_OffsetX
Definition Geometry.h:182
std::array< float, 100 > mLocalLayerZ
Definition Geometry.h:218
Geometry & operator=(const Geometry &geo)=default
int getNumberOfLayers() const
Definition Geometry.h:108
int getNumberOfSegments() const
Definition Geometry.h:104
int getNumberOfPads() const
Definition Geometry.h:96
float mGlobal_PIX_OffsetY
Definition Geometry.h:183
int getVirtualSegment(float z) const
int getVirtualMaxLayerInSegment(int segment) const
int getHCALTowersInX() const
Definition Geometry.h:102
std::vector< Composition > mPixelCompositionBase
Definition Geometry.h:164
double getGlobalPixelSkin() const
Definition Geometry.h:131
double getHCALCenterZ() const
Definition Geometry.cxx:880
int getNumberOfPADsInY() const
Definition Geometry.h:98
std::tuple< double, double, double > getGeoCompositionCenter(int tower, int layer, int stack) const
Definition Geometry.cxx:737
std::tuple< double, double, double > getGeoTowerCenter(int tower, int segment=-1) const
this gives global position of the center of tower
Definition Geometry.cxx:671
double getTowerSizeX() const
Definition Geometry.cxx:810
std::vector< const Composition * > getFOCALMicroModule(int layer) const
Definition Geometry.cxx:650
std::vector< Composition > mPadCompositionBase
Definition Geometry.h:163
std::array< int, 20 > mPixelLayerLocations
Definition Geometry.h:192
const Composition * getComposition(int layer, int stack) const
Definition Geometry.cxx:638
void setUpLayerSegmentMap()
Definition Geometry.cxx:957
std::array< int, 100 > mNumberOfLayersInSegments
Definition Geometry.h:215
std::string_view getTowerGapMaterial() const
Definition Geometry.h:140
int getNumberOfPADsInX() const
Definition Geometry.h:97
double getFOCALZ0() const
Definition Geometry.h:122
bool getVirtualIsPixel(int segment) const
float getMiddleTowerOffset() const
Definition Geometry.h:134
std::tuple< bool, int, int > getVirtualLayerSegment(float z) const
std::vector< Composition > mHCalCompositionBase
Definition Geometry.h:165
double getFOCALSizeX() const
Definition Geometry.cxx:824
int getNumberOfPadLayers() const
Definition Geometry.h:105
bool getUseHCALSandwich()
Definition Geometry.h:158
double getTowerSizeY() const
Definition Geometry.cxx:817
int getNumberOfPIXsInX() const
Definition Geometry.h:99
float getVirtualSegmentSizeZ(int segment) const
std::vector< Composition > mGeometryComposition
Definition Geometry.h:161
int getVirtualMinLayerInSegment(int segment) const
int getNumberOfPIXsInY() const
Definition Geometry.h:100
double getGlobalPixelSize() const
Definition Geometry.h:128
bool disabledTower(int tower)
double getTowerGapSize() const
Definition Geometry.h:125
std::tuple< bool, int > getVirtualSegmentFromLayer(int layer) const
float mGlobal_Middle_Tower_Offset
Definition Geometry.h:199
int mNFrontMatterCompositionBase
Definition Geometry.h:217
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:754
double getECALCenterZ() const
Definition Geometry.cxx:860
float mGlobal_HCAL_Tower_Size
Definition Geometry.h:202
std::array< int, 100 > mSegments
Definition Geometry.h:214
double getGlobalPixelOffsetX() const
Definition Geometry.h:132
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:788
double getFOCALSegmentZ(int seg) const
Definition Geometry.cxx:938
float mPixelLayerThickness
Definition Geometry.h:222
bool mInsertFrontHCalReadoutMaterial
Definition Geometry.h:210
std::string mGlobal_Gap_Material
Definition Geometry.h:200
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