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
17
18#ifndef ALICEO2_FV0_GEOMETRY_H_
19#define ALICEO2_FV0_GEOMETRY_H_
22#include <Rtypes.h>
23#include <TGeoPhysicalNode.h>
24#include <vector>
25#include <array>
26#include <TGeoMatrix.h>
27#include <TGeoVolume.h>
28#include <TVirtualMC.h>
29
30class TGeoPNEntry;
31
32namespace o2
33{
34namespace fv0
35{
36
38 float x;
39 float y;
40 float z;
41 void SetCoordinates(float x, float y, float z)
42 {
43 this->x = x;
44 this->y = y;
45 this->z = z;
46 };
47};
48
51{
52 public:
65
76
80 Geometry() : mGeometryType(eUninitialized), mLeftTransformation(nullptr), mRightTransformation(nullptr){};
81
83 Geometry(const Geometry& geometry);
84
87 static Geometry* instance(EGeoType initType = eUninitialized);
88
89 ~Geometry();
90
96 int getCurrentCellId(const TVirtualMC* fMC) const;
97
100 const std::vector<std::string>& getSensitiveVolumeNames() const { return mSensitiveVolumeNames; };
101
107 bool enableComponent(EGeoComponent component, bool enable = true);
108
110 void buildGeometry() const;
111
113
118 void getGlobalPosition(float& x, float& y, float& z);
119 Point3Dsimple& getCellCenter(UInt_t cellId);
120 Point3Dsimple& getReadoutCenter(UInt_t cellId);
121 static constexpr int getNumberOfReadoutChannels() { return sNumberOfReadoutChannels; };
122
126 bool isRing5(UInt_t cellId);
127
129 TGeoPNEntry* getPNEntry(int index) const
130 {
134 }
135
136 static std::string getDetectorRightSymName()
137 {
138 return sDetectorRightName + "_0";
139 }
140
141 static std::string getDetectorLeftSymName()
142 {
143 return sDetectorLeftName + "_1";
144 }
145
147 static constexpr float getPmtDensity()
148 {
149 return sDensityPmt;
150 }
151
152 private:
153 explicit Geometry(EGeoType initType);
154
155 inline static const std::string sDetectorName = "FV0";
156 inline static const std::string sDetectorRightName = sDetectorName + "RIGHT";
157 inline static const std::string sDetectorLeftName = sDetectorName + "LEFT";
158
159 // General geometry constants
160 static constexpr float sEpsilon = 0.01;
161 static constexpr float sDzScintillator = 4;
162 static constexpr float sDzPlastic = 1;
163
164 static constexpr float sXGlobal = 0;
165 static constexpr float sYGlobal = 0;
166 // FT0 starts at z=328
167 static constexpr float sZGlobal = 320 - sDzScintillator / 2;
168 static constexpr float sDxHalvesSeparation = 0;
169 static constexpr float sDyHalvesSeparation = 0;
170 static constexpr float sDzHalvesSeparation = 0;
171
173 static constexpr int sNumberOfCellSectors = 4;
174 static constexpr int sNumberOfCellRings = 5;
175 static constexpr int sNumberOfCells = sNumberOfCellRings * sNumberOfCellSectors * 2;
176 static constexpr int sNumberOfReadoutChannels = sNumberOfCells + sNumberOfCellSectors * 2;
177
179 static constexpr int sCellToRing[sNumberOfCells] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4};
180 static constexpr int sCellToSector[sNumberOfCells] = {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7};
181
183 static constexpr float sCellRingRadii[sNumberOfCellRings + 1]{4.01, 7.3, 12.9, 21.25, 38.7, 72.115};
184 static constexpr char sCellTypes[sNumberOfCellSectors]{'a', 'b', 'b', 'a'};
186 static constexpr float sDrSeparationScint = 0.03 + 0.04;
187
189 static constexpr float sXShiftInnerRadiusScintillator = -0.15;
191 static constexpr float sDxHoleExtensionScintillator = 0.2;
192 static constexpr float sDrHoleSmallScintillator = 0.265;
193 static constexpr float sDrHoleLargeScintillator = 0.415;
194
195 // Container constants
196 static constexpr float sDzContainer = 30;
197 static constexpr float sDrContainerHole = 4.05;
198 static constexpr float sXShiftContainerHole = -0.15;
199 static constexpr float sDrMaxContainerBack = 83.1;
200 static constexpr float sDzContainerBack = 1;
201 static constexpr float sDrMinContainerFront = 45.7;
202 static constexpr float sDrMaxContainerFront = 83.1;
203 static constexpr float sDzContainerFront = 1;
204 static constexpr float sDxContainerStand = 40;
205 static constexpr float sDyContainerStand = 3;
206 static constexpr float sDrMinContainerCone = 24.3;
207 static constexpr float sDzContainerCone = 16.2;
208 static constexpr float sThicknessContainerCone = 0.6;
209 static constexpr float sXYThicknessContainerCone = 0.975;
210 static constexpr float sDrMinContainerOuterShield = 82.5;
211 static constexpr float sDrMaxContainerOuterShield = 82.65;
212 static constexpr float sDrMinContainerInnerShield = 4;
213 static constexpr float sDrMaxContainerInnerShield = 4.05;
214 static constexpr float sDxContainerCover = 0.15;
215 static constexpr float sDxContainerStandBottom = 38.5;
216 static constexpr float sDyContainerStandBottom = 2;
217
218 // PMT constants
219 static constexpr int sNumberOfPMTs = 24;
220 static constexpr int sNumberOfPMTsPerSector = 6;
221 static constexpr float sDrPmt = 3.75;
222 static constexpr float sDzPmt = 12.199;
223 static constexpr float sMPmt = 376.77;
224 static constexpr float sDensityPmt = sMPmt / (M_PI * sDrPmt * sDrPmt * sDzPmt);
225
226 // Fiber constants
227 static constexpr int sNumberOfPMTFiberVolumes = 5;
229 static constexpr int sPMTFiberCellOrder[sNumberOfPMTsPerSector] = {2, 5, 4, 3, 5, 1};
230
231 // Local position constants
232
234 static constexpr float sXScintillator = sDxContainerCover;
236 static constexpr float sZScintillator = 0;
238 static constexpr float sZPlastic = sZScintillator + sDzScintillator / 2 + sDzPlastic / 2;
240 static constexpr float sZContainerBack = sZScintillator - sDzScintillator / 2 - sDzContainerBack / 2;
242 static constexpr float sZContainerFront = sZContainerBack - sDzContainerBack / 2 + sDzContainer - sDzContainerFront / 2;
244 static constexpr float sZContainerMid = (sZContainerBack + sZContainerFront) / 2;
246 static constexpr float sZFiber = (sZPlastic + sZContainerFront) / 2;
248 static constexpr float sZCone = sZContainerFront + sDzContainerFront / 2 - sDzContainerCone / 2;
250 static constexpr float sXShiftScrews = sXScintillator;
252 static constexpr float sXPmt[sNumberOfPMTs] = {8.023, 16.612, 24.987, 33.042, 40.671, 47.778, 59.646, 64.73, 68.982, 72.348, 74.783, 76.257, 76.330, 74.931, 72.569, 69.273, 65.088, 60.065, 48.3, 41.238, 33.645, 25.62, 17.265, 8.688};
254 static constexpr float sYPmt[sNumberOfPMTs] = {76.33, 74.931, 72.569, 69.273, 65.088, 60.065, 48.3, 41.238, 33.645, 25.62, 17.265, 8.688, -8.023, -16.612, -24.987, -33.042, -40.671, -47.778, -59.646, -64.73, -68.982, -72.348, -74.783, -76.257};
256 static constexpr float sZPmt = sZContainerBack + sDzContainerBack / 2 + sDzPmt / 2;
257
258 // Screw and rod dimensions
259
261 static constexpr int sNumberOfScrewTypes = 6;
263 static constexpr float sDrMinScrewTypes[sNumberOfScrewTypes]{0.25, 0.25, 0.4, 0.4, 0.4, 0.4};
265 static constexpr float sDrMaxScrewTypes[sNumberOfScrewTypes]{0, 0.5, 0.6, 0.6, 0.6, 0};
267 static constexpr float sDzMaxScrewTypes[sNumberOfScrewTypes]{6.02, 13.09, 13.1, 23.1, 28.3, 5};
269 static constexpr float sDzMinScrewTypes[sNumberOfScrewTypes]{0, 6.78, 6.58, 15.98, 21.48, 0};
271 static constexpr float sZShiftScrew = 0;
272
274 static constexpr int sNumberOfRodTypes = 4;
276 static constexpr float sDxMinRodTypes[sNumberOfRodTypes]{0.366, 0.344, 0.344, 0.344};
278 static constexpr float sDxMaxRodTypes[sNumberOfRodTypes]{0.536, 0.566, 0.566, 0.716};
280 static constexpr float sDyMinRodTypes[sNumberOfRodTypes]{0.5, 0.8, 0.8, 0.8};
282 static constexpr float sDyMaxRodTypes[sNumberOfRodTypes]{0.9, 1.2, 1.2, 1.2};
284 static constexpr float sDzMaxRodTypes[sNumberOfRodTypes]{12.5, 12.5, 22.5, 27.7};
286 static constexpr float sDzMinRodTypes[sNumberOfRodTypes]{7.45, 7.45, 17.45, 22.65};
288 static constexpr float sZShiftRod = -0.05;
289
290 // Strings for volume names, etc.
291 inline static const std::string sScintillatorName = "SCINT";
292 inline static const std::string sPlasticName = "PLAST";
293 inline static const std::string sSectorName = "SECTOR";
294 inline static const std::string sCellName = "CELL";
295 inline static const std::string sScintillatorSectorName = sScintillatorName + sSectorName;
296 inline static const std::string sScintillatorCellName = sScintillatorName + sCellName;
297 inline static const std::string sPlasticSectorName = sPlasticName + sSectorName;
298 inline static const std::string sPlasticCellName = sPlasticName + sCellName;
299 inline static const std::string sPmtName = "PMT";
300 inline static const std::string sFiberName = "FIBER";
301 inline static const std::string sScrewName = "SCREW";
302 inline static const std::string sScrewHolesCSName = "FV0SCREWHOLES";
303 inline static const std::string sRodName = "ROD";
304 inline static const std::string sRodHolesCSName = "FV0RODHOLES";
305 inline static const std::string sContainerName = "CONTAINER";
306
308 void initializeGeometry();
309
311 void initializeMaps();
312
314 void initializeVectors();
315
317 void initializeTransformations();
318
320 void initializeCellRingRadii();
321
323 void initializeSectorTransformations();
324
326 void initializeFiberVolumeRadii();
327
329 void initializeFiberMedium();
330
332 void initializeScrewAndRodRadii();
333
335 void initializeScrewTypeMedium();
336
338 void initializeRodTypeMedium();
339
344 void addScrewProperties(int screwTypeID, int iRing, float phi);
345
349 void addRodProperties(int rodTypeID, int iRing);
350
352 void initializeScrewAndRodPositionsAndDimensions();
353
355 void initializeSensVols();
356
358 void initializeNonSensVols();
359
362 void initializeScrewHoles();
363
366 void initializeRodHoles();
367
373 void initializeCells(const std::string& cellType, const float zThickness, const TGeoMedium* medium, bool isSensitive);
374
376 void initializeScintCells();
377
379 void initializePlasticCells();
380
382 void initializePmts();
383
385 void initializeFibers();
386
388 void initializeScrews();
389
391 void initializeRods();
392
394 void initializeMetalContainer();
395
399 void assembleSensVols(TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const;
400
404 void assembleNonSensVols(TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const;
405
409 void assembleScintSectors(TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const;
410
414 void assemblePlasticSectors(TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const;
415
419 void assemblePmts(TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const;
420
424 void assembleFibers(TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const;
425
429 void assembleScrews(TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const;
430
434 void assembleRods(TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const;
435
439 void assembleMetalContainer(TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const;
440
444 TGeoVolumeAssembly* buildSectorAssembly(const std::string& cellName) const;
445
450 TGeoVolumeAssembly* buildSector(const std::string& cellType, int iSector) const;
451
459 TGeoShape* createScrewShape(const std::string& shapeName, int screwTypeID, float xEpsilon = 0, float yEpsilon = 0,
460 float zEpsilon = 0) const;
461
469 TGeoShape* createRodShape(const std::string& shapeName, int rodTypeID, float xEpsilon = 0, float yEpsilon = 0,
470 float zEpsilon = 0) const;
471
478 TGeoTranslation* createAndRegisterTrans(const std::string& name, double dx = 0, double dy = 0, double dz = 0) const;
479
486 TGeoRotation* createAndRegisterRot(const std::string& name, double phi = 0, double theta = 0, double psi = 0) const;
487
492 const std::string createVolumeName(const std::string& volumeType, int number = -1) const;
493
495 void initializeCellCenters();
496 void initializeReadoutCenters();
497
498 std::vector<std::string> mSensitiveVolumeNames;
499
503 std::vector<float> mRAvgRing;
504 std::vector<float> mRMinScintillator;
505 std::vector<float> mRMaxScintillator;
506 std::vector<float> mRMinFiber;
507 std::vector<float> mRMaxFiber;
508
511 std::vector<TGeoMedium*> mMediumFiberRings;
512 std::vector<TGeoMedium*> mMediumFiberPMTs;
513
514 std::vector<float> mRScrewAndRod;
515
516 std::vector<float> mDrMinScrews;
517 std::vector<float> mDrMaxScrews;
518 std::vector<float> mDzMaxScrews;
519 std::vector<float> mDzMinScrews;
520
521 std::vector<float> mRScrews;
522 std::vector<int> mScrewTypeIDs;
523
524 std::vector<float> mDxMinRods;
525 std::vector<float> mDxMaxRods;
526 std::vector<float> mDyMinRods;
527 std::vector<float> mDyMaxRods;
528 std::vector<float> mDzMaxRods;
529 std::vector<float> mDzMinRods;
530 std::vector<int> mRodTypeIDs;
531
532 std::vector<TGeoMatrix*> mSectorTrans;
533 std::vector<std::vector<float>> mScrewPos;
534 std::vector<std::vector<float>> mRodPos;
535 std::vector<TGeoMedium*> mMediumScrewTypes;
536 std::vector<TGeoMedium*> mMediumRodTypes;
537
538 const int mGeometryType;
539 std::map<EGeoComponent, bool> mEnabledComponents;
540 TGeoMatrix* mLeftTransformation;
541 TGeoMatrix* mRightTransformation;
542
544 std::array<Point3Dsimple, sNumberOfCells> mCellCenter;
545 std::array<Point3Dsimple, sNumberOfReadoutChannels> mReadoutCenter;
546
547 static Geometry* sInstance;
548
549 ClassDefNV(Geometry, 1);
550};
551} // namespace fv0
552} // namespace o2
553#endif
Definition of the GeometryManager class.
static TGeoPNEntry * getPNEntry(o2::detectors::DetID detid, Int_t sensid)
static constexpr ID FV0
Definition DetID.h:76
FV0 Geometry.
Definition Geometry.h:51
void buildGeometry() const
Build the geometry.
Definition Geometry.cxx:95
Point3Dsimple & getReadoutCenter(UInt_t cellId)
Definition Geometry.cxx:130
int getCurrentCellId(const TVirtualMC *fMC) const
Definition Geometry.cxx:61
static std::string getDetectorRightSymName()
Definition Geometry.h:136
static std::string getDetectorLeftSymName()
Definition Geometry.h:141
static constexpr int getNumberOfReadoutChannels()
Definition Geometry.h:121
static Geometry * instance(EGeoType initType=eUninitialized)
bool enableComponent(EGeoComponent component, bool enable=true)
Definition Geometry.cxx:85
Point3Dsimple & getCellCenter(UInt_t cellId)
Definition Geometry.cxx:125
static constexpr o2::detectors::DetID::ID getDetID()
Definition Geometry.h:128
TGeoPNEntry * getPNEntry(int index) const
Definition Geometry.h:129
bool isRing5(UInt_t cellId)
Definition Geometry.cxx:135
EGeoComponent
Geometry components possible to be enabled/disabled. Only enabled components will be created.
Definition Geometry.h:67
const std::vector< std::string > & getSensitiveVolumeNames() const
Definition Geometry.h:100
static constexpr float getPmtDensity()
Get the density of the PMTs.
Definition Geometry.h:147
void getGlobalPosition(float &x, float &y, float &z)
Utility functions to be accessed externally.
Definition Geometry.cxx:118
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint index
Definition glcorearb.h:781
GLuint const GLchar * name
Definition glcorearb.h:781
GLboolean enable
Definition glcorearb.h:3991
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
void SetCoordinates(float x, float y, float z)
Definition Geometry.h:41