]>
Commit | Line | Data |
---|---|---|
676fb573 | 1 | // $Id$ |
2 | // Category: geometry | |
3 | // | |
4ecb3cfd | 4 | // Author: I. Hrivnacova |
5 | // | |
6 | // Class AliModuleConstruction | |
7 | // --------------------------- | |
676fb573 | 8 | // See the class description in the header file. |
9 | ||
10 | #include "AliModuleConstruction.h" | |
11 | #include "AliGlobals.h" | |
80ed9a99 | 12 | #include "AliFiles.h" |
13 | #include "AliRun.h" | |
c97337f9 | 14 | #include "AliModule.h" |
4ecb3cfd | 15 | |
80ed9a99 | 16 | #include <G4UImanager.hh> |
17 | ||
18 | #include <TROOT.h> | |
19 | #include <TCint.h> | |
676fb573 | 20 | |
676fb573 | 21 | |
78ca1e9c | 22 | //_____________________________________________________________________________ |
80ed9a99 | 23 | AliModuleConstruction::AliModuleConstruction(const G4String& moduleName, |
24 | G4int version, | |
25 | AliModuleType moduleType) | |
26 | : fAliModule(0), | |
27 | fModuleName(moduleName), | |
28 | fType(moduleType), | |
29 | fVersion(version), | |
30 | fProcessConfig(true), | |
676fb573 | 31 | fReadGeometry(false), |
32 | fWriteGeometry(false), | |
80ed9a99 | 33 | fDataFilePath("") { |
676fb573 | 34 | // |
676fb573 | 35 | } |
36 | ||
78ca1e9c | 37 | //_____________________________________________________________________________ |
80ed9a99 | 38 | AliModuleConstruction::AliModuleConstruction() |
39 | : fAliModule(0), | |
40 | fModuleName(""), | |
41 | fType(kDetector), | |
42 | fVersion(-1), | |
43 | fProcessConfig(true), | |
44 | fReadGeometry(false), | |
45 | fWriteGeometry(false), | |
46 | fDataFilePath("") { | |
676fb573 | 47 | // |
676fb573 | 48 | } |
49 | ||
78ca1e9c | 50 | //_____________________________________________________________________________ |
80ed9a99 | 51 | AliModuleConstruction::AliModuleConstruction(const AliModuleConstruction& right) |
52 | { | |
676fb573 | 53 | // |
80ed9a99 | 54 | // copy stuff |
55 | *this = right; | |
676fb573 | 56 | } |
57 | ||
78ca1e9c | 58 | //_____________________________________________________________________________ |
676fb573 | 59 | AliModuleConstruction::~AliModuleConstruction() |
60 | { | |
61 | // | |
676fb573 | 62 | } |
63 | ||
64 | // operators | |
65 | ||
78ca1e9c | 66 | //_____________________________________________________________________________ |
676fb573 | 67 | AliModuleConstruction& |
68 | AliModuleConstruction::operator=(const AliModuleConstruction& right) | |
69 | { | |
70 | // check assignement to self | |
71 | if (this == &right) return *this; | |
72 | ||
676fb573 | 73 | fAliModule = right.fAliModule; |
80ed9a99 | 74 | fModuleName = right.fModuleName; |
75 | fVersion = right.fVersion; | |
76 | fType = right.fType; | |
77 | fProcessConfig = right.fProcessConfig; | |
676fb573 | 78 | fReadGeometry = right.fReadGeometry; |
79 | fWriteGeometry = right.fWriteGeometry; | |
80 | fDataFilePath = right.fDataFilePath; | |
58c0119e | 81 | |
676fb573 | 82 | return *this; |
83 | } | |
84 | ||
78ca1e9c | 85 | //_____________________________________________________________________________ |
676fb573 | 86 | G4int |
87 | AliModuleConstruction::operator==(const AliModuleConstruction& right) const | |
88 | { | |
89 | // | |
90 | return 0; | |
91 | } | |
92 | ||
78ca1e9c | 93 | //_____________________________________________________________________________ |
676fb573 | 94 | G4int |
95 | AliModuleConstruction::operator!=(const AliModuleConstruction& right) const | |
96 | { | |
97 | // | |
98 | G4int returnValue = 1; | |
99 | if (*this == right) returnValue = 0; | |
100 | ||
101 | return returnValue; | |
102 | } | |
103 | ||
78ca1e9c | 104 | //_____________________________________________________________________________ |
80ed9a99 | 105 | void AliModuleConstruction::Configure() |
676fb573 | 106 | { |
80ed9a99 | 107 | // Executes the detector setup Root macro |
108 | // (extracted from AliRoot Config.C) and | |
109 | // G4 macro. | |
676fb573 | 110 | // --- |
111 | ||
80ed9a99 | 112 | AliFiles* files = AliFiles::Instance(); |
676fb573 | 113 | |
80ed9a99 | 114 | // filepaths and macro names |
115 | G4bool isStructure = (fType == kStructure); | |
116 | G4String rootFilePath | |
117 | = files->GetRootMacroPath(GetDetName(), isStructure); | |
118 | G4String g4FilePath | |
119 | = files->GetG4MacroPath(GetDetName(), isStructure); | |
120 | fDataFilePath | |
121 | = files->GetG3CallsDatPath(GetDetName(), fVersion, isStructure); | |
122 | ||
123 | // load and execute aliroot config macro | |
124 | if (fProcessConfig) { | |
125 | gROOT->LoadMacro(rootFilePath); | |
126 | G4String macroName = files->GetDefaultMacroName(); | |
127 | //macroName = macroName + "_" + GetDetName(); | |
128 | macroName = macroName + "("; | |
129 | AliGlobals::AppendNumberToString(macroName, fVersion); | |
130 | macroName = macroName + ")"; | |
131 | gInterpreter->ProcessLine(macroName); | |
132 | } | |
133 | ||
134 | // process g4 config macro | |
135 | G4String command = "/control/execute "; | |
136 | G4UImanager* pUI = G4UImanager::GetUIpointer(); | |
137 | pUI->ApplyCommand(command + g4FilePath); | |
138 | ||
139 | // get AliModule created in Config.C macro | |
140 | fAliModule = gAlice->GetModule(GetDetName()); | |
141 | if (!fAliModule) { | |
b9396d61 | 142 | G4String text = "AliModuleConstruction::Configure:\n"; |
80ed9a99 | 143 | text = text + " AliModule " + GetDetName(); |
144 | text = text + " has not been found in gAlice."; | |
145 | AliGlobals::Exception(text); | |
676fb573 | 146 | } |
147 | } | |
148 |