4 // Author: I. Hrivnacova
8 // See the class description in the header file.
11 #include "AliGlobals.h"
15 // static data members
17 AliFiles* AliFiles::fgInstance = 0;
18 const G4String AliFiles::fgkTop = getenv("AG4_INSTALL");
19 const G4String AliFiles::fgkDefaultMacroName = "Config";
20 const G4String AliFiles::fgkDefaultG3CallsName = "g3calls";
21 const G4String AliFiles::fgkRootMacroExtension = ".C";
22 const G4String AliFiles::fgkG4MacroExtension = ".in";
23 const G4String AliFiles::fgkG3CallsExtension = ".dat";
24 const G4String AliFiles::fgkXMLFileExtension = ".xml";
26 //_____________________________________________________________________________
28 : fMacroName(fgkDefaultMacroName),
29 fG3CallsName(fgkDefaultG3CallsName)
33 AliGlobals::Exception(
34 "AliFiles: attempt to create two instances of singleton.");
40 //_____________________________________________________________________________
41 AliFiles::AliFiles(const G4String& config)
43 fG3CallsName(fgkDefaultG3CallsName)
47 AliGlobals::Exception(
48 "AliFiles: attempt to create two instances of singleton.");
54 //_____________________________________________________________________________
55 AliFiles::AliFiles(const G4String& config, const G4String& g3calls)
61 AliGlobals::Exception(
62 "AliFiles: attempt to create two instances of singleton.");
68 //_____________________________________________________________________________
69 AliFiles::AliFiles(const AliFiles& right) {
71 AliGlobals::Exception("Attempt to copy AliFiles singleton.");
75 //_____________________________________________________________________________
76 AliFiles::~AliFiles() {
82 //_____________________________________________________________________________
84 AliFiles::operator=(const AliFiles& right)
86 // check assignement to self
87 if (this == &right) return *this;
89 AliGlobals::Exception("Attempt to assign AliFiles singleton.");
96 //_____________________________________________________________________________
97 G4String AliFiles::GetMacroPath(const G4String& macroName,
98 const G4String& moduleName,
99 G4bool isStructure) const
101 // Returns the filepath to Config.C/in with filename extension:
102 // $AG4_INSTALL/macro/XXX/Config
103 // $AG4_INSTALL/macro/STRUCT/XXXConfig
106 G4String name = fgkTop + "/macro/";
109 name = name + moduleName + "/" + macroName;
111 name = name + "STRUCT/"+ fgkDefaultMacroName + moduleName;
118 //_____________________________________________________________________________
119 G4String AliFiles::GetRootMacroPath() const
121 // Returns the filepath:
122 // $ALICE_ROOT/macros/Config.C
126 = fgkTop + "/../macros/" + fMacroName + fgkRootMacroExtension;
131 //_____________________________________________________________________________
132 G4String AliFiles::GetRootMacroPath(const G4String& moduleName,
133 G4bool isStructure) const
135 // Returns the filepath:
136 // $AG4_INSTALL/macro/XXX/Config.C
137 // $AG4_INSTALL/macro/STRUCT/XXXConfig.C
140 G4String name = GetMacroPath(fMacroName, moduleName, isStructure);
141 name = name + fgkRootMacroExtension;
146 //_____________________________________________________________________________
147 G4String AliFiles::GetG4MacroPath(const G4String& moduleName,
148 G4bool isStructure) const
150 // Returns the filepath:
151 // $AG4_INSTALL/macro/XXX/Config.in
152 // $AG4_INSTALL/macro/STRUCT/XXXConfig.in
155 G4String name = GetMacroPath(fgkDefaultMacroName, moduleName, isStructure);
156 name = name + fgkG4MacroExtension;
161 //_____________________________________________________________________________
162 G4String AliFiles::GetG3CallsDatPath(const G4String& moduleName,
163 G4int moduleVersion, G4bool isStructure) const
165 // Returns the filepath:
166 // $AG4_INSTALL/macro/XXX/g3calls_vN.dat
167 // $AG4_INSTALL/macro/STRUCT/g3calls_XXXvN.dat
170 G4String version("v");
171 AliGlobals::AppendNumberToString(version, moduleVersion);
173 G4String name = fgkTop + "/macro/";
176 name = name + moduleName + "/" + fG3CallsName + "_";
178 name = name + "STRUCT/" + fG3CallsName + "_" + moduleName;
180 name = name + version + fgkG3CallsExtension;
185 //_____________________________________________________________________________
186 G4String AliFiles::GetXMLFilePath(const G4String& moduleName,
187 G4int moduleVersion) const
189 // Returns the filepath:
190 // $AG4_INSTALL/xml/XXXvN.xml
193 G4String version = "v";
194 AliGlobals::AppendNumberToString(version, moduleVersion);
197 = fgkTop + "/xml/" + moduleName + version + fgkXMLFileExtension;