38#include "DetectorConstruction.h"
39#include "MCApplication.h"
42#include "TG4RunConfiguration.h"
46#include "TInterpreter.h"
57void PrintUsage(std::string programName)
59 std::cerr <<
" Usage: " << std::endl;
60 std::cerr <<
" " << programName << std::endl;
62 std::cerr <<
" [-g4g, --g4-geometry]: Geant4 VMC geometry option"
64 std::cerr <<
" [-g4pl, --g4-physics-list]: Geant4 physics list selection"
67 <<
" [-g4sp, --g4-special-physics]: Geant4 special physics selection"
69 std::cerr <<
" [-g4m, --g4-macro]: Geant4 macro" << std::endl;
70 std::cerr <<
" [-g4m2, --g4-macro2]: Geant4 post-init macro "
72 std::cerr <<
" [-g4vm, --g4-vis-macro]: Geant4 visualization macro"
75 std::cerr <<
" [-rm, --root-macro]: Root macro" << std::endl;
76 std::cerr <<
" [-v, --verbose]: verbose option (yes,no)"
82void PrintG4Configuration(
const std::string& programName,
83 const std::string& g4Geometry,
const std::string& g4PhysicsList,
84 const std::string& g4SpecialPhysics,
const std::string& g4Macro,
85 const std::string& g4Macro2,
const std::string& g4VisMacro,
86 const std::string& g4Session,
const std::string&
rootMacro)
88 std::cout <<
" Running " << programName <<
" with options:" << std::endl;
89 std::cout <<
" --g4-geometry: " << g4Geometry << std::endl;
90 std::cout <<
" --g4-physics-list: " << g4PhysicsList << std::endl;
91 if (g4SpecialPhysics.size()) {
92 std::cout <<
" --g4-special-physics: " << g4SpecialPhysics << std::endl;
95 std::cout <<
" --g4-macro: " << g4Macro << std::endl;
97 if (g4Macro2.size()) {
98 std::cout <<
" --g4-macro2: " << g4Macro2 << std::endl;
100 if (g4VisMacro.size()) {
101 std::cout <<
" --g4-vis-macro: " << g4VisMacro << std::endl;
103 if (g4Session.size()) {
104 std::cout <<
" --g4-session: " << g4Session << std::endl;
107 std::cout <<
" --root-macro: " <<
rootMacro << std::endl;
120#ifdef G4MULTITHREADED
121 ROOT::EnableThreadSafety();
128 std::string g4Geometry =
"geomRootToGeant4";
129 std::string g4PhysicsList =
"FTFP_BERT+monopole";
130 std::string g4SpecialPhysics =
"stepLimiter";
131 std::string g4Macro =
"g4config.in";
132 std::string g4Macro2 =
"g4config2.in";
134 std::string g4VisMacro =
"";
135 std::string g4Session =
"";
140 for (Int_t i = 1; i < argc; i = i + 2) {
141 std::cout <<
"processing " << argv[i] <<
" with " << argv[i + 1]
144 if (std::string(argv[i]) ==
"--g4-geometry" ||
145 std::string(argv[i]) ==
"-g4g")
146 g4Geometry = argv[i + 1];
147 else if (std::string(argv[i]) ==
"--g4-physics-list" ||
148 std::string(argv[i]) ==
"-g4pl")
149 g4PhysicsList = argv[i + 1];
150 else if (std::string(argv[i]) ==
"--g4-special-physics" ||
151 std::string(argv[i]) ==
"-g4sp")
152 g4SpecialPhysics = argv[i + 1];
153 else if (std::string(argv[i]) ==
"--g4-macro" ||
154 std::string(argv[i]) ==
"-g4m")
155 g4Macro = argv[i + 1];
156 else if (std::string(argv[i]) ==
"--g4-vis-macro" ||
157 std::string(argv[i]) ==
"-g4vm")
158 g4VisMacro = argv[i + 1];
159 else if (std::string(argv[i]) ==
"--g4-session" ||
160 std::string(argv[i]) ==
"-g4s")
161 g4Session = argv[i + 1];
162 else if (std::string(argv[i]) ==
"--root-macro" ||
163 std::string(argv[i]) ==
"-rm")
166 if (std::string(argv[i]) ==
"--root-macro" || std::string(argv[i]) ==
"-rm")
169 else if (std::string(argv[i]) ==
"--verbose" ||
170 std::string(argv[i]) ==
"-v")
173 PrintUsage(
"testMonopole");
180 PrintG4Configuration(
"testMonopole", g4Geometry, g4PhysicsList,
181 g4SpecialPhysics, g4Macro, g4Macro2, g4VisMacro, g4Session,
rootMacro);
189 "ExampleMonopole",
"The example Monopole MC MC application");
208 g4Geometry, g4PhysicsList, g4SpecialPhysics,
false,
false);
211 TGeant4* geant4 =
new TGeant4(
212 "TGeant4",
"The Geant4 Monte Carlo", runConfiguration, argc, argv);
216 if (g4Macro.size()) {
217 geant4->ProcessGeantMacro(g4Macro.data());
225 if (g4Macro2.size()) {
227 geant4->ProcessGeantMacro(
"g4config2.in");
231 if (g4VisMacro.size()) {
232 geant4->ProcessGeantMacro(g4VisMacro.data());
The detector construction (via TGeo )
void SetAbsorberSizeYZ(Double_t sizeYZ)
void SetAbsorberSizeX(Double_t sizeX)
void SetMaxStepSize(Double_t maxStepSize)
void SetAbsorberMaterial(const TString &name)
Implementation of the TVirtualMCApplication.
void InitMC(const char *setup)
void SetBinSize(Double_t binSize)
void RunMC(Int_t nofEvents)
DetectorConstruction * GetDetectorConstruction() const
int main(int argc, char **argv)
Application main program.