Go to the documentation of this file.
12 #include "FairLogger.h"
13 #include "FairModule.h"
14 #include "FairRunSim.h"
16 #include "TGeoMatrix.h"
18 #include "TGeoVolume.h"
27 using std::stringstream;
45 fileName = TString(gSystem->Getenv(
"VMCWORKDIR")) +
"/" + fileName;
47 TFile mapFile(fileName);
48 if (!mapFile.IsOpen()) {
49 LOG(error) <<
"Could not open field map file " << fileName;
54 TString mapName =
"field_";
55 mapName += field.
GetTag().c_str();
57 mapFile.GetObject(mapName, data);
59 LOG(error) <<
"Could not find CbmFieldMapData object " << mapName
60 <<
" in file " << fileName;
63 Int_t fieldType = data->
GetType();
70 default: LOG(error) <<
"Unknown field type " << fieldType;
90 if (moduleMap.find(moduleId) == moduleMap.end()) {
94 fileName = moduleMap.at(moduleId).GetFilePath();
104 if (moduleMap.find(moduleId) == moduleMap.end()) {
108 tag = moduleMap.at(moduleId).GetTag();
126 if (moduleMap.find(moduleId) == moduleMap.end())
return kFALSE;
127 return moduleMap.at(moduleId).GetActive();
145 if (moduleMap.find(moduleId) == moduleMap.end()) {
146 LOG(warn) <<
"Module " << moduleId <<
" does not exist in setup!";
151 moduleMap.at(moduleId).SetActive(active);
163 LOG(warn) << GetName() <<
": Overriding field map "
165 <<
" (according to magnet geometry) with field map " << tag;
169 field.
GetMatrix().SetTranslation(xPos, yPos, zPos);
180 std::map<ECbmModuleId, CbmGeoSetupModule> modmap =
183 if (modmap.find(moduleId) != modmap.end()) {
188 LOG(debug) << GetName() <<
": Changing module " << moduleId <<
": "
189 << module.
GetTag() <<
" -> " << geoTag;
206 ss <<
" " << std::setw(8)
217 ss <<
" Field : " << field.
GetTag() <<
", Position ( "
218 << field.
GetMatrix().GetTranslation()[0] <<
", "
219 << field.
GetMatrix().GetTranslation()[1] <<
", "
220 << field.
GetMatrix().GetTranslation()[2] <<
" ) cm, scaling "
230 switch (setupSource) {
234 LOG(fatal) <<
"Invalid value for geo setup provider source "
Bool_t GetGeoFileName(ECbmModuleId moduleId, TString &fileName)
TGeoTranslation & GetMatrix()
void SetModuleTag(ECbmModuleId moduleId, std::string tag, Bool_t active)
Loads the detector with a tag into setup, will invoke GetModuleByTag.
std::string ToString() const
Info to string.
void SetField(CbmGeoSetupField value)
void SetField(const char *tag, Double_t scale=1., Double_t xPos=0., Double_t yPos=0., Double_t zPos=0.)
Bool_t IsActive(ECbmModuleId moduleId)
void SetModule(ECbmModuleId moduleId, const char *geoTag, Bool_t active=kTRUE)
void SetProvider(CbmGeoSetupProvider *value)
Set the geo setup provider.
void SetSetupSource(ECbmSetupSource setupSource)
Set the source the setup will be loaded from.
void RemoveModule(ECbmModuleId moduleId)
Setup provider with local (svn) repository functionality.
CbmFieldMap * CreateFieldMap()
virtual void SetPosition(Double_t x, Double_t y, Double_t z)
static TString GetModuleNameCaps(ECbmModuleId moduleId)
std::string GetFilePath()
Int_t GetNofModules() const
virtual void SetScale(Double_t factor)
static CbmSetup * fgInstance
Pointer to static instance.
static CbmSetup * Instance()
CbmGeoSetupProvider * fProvider
CbmGeoSetup & GetSetup()
Direct access to underlying geometry setup representation. Allows for fine-tuning of parameters,...
Setup provider with database functionality.
std::string GetFilePath()
void SetScale(Double_t value)
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Bool_t GetGeoTag(ECbmModuleId moduleId, TString &tag)
virtual void Clear(Option_t *opt="")
virtual CbmGeoSetupField GetFieldByTag(std::string tag)=0
Abstract method for constructing the field by tag.
Data transfer object to represent the CBM Detector setup.
void RemoveModule(ECbmModuleId moduleId)
Removes the module from setup.
CbmGeoSetupField & GetField()
void Reset()
Resets the setup to default (empty)
std::map< ECbmModuleId, CbmGeoSetupModule > & GetModuleMap()
void SetActive(ECbmModuleId moduleId, Bool_t active=kTRUE)
CbmSetup()
! Setup provider