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
17
18#ifndef ALICEO2_FT3_GEOMETRYTGEO_H_
19#define ALICEO2_FT3_GEOMETRYTGEO_H_
20
21#include <memory>
24// #include "MathUtils/Utils.h"
25// #include "Rtypes.h" // for Int_t, Double_t, Bool_t, UInt_t, etc
26
27namespace o2
28{
29namespace ft3
30{
32{
33 public:
35 using DetMatrixCache::getMatrixL2G;
36 using DetMatrixCache::getMatrixT2GRot;
37 using DetMatrixCache::getMatrixT2L;
38 // this method is not advised for ITS: for barrel detectors whose tracking frame is just a rotation
39 // it is cheaper to use T2GRot
40 using DetMatrixCache::getMatrixT2G;
41 GeometryTGeo(bool build = false, int loadTrans = 0);
43 void Build(int loadTrans);
44 void fillMatrixCache(int mask);
45
47 {
48 // get (create if needed) a unique instance of the object
49 if (!sInstance) {
50 sInstance = std::unique_ptr<GeometryTGeo>(new GeometryTGeo(true, 0));
51 }
52 return sInstance.get();
53 }
54
55 // adopt the unique instance from external raw pointer (to be used only to read saved instance from file)
56 static void adopt(GeometryTGeo* raw);
57
58 int extractNumberOfDiscs(int dir);
59 int extractNumberOfChips(int dir, int layer);
60 int extractChipId(std::string const volName);
61 void extractStaveChipId(std::string const volName, int& stave, int& chip);
62 void extractChipIds(std::string const volName, int& direction, int& layer, int& stave, int& chip);
63
64 int getChipIndex(int dir, int disc, int stave, int chip) const;
65 // int getDisk(int index) const {return -1;} // TODO: implement this
66 int getLayer(int chipIdx) const;
67 std::string getMatrixPath(int direction, int layer, int stave, int chip) const;
68 int getNumberOfChips() const { return mSize; }
69 int getNumberOfLayers() const { return mNumberOfDiscs[0] + mNumberOfDiscs[1]; }
70 int getNumberOfStaves(int absDisc) const { return mNumberOfStavesPerDisc[absDisc]; }
71 int getSubDetID(int) const { return 2; }
72 int getStave(int chipIdx) const;
73 int getChipOnStave(int chipIdx) const;
74 int getStaveIdxDisc(int absDisc) const { return mStaveIdxDisc[absDisc]; }
75 int getChipIdxStave(int absStave) const { return mChipIdxStave[absStave]; }
77
78 bool isOwner() const { return mOwner; }
79 void setOwner(bool v) { mOwner = v; }
80
81 void Print(Option_t* opt = "") const;
82 static const char* getFT3VolPattern() { return sVolumeName.c_str(); }
83 static const char* getFT3InnerVolPattern() { return sInnerVolumeName.c_str(); }
84 static const char* getFT3LayerPattern() { return sLayerName.c_str(); }
85 static const char* getFT3ChipPattern() { return sChipName.c_str(); }
86 static const char* getFT3SensorPattern() { return sSensorName.c_str(); }
87 static const char* getFT3PassivePattern() { return sPassiveName.c_str(); }
88
89 static const char* composeSymNameFT3(Int_t d) { return Form("%s_%d", o2::detectors::DetID(o2::detectors::DetID::FT3).getName(), d); }
90 static const char* composeSymNameLayer(Int_t d, Int_t lr);
91 static const char* composeSymNameChip(Int_t d, Int_t lr);
92 static const char* composeSymNameSensor(Int_t d, Int_t lr);
93
94 protected:
95 static std::string sInnerVolumeName;
96 static std::string sVolumeName;
97 static std::string sLayerName;
98 static std::string sChipName;
99 static std::string sSensorName;
100 static std::string sPassiveName;
101
102 std::vector<float> mCacheRefXDiscs;
103 std::vector<float> mCacheRefAlphaDiscs;
104 std::vector<int> mNumberOfDiscs;
105 std::vector<int> mNumberOfStavesPerDisc;
106 std::vector<int> mStaveIdxDisc;
107 std::vector<int> mChipIdxStave;
108 std::vector<int> mNumberOfChipsPerDisc;
109 // std::vector<unsigned int> mChipIndexLayer; ///< ID of first chip in the layer
110 // std::vector<int> mChipStaveIds;
111
112 bool mOwner = true;
113
114 private:
115 static std::unique_ptr<o2::ft3::GeometryTGeo> sInstance;
116};
117
118} // namespace ft3
119} // namespace o2
120#endif
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
const char * getName() const
int mSize
prebooked number of sensors
int getStaveIdxDisc(int absDisc) const
int extractNumberOfDiscs(int dir)
std::vector< float > mCacheRefXDiscs
static std::string sPassiveName
Passive material name.
int getNumberOfChips() const
static std::string sChipName
Chip name.
void extractChipIds(std::string const volName, int &direction, int &layer, int &stave, int &chip)
static const char * getFT3PassivePattern()
std::vector< int > mNumberOfChipsPerDisc
Index of first chup for each global stave.
void Build(int loadTrans)
int getNumberOfLayers() const
static const char * composeSymNameSensor(Int_t d, Int_t lr)
static std::string sLayerName
Layer name.
int getSubDetID(int) const
static const char * getFT3SensorPattern()
void Print(Option_t *opt="") const
static std::string sVolumeName
Mother volume name.
void fillMatrixCache(int mask)
int getChipOnStave(int chipIdx) const
static const char * getFT3ChipPattern()
std::vector< int > mNumberOfStavesPerDisc
int getNumberOfStaves(int absDisc) const
static std::string sSensorName
Sensor name.
int getChipIdxStave(int absStave) const
static const char * composeSymNameLayer(Int_t d, Int_t lr)
int getStave(int chipIdx) const
static void adopt(GeometryTGeo *raw)
int extractNumberOfChips(int dir, int layer)
bool isOwner() const
Exract FT3 parameters from TGeo.
std::vector< int > mChipIdxStave
Index of first global stave Id for each disc.
static const char * composeSymNameFT3(Int_t d)
static std::string sInnerVolumeName
Mother inner volume name.
std::vector< float > mCacheRefAlphaDiscs
cache for X of ML and OT
std::vector< int > mStaveIdxDisc
TODO; in principle redundant?
static const char * getFT3LayerPattern()
static const char * composeSymNameChip(Int_t d, Int_t lr)
void setOwner(bool v)
int extractChipId(std::string const volName)
std::vector< int > mNumberOfDiscs
cache for sensor ref alpha ML and OT
void extractStaveChipId(std::string const volName, int &stave, int &chip)
static GeometryTGeo * Instance()
int getLayer(int chipIdx) const
static const char * getFT3VolPattern()
int getChipIndex(int dir, int disc, int stave, int chip) const
std::string getMatrixPath(int direction, int layer, int stave, int chip) const
static const char * getFT3InnerVolPattern()
const GLdouble * v
Definition glcorearb.h:832
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 ...