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