This is a backward incompatible change in AliRoot. The following methods have been...
[u/mrichter/AliRoot.git] / macros / g4Config.C
CommitLineData
1fccbbe0 1// $Id$
2//
3// Configuration macro for running aliroot with Geant4.
4// All AliRoot specifics are defined in g4ConfigCommon.C
5//
6// In order to run aliroot with Geant4, you have to Initialize
7// AliRun with this g4Config.C
8//
9// aliroot
dde0a601 10// root [0] AliSimulation sim("$ALICE_ROOT/macros/g4Config.C");
11// root [1] .... customize your simulation setting here
12// root [1] sim.Run(10);
1fccbbe0 13//
14// You can also start from a mini GUI - g4menu.C.
15// See description in this macro.
e14b4d5a 16//
17// By I. Hrivnacova, IPN Orsay
1fccbbe0 18
19
20void Config()
21{
e14b4d5a 22 cout << "Running g4Config.C ... " << endl;
23
9ac91a91 24 // AliRoot setup
25 //
dde0a601 26 gROOT->LoadMacro("$ALICE_ROOT/macros/g4ConfigCommon1.C");
27 ConfigCommon1();
1fccbbe0 28
29 // Load Geant4 + Geant4 VMC libraries
30 //
31 if (gClassTable->GetID("TGeant4") == -1) {
32 // Load Geant4 libraries
33 if (!gInterpreter->IsLoaded("$ALICE/geant4_vmc/examples/macro/g4libs.C")) {
34 gROOT->LoadMacro("$ALICE/geant4_vmc/examples/macro/g4libs.C");
35 gInterpreter->ProcessLine("g4libs()");
36 }
37 }
38
39 // Create Geant4 VMC
40 //
9ac91a91 41 TGeant4 *geant4 = 0;
dde0a601 42 if ( ! gMC ) {
1fccbbe0 43 TG4RunConfiguration* runConfiguration
e14b4d5a 44 = new TG4RunConfiguration("geomRoot",
dde0a601 45 "QGSP_BERT_EMV+optical",
46 "specialCuts+stackPopper+stepLimiter",
8d121203 47 true);
e14b4d5a 48// = new TG4RunConfiguration("geomRootToGeant4",
49// "emStandard+optical",
dde0a601 50// "specialCuts+specialControls+stackPopper+stepLimiter",
e14b4d5a 51// true);
9ac91a91 52
1fccbbe0 53
9ac91a91 54 geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
1fccbbe0 55 cout << "Geant4 has been created." << endl;
dde0a601 56 }
57 else {
1fccbbe0 58 cout << "Monte Carlo has been already created." << endl;
9ac91a91 59 }
1fccbbe0 60
dde0a601 61 // Customization of Geant4 VMC
62 //
1fccbbe0 63
dde0a601 64 geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 0.01 mm");
65 geant4->ProcessGeantCommand("/mcVerbose/all 1");
9ac91a91 66
dde0a601 67 // Uncomment this line to get a detail info from each step
68 //geant4->ProcessGeantCommand("/tracking/verbose 1");
69
70 // More info from the physics list
71 // the verbosity level is passed to all contained physics lists and their
72 // physics builders
73 //geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2");
74
75 // More info from optical processes
76 //geant4->ProcessGeantCommand("/mcVerbose/opticalPhysicsList 3");
77
78 // More info from geometry building
79 //geant4->ProcessGeantCommand("/mcVerbose/geometryManager 1");
9ac91a91 80
dde0a601 81 // More info from setting geometry properties (in materials and surfaces)
82 // for optical physics
83 //geant4->ProcessGeantCommand("/mcVerbose/opGeometryManager 1");
84
85 // More info about regions construction
86 // and conversion of VMC cuts in cuts in range per regions
87 //geant4->ProcessGeantCommand("/mcVerbose/regionsManager 2");
88
89 // Suppress verbose info from tracks which reached maximum number of steps
90 // (default value is 30000)
91 geant4->ProcessGeantCommand("/mcTracking/loopVerbose 0");
92
93 // AliRoot event generator
94 // (it has to be created after MC, as it may use decayer via VMC)
95 //
96 gROOT->LoadMacro("$ALICE_ROOT/macros/g4ConfigCommon2.C");
97 ConfigCommon2();
e14b4d5a 98
99 cout << "Running g4Config.C finished ... " << endl;
1fccbbe0 100}