]> git.uio.no Git - u/mrichter/AliRoot.git/blame - macros/g4Config.C
Include cstdlib (gcc 4.3.0)
[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
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
17void Config()
18{
9ac91a91 19 // AliRoot setup
20 //
21 gROOT->LoadMacro("g4ConfigCommon.C");
22 ConfigCommon();
1fccbbe0 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()");
9ac91a91 31 // Load G4root library (for G4 navigation with TGeo)
32 gSystem->Load("libG4root");
1fccbbe0 33 }
34 }
35
36 // Create Geant4 VMC
37 //
9ac91a91 38 TGeant4 *geant4 = 0;
1fccbbe0 39 if (!gMC) {
1fccbbe0 40 TG4RunConfiguration* runConfiguration
9ac91a91 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);
1fccbbe0 53
9ac91a91 54 geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
1fccbbe0 55 cout << "Geant4 has been created." << endl;
9ac91a91 56 } else {
1fccbbe0 57 cout << "Monte Carlo has been already created." << endl;
9ac91a91 58 }
1fccbbe0 59
9ac91a91 60 //
61 // Set External decayer
62 TVirtualMCDecayer *decayer = new AliDecayerPythia();
7354fb71 63
9ac91a91 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
1fccbbe0 72
9ac91a91 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);
1fccbbe0 87
9ac91a91 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");
1fccbbe0 110}