REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGDMLParser.h
1 
2 #ifndef restG4_TRestGDMLParser
3 #define restG4_TRestGDMLParser
4 
5 #include <TGeoManager.h>
6 
7 #include "TRestMetadata.h"
8 
9 // we must preprocess gdml file because of a bug in TGDMLParse::Value() in ROOT6
10 
12  private:
13  TGeoManager* fGeoManager{};
14 
15  public:
16  TRestGDMLParser() = default;
17  ~TRestGDMLParser() = default;
18 
19  std::string fFileString = "";
20  std::string fPath = "";
21  std::string fOutputGdmlDirectory =
22  REST_USER_PATH.empty() ? REST_TMP_PATH + "/gdml/" : REST_USER_PATH + "/gdml/";
23  std::string fOutputGdmlFilename = "";
24  std::string fGdmlVersion = "0.0";
25  std::map<std::string, std::string> fEntityVersionMap{};
26 
27  std::string GetEntityVersion(const std::string& name) const;
28 
29  inline std::string GetGDMLVersion() const { return fGdmlVersion; }
30 
31  inline std::string GetOutputGDMLFile() const { return fOutputGdmlFilename; }
32 
33  void Load(const std::string& filename);
34 
35  inline TGeoManager* GetGeoManager(const std::string& gdmlFilename) {
36  Load(gdmlFilename);
37  fGeoManager = TGeoManager::Import(GetOutputGDMLFile().c_str());
38  return fGeoManager;
39  }
40 
41  TGeoManager* CreateGeoManager();
42  [[deprecated("Use CreateGeoManager() instead.")]] inline TGeoManager* CreateGeoM() {
43  return CreateGeoManager();
44  }
45 
46  void InitFromConfigFile() override {}
47 
48  void PrintContent();
49 
50  void ReplaceEntity();
51 
52  void ReplaceAttributeWithKeyWord(const std::string& keyword);
53 
54  ClassDefOverride(TRestGDMLParser, 2);
55 };
56 
57 #endif
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
A base class for any REST metadata class.
Definition: TRestMetadata.h:74