3 // Configuration macro for running aliroot with Geant4
4 // with primary events read from external file.
6 // By I. Hrivnacova, IPN Orsay
9 void Config(const TString& det)
11 cout << "Running g4Config.C ... " << endl;
15 gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/lego/commonConfig.C");
18 // TPC primary ionization
19 AliTPC* TPC = (AliTPC*)gAlice->GetDetector("TPC");
21 cerr << "Cannot get TPC detector" << endl;
23 cerr << "Setting TPC primary ionization" << endl;
24 TPC->SetPrimaryIonisation(); // not used with Geant3
27 // Load Geant4 + Geant4 VMC libraries
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()");
41 TG4RunConfiguration* runConfiguration
42 = new TG4RunConfiguration("geomRoot",
43 "FTFP_BERT_EMV+optical",
44 "specialCuts+stackPopper+stepLimiter",
46 // = new TG4RunConfiguration("geomRootToGeant4",
47 // "FTFP_BERT_EMV+optical",
48 // "specialCuts+specialControls+stackPopper+stepLimiter",
51 geant4 = new TGeant4("TGeant4",
52 "The Geant4 Monte Carlo : QGSP_BERT_EMV+optical",
54 // Repeat physics selection in the title; to be removed
55 // with new geant4_vmc tag (1.13)
57 cout << "Geant4 has been created." << endl;
60 cout << "Monte Carlo has been already created." << endl;
63 // Customization of Geant4 VMC
66 geant4->ProcessGeantCommand("/mcVerbose/all 1");
67 geant4->ProcessGeantCommand("/mcVerbose/geometryManager 1");
68 geant4->ProcessGeantCommand("/mcVerbose/opGeometryManager 1");
69 geant4->ProcessGeantCommand("/mcTracking/loopVerbose 0");
70 geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 0.01 mm");
71 geant4->ProcessGeantCommand("/mcTracking/skipNeutrino true");
72 geant4->ProcessGeantCommand("/mcDet/setMaxStepInLowDensityMaterials 1 cm");
73 // for Geant4 <= 9.4.p03
74 //geant4->ProcessGeantCommand("/mcPhysics/selectOpProcess Scintillation");
75 //geant4->ProcessGeantCommand("/mcPhysics/setOpProcessActivation false");
77 geant4->ProcessGeantCommand("/optics_engine/selectOpProcess Scintillation");
78 geant4->ProcessGeantCommand("/optics_engine/setOpProcessUse false");
79 geant4->ProcessGeantCommand("/optics_engine/selectOpProcess OpWLS");
80 geant4->ProcessGeantCommand("/optics_engine/setOpProcessUse false");
81 geant4->ProcessGeantCommand("/optics_engine/selectOpProcess OpMieHG");
82 geant4->ProcessGeantCommand("/optics_engine/setOpProcessUse false");
84 // Activate saving random engine status
85 // (the file per event will be re-written with each new event)
86 //gAlice->GetMCApp()->SetSaveRndmStatus(kTRUE);
87 //geant4->ProcessGeantCommand("/mcRun/saveRandom true");
89 // Activate saving random engine status for each event
90 // (a new file will be written for each event)
91 //gAlice->GetMCApp()->SetSaveRndmStatusPerEvent(kTRUE);
92 //geant4->ProcessGeantCommand("/mcRun/saveRandom true");
93 //geant4->ProcessGeantCommand("/mcEvent/saveRandom true");
96 // Uncomment this line to get a detail info from each step
97 //geant4->ProcessGeantCommand("/tracking/verbose 1");
99 // More info from the physics list
100 // the verbosity level is passed to all contained physics lists and their
102 //geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2");
104 // More info from optical processes
105 //geant4->ProcessGeantCommand("/mcVerbose/opticalPhysicsList 3");
107 // More info from geometry building
108 //geant4->ProcessGeantCommand("/mcVerbose/geometryManager 1");
110 // More info from setting geometry properties (in materials and surfaces)
111 // for optical physics
112 //geant4->ProcessGeantCommand("/mcVerbose/opGeometryManager 1");
114 // More info about regions construction
115 // and conversion of VMC cuts in cuts in range per regions
116 // geant4->ProcessGeantCommand("/mcVerbose/regionsManager 2");
117 // geant4->ProcessGeantCommand("/mcRegions/print true");
119 // Suppress verbose info from tracks which reached maximum number of steps
120 // (default value is 30000)
121 //geant4->ProcessGeantCommand("/mcTracking/loopVerbose 0");
126 geant4->ProcessGeantCommand("/run/particle/applyCuts");
127 // geant4->ProcessGeantCommand("/mcVerbose/geometryManager 2");
129 geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2");
130 geant4->ProcessGeantCommand("/mcDet/volNameSeparator !");
131 geant4->ProcessGeantCommand("/mcPhysics/setStackPopperSelection e+ e- pi+ pi- kaon+ kaon- gamma");
132 //geant4->ProcessGeantCommand("/tracking/verbose 1");
134 geant4->ProcessGeantCommand("/mcControl/g3Defaults");
135 !!!!n Generates warnings:
137 G4ProcessTable::Insert : arguments are 0 pointer
138 G4ProcessTable::Insert : arguments are 0 pointer
139 G4ProcessTable::Insert : arguments are 0 pointer
140 G4ProcessTable::Insert : arguments are 0 pointer
141 G4ProcessTable::Insert : arguments are 0 pointer
145 cout << "Running g4Config.C finished ... " << endl;