4 // See the class description in the header file.
7 #include "AliGlobals.h"
11 // static data members
13 AliFiles* AliFiles::fgInstance = 0;
14 const G4String AliFiles::fgkTop = getenv("AG4_INSTALL");
15 const G4String AliFiles::fgkDefaultMacroName = "Config";
16 const G4String AliFiles::fgkDefaultG3CallsName = "g3calls";
17 const G4String AliFiles::fgkRootMacroExtension = ".C";
18 const G4String AliFiles::fgkG4MacroExtension = ".in";
19 const G4String AliFiles::fgkG3CallsExtension = ".dat";
20 const G4String AliFiles::fgkXMLFileExtension = ".xml";
23 : fMacroName(fgkDefaultMacroName),
24 fG3CallsName(fgkDefaultG3CallsName)
28 AliGlobals::Exception(
29 "AliFiles: attempt to create two instances of singleton.");
35 AliFiles::AliFiles(const G4String& config)
37 fG3CallsName(fgkDefaultG3CallsName)
41 AliGlobals::Exception(
42 "AliFiles: attempt to create two instances of singleton.");
48 AliFiles::AliFiles(const G4String& config, const G4String& g3calls)
54 AliGlobals::Exception(
55 "AliFiles: attempt to create two instances of singleton.");
61 AliFiles::~AliFiles() {
67 G4String AliFiles::GetMacroPath(const G4String& macroName,
68 const G4String& moduleName,
69 G4bool isStructure) const
71 // Returns the filepath to Config.C/in with filename extension:
72 // $AG4_INSTALL/macro/XXX/Config
73 // $AG4_INSTALL/macro/STRUCT/XXXConfig
76 G4String name = fgkTop + "/macro/";
79 name = name + moduleName + "/" + macroName;
81 name = name + "STRUCT/"+ fgkDefaultMacroName + moduleName;
88 G4String AliFiles::GetRootMacroPath() const
90 // Returns the filepath:
91 // $ALICE_ROOT/macros/Config.C
95 = fgkTop + "/../macros/" + fMacroName + fgkRootMacroExtension;
100 G4String AliFiles::GetRootMacroPath(const G4String& moduleName,
101 G4bool isStructure) const
103 // Returns the filepath:
104 // $AG4_INSTALL/macro/XXX/Config.C
105 // $AG4_INSTALL/macro/STRUCT/XXXConfig.C
108 G4String name = GetMacroPath(fMacroName, moduleName, isStructure);
109 name = name + fgkRootMacroExtension;
114 G4String AliFiles::GetG4MacroPath(const G4String& moduleName,
115 G4bool isStructure) const
117 // Returns the filepath:
118 // $AG4_INSTALL/macro/XXX/Config.in
119 // $AG4_INSTALL/macro/STRUCT/XXXConfig.in
122 G4String name = GetMacroPath(fgkDefaultMacroName, moduleName, isStructure);
123 name = name + fgkG4MacroExtension;
128 G4String AliFiles::GetG3CallsDatPath(const G4String& moduleName,
129 G4int moduleVersion, G4bool isStructure) const
131 // Returns the filepath:
132 // $AG4_INSTALL/macro/XXX/g3calls_vN.dat
133 // $AG4_INSTALL/macro/STRUCT/g3calls_XXXvN.dat
136 G4String version("v");
137 AliGlobals::AppendNumberToString(version, moduleVersion);
139 G4String name = fgkTop + "/macro/";
142 name = name + moduleName + "/" + fG3CallsName + "_";
144 name = name + "STRUCT/" + fG3CallsName + "_" + moduleName;
146 name = name + version + fgkG3CallsExtension;
151 G4String AliFiles::GetXMLFilePath(const G4String& moduleName,
152 G4int moduleVersion) const
154 // Returns the filepath:
155 // $AG4_INSTALL/xml/XXXvN.xml
158 G4String version = "v";
159 AliGlobals::AppendNumberToString(version, moduleVersion);
162 = fgkTop + "/xml/" + moduleName + version + fgkXMLFileExtension;