CbmRoot
Loading...
Searching...
No Matches
CbmStsSetup.h
Go to the documentation of this file.
1/* Copyright (C) 2013-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
11#ifndef CBMSTSSETUP_H
12#define CBMSTSSETUP_H 1
13
14#include "CbmStsElement.h" // for CbmStsElement
15#include "CbmStsSensor.h" // for CbmStsSensor
16
17#include <Logger.h> // for LOG
18
19#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
20#include <RtypesCore.h> // for Int_t, Double_t, Bool_t, UInt_t, UChar_t
21
22#include <map> // for map, __map_const_iterator, operator!=
23#include <set> // for set
24#include <string> // for string
25#include <utility> // for pair
26#include <vector> // for vector
27
28class CbmStsModule;
32class CbmStsStation;
33class TGeoManager;
34
43class CbmStsSetup : public CbmStsElement {
44
45public:
47 virtual ~CbmStsSetup() {};
48
49
55 CbmStsElement* GetElement(Int_t address, Int_t level);
56
57
62 const char* GetLevelName(Int_t level) const;
63
64
72 CbmStsModule* GetModule(Int_t index) const { return fModuleVector.at(index); }
73
74
82 CbmStsSensor* GetSensor(Int_t index) const { return fSensorVector.at(index); }
83
84
86 Int_t GetNofModules() const { return fModules.size(); }
87
88
90 Int_t GetNofSensors() const { return fSensors.size(); }
91
92
94 Int_t GetNofStations() const { return fStations.size(); }
95
96
101 CbmStsStation* GetStation(Int_t stationId) const
102 {
103 if (fStations.find(stationId) == fStations.end()) return nullptr;
104 return fStations.at(stationId);
105 }
106
107
112 Int_t GetStationNumber(Int_t address);
113
114
123 Bool_t Init(const char* geometryFile = nullptr);
124
125
129 Bool_t IsInit() const { return fIsInitialised; }
130
131
135 Bool_t IsModuleParsInit() const { return fIsModuleParsInit; }
136
137
141 Bool_t IsSensorCondInit() const { return fIsSensorParsInit; }
142
143
147 Bool_t IsSensorParsInit() const { return fIsSensorParsInit; }
148
149
151 static CbmStsSetup* Instance();
152
153
155 void ListModules() const;
156
157
159 void ListSensors() const
160 {
161 for (auto it = fSensors.begin(); it != fSensors.end(); it++)
162 LOG(info) << it->second->ToString();
163 }
164
165
170 UInt_t SetModuleParameters(CbmStsParSetModule* modulePars);
171
172
178
179
185
186
187private:
189 CbmStsSetup();
190
191
193 Int_t CreateStations();
194
195
204 Bool_t ReadGeometry(TGeoManager* geoManager);
205
206 void RecomputePhysicalAssmbBbox(TGeoManager* geo);
207
208
217 Bool_t ReadGeometry(const char* fileName);
218
219
221 CbmStsSetup(const CbmStsSetup&) = delete;
222
223
226
227
228private:
230 Bool_t fIsInitialised = kFALSE;
231 Bool_t fIsModuleParsInit = kFALSE;
232 Bool_t fIsSensorParsInit = kFALSE;
233 Bool_t fIsSensorCondInit = kFALSE;
234 Bool_t fHasStations = kFALSE;
235
236 // --- Map of sensors. Key is address.
237 std::map<Int_t, CbmStsSensor*> fSensors;
238
239 // --- Map of modules. Key is address.
240 std::map<Int_t, CbmStsModule*> fModules;
241
242 // --- Vector of modules. For convenient loops.
243 std::vector<CbmStsModule*> fModuleVector;
244
245 // --- Vector of sensors. For convenient loops.
246 std::vector<CbmStsSensor*> fSensorVector;
247
248 // --- Map of stations. Key is station number.
249 // --- Stations are a special case needed for reconstruction;
250 // --- they are not elements in the setup.
251 std::map<Int_t, CbmStsStation*> fStations;
252
253
255};
256
257#endif /* CBMSTSSETUP_H */
Class representing an element of the STS setup.
Class representing an instance of a readout unit in the CBM-STS.
Parameters container for CbmStsParModule.
Parameters container for CbmStsParSensorCond.
Parameters container for CbmStsParSensor.
Class representing an instance of a sensor in the CBM-STS.
Class representing the top level of the STS setup.
Definition CbmStsSetup.h:43
const char * GetLevelName(Int_t level) const
static CbmStsSetup * fgInstance
Static instance of this class.
Bool_t IsModuleParsInit() const
Initialisation status for module parameters.
CbmStsSetup()
Default constructor
Int_t GetNofSensors() const
Definition CbmStsSetup.h:90
Bool_t fIsSensorCondInit
Sensor conditions set.
Bool_t ReadGeometry(TGeoManager *geoManager)
Read the geometry from TGeoManager.
Bool_t IsSensorParsInit() const
Initialisation status for sensor parameters.
Bool_t fHasStations
Legacy with stations instead of units.
Bool_t Init(const char *geometryFile=nullptr)
Initialise the setup.
CbmStsModule * GetModule(Int_t index) const
Get a module from the module array.
Definition CbmStsSetup.h:72
Bool_t fIsSensorParsInit
Sensor parameters set.
void ListSensors() const
CbmStsSetup(const CbmStsSetup &)=delete
Copy constructor (disabled)
CbmStsElement * GetElement(Int_t address, Int_t level)
UInt_t SetSensorConditions(CbmStsParSetSensorCond *conds)
Set sensor conditions from parameter container.
Int_t CreateStations()
Create station objects.
std::map< Int_t, CbmStsSensor * > fSensors
Int_t GetNofStations() const
Definition CbmStsSetup.h:94
CbmStsSetup operator=(const CbmStsSetup &)=delete
Assignment operator (disabled)
void RecomputePhysicalAssmbBbox(TGeoManager *geo)
static CbmStsSetup * Instance()
std::vector< CbmStsModule * > fModuleVector
Bool_t fIsModuleParsInit
Module parameters set.
Bool_t IsSensorCondInit() const
Initialisation status for sensor conditions.
ClassDef(CbmStsSetup, 3)
CbmStsStation * GetStation(Int_t stationId) const
UInt_t SetModuleParameters(CbmStsParSetModule *modulePars)
Set module parameters from parameter container.
CbmStsSensor * GetSensor(Int_t index) const
Get a sensor from the sensor array.
Definition CbmStsSetup.h:82
virtual ~CbmStsSetup()
Definition CbmStsSetup.h:47
UInt_t SetSensorParameters(CbmStsParSetSensor *parSet)
Set sensor parameters from parameter container.
std::vector< CbmStsSensor * > fSensorVector
Int_t GetStationNumber(Int_t address)
Int_t GetNofModules() const
Definition CbmStsSetup.h:86
std::map< Int_t, CbmStsModule * > fModules
Bool_t fIsInitialised
All parameter containers set.
Bool_t IsInit() const
Initialisation status for sensor parameters.
void ListModules() const
std::map< Int_t, CbmStsStation * > fStations
Class representing a station of the StsSystem.