]> git.uio.no Git - u/mrichter/AliRoot.git/blame - AliGeant4/AliFiles.cxx
fixed date (in header) replaced with java script
[u/mrichter/AliRoot.git] / AliGeant4 / AliFiles.cxx
CommitLineData
676fb573 1// $Id$
2// Category: global
3//
4// See the class description in the header file.
5
6#include "AliFiles.h"
ec3a86b4 7#include "AliGlobals.h"
676fb573 8
9#include <stdlib.h>
10
11// static data members
12
ec3a86b4 13AliFiles* AliFiles::fgInstance = 0;
14const G4String AliFiles::fgkTop = getenv("AG4_INSTALL");
15const G4String AliFiles::fgkDefaultMacroName = "Config";
16const G4String AliFiles::fgkDefaultG3CallsName = "g3calls";
17const G4String AliFiles::fgkRootMacroExtension = ".C";
18const G4String AliFiles::fgkG4MacroExtension = ".in";
19const G4String AliFiles::fgkG3CallsExtension = ".dat";
20const G4String AliFiles::fgkXMLFileExtension = ".xml";
21
22AliFiles::AliFiles()
23 : fMacroName(fgkDefaultMacroName),
24 fG3CallsName(fgkDefaultG3CallsName)
25{
26 if (fgInstance) {
27 AliGlobals::Exception(
28 "AliFiles: attempt to create two instances of singleton.");
29 };
30
31 fgInstance = this;
32}
33
34AliFiles::AliFiles(const G4String& config)
35 : fMacroName(config),
36 fG3CallsName(fgkDefaultG3CallsName)
37{
38 if (fgInstance) {
39 AliGlobals::Exception(
40 "AliFiles: attempt to create two instances of singleton.");
41 };
42
43 fgInstance = this;
44}
45
46AliFiles::AliFiles(const G4String& config, const G4String& g3calls)
47 : fMacroName(config),
48 fG3CallsName(g3calls)
49{
50 if (fgInstance) {
51 AliGlobals::Exception(
52 "AliFiles: attempt to create two instances of singleton.");
53 };
54
55 fgInstance = this;
676fb573 56}
57
58AliFiles::~AliFiles() {
59//
60}
ec3a86b4 61
62// private methods
63
64G4String AliFiles::GetMacroPath(const G4String& macroName,
65 const G4String& moduleName,
66 G4bool isStructure) const
67{
68// Returns the filepath to Config.C/in with filename extension:
69// $AG4_INSTALL/macro/XXX/Config
70// $AG4_INSTALL/macro/STRUCT/XXXConfig
71// ---
72
73 G4String name = fgkTop + "/macro/";
676fb573 74
ec3a86b4 75 if (!isStructure)
76 name = name + moduleName + "/" + macroName;
77 else
78 name = name + "STRUCT/"+ fgkDefaultMacroName + moduleName;
79
80 return name;
81}
82
83// public methods
84
85G4String AliFiles::GetRootMacroPath() const
86{
87// Returns the filepath:
88// $ALICE_ROOT/macros/Config.C
89// ---
90
91 G4String name
92 = fgkTop + "/../macros/" + fMacroName + fgkRootMacroExtension;
93
94 return name;
95}
96
97G4String AliFiles::GetRootMacroPath(const G4String& moduleName,
98 G4bool isStructure) const
99{
100// Returns the filepath:
101// $AG4_INSTALL/macro/XXX/Config.C
102// $AG4_INSTALL/macro/STRUCT/XXXConfig.C
103// ---
104
105 G4String name = GetMacroPath(fMacroName, moduleName, isStructure);
106 name = name + fgkRootMacroExtension;
107
108 return name;
109}
110
111G4String AliFiles::GetG4MacroPath(const G4String& moduleName,
112 G4bool isStructure) const
113{
114// Returns the filepath:
115// $AG4_INSTALL/macro/XXX/Config.in
116// $AG4_INSTALL/macro/STRUCT/XXXConfig.in
117// ---
118
119 G4String name = GetMacroPath(fgkDefaultMacroName, moduleName, isStructure);
120 name = name + fgkG4MacroExtension;
121
122 return name;
123}
124
125G4String AliFiles::GetG3CallsDatPath(const G4String& moduleName,
126 G4int moduleVersion, G4bool isStructure) const
127{
128// Returns the filepath:
129// $AG4_INSTALL/macro/XXX/g3calls_vN.dat
130// $AG4_INSTALL/macro/STRUCT/g3calls_XXXvN.dat
131// ---
132
133 G4String version("v");
134 AliGlobals::AppendNumberToString(version, moduleVersion);
135
136 G4String name = fgkTop + "/macro/";
137
138 if (!isStructure)
139 name = name + moduleName + "/" + fG3CallsName + "_";
140 else
141 name = name + "STRUCT/" + fG3CallsName + "_" + moduleName;
142
143 name = name + version + fgkG3CallsExtension;
144
145 return name;
146}
147
148G4String AliFiles::GetXMLFilePath(const G4String& moduleName,
149 G4int moduleVersion) const
150{
151// Returns the filepath:
152// $AG4_INSTALL/xml/XXXvN.xml
153// ---
154
155 G4String version = "v";
156 AliGlobals::AppendNumberToString(version, moduleVersion);
157
158 G4String name
159 = fgkTop + "/xml/" + moduleName + version + fgkXMLFileExtension;
160
161 return name;
162}