CbmRoot
Loading...
Searching...
No Matches
CbmMuchGeoScheme.h
Go to the documentation of this file.
1/* Copyright (C) 2008-2021 St. Petersburg Polytechnic University, St. Petersburg
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig, Evgeny Kryshen, Mikhail Ryzhinskiy [committer], David Emschermann, Vikas Singhal */
4
5// -------------------------------------------------------------------------
6// ----- CbmMuchGeoScheme header file -----
7// ----- Created 18/02/08 by E. Kryshen
8// ----- Modified 18/10/2017 by Omveer Singh -----
9// -------------------------------------------------------------------------
10
18#ifndef CbmMuchGeoScheme_H
19#define CbmMuchGeoScheme_H 1
20
21#include "CbmMuchAddress.h" // for CbmMuchAddress, kMuchLayer, kMuchLayerSide
22
23#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
24#include <RtypesCore.h> // for Int_t, Double_t, Bool_t, Float_t, Char_t
25#include <TArrayC.h> // for TArrayC
26#include <TArrayD.h> // for TArrayD
27#include <TArrayI.h> // for TArrayI
28#include <TGeoBBox.h> // for TGeoBBox
29#include <TGeoCone.h> // for TGeoCone
30#include <TObjArray.h> // for TObjArray
31#include <TObject.h> // for TObject
32#include <TString.h> // for TString
33
34#include <map> // for map
35#include <vector> // for vector
36
37class CbmMuchLayer;
39class CbmMuchModule;
41class CbmMuchStation;
42class TGeoHMatrix;
43class TGeoNode;
44class TGeoTrap;
45class TGeoVolume;
46
47class CbmMuchGeoScheme : public TObject {
48
49public:
52 //void Init(Bool_t isSimulation = kFALSE);
53 static CbmMuchGeoScheme* Instance();
55 Bool_t IsInitialized() { return fInitialized; }
56
57 // Get geometry objects by indices
58 CbmMuchStation* GetStation(Int_t iStation) const;
59 //Int_t GetStation(const TString& path);
60 CbmMuchLayer* GetLayer(Int_t iStation, Int_t iLayer) const;
61 CbmMuchLayerSide* GetLayerSide(Int_t iStation, Int_t iLayer, Bool_t iSide) const;
62 CbmMuchModule* GetModule(Int_t iStation, Int_t iLayer, Bool_t iSide, Int_t iModule) const;
63
64 // Get geometry objects by detector id
65 CbmMuchStation* GetStationByDetId(Int_t detId) const;
66 CbmMuchLayer* GetLayerByDetId(Int_t detId) const;
67 CbmMuchLayerSide* GetLayerSideByDetId(Int_t detId) const;
68 CbmMuchModule* GetModuleByDetId(Int_t detId) const;
69
70 static Int_t GetStationIndex(Int_t address) { return CbmMuchAddress::GetElementId(address, kMuchStation); }
71 static Int_t GetLayerIndex(Int_t address) { return CbmMuchAddress::GetElementId(address, kMuchLayer); }
72 static Int_t GetLayerSideIndex(Int_t address) { return CbmMuchAddress::GetElementId(address, kMuchLayerSide); }
73
74 // fStations->GetEntriesFast();
75 Int_t GetNStations() const { return fStations->GetEntriesFast(); }
76 Int_t GetNAbsorbers() const { return fNabs; }
77 TObjArray* GetStations() const { return fStations; }
78 TObjArray* GetAbsorbers() const { return fAbsorbers; }
79 TGeoCone* GetMuchCave() const { return fMuchCave; }
80 Double_t GetMuchCaveZ0() const { return fMuchZ1 + fMuchCave->GetDz(); }
81 // Double_t GetAbsorberZ0(Int_t i) const {return fMuchZ1+fAbsorberZ1[i]+((TGeoCone*) fAbsorbers->At(i))->GetDz();}
82 Char_t GetAbsorberMat(Int_t i) const { return fAbsorberMat[i]; }
83 Double_t GetAbsorberZ0(Int_t i)
84 {
85 if (i == 0) return fMuchZ1 + fAbsorberZ1[i] + ((TGeoBBox*) fAbsorbers->At(i))->GetDZ();
86 //return fMuchZ1+fAbsorberZ1[i]+((TGeoCone*)fAbsorbers->At(i))->GetDz();
87
88 else
89 return fMuchZ1 + fAbsorberZ1[i] + ((TGeoBBox*) fAbsorbers->At(i))->GetDZ();
90 }
91
92
93 Double_t GetSizeX(const TString& path);
94 Double_t GetSizeY(const TString& path);
95 Double_t GetSizeZ(const TString& path);
96 Double_t GetX(const TString& path);
97 Double_t GetY(const TString& path);
98 Double_t GetZ(const TString& path);
99
100
101 Double_t GetModuleDZ(const TString& path);
102 Double_t GetModuleX(const TString& path);
103 Double_t GetModuleY(const TString& path);
104 Double_t GetModuleZ(const TString& path);
105 Double_t GetModulePhi(const TString& path);
106 Double_t GetModuleH1(const TString& path);
107 Double_t GetModuleBl1(const TString& path);
108 Double_t GetModuleTl1(const TString& path);
109
110
111 Double_t GetActiveLx() const { return fActiveLx; }
112 Double_t GetActiveLy() const { return fActiveLy; }
113 Double_t GetActiveLz() const { return fActiveLz; }
114 Double_t GetSpacerLx() const { return fSpacerLx; }
115 Double_t GetSpacerLy() const { return fSpacerLy; }
116 Double_t GetSpacerR() const { return fSpacerR; }
117 Double_t GetSpacerPhi() const { return fSpacerPhi; }
118 Double_t GetLayersDz(Int_t st) const { return fLayersDz[st]; }
119
120 void Init(TObjArray* stations, Int_t flag);
121 void Init(TString digiFileName, Int_t flag);
122 void CreatePointArrays();
123 void CreateHitArrays();
124 void CreateClusterArrays();
125 void ClearPointArrays();
126 void ClearHitArrays();
127 void ClearClusterArrays();
128 std::vector<CbmMuchModule*> GetModules() const;
129 std::vector<CbmMuchModuleGem*> GetGemModules() const;
130 std::vector<CbmMuchModule*> GetModules(Int_t iStation) const;
131 std::vector<CbmMuchLayerSide*> GetLayerSides(Int_t iStation) const;
132 Int_t GetLayerSideNr(Int_t detId) const;
133
134 void ExtractGeoParameter(TGeoNode* muchNode, const char* volumeName);
135 void StationNode(TGeoNode* MuchObjNode, TString MuchObjPath);
136 void LayerNode(TGeoNode* StNode, Int_t iStation, TString StPath);
137 void ModuleNode(TGeoNode* layerNode, Int_t iStation, Int_t iLayer, TString layerPath);
138 void ActiveModuleNode(TGeoNode* moduleNode, Int_t iStation, Int_t iLayer, Int_t iModule, TString modulePath);
139
140
141private:
143 void NavigateTo(const TString& path);
144 void NavigateModule(const TString& path);
145 void InitModules();
146 Int_t Intersect(Float_t x, Float_t y, Float_t dx, Float_t dy, Float_t r);
147
149 TGeoVolume* fCurrentVolume;
150 TGeoBBox* fVolumeBoxShape;
152 Double_t fGlobal[3];
153 Double_t fGlobalTrap[3];
154 TGeoHMatrix* fGlobalMatrix;
155
156 // for backward compatibility
157 Int_t fStation;
158 Int_t fLayer;
159 Int_t fActive;
160 Int_t fGeoID; // Id to distinguish geometry (mcbm/cbm)
161
163 static Bool_t fInitialized; // Defines whether the instance was initialized
164 static Bool_t fModulesInitialized; // Defines whether grid of the instance was initialized
165
166 std::vector<std::vector<CbmMuchModule*>> fModules;
167 std::vector<std::vector<CbmMuchLayerSide*>> fSides;
168 std::map<Int_t, Int_t> fMapSides;
169
170 TObjArray* fStations;
171 TObjArray* fAbsorbers;
172 TGeoCone* fMuchCave;
173
174 // Input parameters
175 Double_t fMuchZ1; // MuchCave Zin position [cm]
176 Double_t fAcceptanceTanMin; // Acceptance tangent min
177 Double_t fAcceptanceTanMax; // Acceptance tangent max
178 Int_t fNabs; // Number of absorbers
179 Int_t fNst; // Number of stations
180
181 // GEM module parameters
182 Double_t fActiveLx; // Active volume lx [cm]
183 Double_t fActiveLy; // Active volume ly [cm]
184 Double_t fActiveLz; // Active volume lz [cm]
185 Double_t fSpacerLx; // Spacer lx [cm]
186 Double_t fSpacerLy; // Spacer ly [cm]
187 Double_t fOverlapY; // Overlap along y axis [cm]
188
189 // Straw module parameters
190 Double_t fStrawLz;
191
192 // Sector-type module parameters
193 TArrayI fNSectorsPerLayer; // Number of sectors per layer
194 Double_t fActiveLzSector; // Active volume thickness [cm]
195 Double_t fSpacerR; // Spacer width in R [cm]
196 Double_t fSpacerPhi; // Spacer width in Phi [cm]
197 Double_t fOverlapR; // Overlap in R direction [cm]
198
199 TArrayD fAbsorberZ1; // Absorber Zin position [cm] in the cave reference frame
200 TArrayD fAbsorberLz; // Absorber thickness [cm]
201 TArrayC fAbsorberMat; // Absorber material
202 TArrayD fStationZ0; // Station Zceneter [cm] in the cave reference frame
203 TArrayI fNlayers; // Number of layers
204 TArrayI fDetType; // Detector type
205 TArrayD fLayersDz; // Distance between layers [cm]
206 TArrayD fSupportLz; // Support thickness [cm]
207 TArrayI fModuleDesign; /* 1 - detailed design (modules at two sides)
208 * 0 - simple design (1 module per layer) */
209
213 Double_t Rmin;
214 Double_t Rmax;
215 Double_t Dx2;
216
219
221};
222
223#endif
@ kMuchLayerSide
LayerSide.
@ kMuchStation
Station.
@ kMuchLayer
Layer.
static int32_t GetElementId(uint32_t address, int32_t level)
Int_t GetLayerSideNr(Int_t detId) const
std::vector< CbmMuchLayerSide * > GetLayerSides(Int_t iStation) const
Int_t fLayer
StationTypeID, 1..3.
std::vector< CbmMuchModuleGem * > GetGemModules() const
Double_t GetModuleY(const TString &path)
void ExtractGeoParameter(TGeoNode *muchNode, const char *volumeName)
Double_t GetSpacerLy() const
Int_t fActive
LayerID within station, 1..4.
CbmMuchLayer * GetLayerByDetId(Int_t detId) const
Double_t GetSpacerLx() const
Double_t GetZ(const TString &path)
Double_t GetActiveLx() const
TGeoHMatrix * fGlobalMatrix
Global center of volume.
Int_t GetNAbsorbers() const
std::map< Int_t, Int_t > fMapSides
Double_t fGlobalTrap[3]
Double_t GetModuleBl1(const TString &path)
Double_t GetModuleH1(const TString &path)
std::vector< std::vector< CbmMuchModule * > > fModules
void StationNode(TGeoNode *MuchObjNode, TString MuchObjPath)
CbmMuchStation * GetStationByDetId(Int_t detId) const
std::vector< std::vector< CbmMuchLayerSide * > > fSides
void ActiveModuleNode(TGeoNode *moduleNode, Int_t iStation, Int_t iLayer, Int_t iModule, TString modulePath)
Double_t GetSizeY(const TString &path)
Double_t GetLayersDz(Int_t st) const
Double_t GetModuleTl1(const TString &path)
CbmMuchStation * GetStation(Int_t iStation) const
std::vector< CbmMuchModule * > GetModules() const
Double_t GetSpacerPhi() const
static CbmMuchGeoScheme * Instance()
void Init(TObjArray *stations, Int_t flag)
static CbmMuchGeoScheme * fInstance
TGeoVolume * fCurrentVolume
Double_t GetActiveLz() const
static Int_t GetLayerSideIndex(Int_t address)
Double_t GetSpacerR() const
void NavigateModule(const TString &path)
Double_t GetY(const TString &path)
Double_t GetModulePhi(const TString &path)
Char_t GetAbsorberMat(Int_t i) const
static Int_t GetStationIndex(Int_t address)
TObjArray * GetStations() const
void ModuleNode(TGeoNode *layerNode, Int_t iStation, Int_t iLayer, TString layerPath)
static Bool_t fModulesInitialized
CbmMuchLayerSide * GetLayerSideByDetId(Int_t detId) const
Double_t GetMuchCaveZ0() const
CbmMuchLayerSide * GetLayerSide(Int_t iStation, Int_t iLayer, Bool_t iSide) const
CbmMuchLayer * GetLayer(Int_t iStation, Int_t iLayer) const
Double_t GetModuleX(const TString &path)
TGeoCone * GetMuchCave() const
Double_t GetSizeX(const TString &path)
CbmMuchStation * muchSt
Int_t GetNStations() const
CbmMuchLayer * muchLy
void NavigateTo(const TString &path)
CbmMuchLayerSide * muchLySd
CbmMuchGeoScheme(const CbmMuchGeoScheme &)
Double_t GetModuleDZ(const TString &path)
static Bool_t fInitialized
CbmMuchGeoScheme & operator=(const CbmMuchGeoScheme &)
Double_t GetX(const TString &path)
Int_t fGeoID
ModuleCopyID with module type.
CbmMuchModule * GetModuleByDetId(Int_t detId) const
Double_t GetSizeZ(const TString &path)
CbmMuchModule * GetModule(Int_t iStation, Int_t iLayer, Bool_t iSide, Int_t iModule) const
TGeoBBox * fVolumeBoxShape
static Int_t GetLayerIndex(Int_t address)
void LayerNode(TGeoNode *StNode, Int_t iStation, TString StPath)
Double_t GetAbsorberZ0(Int_t i)
Double_t GetModuleZ(const TString &path)
ClassDef(CbmMuchGeoScheme, 1)
TGeoTrap * fVolumeTrapShape
TObjArray * GetAbsorbers() const
Int_t Intersect(Float_t x, Float_t y, Float_t dx, Float_t dy, Float_t r)
Double_t GetActiveLy() const