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";
22 //_____________________________________________________________________________
24 : fMacroName(fgkDefaultMacroName),
25 fG3CallsName(fgkDefaultG3CallsName)
29 AliGlobals::Exception(
30 "AliFiles: attempt to create two instances of singleton.");
36 //_____________________________________________________________________________
37 AliFiles::AliFiles(const G4String& config)
39 fG3CallsName(fgkDefaultG3CallsName)
43 AliGlobals::Exception(
44 "AliFiles: attempt to create two instances of singleton.");
50 //_____________________________________________________________________________
51 AliFiles::AliFiles(const G4String& config, const G4String& g3calls)
57 AliGlobals::Exception(
58 "AliFiles: attempt to create two instances of singleton.");
64 //_____________________________________________________________________________
65 AliFiles::AliFiles(const AliFiles& right) {
67 AliGlobals::Exception("Attempt to copy AliFiles singleton.");
71 //_____________________________________________________________________________
72 AliFiles::~AliFiles() {
78 //_____________________________________________________________________________
80 AliFiles::operator=(const AliFiles& right)
82 // check assignement to self
83 if (this == &right) return *this;
85 AliGlobals::Exception("Attempt to assign AliFiles singleton.");
92 //_____________________________________________________________________________
93 G4String AliFiles::GetMacroPath(const G4String& macroName,
94 const G4String& moduleName,
95 G4bool isStructure) const
97 // Returns the filepath to Config.C/in with filename extension:
98 // $AG4_INSTALL/macro/XXX/Config
99 // $AG4_INSTALL/macro/STRUCT/XXXConfig
102 G4String name = fgkTop + "/macro/";
105 name = name + moduleName + "/" + macroName;
107 name = name + "STRUCT/"+ fgkDefaultMacroName + moduleName;
114 //_____________________________________________________________________________
115 G4String AliFiles::GetRootMacroPath() const
117 // Returns the filepath:
118 // $ALICE_ROOT/macros/Config.C
122 = fgkTop + "/../macros/" + fMacroName + fgkRootMacroExtension;
127 //_____________________________________________________________________________
128 G4String AliFiles::GetRootMacroPath(const G4String& moduleName,
129 G4bool isStructure) const
131 // Returns the filepath:
132 // $AG4_INSTALL/macro/XXX/Config.C
133 // $AG4_INSTALL/macro/STRUCT/XXXConfig.C
136 G4String name = GetMacroPath(fMacroName, moduleName, isStructure);
137 name = name + fgkRootMacroExtension;
142 //_____________________________________________________________________________
143 G4String AliFiles::GetG4MacroPath(const G4String& moduleName,
144 G4bool isStructure) const
146 // Returns the filepath:
147 // $AG4_INSTALL/macro/XXX/Config.in
148 // $AG4_INSTALL/macro/STRUCT/XXXConfig.in
151 G4String name = GetMacroPath(fgkDefaultMacroName, moduleName, isStructure);
152 name = name + fgkG4MacroExtension;
157 //_____________________________________________________________________________
158 G4String AliFiles::GetG3CallsDatPath(const G4String& moduleName,
159 G4int moduleVersion, G4bool isStructure) const
161 // Returns the filepath:
162 // $AG4_INSTALL/macro/XXX/g3calls_vN.dat
163 // $AG4_INSTALL/macro/STRUCT/g3calls_XXXvN.dat
166 G4String version("v");
167 AliGlobals::AppendNumberToString(version, moduleVersion);
169 G4String name = fgkTop + "/macro/";
172 name = name + moduleName + "/" + fG3CallsName + "_";
174 name = name + "STRUCT/" + fG3CallsName + "_" + moduleName;
176 name = name + version + fgkG3CallsExtension;
181 //_____________________________________________________________________________
182 G4String AliFiles::GetXMLFilePath(const G4String& moduleName,
183 G4int moduleVersion) const
185 // Returns the filepath:
186 // $AG4_INSTALL/xml/XXXvN.xml
189 G4String version = "v";
190 AliGlobals::AppendNumberToString(version, moduleVersion);
193 = fgkTop + "/xml/" + moduleName + version + fgkXMLFileExtension;