]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/g4Config.C
Exec changed to UserExec.
[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 // By I. Hrivnacova, IPN Orsay
17         
18
19 void Config()
20 {
21   cout << "Running g4Config.C ... " << endl;
22
23   // AliRoot setup
24   //
25   gROOT->LoadMacro("$ALICE_ROOT/macros/g4ConfigCommon.C");
26   ConfigCommon();
27
28   // Load Geant4 + Geant4 VMC libraries
29   //
30   if (gClassTable->GetID("TGeant4") == -1) {
31     // Load Geant4 libraries 
32     if (!gInterpreter->IsLoaded("$ALICE/geant4_vmc/examples/macro/g4libs.C")) {
33       gROOT->LoadMacro("$ALICE/geant4_vmc/examples/macro/g4libs.C");
34       gInterpreter->ProcessLine("g4libs()");
35     }
36   }    
37
38   // Create Geant4 VMC
39   //  
40   TGeant4 *geant4 = 0;
41   if (!gMC) {
42     TG4RunConfiguration* runConfiguration 
43       = new TG4RunConfiguration("geomRoot", 
44                                 "emStandard+optical", 
45                                 "specialCuts+specialControls+stackPopper");
46 //      = new TG4RunConfiguration("geomRootToGeant4",
47 //                                "emStandard+optical", 
48 //                                "specialCuts+specialControls+stackPopper",
49 //                                 true);
50       
51
52     geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
53     cout << "Geant4 has been created." << endl;
54   } else {
55     cout << "Monte Carlo has been already created." << endl;
56   }  
57     
58   //
59   // Set External decayer
60   TVirtualMCDecayer *decayer = new AliDecayerPythia();
61
62   decayer->SetForceDecay(kAll);
63   decayer->Init();
64   gMC->SetExternalDecayer(decayer);
65   
66   //=======================================================================
67   // ************* STEERING parameters FOR ALICE SIMULATION **************
68   // --- Specify event type to be tracked through the ALICE setup
69   // --- All positions are in cm, angles in degrees, and P and E in GeV
70
71   gMC->SetProcess("DCAY",1);
72   gMC->SetProcess("PAIR",1);
73   gMC->SetProcess("COMP",1);
74   gMC->SetProcess("PHOT",1);
75   gMC->SetProcess("PFIS",0);
76   gMC->SetProcess("DRAY",0);
77   gMC->SetProcess("ANNI",1);
78   gMC->SetProcess("BREM",1);
79   gMC->SetProcess("MUNU",1);
80   gMC->SetProcess("CKOV",1);
81   gMC->SetProcess("HADR",1);
82   gMC->SetProcess("LOSS",2);
83   gMC->SetProcess("MULS",1);
84   //gMC->SetProcess("RAYL",1);
85
86   Float_t cut = 1.e-3;        // 1MeV cut by default
87   Float_t tofmax = 1.e10;
88
89   gMC->SetCut("CUTGAM", cut);
90   gMC->SetCut("CUTELE", cut);
91   gMC->SetCut("CUTNEU", cut);
92   gMC->SetCut("CUTHAD", cut);
93   gMC->SetCut("CUTMUO", cut);
94   gMC->SetCut("BCUTE",  cut); 
95   gMC->SetCut("BCUTM",  cut); 
96   gMC->SetCut("DCUTE",  cut); 
97   gMC->SetCut("DCUTM",  cut); 
98   gMC->SetCut("PPCUTM", cut);
99   gMC->SetCut("TOFMAX", tofmax); 
100
101   // Set apply cuts 
102   geant4->ProcessGeantCommand("/run/particle/applyCuts");  
103   // geant4->ProcessGeantCommand("/mcVerbose/geometryManager 2");  
104   geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2");  
105   geant4->ProcessGeantCommand("/mcDet/volNameSeparator !");
106   geant4->ProcessGeantCommand("/mcControl/g3Defaults");
107   geant4->ProcessGeantCommand("/mcPhysics/setStackPopperSelection e+ e- pi+ pi- kaon+ kaon- gamma");
108   // geant4->ProcessGeantCommand("/tracking/verbose 1");  
109
110   cout << "Running g4Config.C finished ... " << endl;
111 }