Belle II Software development
FullSimModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <simulation/modules/fullsim/FullSimModule.h>
10#include <simulation/kernel/RunManager.h>
11#include <simulation/kernel/DetectorConstruction.h>
12//- #include <simulation/kernel/PhysicsList.h>
13#include <simulation/physicslist/Belle2PhysicsList.h>
14#include <simulation/kernel/ExtPhysicsConstructor.h>
15#include <simulation/kernel/MagneticField.h>
16#include <simulation/kernel/PrimaryGeneratorAction.h>
17#include <simulation/kernel/EventAction.h>
18#include <simulation/kernel/TrackingAction.h>
19#include <simulation/kernel/SteppingAction.h>
20#include <simulation/kernel/StackingAction.h>
21
22#include <mdst/dataobjects/MCParticle.h>
23#include <framework/datastore/StoreObjPtr.h>
24#include <framework/datastore/StoreArray.h>
25#include <framework/dataobjects/EventMetaData.h>
26#include <framework/gearbox/Unit.h>
27
28#include <CLHEP/Units/SystemOfUnits.h>
29
30#include <simulation/monopoles/G4MonopolePhysics.h>
31#include <simulation/longlivedneutral/G4LongLivedNeutralPhysics.h>
32
33#include <G4FieldManager.hh>
34#include <G4TransportationManager.hh>
35#include <G4Transportation.hh>
36#include <G4PhysListFactory.hh>
37#include <G4ProcessVector.hh>
38#include <G4OpticalPhysics.hh>
39#include <G4ParticleDefinition.hh>
40#include <G4ParticleTable.hh>
41#include <G4EventManager.hh>
42#include <G4RunManager.hh>
43#include <G4UImanager.hh>
44#include <G4VisExecutive.hh>
45#include <G4StepLimiter.hh>
46#include <G4EmParameters.hh>
47#include <G4HadronicProcessStore.hh>
48#include <G4InuclParticleNames.hh>
49
50#include <G4Mag_UsualEqRhs.hh>
51#include <G4NystromRK4.hh>
52#include <G4HelixExplicitEuler.hh>
53#include <G4HelixSimpleRunge.hh>
54#include <G4CachedMagneticField.hh>
55#include <G4ChordFinder.hh>
56
57using namespace std;
58using namespace Belle2;
59using namespace Belle2::Simulation;
60using namespace Belle2::Monopoles;
61using namespace G4InuclParticleNames;
62
63//-----------------------------------------------------------------
64// Register the Module
65//-----------------------------------------------------------------
66REG_MODULE(FullSim);
67
68//-----------------------------------------------------------------
69// Implementation
70//-----------------------------------------------------------------
71
72FullSimModule::FullSimModule() : Module(), m_useNativeGeant4(true)
73{
74 //Set module properties and the description
75 setDescription("Performs the full Geant4 detector simulation. Requires a valid geometry in memory.");
77
78 //Parameter definition
79 addParam("InputMCParticleCollection", m_mcParticleInputColName, "The name of the input MCParticle collection.", string(""));
80 addParam("ThresholdImportantEnergy", m_thresholdImportantEnergy,
81 "[GeV] A particle which got 'stuck' and has less than this energy will be killed after 'ThresholdTrials' trials.", 0.250);
82 addParam("ThresholdTrials", m_thresholdTrials,
83 "Geant4 will try 'ThresholdTrials' times to move a particle which got 'stuck' and has an energy less than 'ThresholdImportantEnergy'.",
84 10);
85 addParam("RunEventVerbosity", m_runEventVerbosity, "Geant4 run/event verbosity: 0=silent; 1=info level; 2=debug level", 0);
86 addParam("TrackingVerbosity", m_trackingVerbosity,
87 "Tracking verbosity: 0=Silent; 1=Min info per step; 2=sec particles; 3=pre/post step info; 4=like 3 but more info; 5=proposed step length info.",
88 0);
89 addParam("HadronProcessVerbosity", m_hadronProcessVerbosity, "Hadron Process verbosity: 0=Silent; 1=info level; 2=debug level", 0);
90 addParam("EmProcessVerbosity", m_emProcessVerbosity, "Em Process verbosity: 0=Silent; 1=info level; 2=debug level", 0);
91 addParam("PhysicsList", m_physicsList, "The name of the physics list which is used for the simulation.", string("Belle2"));
92 addParam("StandardEM", m_standardEM, "If true, replaces fast EM physics with standard EM physics.", false);
93 addParam("RegisterOptics", m_optics, "If true, G4OpticalPhysics is registered in Geant4 PhysicsList.", true);
94 addParam("UseHighPrecisionNeutrons", m_HPneutrons, "If true, high precision neutron models used below 20 MeV.", false);
95 addParam("RegisterMonopoles", m_monopoles, "If set to true, G4MonopolePhysics is registered in Geant4 PhysicsList.", false);
96 addParam("MonopoleMagCharge", m_monopoleMagneticCharge, "The value of monopole magnetic charge in units of e+.", 1.0);
97 addParam("ProductionCut", m_productionCut,
98 "[cm] Apply continuous energy loss to primary particle which has no longer enough energy to produce secondaries which travel at least the specified productionCut distance.",
99 0.07);
100 addParam("PXDProductionCut", m_pxdProductionCut, "[cm] Secondary production threshold in PXD envelope.", 0.0);
101 addParam("SVDProductionCut", m_svdProductionCut, "[cm] Secondary production threshold in SVD envelope.", 0.0);
102 addParam("CDCProductionCut", m_cdcProductionCut, "[cm] Secondary production threshold in CDC envelope.", 0.0);
103 addParam("ARICHTOPProductionCut", m_arichtopProductionCut, "[cm] Secondary production threshold in ARICH and TOP envelopes.", 0.02);
104 addParam("ECLProductionCut", m_eclProductionCut, "[cm] Secondary production threshold in ECL envelope.", 0.0);
105 addParam("KLMProductionCut", m_klmProductionCut, "[cm] Secondary production threshold in BKLM and EKLM envelopes.", 0.0);
106 addParam("MaxNumberSteps", m_maxNumberSteps,
107 "The maximum number of steps before the track transportation is stopped and the track is killed.", 100000);
108 addParam("PhotonFraction", m_photonFraction, "The fraction of Cerenkov photons which will be kept and propagated.", 0.5);
109 addParam("EnableVisualization", m_EnableVisualization, "If set to True, the Geant4 visualization support is enabled.", false);
110
111 addParam("StoreOpticalPhotons", m_storeOpticalPhotons, "If set to True, optical photons are stored in MCParticles.", false);
112 addParam("StoreAllSecondaries", m_storeSecondaries,
113 "If set to True, all secondaries produced by Geant4 over a kinetic energy cut are stored in MCParticles. Otherwise do not store them.",
114 false);
115 addParam("SecondariesEnergyCut", m_secondariesEnergyCut, "[MeV] Kinetic energy cut for storing secondaries", 1.0);
116 addParam("StoreBremsstrahlungPhotons", m_storeBremsstrahlungPhotons,
117 "If set to True, store BremsstrahlungPhotons over a kinetic energy cut in MCParticles. Otherwise do not store them.", false);
118 addParam("BremsstrahlungPhotonsEnergyCut", m_bremsstrahlungPhotonsEnergyCut,
119 "[MeV] Kinetic energy cut for storing bremsstrahlung photons", 10.0);
120 addParam("StorePairConversions", m_storePairConversions,
121 "If set to True, store e+ or e- from pair conversions over a kinetic energy cut in MCParticles. Otherwise do not store them.",
122 false);
123 addParam("PairConversionsEnergyCut", m_pairConversionsEnergyCut,
124 "[MeV] Kinetic energy cut for storing e+ or e- from pair conversions", 10.0);
125
126 addParam("magneticField", m_magneticFieldName,
127 "Chooses the magnetic field stepper used by Geant4. Possible values are: default, nystrom, expliciteuler, simplerunge",
128 string("default"));
129 addParam("magneticCacheDistance", m_magneticCacheDistance,
130 "Minimum distance for BField lookup in cm. If the next requested point is closer than this distance than return the flast BField value. 0 means no caching",
131 0.0);
132 addParam("deltaChordInMagneticField", m_deltaChordInMagneticField,
133 "[mm] The maximum miss-distance between the trajectory curve and its linear cord(s) approximation", 0.25);
134 vector<string> defaultCommandsAtPreInit;
135 addParam("UICommandsAtPreInit", m_uiCommandsAtPreInit,
136 "A list of Geant4 UI commands that should be applied at PreInit state, before the simulation starts.",
137 defaultCommandsAtPreInit);
138 vector<string> defaultCommandsAtIdle;
139 addParam("UICommandsAtIdle", m_uiCommandsAtIdle,
140 "A list of Geant4 UI commands that should be applied at Idle state, before the simulation starts.",
141 defaultCommandsAtIdle);
142 addParam("trajectoryStore", m_trajectoryStore,
143 "If non-zero save the full trajectory of 1=primary, 2=non-optical or 3=all particles", 0);
144 addParam("trajectoryDistanceTolerance", m_trajectoryDistanceTolerance,
145 "Maximum deviation from the real trajectory points when merging "
146 "segments (in cm)", 5e-4);
147 vector<float> defaultAbsorbers;
148 addParam("AbsorbersRadii", m_absorbers,
149 "Radii (in cm) of absorbers across which tracks will be destroyed.", defaultAbsorbers);
150
151 //Make sure the instance of the run manager is created now to initialize some stuff we need for geometry
153 m_magneticField = NULL;
154 m_uncachedField = NULL;
155 m_magFldEquation = NULL;
156 m_stepper = NULL;
157 m_chordFinder = NULL;
158 m_visManager = NULL;
159 m_stepLimiter = NULL;
160}
161
162
164{
165
166}
167
168
170{
171 // MCParticles input and output collections can be different.
172 // Output collection is always the default one.
173 // In case we simulate only beam background events using BG mixing or BG overlay
174 // there is no input collection.
175
176 if (m_mcParticleInputColName.empty()) {
177 // input and output collections are the same
178 // register in datastore because the input collection may not exist (case: only BG)
180 } else {
181 // input and output collections are different
183 StoreArray<MCParticle>().registerInDataStore(); // output collection
184 }
185
186 //Make sure the EventMetaData already exists.
188
189 //Get the instance of the run manager.
190 RunManager& runManager = RunManager::Instance();
191
192 //Add Geometry
193 runManager.SetUserInitialization(new DetectorConstruction());
194
195 //Create the Physics list
196 //- PhysicsList* physicsList = new PhysicsList(m_physicsList);
197 //- physicsList->setProductionCutValue(m_productionCut);
198 //- if (m_optics) physicsList->registerOpticalPhysicsList();
199 //- runManager.SetUserInitialization(physicsList);
200
201 if (m_physicsList == "Belle2") {
202 // Use Belle2PhysicsList
204 physicsList->SetVerbosity(m_runEventVerbosity);
206 physicsList->UseOpticalPhysics(m_optics);
215 physicsList->UseLongLivedNeutralParticles();
216
217 //Apply the Geant4 UI commands in PreInit State - before initialization
218 if (m_uiCommandsAtPreInit.size() > 0) {
219 G4UImanager* uiManager = G4UImanager::GetUIpointer();
220 for (vector<string>::iterator iter = m_uiCommandsAtPreInit.begin(); iter != m_uiCommandsAtPreInit.end(); ++iter) {
221 uiManager->ApplyCommand(*iter);
222 }
223 }
224
225 runManager.SetUserInitialization(physicsList);
226
227 } else {
228 G4PhysListFactory physListFactory;
229 physListFactory.SetVerbose(m_runEventVerbosity);
230 G4VModularPhysicsList* physicsList = NULL;
231 if (physListFactory.IsReferencePhysList(m_physicsList)) physicsList = physListFactory.GetReferencePhysList(m_physicsList);
232 if (physicsList == NULL) B2FATAL("Could not load the physics list " << m_physicsList);
233 physicsList->RegisterPhysics(new ExtPhysicsConstructor);
234 if (m_optics) physicsList->RegisterPhysics(new G4OpticalPhysics);
235 if (m_monopoles) {
236 physicsList->RegisterPhysics(new G4MonopolePhysics(m_monopoleMagneticCharge));
237 }
238
239 physicsList->RegisterPhysics(new G4LongLivedNeutralPhysics());
240
241 physicsList->SetDefaultCutValue((m_productionCut / Unit::mm) * CLHEP::mm); // default is 0.7 mm
242
243 //Apply the Geant4 UI commands in PreInit State - before initialization
244 if (m_uiCommandsAtPreInit.size() > 0) {
245 G4UImanager* uiManager = G4UImanager::GetUIpointer();
246 for (vector<string>::iterator iter = m_uiCommandsAtPreInit.begin(); iter != m_uiCommandsAtPreInit.end(); ++iter) {
247 uiManager->ApplyCommand(*iter);
248 }
249 }
250
251 // // LEP: For geant4e-specific particles, set a big step so that AlongStep computes
252 // // all the energy (as is done in G4ErrorPhysicsList)
253 // G4ParticleTable::G4PTblDicIterator* myParticleIterator = G4ParticleTable::GetParticleTable()->GetIterator();
254 // myParticleIterator->reset();
255 // while ((*myParticleIterator)()) {
256 // G4ParticleDefinition* particle = myParticleIterator->value();
257 // if (particle->GetParticleName().compare(0, 4, "g4e_") == 0) {
258 // physicsList->SetParticleCuts(1.0E+9 * CLHEP::cm, particle);
259 // }
260 // }
261 runManager.SetUserInitialization(physicsList);
262 }
263
264 //Create the magnetic field for the Geant4 simulation
265 if (m_magneticFieldName != "none") {
267 if (m_magneticCacheDistance > 0) {
269 m_magneticField = new G4CachedMagneticField(m_uncachedField, m_magneticCacheDistance);
270 }
271 G4FieldManager* fieldManager = G4TransportationManager::GetTransportationManager()->GetFieldManager();
272 fieldManager->SetDetectorField(m_magneticField);
273 if (m_magneticFieldName != "default") {
274
275 //We only use Magnetic field so let's try the specialized steppers
276 m_magFldEquation = new G4Mag_UsualEqRhs(m_magneticField);
277 if (m_magneticFieldName == "nystrom") {
278 m_stepper = new G4NystromRK4(m_magFldEquation);
279 } else if (m_magneticFieldName == "expliciteuler") {
280 m_stepper = new G4HelixExplicitEuler(m_magFldEquation);
281 } else if (m_magneticFieldName == "simplerunge") {
282 m_stepper = new G4HelixSimpleRunge(m_magFldEquation);
283 } else {
284 B2FATAL("Unknown magnetic field option: " << m_magneticFieldName);
285 }
286
287 //Set a minimum stepsize (stepMinimum): The chordfinder should not attempt to limit
288 //the stepsize to something less than 10µm (which is the default value of Geant4).
289 m_chordFinder = new G4ChordFinder(m_magneticField, 1e-2 * CLHEP::mm, m_stepper);
290 fieldManager->SetChordFinder(m_chordFinder);
291 } else {
292 fieldManager->CreateChordFinder(m_magneticField);
293 }
294
295 //Change DeltaCord (the max. miss-distance between the trajectory curve and its linear chord(s) approximation, if asked.
296 G4ChordFinder* chordFinder = fieldManager->GetChordFinder();
297 B2DEBUG(1, "Geant4 default deltaChord = " << chordFinder->GetDeltaChord());
298 chordFinder->SetDeltaChord(m_deltaChordInMagneticField * CLHEP::mm);
299 B2DEBUG(1, "DeltaChord after reset = " << chordFinder->GetDeltaChord());
300
301 //This might be a good place to optimize the Integration parameters (DeltaOneStep, DeltaIntersection, MinEpsilon, MaxEpsilon)
302 }
303
304 //Create the generator action which takes the MCParticle list and converts it to Geant4 primary vertices.
305 G4VUserPrimaryGeneratorAction* generatorAction = new PrimaryGeneratorAction(m_mcParticleInputColName, m_mcParticleGraph);
306 runManager.SetUserAction(generatorAction);
307
308 //Add the event action which creates the final MCParticle list and the Relation list.
309 //The output collection name will be always "MCParticles".
310 EventAction* eventAction = new EventAction("", m_mcParticleGraph);
311 runManager.SetUserAction(eventAction);
312
313 //Add the tracking action which handles the secondary particles created by Geant4.
314 TrackingAction* trackingAction = new TrackingAction(m_mcParticleGraph);
322
323 runManager.SetUserAction(trackingAction);
324
325 //Add the stepping action which provides additional security checks
326 SteppingAction* steppingAction = new SteppingAction();
327 steppingAction->setMaxNumberSteps(m_maxNumberSteps);
328 steppingAction->setAbsorbersR(m_absorbers);
329 for (auto& rAbsorber : m_absorbers) {
330 B2INFO("An absorber found at R = " << rAbsorber << " cm");
331 }
332 runManager.SetUserAction(steppingAction);
333
334 //Add the stacking action which provides performance speed ups for the handling of optical photons
335 StackingAction* stackingAction = new StackingAction();
337 runManager.SetUserAction(stackingAction);
338
339 //Initialize G4 kernel
340 runManager.Initialize();
341
342 //Set the parameters for the G4Transportation system.
343 //To make sure we really change all G4Transportation classes, we loop over all particles
344 //even if the pointer to the G4Transportation object seems to be the same for all particles.
345 //Only one instance of G4StepLimiter is needed: see G4StepLimiterBuilder(), for example.
346 m_stepLimiter = new G4StepLimiter();
347 G4ParticleTable::G4PTblDicIterator* partIter = G4ParticleTable::GetParticleTable()->GetIterator();
348 partIter->reset();
349 while ((*partIter)()) {
350 G4ParticleDefinition* currParticle = partIter->value();
351 G4ProcessVector& currProcList = *currParticle->GetProcessManager()->GetProcessList();
352 assert(currProcList.size() < INT_MAX);
353 for (int iProcess = 0; iProcess < static_cast<int>(currProcList.size()); ++iProcess) {
354 G4Transportation* transport = dynamic_cast<G4Transportation*>(currProcList[iProcess]);
355 if (transport != nullptr) {
356 //Geant4 energy unit is MeV
357 transport->SetThresholdImportantEnergy(m_thresholdImportantEnergy / Unit::MeV * CLHEP::MeV);
358 transport->SetThresholdTrials(m_thresholdTrials);
359 break;
360 }
361 }
362 // Add StepLimiter process for charged tracks.
363 double zeroChargeTol = 0.01 * Unit::e;
364 if (fabs(currParticle->GetPDGCharge()) > zeroChargeTol) {
365 currParticle->GetProcessManager()->AddDiscreteProcess(m_stepLimiter);
366 B2DEBUG(100, "Added StepLimiter process for " << currParticle->GetParticleName());
367 }
368 }
369
370 // Inactivate all secondary-generating processes for g4e particles. This comprises
371 // Cerenkov and Scintillation that were inserted by G4OpticalPhysics and the
372 // CaptureAtRest process for g4e anti-deuteron.
373 partIter->reset();
374 while ((*partIter)()) {
375 G4ParticleDefinition* currParticle = partIter->value();
376 if (currParticle->GetParticleName().compare(0, 4, "g4e_") == 0) {
377 G4ProcessManager* processManager = currParticle->GetProcessManager();
378 if (processManager) {
379 G4ProcessVector* processList = processManager->GetProcessList();
380 assert(processList->size() < INT_MAX);
381 for (int i = 0; i < static_cast<int>(processList->size()); ++i) {
382 if (((*processList)[i]->GetProcessName() == "Cerenkov") ||
383 ((*processList)[i]->GetProcessName() == "Scintillation") ||
384 ((*processList)[i]->GetProcessName() == "hFritiofCaptureAtRest")) {
385 processManager->SetProcessActivation(i, false);
386 }
387 }
388 }
389 }
390 }
391
392 //Set the verbosity level of Geant4 according to the logging settings of the module
393 //int g4VerboseLevel = 0;
394 //switch (LogSystem::Instance().getCurrentLogLevel()) {
395 // case LogConfig::c_Debug : g4VerboseLevel = 2;
396 // break;
397 // case LogConfig::c_Info : g4VerboseLevel = 1;
398 // break;
399 // default: g4VerboseLevel = 0;
400 //}
401 //G4EventManager::GetEventManager()->SetVerboseLevel(g4VerboseLevel);
402 //G4RunManager::GetRunManager()->SetVerboseLevel(g4VerboseLevel);
403 G4EventManager::GetEventManager()->SetVerboseLevel(m_runEventVerbosity);
404 G4RunManager::GetRunManager()->SetVerboseLevel(m_runEventVerbosity);
405 G4EventManager::GetEventManager()->GetTrackingManager()->SetVerboseLevel(
406 m_trackingVerbosity); //turned out to be more useful as a parameter.
407 G4HadronicProcessStore::Instance()->SetVerbose(m_hadronProcessVerbosity);
408 G4EmParameters::Instance()->SetVerbose(m_emProcessVerbosity);
409
410
412 m_visManager = new G4VisExecutive;
413 m_visManager->Initialize();
414 }
415
416 //Apply the Geant4 UI commands at Idle state - after initilization
417 if (m_uiCommandsAtIdle.size() > 0) {
418 G4UImanager* uiManager = G4UImanager::GetUIpointer();
419 for (vector<string>::iterator iter = m_uiCommandsAtIdle.begin(); iter != m_uiCommandsAtIdle.end(); ++iter) {
420 uiManager->ApplyCommand(*iter);
421 }
422 }
423
424 //Store Trajectories?
425 if (m_trajectoryStore) {
427 steppingAction->setStoreTrajectories(true);
428 }
429
430 //Physics tables are build in run initialization. We have run independent
431 //geometry at the moment so there is no need to do this in begin run. Instead
432 //we use one Geant4 run for all Belle2 runs we might encounter. So let's do
433 //run initialization now to save memory when doing parallel processing
434 B2INFO("Perform Geant4 final initialization: Geometry optimization, PhysicsList calculations...");
436 B2INFO("done, Geant4 ready");
437 //Otherwise we could use a fake run to do this and move RunManager::beginRun
438 //back to beginRun()
439 //runManager.BeamOn(0);
440}
441
442
444{
445 //Nothing to do: geometry and physics are run independent
446}
447
448
450{
451 //Get the event meta data
452 StoreObjPtr<EventMetaData> eventMetaDataPtr;
453
454 //Process the event
455 RunManager::Instance().processEvent(eventMetaDataPtr->getEvent());
456}
457
458
460{
461 //Nothing to do: geometry and physics are run independent
462}
463
465{
466 //We used one Geant4 run for all Belle2 runs so end the geant4 run here
468 //And clean up the run manager
469 if (m_visManager != nullptr) delete m_visManager;
471 // Delete the step limiter process
472 delete m_stepLimiter;
473 // Delete the objects associated with transport in magnetic field
474 if (m_chordFinder) delete m_chordFinder;
475 if (m_stepper) delete m_stepper;
479}
Class responsible to connect to geometry to simulation.
std::vector< float > m_absorbers
The absorbers defined at given radii where tracks across them will be destroyed.
int m_emProcessVerbosity
Loss Table verbosity: 0=Silent; 1=info level; 2=debug level, default=0.
Definition: FullSimModule.h:95
double m_trajectoryDistanceTolerance
Maximum distance to actuall trajectory when merging points.
G4VisManager * m_visManager
Pointer to the visualization manager (if used)
std::vector< std::string > m_uiCommandsAtIdle
A list of Geant4 UI commands that should be applied at Idle state, after the Geant4 initialization an...
double m_monopoleMagneticCharge
The value of monopole magnetic charge in units of e+.
double m_cdcProductionCut
Secondary production threshold in CDC envelope.
double m_photonFraction
The fraction of Cerenkov photons which will be kept and propagated.
bool m_HPneutrons
If true, high precision neutron models used below 20 MeV.
Definition: FullSimModule.h:99
int m_hadronProcessVerbosity
Hadron Process verbosity: 0=Silent; 1=info level; 2=debug level, default=0.
Definition: FullSimModule.h:94
G4Mag_UsualEqRhs * m_magFldEquation
Pointer to the equation of motion in the magnetic field (if not the default)
double m_klmProductionCut
Secondary production threshold in BKLM and EKLM envelopes.
virtual void initialize() override
Initialize the Module.
int m_thresholdTrials
Geant4 will try m_thresholdTrials times to move a particle which got 'stuck' and has an energy less t...
Definition: FullSimModule.h:91
bool m_storePairConversions
controls storing of e+ or e- from pair conversions in MCParticles
double m_pxdProductionCut
Secondary production threshold in PXD envelope.
int m_trackingVerbosity
Tracking verbosity: 0=Silent; 1=Min info per step; 2=sec particles; 3=pre/post step info; 4=like 3 bu...
Definition: FullSimModule.h:93
virtual void event() override
Performs the full Geant4 simulation.
double m_productionCut
Apply continuous energy loss to primary particle which has no longer enough energy to produce seconda...
bool m_storeOpticalPhotons
controls storing of optical photons in MCParticles
bool m_standardEM
If set to true, replaces fast EM physics with standard EM physics.
Definition: FullSimModule.h:97
G4MagIntegratorStepper * m_stepper
Pointer to the equation-of-motion stepper (if not the default)
virtual void endRun() override
Called when run has ended.
double m_svdProductionCut
Secondary production threshold in SVD envelope.
virtual void terminate() override
Terminates the module.
double m_arichtopProductionCut
Secondary production threshold in ARICH and TOP envelopes.
bool m_optics
If set to true, registers the optical physics list.
Definition: FullSimModule.h:98
double m_pairConversionsEnergyCut
kinetic energy cut for the stored e+ or e- from pair conversions
std::vector< std::string > m_uiCommandsAtPreInit
A list of Geant4 UI commands that should be applied at PreInit state, before the Geant4 initializatio...
bool m_storeBremsstrahlungPhotons
controls storing of bremsstrahlung photons in MCParticles
std::string m_mcParticleInputColName
The parameter variable for the name of the input MCParticle collection.
Definition: FullSimModule.h:89
virtual void beginRun() override
Called when a new run is started.
double m_thresholdImportantEnergy
A particle which got 'stuck' and has less than this energy will be killed after m_thresholdTrials tri...
Definition: FullSimModule.h:90
std::string m_physicsList
The name of the physics list which is used for the simulation.
Definition: FullSimModule.h:96
int m_runEventVerbosity
Geant4 run/event verbosity: 0=Silent; 1=info level; 2=debug level, default=0.
Definition: FullSimModule.h:92
double m_magneticCacheDistance
minimal distance for magnetic field lookup.
double m_eclProductionCut
Secondary production threshold in ECL envelopes.
bool m_EnableVisualization
If set to true the Geant4 visualization support is enabled.
double m_secondariesEnergyCut
kinetic energy cut for the stored Geant secondaries
std::string m_magneticFieldName
magnetic field stepper to use
G4MagneticField * m_magneticField
Pointer to the (un)cached magnetic field.
G4MagneticField * m_uncachedField
Pointer to the uncached magnetic field (might be superseded by its cached version)
int m_maxNumberSteps
The maximum number of steps before the track transportation is stopped and the track is killed.
double m_deltaChordInMagneticField
The maximum miss-distance between the trajectory curve and its linear chord(s) approximation.
G4ChordFinder * m_chordFinder
Pointer to the equation-of-motion chord finder (if not the default)
MCParticleGraph m_mcParticleGraph
The MCParticle Graph used to manage the MCParticles before and after the simulation.
virtual ~FullSimModule()
Destructor of the module.
bool m_monopoles
If set to true, G4MonopolePhysics is registered in Geant4 PhysicsList.
double m_bremsstrahlungPhotonsEnergyCut
kinetic energy cut for the stored bremsstrahlung photons
int m_trajectoryStore
If true, store the trajectories of all primary particles.
bool m_storeSecondaries
controls storing of Geant secondaries in MCParticles
G4StepLimiter * m_stepLimiter
Pointer to the step limiter.
FullSimModule()
Constructor of the module.
LongLivedNeutral physics Class – to be registered in the physics list.
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
Definition: Module.h:83
Monopole physics class to register on the physics list.
Custom Geant4 physics list for Belle II with options to add optical physics, standard EM physics and ...
void SetSVDProductionCutValue(G4double)
Set cut value for SVD envelope.
void SetProductionCutValue(G4double)
Use parameter to set global cut value.
void SetARICHTOPProductionCutValue(G4double)
Set cut value for ARICH and TOP envelopes.
void SetECLProductionCutValue(G4double)
Set cut value for ECL barrel, forward and backward envelopes.
void UseHighPrecisionNeutrons(G4bool)
Use high precision neutron models below 20 MeV.
void SetPXDProductionCutValue(G4double)
Set cut value for PXD envelope.
void UseLongLivedNeutralParticles()
Simulate neutral long-lived particles with given pdg and mass value.
void UseOpticalPhysics(G4bool)
Add optical photon physics.
void SetVerbosity(G4int verb)
Run/event verbosity level.
void SetCDCProductionCutValue(G4double)
Set cut value for CDC envelope.
void SetKLMProductionCutValue(G4double)
Set cut value for BKLM and EKLM envelopes.
void UseStandardEMPhysics(G4bool)
Use standard EM physics instead of EM option1.
The Event Action class.
Definition: EventAction.h:36
The Class for the Belle2 magnetic field implementation for Geant4.
Definition: MagneticField.h:28
The PrimaryGeneratorAction class inherits from G4VuserPrimaryGeneratorAction and specifies how a prim...
The run manager controls the flow of the Geant4 program and manages the event loop(s) within a run.
Definition: RunManager.h:32
void beginRun(int runNumber)
Prepares Geant4 for a new run.
Definition: RunManager.cc:49
void destroy()
Destroys the RunManager at the end of the simulation.
Definition: RunManager.cc:85
void processEvent(int evtNumber)
Process a single event in Geant4.
Definition: RunManager.cc:67
void endRun()
Terminates a Geant4 run.
Definition: RunManager.cc:79
void Initialize()
Initialize the Kernel.
Definition: RunManager.cc:35
static RunManager & Instance()
Static method to get a reference to the RunManager instance.
Definition: RunManager.cc:29
The basf2 stacking action.
void setPropagatedPhotonFraction(double fraction)
Set fraction of Cerenkov photons that are actually propagated.
The Class for the stepping action.
void setAbsorbersR(const std::vector< float > &vec)
Sets the radii of absorbers for killing tracks across them.
void setStoreTrajectories(bool store)
Sets the trajectory option to enable storing of the simulated particle trajectories.
void setMaxNumberSteps(int maxSteps)
Sets the maximum number of steps before a track is stopped and killed.
The Tracking Action class.
void setIgnorePairConversions(bool ignore=true)
Set ignore flag for e+ or e- coming from gamma conversions into a pair if set to true,...
void setIgnoreBremsstrahlungPhotons(bool ignore=true)
Set ignore flag for low energy breamsstrahlung photons if set to true, breamsstrahlung photons with k...
void setSecondariesEnergyCut(double cut_MeV)
Set kinetic energy cut for secondaries.
void setStoreTrajectories(int store, double distanceTolerance)
Sets the trajectory option to enable storing of the simulated particle trajectories.
void setBremsstrahlungPhotonsEnergyCut(double cut_MeV)
Set kinetic energy cut for bremsstrahlung photons.
void setPairConversionsEnergyCut(double cut_MeV)
Set kinetic energy cut for e+ e- pair conversions.
void setIgnoreSecondaries(bool ignore=true)
Set ignore flag for low energy Geant-produced secondary particles if set to true, secondaries with ki...
void setIgnoreOpticalPhotons(bool ignore=true)
Set ignore flag for optical photons if set to true, optical photons will not be stored in MCParticles...
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
static const double mm
[millimeters]
Definition: Unit.h:70
static const double e
Standard of [electric charge].
Definition: Unit.h:53
static const double MeV
[megaelectronvolt]
Definition: Unit.h:114
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.
STL namespace.