]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/g4Config.C
Transient pointer to AliRunDigitizer
[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] gAlice->Init("g4Config.C");        
11 // root [1] gAlice->Run();      
12 //
13 // You can also start from a mini GUI - g4menu.C.
14 // See description in this macro.
15         
16
17 void Config()
18 {
19   // ============================= 
20   // Geant4
21   // ============================= 
22
23   // Load Geant4 + Geant4 VMC libraries
24   //
25   if (gClassTable->GetID("TGeant4") == -1) {
26     // Load Geant4 libraries 
27     if (!gInterpreter->IsLoaded("$ALICE/geant4_vmc/examples/macro/g4libs.C")) {
28       gROOT->LoadMacro("$ALICE/geant4_vmc/examples/macro/g4libs.C");
29       gInterpreter->ProcessLine("g4libs()");
30     }
31   }    
32
33   // Create Geant4 VMC
34   //  
35   if (!gMC) {
36
37     TG4RunConfiguration* runConfiguration 
38       = new TG4RunConfiguration(true);
39         
40     TGeant4* geant4
41        = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
42
43     cout << "Geant4 has been created." << endl;
44   }      
45   else 
46     cout << "Monte Carlo has been already created." << endl;
47     
48   // Switch on hadron physics
49   geant4->ProcessGeantCommand("/mcPhysics/setHadron true");  
50
51   // Switch on special cuts process
52   geant4->ProcessGeantCommand("/mcPhysics/setSpecialCuts true");  
53   geant4->ProcessGeantCommand("/run/particle/applyCuts");  
54
55   // ============================= 
56   // AliRoot setup
57   // ============================= 
58
59   gROOT->LoadMacro("g4ConfigCommon.C");
60   ConfigCommon(false);
61 }