20 : fPostInitFlag(false)
21 , fPostInitName(
"g4ConfigPostInit.C")
28 LOG(warning) <<
"FairGenericVMCConfig::Setup() Using gConfig.C macro DEPRACATED.";
29 LOG(warning) <<
"Check FairRoot/examples/common/gconfig/ for current YAML implementation.";
34 TString work = getenv(
"VMCWORKDIR");
35 TString work_config = work +
"/gconfig/";
36 work_config.ReplaceAll(
"//",
"/");
38 TString Lib_config = getenv(
"GEANT4VMC_MACRO_DIR");
39 Lib_config.ReplaceAll(
"//",
"/");
40 if (!Lib_config.EndsWith(
"/") && !Lib_config.IsNull()) {
44 TString config_dir = getenv(
"CONFIG_DIR");
45 config_dir.ReplaceAll(
"//",
"/");
47 Bool_t AbsPath = kFALSE;
52 TString cuts = lUserCuts;
54 if (strcmp(mcEngine,
"TGeant4") == 0) {
55 TString g4LibMacro =
"g4libs.C";
57 if (lUserConfig.IsNull()) {
58 g4Macro =
"g4Config.C";
59 lUserConfig = g4Macro;
61 if (lUserConfig.Contains(
"/")) {
64 g4Macro = lUserConfig;
65 LOG(info) <<
"---------------User config is used: " << g4Macro.Data();
67 if (TString(gSystem->FindFile(config_dir.Data(), g4LibMacro))
69 LOG(info) <<
"---User path for Configuration (g4libs.C) is used: " << config_dir.Data();
70 LibMacro = g4LibMacro;
71 }
else if (gSystem->AccessPathName((Lib_config +
"g4libs.C").Data()) ==
false) {
73 LOG(info) <<
"---G4VMC macro path for Configuration (g4libs.C) is used: " << Lib_config.Data();
74 LibMacro = Lib_config +
"g4libs.C";
76 LibFunction =
"g4libs()";
77 if (!AbsPath && TString(gSystem->FindFile(config_dir.Data(), g4Macro)) != TString(
"")) {
78 LOG(info) <<
"---User path for Configuration (g4Config.C) is used: " << config_dir.Data();
79 ConfigMacro = g4Macro;
82 ConfigMacro = lUserConfig;
84 ConfigMacro = work_config + lUserConfig;
88 }
else if (strcmp(mcEngine,
"TGeant3") == 0) {
89 TString g3LibMacro =
"g3libs.C";
90 TString g3Macro =
"g3Config.C";
91 if (lUserConfig.IsNull()) {
92 g3Macro =
"g3Config.C";
93 lUserConfig = g3Macro;
94 LOG(info) <<
"-------------- Standard Config is called ------------------------------------";
96 if (lUserConfig.Contains(
"/")) {
99 g3Macro = lUserConfig;
100 LOG(info) <<
"---------------User config is used: " << g3Macro.Data();
102 if (TString(gSystem->FindFile(config_dir.Data(), g3LibMacro)) != TString(
"")) {
103 LOG(info) <<
"---User path for Configuration (g3libs.C) is used: " << config_dir.Data();
104 LibMacro = g3LibMacro;
105 }
else if (gSystem->AccessPathName((work_config +
"g3libs.C").Data()) ==
false) {
107 LOG(info) <<
"---VMCWORKDIR path for Configuration (g3libs.C) is used: " << work_config.Data();
108 LibMacro = work_config +
"g3libs.C";
110 LibFunction =
"g3libs()";
111 if (!AbsPath && TString(gSystem->FindFile(config_dir.Data(), g3Macro)) != TString(
"")) {
112 LOG(info) <<
"---User path for Configuration (g3Config.C) is used: " << config_dir.Data();
113 ConfigMacro = g3Macro;
116 ConfigMacro = lUserConfig;
118 ConfigMacro = work_config + lUserConfig;
122 }
else if (strcmp(mcEngine,
"TFluka") == 0) {
123 TString flLibMacro =
"fllibs.C";
124 TString flMacro =
"flConfig.C";
125 if (lUserConfig.IsNull()) {
126 flMacro =
"flConfig.C";
127 lUserConfig = flMacro;
129 if (lUserConfig.Contains(
"/")) {
132 flMacro = lUserConfig;
133 LOG(info) <<
"---------------User config is used: " << flMacro.Data();
135 if (TString(gSystem->FindFile(config_dir.Data(), flLibMacro)) != TString(
"")) {
136 LOG(info) <<
"---User path for Configuration (fllibs.C) is used: " << config_dir.Data();
138 flLibMacro = work_config +
"fllibs.C";
140 LibMacro = flLibMacro;
141 LibFunction =
"fllibs()";
142 if (!AbsPath && TString(gSystem->FindFile(config_dir.Data(), flMacro)) != TString(
"")) {
143 LOG(info) <<
"---User path for Configuration (flConfig.C) is used: " << config_dir.Data();
144 ConfigMacro = flMacro;
147 ConfigMacro = lUserConfig;
149 ConfigMacro = work_config + lUserConfig;
154 if (TString(gSystem->FindFile(config_dir.Data(), cuts)) != TString(
"")) {
155 LOG(info) <<
"---User path for Cuts and Processes (SetCuts.C) is used: " << config_dir.Data();
157 cuts = work_config + lUserCuts;
160 if (!LibMacro.IsNull()) {
161 gROOT->LoadMacro(LibMacro.Data());
162 gROOT->ProcessLine(LibFunction.Data());
165 gROOT->LoadMacro(ConfigMacro.Data());
166 gROOT->ProcessLine(
"Config()");
168 gROOT->LoadMacro(cuts);
169 gROOT->ProcessLine(
"SetCuts()");
175 LOG(info) <<
"FairGenericVMCConfig::SetupPostInit() OFF.";
179 LOG(warning) <<
"FairGenericVMCConfig::SetupPostInit() Using " <<
fPostInitName <<
" macro DEPRACATED.";
180 LOG(warning) <<
"Check FairRoot/examples/common/gconfig/ for current YAML implementation.";
182 TString work = getenv(
"VMCWORKDIR");
183 TString work_config = work +
"/gconfig/";
184 work_config.ReplaceAll(
"//",
"/");
186 TString config_dir = getenv(
"CONFIG_DIR");
187 config_dir.ReplaceAll(
"//",
"/");
189 Bool_t AbsPath = kFALSE;
193 if (strcmp(mcEngine,
"TGeant4") == 0) {
196 g4Macro =
"g4ConfigPostInit.C";
203 LOG(info) <<
"---------------User config is used: " << g4Macro.Data();
205 if (!AbsPath && TString(gSystem->FindFile(config_dir.Data(), g4Macro)) != TString(
"")) {
206 LOG(info) <<
"---User path for Configuration (" <<
fPostInitName <<
".C) is used: " << config_dir.Data();
207 ConfigMacro = g4Macro;
216 }
else if (strcmp(mcEngine,
"TGeant3") == 0) {
218 }
else if (strcmp(mcEngine,
"TFluka") == 0) {
221 if (ConfigMacro.Length() > 0) {
222 LOG(info) <<
" SetupPostInit -> \"" << ConfigMacro.Data() <<
"\"";
223 gROOT->LoadMacro(ConfigMacro.Data());
224 gROOT->ProcessLine(
"ConfigPostInit()");
virtual void Setup(const char *mcEngine)
static FairRunSim * Instance()
ClassImp(FairEventBuilder)
virtual void SetupPostInit(const char *mcEngine)
std::string fPostInitName
virtual ~FairGenericVMCConfig()