1818#ifndef ALICEO2_FT3_GEOMETRYTGEO_H_
1919#define ALICEO2_FT3_GEOMETRYTGEO_H_
2020
21- #include < TGeoMatrix.h> // for TGeoHMatrix
22- #include < TObject.h> // for TObject
23- #include < array>
24- #include < string>
25- #include < vector>
26- #include " DetectorsBase/GeometryManager.h"
27- #include " DetectorsCommonDataFormats/DetID.h"
21+ #include < memory>
2822#include " DetectorsCommonDataFormats/DetMatrixCache.h"
29- #include " MathUtils/Utils.h"
30- #include " Rtypes.h" // for Int_t, Double_t, Bool_t, UInt_t, etc
31-
32- class TGeoPNEntry ;
23+ #include " DetectorsCommonDataFormats/DetID.h"
24+ // #include "MathUtils/Utils.h"
25+ // #include "Rtypes.h" // for Int_t, Double_t, Bool_t, UInt_t, etc
3326
3427namespace o2
3528{
3629namespace ft3
3730{
38- // / GeometryTGeo is a simple interface class to TGeoManager. It is used in the simulation
39- // / in order to query the TGeo FT3 geometry.
40- // / RS: In order to preserve the static character of the class but make it dynamically access
41- // / geometry, we need to check in every method if the structures are initialized. To be converted
42- // / to singleton at later stage.
43-
4431class GeometryTGeo : public o2 ::detectors::DetMatrixCache
4532{
4633 public:
47- typedef o2::math_utils::Transform3D Mat3D ;
34+ using Mat3D = o2::math_utils::Transform3D;
4835 using DetMatrixCache::getMatrixL2G;
4936 using DetMatrixCache::getMatrixT2GRot;
5037 using DetMatrixCache::getMatrixT2L;
5138 // this method is not advised for ITS: for barrel detectors whose tracking frame is just a rotation
5239 // it is cheaper to use T2GRot
5340 using DetMatrixCache::getMatrixT2G;
41+ GeometryTGeo (bool build = false , int loadTrans = 0 );
42+ ~GeometryTGeo ();
43+ void Build (int loadTrans);
44+ void fillMatrixCache (int mask);
5445
5546 static GeometryTGeo* Instance ()
5647 {
@@ -64,27 +55,28 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
6455 // adopt the unique instance from external raw pointer (to be used only to read saved instance from file)
6556 static void adopt (GeometryTGeo* raw);
6657
67- // constructor
68- // ATTENTION: this class is supposed to behave as a singleton, but to make it root-persistent
69- // we must define public default constructor.
70- // NEVER use it, it will throw exception if the class instance was already created
71- // Use GeometryTGeo::Instance() instead
72- GeometryTGeo (bool build = kFALSE , int loadTrans = 0
73- /* o2::base::utils::bit2Mask(o2::TransformType::T2L, // default transformations to load
74- o2::TransformType::T2G,
75- o2::TransformType::L2G)*/
76- );
77-
78- // / Default destructor
79- ~GeometryTGeo () = default ;
80-
81- GeometryTGeo (const GeometryTGeo& src) = delete ;
82- GeometryTGeo& operator =(const GeometryTGeo& geom) = delete ;
83-
84- void fillMatrixCache (int mask);
85-
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];}
8676 // / Exract FT3 parameters from TGeo
87- void Build (int loadTrans = 0 );
77+
78+ bool isOwner () const { return mOwner ; }
79+ void setOwner (bool v) { mOwner = v; }
8880
8981 void Print (Option_t* opt = " " ) const ;
9082 static const char * getFT3VolPattern () { return sVolumeName .c_str (); }
@@ -93,40 +85,37 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
9385 static const char * getFT3ChipPattern () { return sChipName .c_str (); }
9486 static const char * getFT3SensorPattern () { return sSensorName .c_str (); }
9587 static const char * getFT3PassivePattern () { return sPassiveName .c_str (); }
96-
88+
9789 static const char * composeSymNameFT3 (Int_t d) { return Form (" %s_%d" , o2::detectors::DetID (o2::detectors::DetID::FT3 ).getName (), d); }
9890 static const char * composeSymNameLayer (Int_t d, Int_t lr);
9991 static const char * composeSymNameChip (Int_t d, Int_t lr);
10092 static const char * composeSymNameSensor (Int_t d, Int_t lr);
10193
102- int getNumberOfChips () const { return mSize ; }
103- int getNumberOfLayers () const { return mFirstChipIndexLayer .size () > 0 ? mFirstChipIndexLayer .size () - 1 : 0 ; }
104- int getSubDetID (int ) const { return 2 ; }
105- int getLayer (int index) const ;
106- int getStave (int index) const ;
107- int getChip (int index) const ;
108- int getChipIndex (int layer, int stave, int chip) const ;
109- int getChipIndex (const std::string& volName) const ;
110- void extractChipIdsFT3 (std::string const & volName, int & layer, int & stave, int & chip) const ;
111-
94+
11295 protected:
11396 static std::string sInnerVolumeName ; // /< Mother inner volume name
11497 static std::string sVolumeName ; // /< Mother volume name
11598 static std::string sLayerName ; // /< Layer name
11699 static std::string sChipName ; // /< Chip name
117100 static std::string sSensorName ; // /< Sensor name
118101 static std::string sPassiveName ; // /< Passive material name
119- std::vector<unsigned short > mFirstChipIndexLayer ;
120- std::vector<unsigned short > mFirstStaveIndexLayer ;
121- std::vector<unsigned short > mFirstChipIndexStave ;
122- int mNumberOfLayersPerSide = 0 ;
123102
124- private:
125- static std::unique_ptr<o2::ft3::GeometryTGeo> sInstance ; // /< singletone instance
103+ std::vector<float > mCacheRefXDiscs ; // / cache for X of ML and OT
104+ std::vector<float > mCacheRefAlphaDiscs ; // / cache for sensor ref alpha ML and OT
105+ std::vector<int > mNumberOfDiscs ; // /< Number Discs per direction
106+ std::vector<int > mNumberOfStavesPerDisc ; // / TODO; in principle redundant?
107+ std::vector<int > mStaveIdxDisc ; // / Index of first global stave Id for each disc
108+ std::vector<int > mChipIdxStave ; // / Index of first chup for each global stave
109+ std::vector<int > mNumberOfChipsPerDisc ; // /
110+ // std::vector<unsigned int> mChipIndexLayer; ///< ID of first chip in the layer
111+ // std::vector<int> mChipStaveIds;
112+
113+ bool mOwner = true ; // ! is it owned by the singleton?
126114
127- ClassDefNV (GeometryTGeo, 1 ); // FT3 geometry based on TGeo
115+ private:
116+ static std::unique_ptr<o2::ft3::GeometryTGeo> sInstance ; // /< singleton instance
128117};
118+
129119} // namespace ft3
130120} // namespace o2
131-
132- #endif
121+ #endif
0 commit comments