BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
g4Config.C
Go to the documentation of this file.
1// Configuration macro for Geant4 VirtualMC
2void Config()
3{
4 /// Create the run configuration
5 /// In constructor user has to specify the geometry input
6 /// and select geometry navigation via the following options:
7 /// - geomVMCtoGeant4 - geometry defined via VMC, G4 native navigation
8 /// - geomVMCtoRoot - geometry defined via VMC, Root navigation
9 /// - geomRoot - geometry defined via Root, Root navigation
10 /// - geomRootToGeant4 - geometry defined via Root, G4 native navigation
11 /// - geomGeant4 - geometry defined via Geant4, G4 native navigation
12 ///
13 /// The second argument in the constructor selects physics list:
14 /// - emStandard - standard em physics (default)
15 /// - emStandard+optical - standard em physics + optical physics
16 /// - XYZ - selected hadron physics list ( XYZ = LHEP, QGSP, ...)
17 /// - XYZ+optical - selected hadron physics list + optical physics
18 ///
19 /// The third argument activates the special processes in the TG4SpecialPhysicsList,
20 /// which implement VMC features:
21 /// - stepLimiter - step limiter (default)
22 /// - specialCuts - VMC cuts
23 /// - specialControls - VMC controls for activation/inactivation selected processes
24 /// - stackPopper - stackPopper process
25 /// When more than one options are selected, they should be separated with '+'
26 /// character: eg. stepLimit+specialCuts.
27 TG4RunConfiguration* runConfiguration = new TG4RunConfiguration("geomRoot", "FTFP_BERT", "stepLimiter+specialCuts");
28
29 /// Create the G4 VMC
30 TGeant4* geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
31 cout << "Geant4 has been created." << endl;
32
33 /// Create the Specific stack
34 CbmStack* stack = new CbmStack(1000);
35 stack->StoreSecondaries(kTRUE);
36 // stack->SetStartZCut(750.); // run6 exclude ECAL + ZDC
37 // stack->SetStartZCut(850.); // run6 exclude ZDC
38 // stack->SetMinPoints(0);
39 geant4->SetStack(stack);
40
41 if (FairRunSim::Instance()->IsExtDecayer()) {
42 TVirtualMCDecayer* decayer = new TPythia8Decayer();
43 geant4->SetExternalDecayer(decayer);
44 }
45
46 /// Customise Geant4 setting
47 /// (verbose level, global range cut, ..)
48 TString configm(gSystem->Getenv("VMCWORKDIR"));
49 TString configm1 = configm + "/gconfig/g4config.in";
50 cout << " -I g4Config() using g4conf macro: " << configm1 << endl;
51
52 // set the common cuts
53 TString cuts = configm + "/gconfig/SetCuts.C";
54 cout << "Physics cuts with script \n " << cuts.Data() << endl;
55 Int_t cut = gROOT->LoadMacro(cuts.Data());
56 if (cut == 0)
57 gInterpreter->ProcessLine("SetCuts()");
58
59 // set geant4 specific stuff
60 geant4->SetMaxNStep(10000); // default is 30000
61 geant4->ProcessGeantMacro(configm1.Data());
62
63 // Activate the parameters defined in tracking media
64 // (DEEMAX, STMIN, STEMAX), which are, be default, ignored.
65 // In Geant4 case, only STEMAX is taken into account.
66 geant4->SetUserParameters(kTRUE);
67}
int Int_t
constexpr Bool_t kTRUE
#define gInterpreter
#define gROOT
R__EXTERN TSystem * gSystem
CbmStack.h.
Definition CbmStack.h:43
void StoreSecondaries(Bool_t choice=kTRUE)
Modifiers.
Definition CbmStack.h:172
const char * Data() const
void Config()
Definition g4Config.C:2