18#include "FairModule.h"
19#include "FairRunSim.h"
21#include "TGeoMatrix.h"
23#include "TGeoVolume.h"
34using std::stringstream;
49 if (
nullptr == ptrRepoProv) {
51 if (
nullptr == ptrDbProv) {
53 LOG(error) <<
"Could not leod event as storable even does not contain any provider";
72 fileName = TString(gSystem->Getenv(
"VMCWORKDIR")) +
"/" + fileName;
74 TFile mapFile(fileName);
75 if (!mapFile.IsOpen()) {
76 LOG(error) <<
"Could not open field map file " << fileName;
81 TString mapName =
"field_";
82 mapName += field.
GetTag().c_str();
84 mapFile.GetObject(mapName, data);
86 LOG(error) <<
"Could not find CbmFieldMapData object " << mapName <<
" in file " << fileName;
89 Int_t fieldType = data->
GetType();
96 default: LOG(error) <<
"Unknown field type " << fieldType;
116 if (moduleMap.find(moduleId) == moduleMap.end()) {
120 fileName = moduleMap.at(moduleId).GetFilePath();
131 if (moduleMap.find(moduleId) == moduleMap.end()) {
135 tag = moduleMap.at(moduleId).GetTag();
145 std::string hashString{
""};
147 for (
auto& entry : moduleMap) {
148 if (!hashString.empty()) {
151 hashString += entry.second.GetName() +
":" + entry.second.GetTag();
154 return std::hash<std::string>{}(hashString);
173 if (moduleMap.find(moduleId) == moduleMap.end())
return kFALSE;
174 return moduleMap.at(moduleId).GetActive();
191 if (moduleMap.find(moduleId) == moduleMap.end()) {
192 LOG(warn) <<
"Module " << moduleId <<
" does not exist in setup!";
197 moduleMap.at(moduleId).SetActive(active);
207 <<
" (according to magnet geometry) with field map " << tag;
211 field.
GetMatrix().SetTranslation(xPos, yPos, zPos);
223 if (modmap.find(moduleId) != modmap.end()) {
227 LOG(debug) << GetName() <<
": Changing module " << moduleId <<
": " << module.
GetTag() <<
" -> " << geoTag;
240 ss << std::left <<
"CBM setup: " << setup.
GetName() <<
", " <<
GetNofModules() <<
" modules \n";
246 if (module.
GetActive()) ss <<
" *ACTIVE* ";
253 ss <<
" Field : " << field.
GetTag() <<
", Position ( " << field.
GetMatrix().GetTranslation()[0] <<
", "
254 << field.
GetMatrix().GetTranslation()[1] <<
", " << field.
GetMatrix().GetTranslation()[2] <<
" ) cm, scaling "
265 switch (setupSource) {
268 default: LOG(fatal) <<
"Invalid value for geo setup provider source " << setupSource;
ClassImp(CbmConverterManager)
virtual void SetPosition(Double_t x, Double_t y, Double_t z)
virtual void SetScale(Double_t factor)
Setup provider with database functionality.
TGeoTranslation & GetMatrix()
void SetScale(Double_t value)
std::string GetFilePath()
std::string GetFilePath()
CbmGeoSetup & GetSetup()
Direct access to underlying geometry setup representation. Allows for fine-tuning of parameters,...
void Reset()
Resets the setup to default (empty)
void SetModuleTag(ECbmModuleId moduleId, std::string tag, Bool_t active)
Loads the detector with a tag into setup, will invoke GetModuleByTag.
void RemoveModule(ECbmModuleId moduleId)
Removes the module from setup.
virtual CbmGeoSetupField GetFieldByTag(std::string tag)=0
Abstract method for constructing the field by tag.
Setup provider with local (svn) repository functionality.
Data transfer object to represent the CBM Detector setup.
void SetField(CbmGeoSetupField value)
CbmGeoSetupField & GetField()
std::map< ECbmModuleId, CbmGeoSetupModule > & GetModuleMap()
static TString GetModuleNameCaps(ECbmModuleId moduleId)
CbmGeoSetupRepoProvider * GetRepoProvPtr()
CbmGeoSetupDbProvider * GetDbProvPtr()
void SetActive(ECbmModuleId moduleId, Bool_t active=kTRUE)
Bool_t GetGeoFileName(ECbmModuleId moduleId, TString &fileName)
void SetSetupSource(ECbmSetupSource setupSource)
Set the source the setup will be loaded from.
Bool_t IsActive(ECbmModuleId moduleId)
Int_t GetNofModules() const
CbmSetup()
! Setup provider
virtual void Clear(Option_t *opt="")
void RemoveModule(ECbmModuleId moduleId)
void SetModule(ECbmModuleId moduleId, const char *geoTag, Bool_t active=kTRUE)
CbmGeoSetupProvider * fProvider
void LoadStoredSetup(CbmSetupStorable *setupIn)
std::string ToString() const
Info to string.
CbmFieldMap * CreateFieldMap()
Bool_t GetGeoTag(ECbmModuleId moduleId, TString &tag)
static CbmSetup * Instance()
void SetProvider(CbmGeoSetupProvider *value)
Set the geo setup provider.
void SetField(const char *tag, Double_t scale=1., Double_t xPos=0., Double_t yPos=0., Double_t zPos=0.)
static CbmSetup * fgInstance
Pointer to static instance.