In vmctest/*/g4Config.C:
[u/mrichter/AliRoot.git] / test / vmctest / gun / g4Config.C
CommitLineData
267e5cd8 1// $Id$
2//
3// Configuration macro for running aliroot with Geant4
4// with primary events read from external file.
5//
6// By I. Hrivnacova, IPN Orsay
7
8
9void Config()
10{
11 cout << "Running g4Config.C ... " << endl;
12
13 // AliRoot setup
14 //
15 gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/gun/commonConfig.C");
d111ffce 16 commonConfig();
17
18 // TPC primary ionization
19 AliTPC* TPC = (AliTPC*)gAlice->GetDetector("TPC");
20 if ( ! TPC )
21 cerr << "Cannot get TPC detector" << endl;
22 else {
23 cerr << "Setting TPC primary ionization" << endl;
24 TPC->SetPrimaryIonisation(); // not used with Geant3
25 }
267e5cd8 26
27 // Load Geant4 + Geant4 VMC libraries
28 //
29 if (gClassTable->GetID("TGeant4") == -1) {
30 // Load Geant4 libraries
31 if (!gInterpreter->IsLoaded("$ALICE/geant4_vmc/examples/macro/g4libs.C")) {
32 gROOT->LoadMacro("$ALICE/geant4_vmc/examples/macro/g4libs.C");
33 gInterpreter->ProcessLine("g4libs()");
34 }
35 }
36
37 // Create Geant4 VMC
38 //
39 TGeant4 *geant4 = 0;
40 if ( ! gMC ) {
41 TG4RunConfiguration* runConfiguration
42 = new TG4RunConfiguration("geomRoot",
43 "QGSP_BERT_EMV+optical",
44 "specialCuts+stackPopper+stepLimiter",
45 true);
46// = new TG4RunConfiguration("geomRootToGeant4",
47// "emStandard+optical",
48// "specialCuts+specialControls+stackPopper+stepLimiter",
49// true);
50
e2750a44 51 geant4 = new TGeant4("TGeant4",
52 "The Geant4 Monte Carlo : QGSP_BERT_EMV+optical",
53 runConfiguration);
54 // Repeat physics selection in the title; to be removed
55 // with new geant4_vmc tag (1.13)
56
267e5cd8 57 cout << "Geant4 has been created." << endl;
58 }
59 else {
60 cout << "Monte Carlo has been already created." << endl;
61 }
62
63 // Customization of Geant4 VMC
64 //
65
267e5cd8 66 geant4->ProcessGeantCommand("/mcVerbose/all 1");
d111ffce 67 geant4->ProcessGeantCommand("/mcVerbose/geometryManager 1");
267e5cd8 68 geant4->ProcessGeantCommand("/mcVerbose/opGeometryManager 1");
69 geant4->ProcessGeantCommand("/mcTracking/loopVerbose 0");
70 geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 0.01 mm");
267e5cd8 71 geant4->ProcessGeantCommand("/mcPhysics/selectOpProcess Scintillation");
72 geant4->ProcessGeantCommand("/mcPhysics/setOpProcessActivation false");
73 geant4->ProcessGeantCommand("/mcTracking/skipNeutrino true");
d111ffce 74 geant4->ProcessGeantCommand("/mcDet/setMaxStepInLowDensityMaterials 1 cm");
267e5cd8 75
76 // Uncomment this line to get a detail info from each step
d111ffce 77 //geant4->ProcessGeantCommand("/tracking/verbose 1");
267e5cd8 78
79 // More info from the physics list
80 // the verbosity level is passed to all contained physics lists and their
81 // physics builders
82 //geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2");
83
84 // More info from optical processes
85 //geant4->ProcessGeantCommand("/mcVerbose/opticalPhysicsList 3");
86
87 // More info from geometry building
88 //geant4->ProcessGeantCommand("/mcVerbose/geometryManager 1");
89
90 // More info from setting geometry properties (in materials and surfaces)
91 // for optical physics
92 //geant4->ProcessGeantCommand("/mcVerbose/opGeometryManager 1");
93
94 // More info about regions construction
95 // and conversion of VMC cuts in cuts in range per regions
96 // geant4->ProcessGeantCommand("/mcVerbose/regionsManager 2");
d111ffce 97 // geant4->ProcessGeantCommand("/mcRegions/print true");
267e5cd8 98
99 // Suppress verbose info from tracks which reached maximum number of steps
100 // (default value is 30000)
101 //geant4->ProcessGeantCommand("/mcTracking/loopVerbose 0");
102
103 //
104 // Set apply cuts
105/*
106 geant4->ProcessGeantCommand("/run/particle/applyCuts");
107 // geant4->ProcessGeantCommand("/mcVerbose/geometryManager 2");
108
109 geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2");
110 geant4->ProcessGeantCommand("/mcDet/volNameSeparator !");
111 geant4->ProcessGeantCommand("/mcPhysics/setStackPopperSelection e+ e- pi+ pi- kaon+ kaon- gamma");
112 //geant4->ProcessGeantCommand("/tracking/verbose 1");
113
114 geant4->ProcessGeantCommand("/mcControl/g3Defaults");
115!!!!n Generates warnings:
116>>> Event 0
117G4ProcessTable::Insert : arguments are 0 pointer
118G4ProcessTable::Insert : arguments are 0 pointer
119G4ProcessTable::Insert : arguments are 0 pointer
120G4ProcessTable::Insert : arguments are 0 pointer
121G4ProcessTable::Insert : arguments are 0 pointer
122
123*/
124
125 // AliRoot event generator
126 // (it has to be created after MC, as it may use decayer via VMC)
127 //
128 gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/gun/genExtFileConfig.C");
129 genExtFileConfig();
130
131 cout << "Running g4Config.C finished ... " << endl;
132}