]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/g4Config.C
update EMCal EP v2
[u/mrichter/AliRoot.git] / macros / g4Config.C
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
10 // root [0] AliSimulation sim("$ALICE_ROOT/macros/g4Config.C");        
11 // root [1] .... customize your simulation setting here        
12 // root [1] sim.Run(10);
13 //
14 // You can also start from a mini GUI - g4menu.C.
15 // See description in this macro.
16 //
17 // By I. Hrivnacova, IPN Orsay
18         
19
20 void Config()
21 {
22   cout << "Running g4Config.C ... " << endl;
23
24   // AliRoot setup
25   //
26   gROOT->LoadMacro("$ALICE_ROOT/macros/g4ConfigCommon1.C");
27   ConfigCommon1();
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   //  
41   TGeant4 *geant4 = 0;
42   if ( ! gMC ) {
43     TG4RunConfiguration* runConfiguration 
44       = new TG4RunConfiguration("geomRoot", 
45                                 "QGSP_BERT_EMV+optical", 
46                                 "specialCuts+stackPopper+stepLimiter",
47                                  true);
48 //      = new TG4RunConfiguration("geomRootToGeant4",
49 //                                "emStandard+optical", 
50 //                                "specialCuts+specialControls+stackPopper+stepLimiter",
51 //                                 true);
52       
53
54     geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
55     cout << "Geant4 has been created." << endl;
56   } 
57   else {
58     cout << "Monte Carlo has been already created." << endl;
59   }  
60
61   // Customization of Geant4 VMC
62   //
63
64   geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 0.01 mm"); 
65   geant4->ProcessGeantCommand("/mcVerbose/all 1");  
66
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");  
80
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();
98
99   cout << "Running g4Config.C finished ... " << endl;
100 }