44#include "TG4RunConfiguration.h"
49#include "TGeant3TGeo.h"
52#include "TInterpreter.h"
63void PrintUsage(std::string programName)
65 std::cerr <<
" Usage: " << std::endl;
66 std::cerr <<
" " << programName << std::endl;
68 std::cerr <<
" [-g4g, --g4-geometry]: Geant4 VMC geometry option"
70 std::cerr <<
" [-g4pl, --g4-physics-list]: Geant4 physics list selection"
73 <<
" [-g4sp, --g4-special-physics]: Geant4 special physics selection"
75 std::cerr <<
" [-g4m, --g4-macro]: Geant4 macro" << std::endl;
77 <<
" [-g4m2, --g4-macro2]: Geant4 macro run after initialization"
79 std::cerr <<
" [-g4vm, --g4-vis-macro]: Geant4 visualization macro"
83 std::cerr <<
" [-g3g, --g3-geometry]: Geant3 geometry option "
84 "(TGeant3,TGeant3TGeo)"
87 std::cerr <<
" [-rm, --root-macro]: Root macro" << std::endl;
88 std::cerr <<
" [-v, --verbose]: verbose option (yes,no)"
94void PrintG4Configuration(
const std::string& programName,
95 const std::string& g4Geometry,
const std::string& g4PhysicsList,
96 const std::string& g4SpecialPhysics,
const std::string& g4Macro,
97 const std::string& g4Macro2,
const std::string& g4VisMacro,
98 const std::string& g4Session,
const std::string&
rootMacro)
100 std::cout <<
" Running " << programName <<
" with options:" << std::endl;
101 std::cout <<
" --g4-geometry: " << g4Geometry << std::endl;
102 std::cout <<
" --g4-physics-list: " << g4PhysicsList << std::endl;
103 if (g4SpecialPhysics.size()) {
104 std::cout <<
" --g4-special-physics: " << g4SpecialPhysics << std::endl;
106 if (g4Macro.size()) {
107 std::cout <<
" --g4-macro: " << g4Macro << std::endl;
109 if (g4Macro2.size()) {
110 std::cout <<
" --g4-macro2: " << g4Macro2 << std::endl;
112 if (g4VisMacro.size()) {
113 std::cout <<
" --g4-vis-macro: " << g4VisMacro << std::endl;
115 if (g4Session.size()) {
116 std::cout <<
" --g4-session: " << g4Session << std::endl;
119 std::cout <<
" --root-macro: " <<
rootMacro << std::endl;
126void PrintG3Configuration(
const std::string& programName,
127 const std::string& g3Geometry,
const std::string&
rootMacro)
129 std::cout <<
" Running: " << std::endl;
130 std::cout <<
" " << programName << std::endl;
131 std::cout <<
" --g3-geometry: " << g3Geometry << std::endl;
133 std::cout <<
" --root-macro]: " <<
rootMacro << std::endl;
146#ifdef G4MULTITHREADED
147 ROOT::EnableThreadSafety();
154 std::string g4Geometry =
"geomRootToGeant4";
155 std::string g4PhysicsList =
"emStandard+optical";
156 std::string g4SpecialPhysics =
"stepLimiter";
157 std::string g4Macro =
"g4config.in";
158 std::string g4Macro2 =
"g4config2.in";
159 std::string g4VisMacro =
"g4vis.in";
160 std::string g4Session =
"";
163 std::string g3Geometry =
"TGeant3TGeo";
168 for (Int_t i = 1; i < argc; i = i + 2) {
169 std::cout <<
"processing " << argv[i] <<
" with " << argv[i + 1]
172 if (std::string(argv[i]) ==
"--g4-geometry" ||
173 std::string(argv[i]) ==
"-g4g")
174 g4Geometry = argv[i + 1];
175 else if (std::string(argv[i]) ==
"--g4-physics-list" ||
176 std::string(argv[i]) ==
"-g4pl")
177 g4PhysicsList = argv[i + 1];
178 else if (std::string(argv[i]) ==
"--g4-special-physics" ||
179 std::string(argv[i]) ==
"-g4sp")
180 g4SpecialPhysics = argv[i + 1];
181 else if (std::string(argv[i]) ==
"--g4-macro" ||
182 std::string(argv[i]) ==
"-g4m")
183 g4Macro = argv[i + 1];
184 else if (std::string(argv[i]) ==
"--g4-macro2" ||
185 std::string(argv[i]) ==
"-g4m2")
186 g4Macro2 = argv[i + 1];
187 else if (std::string(argv[i]) ==
"--g4-vis-macro" ||
188 std::string(argv[i]) ==
"-g4vm")
189 g4VisMacro = argv[i + 1];
190 else if (std::string(argv[i]) ==
"--g4-session" ||
191 std::string(argv[i]) ==
"-g4s")
192 g4Session = argv[i + 1];
195 if (std::string(argv[i]) ==
"--g3-geometry" ||
196 std::string(argv[i]) ==
"-g3g")
197 g3Geometry = argv[i + 1];
199 else if (std::string(argv[i]) ==
"--root-macro" ||
200 std::string(argv[i]) ==
"-rm")
202 else if (std::string(argv[i]) ==
"--verbose" ||
203 std::string(argv[i]) ==
"-v")
206 PrintUsage(
"testE06");
213 PrintG4Configuration(
"testE06", g4Geometry, g4PhysicsList, g4SpecialPhysics,
214 g4Macro, g4Macro2, g4VisMacro, g4Session,
rootMacro);
217 PrintG3Configuration(
"testE06", g3Geometry,
rootMacro);
230 if (g4Geometry.find(
"VMC") != std::string::npos) {
235 if (g3Geometry ==
"TGeant3") {
247 TGeant4* geant4 =
new TGeant4(
248 "TGeant4",
"The Geant4 Monte Carlo", runConfiguration, argc, argv);
252 if (g4Macro.size()) {
253 geant4->ProcessGeantMacro(g4Macro.data());
259 if (g3Geometry ==
"TGeant3") {
260 geant3 =
new TGeant3(
"C++ Interface to Geant3");
262 else if (g3Geometry ==
"TGeant3TGeo") {
263 geant3 =
new TGeant3TGeo(
"C++ Interface to Geant3");
266 PrintUsage(
"testE06");
269 gMC->SetProcess(
"CKOV", 1);
270 gMC->SetCut(
"CUTELE", 10e-06);
271 gMC->SetCut(
"CUTGAM", 10e-06);
272 geant3->SetSWIT(4, 1000);
287 if (g4Macro.size()) {
288 geant4->ProcessGeantMacro(g4Macro2.data());
291 if (g4VisMacro.size()) {
292 geant4->ProcessGeantMacro(g4VisMacro.data());
Definition of the Ex06MCApplication class.
Definition of the Ex06PrimaryGenerator class.
Implementation of the TVirtualMCApplication.
void RunMC(Int_t nofEvents)
void InitMC(const char *setup)
void SetOldGeometry(Bool_t oldGeometry=kTRUE)
Ex06PrimaryGenerator * GetPrimaryGenerator() const
void SetNofPrimaries(Int_t nofPrimaries)
int main(int argc, char **argv)
Application main program.