VMC Examples Version 6.6
Loading...
Searching...
No Matches
exampleMonopole.cxx File Reference

The Geant4 VMC example Monopole application executable. More...

#include "DetectorConstruction.h"
#include "MCApplication.h"
#include "TROOT.h"
Include dependency graph for exampleMonopole.cxx:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 Application main program.
 

Detailed Description

The Geant4 VMC example Monopole application executable.

The Geant4 VMC application executable with explicitely instantiated TGeant3 or TGeant4 and linked with all libraries.

Date
15/07/2018
Author
I. Hrivnacova; IPN, Orsay

Definition in file exampleMonopole.cxx.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Application main program.

Definition at line 31 of file exampleMonopole.cxx.

32{
33#ifdef USE_GEANT3
34 // This example cannot run with Geant3
35 std::cerr << "Monopole example: Geant3 is not supported." << std::endl;
36 return 1;
37#endif
38
39 // Initialize Root threading.
40 // (Multi-threading is triggered automatically if Geant4 was built
41 // in MT mode.)
42#ifdef G4MULTITHREADED
43 ROOT::EnableThreadSafety();
44#endif
45
46 // Create MC application
48 "ExampleMonopole", "The exampleMonopole MC application");
49 // Set detector parameters
50 // /testex/det/setMat G4_Si
51 // /testex/det/setSizeX 10 cm
52 // /testex/det/setSizeYZ 20 cm
53 // /testex/det/setStepSize 0.2 mm
54 // /testex/run/binSize 0.2 mm
57 detector->SetAbsorberMaterial("Si");
58 detector->SetAbsorberSizeX(10);
59 detector->SetAbsorberSizeYZ(20);
60 detector->SetMaxStepSize(0.02);
61 appl->SetBinSize(0.02);
62
63#ifdef USE_GEANT4
64 // RunConfiguration for Geant4
65 TG4RunConfiguration* runConfiguration = new TG4RunConfiguration(
66 "geomRootToGeant4", "FTFP_BERT+monopole", "stepLimiter", false, false);
67
68 // TGeant4
69 TGeant4* geant4 = new TGeant4(
70 "TGeant4", "The Geant4 Monte Carlo", runConfiguration, argc, argv);
71 std::cout << "Geant4 has been created." << std::endl;
72
73 // Customise Geant4 setting
74 // (verbose level, global range cut, ..)
75 geant4->ProcessGeantMacro("g4config.in");
76#endif
77
78 // Run from this main
79 appl->InitMC("");
80
81#ifdef USE_GEANT4
82 // Customise Geant4 setting after initialization:
83 // Physics list
84 geant4->ProcessGeantMacro("g4config2.in");
85#endif
86
87#ifdef USE_GEANT4
88 // Setting Geant4 visualization
89 geant4->ProcessGeantMacro("g4vis.in");
90#endif
91
92 appl->RunMC(5);
93
94 delete appl;
95}
The detector construction (via TGeo )
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