CbmRoot
CbmStsSetup.h
Go to the documentation of this file.
1 
7 #ifndef CBMSTSSETUP_H
8 #define CBMSTSSETUP_H 1
9 
10 #include <Rtypes.h> // for THashConsistencyHolder, ClassDef
11 #include <RtypesCore.h> // for Int_t, Double_t, Bool_t, UInt_t, UChar_t
12 
13 #include <FairLogger.h> // for LOG
14 
15 #include <map> // for map, __map_const_iterator, operator!=
16 #include <set> // for set
17 #include <string> // for string
18 #include <utility> // for pair
19 #include <vector> // for vector
20 
21 #include "CbmStsElement.h" // for CbmStsElement
22 #include "CbmStsSensor.h" // for CbmStsSensor
23 
24 class CbmStsModule;
25 class CbmStsParSetModule;
26 class CbmStsParSetSensor;
28 class CbmStsStation;
29 class TGeoManager;
30 
39 class CbmStsSetup : public CbmStsElement {
40 
41 public:
43  virtual ~CbmStsSetup() {};
44 
45 
51  CbmStsElement* GetElement(Int_t address, Int_t level);
52 
53 
58  const char* GetLevelName(Int_t level) const;
59 
60 
68  CbmStsModule* GetModule(Int_t index) const { return fModuleVector.at(index); }
69 
70 
78  CbmStsSensor* GetSensor(Int_t index) const { return fSensorVector.at(index); }
79 
80 
82  Int_t GetNofModules() const { return fModules.size(); }
83 
84 
86  Int_t GetNofSensors() const { return fSensors.size(); }
87 
88 
90  Int_t GetNofStations() const { return fStations.size(); }
91 
92 
97  CbmStsStation* GetStation(Int_t stationId) const {
98  if (fStations.find(stationId) == fStations.end()) return nullptr;
99  return fStations.at(stationId);
100  }
101 
102 
107  Int_t GetStationNumber(Int_t address);
108 
109 
118  Bool_t Init(const char* geometryFile = nullptr);
119 
120 
124  Bool_t IsInit() const { return fIsInitialised; }
125 
126 
130  Bool_t IsModuleParsInit() const { return fIsModuleParsInit; }
131 
132 
136  Bool_t IsSensorCondInit() const { return fIsSensorParsInit; }
137 
138 
142  Bool_t IsSensorParsInit() const { return fIsSensorParsInit; }
143 
144 
146  static CbmStsSetup* Instance();
147 
148 
150  void ListModules() const;
151 
152 
154  void ListSensors() const {
155  for (auto it = fSensors.begin(); it != fSensors.end(); it++)
156  LOG(info) << it->second->ToString();
157  }
158 
159 
164  UInt_t SetModuleParameters(CbmStsParSetModule* modulePars);
165 
166 
172 
173 
178  UInt_t SetSensorParameters(CbmStsParSetSensor* parSet);
179 
180 
181 private:
183  CbmStsSetup();
184 
185 
187  Int_t CreateStations();
188 
189 
198  Bool_t ReadGeometry(TGeoManager* geoManager);
199 
200 
209  Bool_t ReadGeometry(const char* fileName);
210 
211 
213  CbmStsSetup(const CbmStsSetup&) = delete;
214 
215 
218 
219 
220 private:
222  Bool_t fIsInitialised = kFALSE;
223  Bool_t fIsModuleParsInit = kFALSE;
224  Bool_t fIsSensorParsInit = kFALSE;
225  Bool_t fIsSensorCondInit = kFALSE;
226  Bool_t fHasStations = kFALSE;
227 
228  // --- Map of sensors. Key is address.
229  std::map<Int_t, CbmStsSensor*> fSensors;
230 
231  // --- Map of modules. Key is address.
232  std::map<Int_t, CbmStsModule*> fModules;
233 
234  // --- Vector of modules. For convenient loops.
235  std::vector<CbmStsModule*> fModuleVector;
236 
237  // --- Vector of sensors. For convenient loops.
238  std::vector<CbmStsSensor*> fSensorVector;
239 
240  // --- Map of stations. Key is station number.
241  // --- Stations are a special case needed for reconstruction;
242  // --- they are not elements in the setup.
243  std::map<Int_t, CbmStsStation*> fStations;
244 
245 
247 };
248 
249 #endif /* CBMSTSSETUP_H */
CbmStsSetup::fIsSensorCondInit
Bool_t fIsSensorCondInit
Sensor conditions set.
Definition: CbmStsSetup.h:225
CbmStsSetup::fSensorVector
std::vector< CbmStsSensor * > fSensorVector
Definition: CbmStsSetup.h:238
CbmStsSetup::ListSensors
void ListSensors() const
Definition: CbmStsSetup.h:154
CbmStsSetup::operator=
CbmStsSetup operator=(const CbmStsSetup &)=delete
Assignment operator (disabled)
CbmStsSetup::ClassDef
ClassDef(CbmStsSetup, 3)
CbmStsSetup::~CbmStsSetup
virtual ~CbmStsSetup()
Definition: CbmStsSetup.h:43
CbmStsSetup::SetSensorConditions
UInt_t SetSensorConditions(CbmStsParSetSensorCond *conds)
Set sensor conditions from parameter container.
Definition: CbmStsSetup.cxx:470
CbmStsSetup::CbmStsSetup
CbmStsSetup()
Default constructor
Definition: CbmStsSetup.cxx:46
CbmStsSetup::Instance
static CbmStsSetup * Instance()
Definition: CbmStsSetup.cxx:293
CbmStsSetup::IsSensorParsInit
Bool_t IsSensorParsInit() const
Initialisation status for sensor parameters.
Definition: CbmStsSetup.h:142
CbmStsSetup::CbmStsSetup
CbmStsSetup(const CbmStsSetup &)=delete
Copy constructor (disabled)
CbmStsSetup::SetSensorParameters
UInt_t SetSensorParameters(CbmStsParSetSensor *parSet)
Set sensor parameters from parameter container.
Definition: CbmStsSetup.cxx:486
CbmStsSetup::CreateStations
Int_t CreateStations()
Create station objects.
Definition: CbmStsSetup.cxx:56
CbmStsSetup::GetLevelName
const char * GetLevelName(Int_t level) const
Definition: CbmStsSetup.cxx:167
CbmStsSetup::GetNofStations
Int_t GetNofStations() const
Definition: CbmStsSetup.h:90
CbmStsSetup::fIsInitialised
Bool_t fIsInitialised
All parameter containers set.
Definition: CbmStsSetup.h:222
CbmStsSetup::fHasStations
Bool_t fHasStations
Legacy with stations instead of units.
Definition: CbmStsSetup.h:226
CbmStsSetup::ListModules
void ListModules() const
Definition: CbmStsSetup.cxx:301
CbmStsParSetSensorCond
Parameters container for CbmStsParSensorCond.
Definition: CbmStsParSetSensorCond.h:30
CbmStsModule
Class representing an instance of a readout unit in the CBM-STS.
Definition: CbmStsModule.h:31
CbmStsSetup::fgInstance
static CbmStsSetup * fgInstance
Static instance of this class.
Definition: CbmStsSetup.h:221
CbmStsSetup::fModuleVector
std::vector< CbmStsModule * > fModuleVector
Definition: CbmStsSetup.h:235
CbmStsParSetSensor
Parameters container for CbmStsParSensor.
Definition: CbmStsParSetSensor.h:30
CbmStsSetup::IsSensorCondInit
Bool_t IsSensorCondInit() const
Initialisation status for sensor conditions.
Definition: CbmStsSetup.h:136
CbmStsSetup::GetStationNumber
Int_t GetStationNumber(Int_t address)
Definition: CbmStsSetup.cxx:187
CbmStsSetup::GetSensor
CbmStsSensor * GetSensor(Int_t index) const
Get a sensor from the sensor array.
Definition: CbmStsSetup.h:78
CbmStsElement.h
CbmStsSetup::fModules
std::map< Int_t, CbmStsModule * > fModules
Definition: CbmStsSetup.h:232
CbmStsSensor
Class representing an instance of a sensor in the CBM-STS.
Definition: CbmStsSensor.h:38
CbmStsSetup::IsModuleParsInit
Bool_t IsModuleParsInit() const
Initialisation status for module parameters.
Definition: CbmStsSetup.h:130
CbmStsSetup::Init
Bool_t Init(const char *geometryFile=nullptr)
Initialise the setup.
Definition: CbmStsSetup.cxx:201
CbmStsSetup
Class representing the top level of the STS setup.
Definition: CbmStsSetup.h:39
CbmStsSetup::GetModule
CbmStsModule * GetModule(Int_t index) const
Get a module from the module array.
Definition: CbmStsSetup.h:68
CbmStsSetup::GetStation
CbmStsStation * GetStation(Int_t stationId) const
Definition: CbmStsSetup.h:97
CbmStsSetup::SetModuleParameters
UInt_t SetModuleParameters(CbmStsParSetModule *modulePars)
Set module parameters from parameter container.
Definition: CbmStsSetup.cxx:455
CbmStsParSetModule
Parameters container for CbmStsParModule.
Definition: CbmStsParSetModule.h:30
CbmStsSetup::GetElement
CbmStsElement * GetElement(Int_t address, Int_t level)
Definition: CbmStsSetup.cxx:137
CbmStsSetup::GetNofSensors
Int_t GetNofSensors() const
Definition: CbmStsSetup.h:86
CbmStsSetup::GetNofModules
Int_t GetNofModules() const
Definition: CbmStsSetup.h:82
CbmStsSetup::fStations
std::map< Int_t, CbmStsStation * > fStations
Definition: CbmStsSetup.h:243
CbmStsElement
Class representing an element of the STS setup.
Definition: CbmStsElement.h:32
CbmStsSetup::fIsModuleParsInit
Bool_t fIsModuleParsInit
Module parameters set.
Definition: CbmStsSetup.h:223
CbmStsStation
Class representing a station of the StsSystem.
Definition: CbmStsStation.h:29
CbmStsSetup::IsInit
Bool_t IsInit() const
Initialisation status for sensor parameters.
Definition: CbmStsSetup.h:124
CbmStsSetup::fSensors
std::map< Int_t, CbmStsSensor * > fSensors
Definition: CbmStsSetup.h:229
CbmStsSetup::ReadGeometry
Bool_t ReadGeometry(TGeoManager *geoManager)
Read the geometry from TGeoManager.
Definition: CbmStsSetup.cxx:309
CbmStsSetup::fIsSensorParsInit
Bool_t fIsSensorParsInit
Sensor parameters set.
Definition: CbmStsSetup.h:224
CbmStsSensor.h