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