]>
Commit | Line | Data |
---|---|---|
e2251cfe | 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 | ||
9 | void Config(const TString& det) | |
10 | { | |
11 | cout << "Running g4Config.C ... " << endl; | |
12 | ||
13 | // AliRoot setup | |
14 | // | |
15 | gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/lego/commonConfig.C"); | |
16 | commonConfig(det); | |
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 | } | |
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", | |
250872b3 | 43 | "FTFP_BERT_EMV+optical", |
e2251cfe | 44 | "specialCuts+stackPopper+stepLimiter", |
45 | true); | |
46 | // = new TG4RunConfiguration("geomRootToGeant4", | |
250872b3 | 47 | // "FTFP_BERT_EMV+optical", |
e2251cfe | 48 | // "specialCuts+specialControls+stackPopper+stepLimiter", |
49 | // true); | |
50 | ||
51 | geant4 = new TGeant4("TGeant4", | |
a9cdb946 | 52 | "The Geant4 Monte Carlo : FTFP_BERT_EMV+optical", |
e2251cfe | 53 | runConfiguration); |
54 | // Repeat physics selection in the title; to be removed | |
55 | // with new geant4_vmc tag (1.13) | |
56 | ||
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 | ||
66 | geant4->ProcessGeantCommand("/mcVerbose/all 1"); | |
67 | geant4->ProcessGeantCommand("/mcVerbose/geometryManager 1"); | |
68 | geant4->ProcessGeantCommand("/mcVerbose/opGeometryManager 1"); | |
a9cdb946 | 69 | geant4->ProcessGeantCommand("/mcTracking/loopVerbose 1"); |
e2251cfe | 70 | geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 0.01 mm"); |
e2251cfe | 71 | geant4->ProcessGeantCommand("/mcTracking/skipNeutrino true"); |
a9cdb946 | 72 | |
73 | // Activate step limit defined in low density materials | |
74 | // (the default value is 10 cm) | |
75 | //geant4->ProcessGeantCommand("/mcDet/setIsMaxStepInLowDensityMaterials true"); | |
76 | //geant4->ProcessGeantCommand("/mcDet/setMaxStepInLowDensityMaterials 1 cm"); | |
77 | ||
78 | // Activate step limit defined in tracking media | |
79 | // (Note: this slows down simulation significantly) | |
80 | //geant4->ProcessGeantCommand("/mcDet/setIsUserMaxStep true"); | |
81 | ||
250872b3 | 82 | // for Geant4 <= 9.4.p03 |
83 | //geant4->ProcessGeantCommand("/mcPhysics/selectOpProcess Scintillation"); | |
84 | //geant4->ProcessGeantCommand("/mcPhysics/setOpProcessActivation false"); | |
85 | // for Geant4 >= 9.5 | |
86 | geant4->ProcessGeantCommand("/optics_engine/selectOpProcess Scintillation"); | |
87 | geant4->ProcessGeantCommand("/optics_engine/setOpProcessUse false"); | |
88 | geant4->ProcessGeantCommand("/optics_engine/selectOpProcess OpWLS"); | |
89 | geant4->ProcessGeantCommand("/optics_engine/setOpProcessUse false"); | |
90 | geant4->ProcessGeantCommand("/optics_engine/selectOpProcess OpMieHG"); | |
91 | geant4->ProcessGeantCommand("/optics_engine/setOpProcessUse false"); | |
a9cdb946 | 92 | geant4->ProcessGeantCommand("/optics_engine/selectOpProcess Cerenkov"); |
93 | geant4->ProcessGeantCommand("/optics_engine/setTrackSecondariesFirst false"); | |
94 | ||
250872b3 | 95 | // Activate saving random engine status |
96 | // (the file per event will be re-written with each new event) | |
97 | //gAlice->GetMCApp()->SetSaveRndmStatus(kTRUE); | |
98 | //geant4->ProcessGeantCommand("/mcRun/saveRandom true"); | |
99 | ||
100 | // Activate saving random engine status for each event | |
101 | // (a new file will be written for each event) | |
102 | //gAlice->GetMCApp()->SetSaveRndmStatusPerEvent(kTRUE); | |
103 | //geant4->ProcessGeantCommand("/mcRun/saveRandom true"); | |
104 | //geant4->ProcessGeantCommand("/mcEvent/saveRandom true"); | |
a9cdb946 | 105 | |
106 | // Activate printing size of used memory per event | |
107 | geant4->ProcessGeantCommand("/mcEvent/printMemory true"); | |
e2251cfe | 108 | |
109 | // Uncomment this line to get a detail info from each step | |
110 | //geant4->ProcessGeantCommand("/tracking/verbose 1"); | |
111 | ||
112 | // More info from the physics list | |
113 | // the verbosity level is passed to all contained physics lists and their | |
114 | // physics builders | |
115 | //geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2"); | |
116 | ||
117 | // More info from optical processes | |
118 | //geant4->ProcessGeantCommand("/mcVerbose/opticalPhysicsList 3"); | |
119 | ||
120 | // More info from geometry building | |
121 | //geant4->ProcessGeantCommand("/mcVerbose/geometryManager 1"); | |
122 | ||
123 | // More info from setting geometry properties (in materials and surfaces) | |
124 | // for optical physics | |
125 | //geant4->ProcessGeantCommand("/mcVerbose/opGeometryManager 1"); | |
126 | ||
127 | // More info about regions construction | |
128 | // and conversion of VMC cuts in cuts in range per regions | |
129 | // geant4->ProcessGeantCommand("/mcVerbose/regionsManager 2"); | |
130 | // geant4->ProcessGeantCommand("/mcRegions/print true"); | |
131 | ||
132 | // Suppress verbose info from tracks which reached maximum number of steps | |
133 | // (default value is 30000) | |
134 | //geant4->ProcessGeantCommand("/mcTracking/loopVerbose 0"); | |
135 | ||
136 | // | |
137 | // Set apply cuts | |
138 | /* | |
139 | geant4->ProcessGeantCommand("/run/particle/applyCuts"); | |
140 | // geant4->ProcessGeantCommand("/mcVerbose/geometryManager 2"); | |
141 | ||
142 | geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2"); | |
143 | geant4->ProcessGeantCommand("/mcDet/volNameSeparator !"); | |
144 | geant4->ProcessGeantCommand("/mcPhysics/setStackPopperSelection e+ e- pi+ pi- kaon+ kaon- gamma"); | |
145 | //geant4->ProcessGeantCommand("/tracking/verbose 1"); | |
146 | ||
147 | geant4->ProcessGeantCommand("/mcControl/g3Defaults"); | |
148 | !!!!n Generates warnings: | |
149 | >>> Event 0 | |
150 | G4ProcessTable::Insert : arguments are 0 pointer | |
151 | G4ProcessTable::Insert : arguments are 0 pointer | |
152 | G4ProcessTable::Insert : arguments are 0 pointer | |
153 | G4ProcessTable::Insert : arguments are 0 pointer | |
154 | G4ProcessTable::Insert : arguments are 0 pointer | |
155 | ||
156 | */ | |
157 | ||
158 | cout << "Running g4Config.C finished ... " << endl; | |
159 | } |