CbmRoot
CbmSetup.h
Go to the documentation of this file.
1 
6 #ifndef CBMSETUP_H
7 #define CBMSETUP_H 1
8 
9 
10 #include "CbmDefs.h"
11 #include "CbmGeoSetupDbProvider.h"
12 #include "CbmGeoSetupProvider.h"
14 #include "CbmModuleList.h"
15 #include "FairLogger.h"
16 #include "TNamed.h"
17 #include "TString.h"
18 #include "TVector3.h"
19 #include <map>
20 
21 class FairModule;
22 class FairRunSim;
23 class CbmFieldMap;
24 
26 
27 // TODO: This class is a singleton, so it can be used when including
28 // a ROOT macro from another one. Since this is the only reason,
29 // the singleton nature shall be removed once not needed any longer.
30 
31 class CbmSetup : public TNamed {
32 public:
34  ~CbmSetup() {};
35 
36 
41  virtual void Clear(Option_t* opt = "");
42 
48  void LoadSetup(const char* setupName) { fProvider->LoadSetup(setupName); }
49 
54 
57  std::string GetMediaFilePath() {
58  return fProvider->GetSetup().GetMedia().GetFilePath();
59  }
60 
63  void SetMediaFilePath(std::string filePath) {
64  fProvider->GetSetup().GetMedia().SetFilePath(filePath);
65  }
66 
69 
70 
76  Bool_t GetGeoTag(ECbmModuleId moduleId, TString& tag);
77 
78 
84  Bool_t GetGeoFileName(ECbmModuleId moduleId, TString& fileName);
85 
86 
90  Int_t GetNofModules() const {
91  return fProvider->GetSetup().GetModuleMap().size();
92  }
93 
94 
96  static CbmSetup* Instance();
97 
98 
103  Bool_t IsActive(ECbmModuleId moduleId);
104 
105 
109  Bool_t IsEmpty() const { return (GetNofModules() == 0); }
110 
111 
113  virtual void Print(Option_t* /*opt*/ = "") const { LOG(info) << ToString(); }
114 
115 
119  void RemoveModule(ECbmModuleId moduleId);
120 
121 
131  void SetActive(ECbmModuleId moduleId, Bool_t active = kTRUE);
132 
133 
144  void SetField(const char* tag,
145  Double_t scale = 1.,
146  Double_t xPos = 0.,
147  Double_t yPos = 0.,
148  Double_t zPos = 0.);
149 
150 
157  void SetFieldScale(Double_t scale) {
158  fProvider->GetSetup().GetField().SetScale(scale);
159  }
160 
161 
170  void
171  SetModule(ECbmModuleId moduleId, const char* geoTag, Bool_t active = kTRUE);
172 
173 
175  std::string ToString() const;
176 
177 
181  void SetSetupSource(ECbmSetupSource setupSource);
182 
183 
186 
187 
193  delete fProvider;
194  fProvider = value;
195  };
196 
197 private:
199 
201  new CbmGeoSetupRepoProvider()};
202 
203 
205  CbmSetup() : TNamed("CBM Setup", "") {};
206 
210 
211 
213 };
214 
215 #endif /* CBMSETUP_H */
CbmSetup::GetGeoFileName
Bool_t GetGeoFileName(ECbmModuleId moduleId, TString &fileName)
Definition: CbmSetup.cxx:87
CbmSetup::ClassDef
ClassDef(CbmSetup, 3)
CbmSetup::ToString
std::string ToString() const
Info to string.
Definition: CbmSetup.cxx:197
CbmSetup::SetField
void SetField(const char *tag, Double_t scale=1., Double_t xPos=0., Double_t yPos=0., Double_t zPos=0.)
Definition: CbmSetup.cxx:157
CbmSetup::IsActive
Bool_t IsActive(ECbmModuleId moduleId)
Definition: CbmSetup.cxx:123
CbmSetup::SetModule
void SetModule(ECbmModuleId moduleId, const char *geoTag, Bool_t active=kTRUE)
Definition: CbmSetup.cxx:176
CbmSetup::SetProvider
void SetProvider(CbmGeoSetupProvider *value)
Set the geo setup provider.
Definition: CbmSetup.h:192
CbmSetup::SetSetupSource
void SetSetupSource(ECbmSetupSource setupSource)
Set the source the setup will be loaded from.
Definition: CbmSetup.cxx:229
CbmGeoSetupRepoProvider.h
CbmSetup::CbmSetup
CbmSetup(const CbmSetup &)
CbmGeoSetupMedia::GetFilePath
std::string GetFilePath()
Definition: CbmGeoSetupMedia.h:26
CbmSetup::RemoveModule
void RemoveModule(ECbmModuleId moduleId)
Definition: CbmSetup.cxx:133
CbmSetup::Print
virtual void Print(Option_t *="") const
Info to screen.
Definition: CbmSetup.h:113
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmGeoSetup::GetMedia
CbmGeoSetupMedia & GetMedia()
Definition: CbmGeoSetup.h:43
CbmGeoSetupRepoProvider
Setup provider with local (svn) repository functionality.
Definition: CbmGeoSetupRepoProvider.h:21
CbmSetup::CreateFieldMap
CbmFieldMap * CreateFieldMap()
Definition: CbmSetup.cxx:40
CbmSetup
Definition: CbmSetup.h:31
CbmSetup::GetNofModules
Int_t GetNofModules() const
Definition: CbmSetup.h:90
kDb
@ kDb
Definition: CbmSetup.h:25
CbmGeoSetupDbProvider.h
CbmSetup::fgInstance
static CbmSetup * fgInstance
Pointer to static instance.
Definition: CbmSetup.h:195
CbmFieldMap
Definition: CbmFieldMap.h:34
CbmSetup::GetMediaFilePath
std::string GetMediaFilePath()
Definition: CbmSetup.h:57
CbmSetup::SetMediaFilePath
void SetMediaFilePath(std::string filePath)
Definition: CbmSetup.h:63
CbmSetup::GetProvider
CbmGeoSetupProvider * GetProvider()
Get the geo setup provider.
Definition: CbmSetup.h:185
CbmSetup::Instance
static CbmSetup * Instance()
Definition: CbmSetup.cxx:115
CbmSetup::fProvider
CbmGeoSetupProvider * fProvider
Definition: CbmSetup.h:200
CbmGeoSetupProvider::GetSetup
CbmGeoSetup & GetSetup()
Direct access to underlying geometry setup representation. Allows for fine-tuning of parameters,...
Definition: CbmGeoSetupProvider.h:62
CbmSetup::IsEmpty
Bool_t IsEmpty() const
Definition: CbmSetup.h:109
CbmGeoSetupField::SetScale
void SetScale(Double_t value)
Definition: CbmGeoSetupField.h:40
CbmModuleList.h
CbmSetup::GetGeoTag
Bool_t GetGeoTag(ECbmModuleId moduleId, TString &tag)
Definition: CbmSetup.cxx:101
CbmSetup::Clear
virtual void Clear(Option_t *opt="")
Definition: CbmSetup.cxx:35
CbmSetup::operator=
CbmSetup operator=(const CbmSetup &)
ECbmSetupSource
ECbmSetupSource
Definition: CbmSetup.h:25
CbmSetup::RegisterSetup
void RegisterSetup()
Definition: CbmSetup.h:53
kRepo
@ kRepo
Definition: CbmSetup.h:25
CbmGeoSetup::GetField
CbmGeoSetupField & GetField()
Definition: CbmGeoSetup.h:42
CbmGeoSetupProvider::LoadSetup
virtual void LoadSetup(std::string setupTag, std::string revision="")=0
Abstract method to load the setup with a tag and revision version.
CbmGeoSetupMedia::SetFilePath
void SetFilePath(std::string value)
Definition: CbmGeoSetupMedia.h:34
CbmGeoSetupProvider.h
CbmSetup::LoadSetup
void LoadSetup(const char *setupName)
Definition: CbmSetup.h:48
CbmSetup::SetFieldScale
void SetFieldScale(Double_t scale)
Definition: CbmSetup.h:157
CbmGeoSetupProvider
Abstract interface class for providing the CBM detector setup description, module list,...
Definition: CbmGeoSetupProvider.h:26
CbmGeoSetup::GetModuleMap
std::map< ECbmModuleId, CbmGeoSetupModule > & GetModuleMap()
Definition: CbmGeoSetup.h:39
CbmSetup::SetActive
void SetActive(ECbmModuleId moduleId, Bool_t active=kTRUE)
Definition: CbmSetup.cxx:140
CbmGeoSetupProvider::RegisterSetup
void RegisterSetup()
Registers the previously loaded setup with FairRoot. Replaces the registerSetup.C macro.
Definition: CbmGeoSetupProvider.cxx:78
CbmSetup::~CbmSetup
~CbmSetup()
Definition: CbmSetup.h:34
CbmDefs.h
CbmSetup::CbmSetup
CbmSetup()
! Setup provider
Definition: CbmSetup.h:205