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