DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4Kernel.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DDG4_GEANT4KERNEL_H
14 #define DDG4_GEANT4KERNEL_H
15 
16 // Framework include files
18 
19 // C/C++ include files
20 #include <map>
21 #include <typeinfo>
22 #include <functional>
23 
24 // Forward declarations
25 class G4RunManager;
26 class G4UIdirectory;
27 class G4VPhysicalVolume;
28 
30 namespace dd4hep {
31 
32  // Forward declarations
33  class Geant4Interrupts;
34 
36  namespace sim {
37 
38  // Forward declarations
39  class Geant4Interrupts;
40  class Geant4ActionPhase;
41 
44  public:
46  virtual const char* what() const noexcept override { return "Reached end of input file"; }
47  };
48 
51  public:
53  virtual const char* what() const noexcept override { return "Event loop STOP signalled. Processing stops"; }
54  };
55 
57 
65  public:
66  typedef std::map<unsigned long, Geant4Kernel*> Workers;
67  typedef std::map<std::string, Geant4ActionPhase*> Phases;
68  typedef std::map<std::string, Geant4Action*> GlobalActions;
69  typedef std::map<std::string,int> ClientOutputLevels;
70  typedef std::pair<void*, const std::type_info*> UserFramework;
71  using UserCallbacks = std::vector<std::function<void()> >;
72 
76  };
77 
78  protected:
80  G4RunManager* m_runManager { nullptr };
82  G4UIdirectory* m_control { nullptr };
84  G4TrackingManager* m_trackMgr { nullptr };
86  Detector* m_detDesc { nullptr };
91 
103  std::string m_controlName { };
105  std::string m_uiName { };
107  std::string m_runManagerType;
111  std::map<std::string, std::string> m_sensitiveDetectorTypes;
113  long m_numEvent = 10;
115  int m_outputLevel = 0;
116 
118  int m_numThreads = 0;
120  int m_haveScoringMgr = false;
123 
124 
131 
132 
134  unsigned long m_id = 0, m_ident = 0;
136  G4VPhysicalVolume* m_world = 0;
137 
139  Geant4Kernel* m_master { nullptr };
144 
145  bool isMaster() const { return this == m_master; }
146  bool isWorker() const { return this != m_master; }
147 
148 #ifndef __CINT__
149  Geant4Kernel(Geant4Kernel* m, unsigned long identifier);
151 #endif
152 
153  public:
155  Geant4Kernel(Detector& description);
156 
158  Geant4Kernel& master() const { return *m_master; }
159 
160  //bool isMultiThreaded() const { return m_multiThreaded; }
161  bool isMultiThreaded() const { return m_numThreads > 0; }
162 
164  static unsigned long int thread_self();
165 
166  public:
167 
169 
175  public:
179  PhaseSelector(Geant4Kernel* kernel);
181  PhaseSelector(const PhaseSelector& c);
185  Geant4ActionPhase& operator[](const std::string& name) const;
186  } phase;
187 
188  enum State {
190  };
192  virtual ~Geant4Kernel();
193 
194 #ifndef __CINT__
195  static Geant4Kernel& instance(Detector& description);
197 #endif
198  const Phases& phases() const { return m_phases; }
201  Detector& detectorDescription() const { return *m_detDesc; }
203  G4TrackingManager* trackMgr() const { return m_trackMgr; }
205  void setTrackMgr(G4TrackingManager* mgr) { m_trackMgr = mgr; }
207  const std::string& directoryName() const { return m_controlName; }
209  unsigned long id() const { return m_ident; }
211  G4RunManager& runManager();
215  template <typename T> void setUserFramework(T* object) {
216  m_userFramework = UserFramework(object,&typeid(T));
217  }
219  const std::string defaultSensitiveDetectorType() const {
221  }
223  const std::map<std::string, std::string>& sensitiveDetectorTypes() const {
225  }
227 
232  void defineSensitiveDetectorType(const std::string& type, const std::string& factory);
234  G4VPhysicalVolume* world() const;
236  void setWorld(G4VPhysicalVolume* volume);
237 
242  void printProperties() const;
244  template <typename T> Geant4Kernel& declareProperty(const std::string& nam, T& val);
246  template <typename T> Geant4Kernel& declareProperty(const char* nam, T& val);
248  bool hasProperty(const std::string& name) const;
250  Property& property(const std::string& name);
251 
253  PrintLevel outputLevel() const { return (PrintLevel)m_outputLevel; }
256  PrintLevel setOutputLevel(PrintLevel new_level);
258  void setOutputLevel(const std::string object, PrintLevel new_level);
260  PrintLevel getOutputLevel(const std::string object) const;
261 
263  void register_configure(const std::function<void()>& callback);
265  void register_initialize(const std::function<void()>& callback);
267  void register_terminate(const std::function<void()>& callback);
268 
270  Geant4Interrupts& interruptHandler() const;
272  void triggerStop();
274  bool processEvents() const;
276  bool registerInterruptHandler(int sig_num);
278 
280  void applyInterruptHandlers();
281 
283 
287  Geant4Kernel& registerGlobalAction(Geant4Action* action);
289  Geant4Action* globalAction(const std::string& action_name, bool throw_if_not_present = true);
291 
295  Geant4Kernel& registerGlobalFilter(Geant4Action* filter);
297  Geant4Action* globalFilter(const std::string& filter_name, bool throw_if_not_present = true);
298 
300  Geant4ActionPhase* getPhase(const std::string& name);
301 
303  virtual Geant4ActionPhase* addSimplePhase(const std::string& name, bool throw_on_exist);
304 
306  virtual Geant4ActionPhase* addPhase(const std::string& name, const std::type_info& arg1, const std::type_info& arg2,
307  const std::type_info& arg3, bool throw_on_exist);
309  template <typename A0> Geant4ActionPhase* addPhase(const std::string& name, bool throw_on_exist = true) {
310  return addPhase(name, typeid(A0), typeid(void), typeid(void), throw_on_exist);
311  }
313  template <typename A0, typename A1>
314  Geant4ActionPhase* addPhase(const std::string& name, bool throw_on_exist = true) {
315  return addPhase(name, typeid(A0), typeid(A1), typeid(void), throw_on_exist);
316  }
318  template <typename A0, typename A1, typename A2>
319  Geant4ActionPhase* addPhase(const std::string& name, bool throw_on_exist = true) {
320  return addPhase(name, typeid(A0), typeid(A1), typeid(A2), throw_on_exist);
321  }
323  virtual bool removePhase(const std::string& name);
325  virtual void destroyPhases();
326 
328  virtual bool executePhase(const std::string& name, const void** args) const;
329 
331  virtual void loadGeometry(const std::string& compact_file);
333  virtual void loadXML(const char* fname);
334 
336  virtual Geant4Kernel& createWorker();
339  Geant4Kernel& worker(unsigned long thread_identifier, bool create_if=false);
341  int numWorkers() const;
342 
344  virtual int configure();
346  virtual int initialize();
348  virtual int run();
350  virtual int runEvents(int num_events);
352  virtual int terminate() override;
353  };
355  template <typename T> Geant4Kernel& Geant4Kernel::declareProperty(const std::string& nam, T& val) {
356  m_properties.add(nam, val);
357  return *this;
358  }
359 
361  template <typename T> Geant4Kernel& Geant4Kernel::declareProperty(const char* nam, T& val) {
362  m_properties.add(nam, val);
363  return *this;
364  }
365 
367  class Geant4Exec {
368  public:
370  static int configure(Geant4Kernel& kernel);
372  static int initialize(Geant4Kernel& kernel);
374  static int run(Geant4Kernel& kernel);
376  static int terminate(Geant4Kernel& kernel);
377  };
378 
379  } // End namespace sim
380 } // End namespace dd4hep
381 #endif // DDG4_GEANT4KERNEL_H
dd4hep::sim::Geant4Kernel::Workers
std::map< unsigned long, Geant4Kernel * > Workers
Definition: Geant4Kernel.h:66
dd4hep::sim::Geant4Kernel::addPhase
Geant4ActionPhase * addPhase(const std::string &name, bool throw_on_exist=true)
Add a new phase to the phase.
Definition: Geant4Kernel.h:314
dd4hep::sim::Geant4Kernel::m_userFramework
UserFramework m_userFramework
Reference to the user framework.
Definition: Geant4Kernel.h:90
dd4hep::sim::Geant4Kernel::triggerStop
void triggerStop()
Trigger smooth end-of-event-loop with finishing currently processing event.
Definition: Geant4Kernel.cpp:184
dd4hep::sim::Geant4Kernel::directoryName
const std::string & directoryName() const
Access the command directory.
Definition: Geant4Kernel.h:207
dd4hep::sim::Geant4Kernel::configure
virtual int configure()
Run the simulation: Configure Geant4.
Definition: Geant4Kernel.cpp:385
dd4hep::sim::Geant4Kernel::m_control
G4UIdirectory * m_control
Top level control directory.
Definition: Geant4Kernel.h:82
dd4hep::sim::Geant4Kernel::phase
class dd4hep::sim::Geant4Kernel::PhaseSelector phase
dd4hep::sim::Geant4Kernel::UserFramework
std::pair< void *, const std::type_info * > UserFramework
Definition: Geant4Kernel.h:70
dd4hep::sim::Geant4Kernel::PhaseSelector::m_kernel
Geant4Kernel * m_kernel
Reference to embedding object.
Definition: Geant4Kernel.h:177
dd4hep::sim::Geant4Kernel::loadXML
virtual void loadXML(const char *fname)
Load XML file.
Definition: Geant4Kernel.cpp:364
dd4hep::sim::Geant4Kernel::defineSensitiveDetectorType
void defineSensitiveDetectorType(const std::string &type, const std::string &factory)
Add new sensitive type to factory list.
Definition: Geant4Kernel.cpp:268
dd4hep::sim::Geant4Kernel::setWorld
void setWorld(G4VPhysicalVolume *volume)
Set the geometry world.
Definition: Geant4Kernel.cpp:262
dd4hep::sim::Geant4Kernel::addSimplePhase
virtual Geant4ActionPhase * addSimplePhase(const std::string &name, bool throw_on_exist)
Add a new phase to the phase.
Definition: Geant4Kernel.cpp:536
dd4hep::sim::Geant4Kernel::outputLevel
PrintLevel outputLevel() const
Access the output level.
Definition: Geant4Kernel.h:254
dd4hep::Property
The property class to assign options to actions.
Definition: ComponentProperties.h:48
dd4hep::sim::Geant4Kernel::EVENTLOOP_HALT
@ EVENTLOOP_HALT
Definition: Geant4Kernel.h:74
dd4hep::sim::Geant4Interrupts
Interruptsback interface class with argument.
Definition: Geant4Interrupts.h:36
dd4hep::sim::Geant4Exec::configure
static int configure(Geant4Kernel &kernel)
Configure the application.
Definition: Geant4Exec.cpp:552
dd4hep::sim::Geant4Kernel::m_outputLevel
int m_outputLevel
Property: Output level.
Definition: Geant4Kernel.h:115
dd4hep::sim::Geant4Kernel::PhaseSelector
Embedded helper class to facilitate map access to the phases.
Definition: Geant4Kernel.h:174
dd4hep::sim::Geant4Kernel::destroyPhases
virtual void destroyPhases()
Destroy all phases. To be called only at shutdown.
Definition: Geant4Kernel.cpp:569
dd4hep::sim::Geant4Kernel::id
unsigned long id() const
Access worker identifier.
Definition: Geant4Kernel.h:209
dd4hep::sim::Geant4Exec::run
static int run(Geant4Kernel &kernel)
Run the application and simulate events.
Definition: Geant4Exec.cpp:635
dd4hep::sim::Geant4Kernel::declareProperty
Geant4Kernel & declareProperty(const std::string &nam, T &val)
Declare property.
Definition: Geant4Kernel.h:355
dd4hep::exception
void exception(const std::string &src, const std::string &msg)
Definition: RootDictionary.h:69
dd4hep::sim::Geant4Kernel::m_dfltSensitiveDetectorType
std::string m_dfltSensitiveDetectorType
Property: Name of the default factory to create G4VSensitiveDetector instances.
Definition: Geant4Kernel.h:109
dd4hep::sim::Geant4Kernel::m_workers
Workers m_workers
Worker threads.
Definition: Geant4Kernel.h:95
dd4hep::sim::Geant4Kernel::addPhase
virtual Geant4ActionPhase * addPhase(const std::string &name, const std::type_info &arg1, const std::type_info &arg2, const std::type_info &arg3, bool throw_on_exist)
Add a new phase to the phase.
Definition: Geant4Kernel.cpp:541
dd4hep::sim::Geant4Kernel::Geant4Kernel
Geant4Kernel(Geant4Kernel *m, unsigned long identifier)
Standard constructor for workers.
Definition: Geant4Kernel.cpp:113
dd4hep::sim::Geant4Kernel::m_master
Geant4Kernel * m_master
Parent reference.
Definition: Geant4Kernel.h:139
dd4hep::sim::Geant4Kernel::registerGlobalAction
Geant4Kernel & registerGlobalAction(Geant4Action *action)
Register action by name to be retrieved when setting up and connecting action objects.
Definition: Geant4Kernel.cpp:457
dd4hep::sim::Geant4Kernel::m_processEvents
int m_processEvents
Master property: Flag if event loop is enabled.
Definition: Geant4Kernel.h:122
dd4hep::sim::Geant4Kernel::property
Property & property(const std::string &name)
Access single property.
Definition: Geant4Kernel.cpp:298
dd4hep::sim::Geant4Kernel
Class, which allows all Geant4Action derivatives to access the DDG4 kernel structures.
Definition: Geant4Kernel.h:64
dd4hep::sim::Geant4Kernel::executePhase
virtual bool executePhase(const std::string &name, const void **args) const
Execute phase action if it exists.
Definition: Geant4Kernel.cpp:519
dd4hep::sim::Geant4ActionPhase
Action phase definition. Client callback at various stage of the simulation processing.
Definition: Geant4ActionPhase.h:68
dd4hep::sim::Geant4Kernel::SETTING_UP
@ SETTING_UP
Definition: Geant4Kernel.h:189
dd4hep::sim::Geant4Kernel::m_interrupts
Geant4Interrupts * m_interrupts
Interrupt/signal handler: only on master instance.
Definition: Geant4Kernel.h:143
dd4hep::sim::Geant4Kernel::setOutputLevel
PrintLevel setOutputLevel(PrintLevel new_level)
Set the global output level of the kernel object; returns previous value.
Definition: Geant4Kernel.cpp:315
Geant4ActionContainer.h
dd4hep::sim::Geant4Kernel::removePhase
virtual bool removePhase(const std::string &name)
Remove an existing phase from the phase. If not existing returns false.
Definition: Geant4Kernel.cpp:559
dd4hep::sim::Geant4Kernel::processEvents
bool processEvents() const
Check if event processing should be continued.
Definition: Geant4Kernel.cpp:193
dd4hep::sim::Geant4Kernel::PhaseSelector::PhaseSelector
PhaseSelector(Geant4Kernel *kernel)
Standard constructor.
Definition: Geant4Kernel.cpp:65
dd4hep::sim::Geant4Kernel::register_initialize
void register_initialize(const std::function< void()> &callback)
Register initialize callback. Signature: (function)()
Definition: Geant4Kernel.cpp:375
dd4hep::sim::Geant4Kernel::m_threadContext
Geant4Context * m_threadContext
Thread context reference.
Definition: Geant4Kernel.h:141
dd4hep::sim::Geant4Kernel::detectorDescription
Detector & detectorDescription() const
Access to detector description.
Definition: Geant4Kernel.h:201
dd4hep::sim::Geant4Kernel::addPhase
Geant4ActionPhase * addPhase(const std::string &name, bool throw_on_exist=true)
Add a new phase to the phase.
Definition: Geant4Kernel.h:309
dd4hep::sim::Geant4Kernel::worker
Geant4Kernel & worker(unsigned long thread_identifier, bool create_if=false)
Access worker instance by its identifier.
Definition: Geant4Kernel.cpp:230
dd4hep::sim::Geant4Kernel::m_clientLevels
ClientOutputLevels m_clientLevels
Property: Client output levels.
Definition: Geant4Kernel.h:101
dd4hep::sim::Geant4Kernel::addPhase
Geant4ActionPhase * addPhase(const std::string &name, bool throw_on_exist=true)
Add a new phase to the phase.
Definition: Geant4Kernel.h:319
dd4hep::sim::Geant4Kernel::registerGlobalFilter
Geant4Kernel & registerGlobalFilter(Geant4Action *filter)
Register filter by name to be retrieved when setting up and connecting filter objects.
Definition: Geant4Kernel.cpp:491
dd4hep::sim::Geant4Kernel::getOutputLevel
PrintLevel getOutputLevel(const std::string object) const
Retrieve the global output level of a named object.
Definition: Geant4Kernel.cpp:308
dd4hep::sim::Geant4Kernel::register_terminate
void register_terminate(const std::function< void()> &callback)
Register terminate callback. Signature: (function)()
Definition: Geant4Kernel.cpp:380
dd4hep::sim::Geant4Kernel::m_globalActions
GlobalActions m_globalActions
Globally registered actions.
Definition: Geant4Kernel.h:97
dd4hep::sim::Geant4Kernel::m_actionInitialize
UserCallbacks m_actionInitialize
Registered action callbacks on initialize.
Definition: Geant4Kernel.h:128
dd4hep::sim::Geant4Kernel::sensitiveDetectorTypes
const std::map< std::string, std::string > & sensitiveDetectorTypes() const
Property access: Names with specialized factories to create G4VSensitiveDetector instances.
Definition: Geant4Kernel.h:223
dd4hep::sim::Geant4Kernel::interruptHandler
Geant4Interrupts & interruptHandler() const
Access interrupt handler. Will be created on the first call.
Definition: Geant4Kernel.cpp:177
dd4hep::sim::Geant4Kernel::PhaseSelector::operator[]
Geant4ActionPhase & operator[](const std::string &name) const
Phase access to the map.
Definition: Geant4Kernel.cpp:83
dd4hep::sim::Geant4Kernel::m_runManager
G4RunManager * m_runManager
Reference to the run manager.
Definition: Geant4Kernel.h:80
dd4hep::sim::Geant4Kernel::getPhase
Geant4ActionPhase * getPhase(const std::string &name)
Access phase by name.
Definition: Geant4Kernel.cpp:528
dd4hep::sim::Geant4Kernel::m_runManagerType
std::string m_runManagerType
Property: Name of the G4 run manager factory to be used. Default: Geant4RunManager.
Definition: Geant4Kernel.h:107
dd4hep::sim::Geant4Kernel::hasProperty
bool hasProperty(const std::string &name) const
Check property for existence.
Definition: Geant4Kernel.cpp:293
dd4hep::sim::Geant4Kernel::m_actionConfigure
UserCallbacks m_actionConfigure
Registered action callbacks on configure.
Definition: Geant4Kernel.h:126
dd4hep::sim::Geant4Kernel::m_haveScoringMgr
int m_haveScoringMgr
Master property: Instantiate the Geant4 scoring manager object.
Definition: Geant4Kernel.h:120
dd4hep::sim::Geant4Kernel::defaultSensitiveDetectorType
const std::string defaultSensitiveDetectorType() const
Property access: Name of the default factory to create G4VSensitiveDetector instances.
Definition: Geant4Kernel.h:219
dd4hep::sim::Geant4Kernel::trackMgr
G4TrackingManager * trackMgr() const
Access the tracking manager.
Definition: Geant4Kernel.h:203
dd4hep::sim::Geant4Kernel::UserCallbacks
std::vector< std::function< void()> > UserCallbacks
Definition: Geant4Kernel.h:71
dd4hep::sim::Geant4Kernel::world
G4VPhysicalVolume * world() const
Access to geometry world.
Definition: Geant4Kernel.cpp:256
dd4hep::sim::DD4hep_Stop_Processing::what
virtual const char * what() const noexcept override
Definition: Geant4Kernel.h:53
dd4hep::sim::Geant4Kernel::event_loop_status
event_loop_status
Definition: Geant4Kernel.h:73
dd4hep::sim::Geant4Exec::terminate
static int terminate(Geant4Kernel &kernel)
Terminate the application.
Definition: Geant4Exec.cpp:661
dd4hep::sim::Geant4Kernel::ClientOutputLevels
std::map< std::string, int > ClientOutputLevels
Definition: Geant4Kernel.h:69
dd4hep::sim::Geant4Kernel::registerInterruptHandler
bool registerInterruptHandler(int sig_num)
Install DDG4 default handler for a given signal. If no handler: return false.
Definition: Geant4Kernel.cpp:198
dd4hep::sim::Geant4Kernel::thread_self
static unsigned long int thread_self()
Access thread identifier.
Definition: Geant4Kernel.cpp:211
dd4hep::sim::Geant4Kernel::phases
const Phases & phases() const
Access phase phases.
Definition: Geant4Kernel.h:199
dd4hep::sim::Geant4Kernel::properties
PropertyManager & properties()
Access to the properties of the object.
Definition: Geant4Kernel.h:240
dd4hep::sim::Geant4Kernel::m_phases
Phases m_phases
Action phases.
Definition: Geant4Kernel.h:93
dd4hep::sim::Geant4Kernel::isMaster
bool isMaster() const
Definition: Geant4Kernel.h:145
dd4hep::sim::Geant4Kernel::globalFilter
Geant4Action * globalFilter(const std::string &filter_name, bool throw_if_not_present=true)
Retrieve filter from repository.
Definition: Geant4Kernel.cpp:508
dd4hep::sim::Geant4Kernel::m_ident
unsigned long m_ident
Definition: Geant4Kernel.h:134
dd4hep::sim::Geant4Kernel::m_numThreads
int m_numThreads
Master property: Number of execution threads in multi threaded mode.
Definition: Geant4Kernel.h:118
dd4hep::sim::Geant4Kernel::register_configure
void register_configure(const std::function< void()> &callback)
Register configure callback. Signature: (function)()
Definition: Geant4Kernel.cpp:370
dd4hep::sim::Geant4Exec::initialize
static int initialize(Geant4Kernel &kernel)
Initialize the application.
Definition: Geant4Exec.cpp:622
dd4hep::sim::Geant4Kernel::EVENTLOOP_RUNNING
@ EVENTLOOP_RUNNING
Definition: Geant4Kernel.h:75
dd4hep::sim::Geant4Kernel::m_uiName
std::string m_uiName
Property: Name of the UI action. Must be member of the global actions.
Definition: Geant4Kernel.h:105
dd4hep::sim::Geant4Kernel::isWorker
bool isWorker() const
Definition: Geant4Kernel.h:146
dd4hep::sim::Geant4Kernel::m_globalFilters
GlobalActions m_globalFilters
Globally registered filters of sensitive detectors.
Definition: Geant4Kernel.h:99
dd4hep::sim::Geant4Kernel::State
State
Definition: Geant4Kernel.h:188
dd4hep::PropertyManager::add
void add(const std::string &name, const Property &property)
Add a new property.
Definition: ComponentProperties.cpp:154
dd4hep::sim::Geant4Kernel::m_world
G4VPhysicalVolume * m_world
Access to geometry world.
Definition: Geant4Kernel.h:136
dd4hep::sim::Geant4Kernel::isMultiThreaded
bool isMultiThreaded() const
Definition: Geant4Kernel.h:161
dd4hep::sim::Geant4Kernel::m_numEvent
long m_numEvent
Property: Number of events to be executed in batch mode.
Definition: Geant4Kernel.h:113
dd4hep::sim::Geant4Kernel::globalAction
Geant4Action * globalAction(const std::string &action_name, bool throw_if_not_present=true)
Retrieve action from repository.
Definition: Geant4Kernel.cpp:476
dd4hep::sim::Geant4Kernel::GlobalActions
std::map< std::string, Geant4Action * > GlobalActions
Definition: Geant4Kernel.h:68
dd4hep::sim::Geant4Kernel::initialize
virtual int initialize()
Run the simulation: Initialize Geant4.
Definition: Geant4Kernel.cpp:396
dd4hep::sim::Geant4Kernel::userFramework
UserFramework & userFramework()
Generic framework access.
Definition: Geant4Kernel.h:213
dd4hep::sim::Geant4Kernel::instance
static Geant4Kernel & instance(Detector &description)
Instance accessor.
Definition: Geant4Kernel.cpp:163
dd4hep::sim::Geant4Kernel::createWorker
virtual Geant4Kernel & createWorker()
Create identified worker instance.
Definition: Geant4Kernel.cpp:217
dd4hep::sim::Geant4Kernel::run
virtual int run()
Run the simulation: Simulate the number of events given by the property "NumEvents".
Definition: Geant4Kernel.cpp:407
dd4hep::sim::Geant4Kernel::loadGeometry
virtual void loadGeometry(const std::string &compact_file)
Construct detector geometry using description plugin.
Definition: Geant4Kernel.cpp:357
dd4hep::sim::Geant4Kernel::m_id
unsigned long m_id
Flag: Master instance (id<0) or worker (id >= 0)
Definition: Geant4Kernel.h:134
dd4hep::sim::Geant4Exec
Main executor steering the Geant4 execution.
Definition: Geant4Kernel.h:367
std
Definition: Plugins.h:30
dd4hep::sim::Geant4Kernel::setUserFramework
void setUserFramework(T *object)
Set the framework context to the kernel object.
Definition: Geant4Kernel.h:215
dd4hep::PropertyManager
Manager to ease the handling of groups of properties.
Definition: ComponentProperties.h:174
dd4hep::sim::Geant4Kernel::m_controlName
std::string m_controlName
Property: Name of the G4UI command tree.
Definition: Geant4Kernel.h:103
dd4hep::sim::Geant4ActionContainer
Class, which allows all Geant4Action to be stored.
Definition: Geant4ActionContainer.h:60
dd4hep::sim::DD4hep_End_Of_File
Helper class to indicate the end of the input file.
Definition: Geant4Kernel.h:43
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4Kernel::INITIALIZED
@ INITIALIZED
Definition: Geant4Kernel.h:189
dd4hep::sim::Geant4Kernel::setTrackMgr
void setTrackMgr(G4TrackingManager *mgr)
Access the tracking manager.
Definition: Geant4Kernel.h:205
dd4hep::sim::DD4hep_End_Of_File::what
virtual const char * what() const noexcept override
Definition: Geant4Kernel.h:46
dd4hep::sim::DD4hep_End_Of_File::DD4hep_End_Of_File
DD4hep_End_Of_File()
Definition: Geant4Kernel.h:45
dd4hep::sim::Geant4Kernel::runEvents
virtual int runEvents(int num_events)
Run the simulation: Simulate the number of events "num_events" and modify the property "NumEvents".
Definition: Geant4Kernel.cpp:423
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::sim::Geant4Kernel::m_detDesc
Detector * m_detDesc
Detector description object.
Definition: Geant4Kernel.h:86
dd4hep::sim::DD4hep_Stop_Processing::DD4hep_Stop_Processing
DD4hep_Stop_Processing()
Definition: Geant4Kernel.h:52
dd4hep::sim::Geant4Kernel::Phases
std::map< std::string, Geant4ActionPhase * > Phases
Definition: Geant4Kernel.h:67
dd4hep::sim::Geant4Kernel::m_properties
PropertyManager m_properties
Property pool.
Definition: Geant4Kernel.h:88
dd4hep::sim::Geant4Kernel::runManager
G4RunManager & runManager()
Access to the Geant4 run manager.
Definition: Geant4Kernel.cpp:322
dd4hep::sim::Geant4Kernel::m_trackMgr
G4TrackingManager * m_trackMgr
Reference to Geant4 track manager.
Definition: Geant4Kernel.h:84
dd4hep::sim::Geant4Kernel::~Geant4Kernel
virtual ~Geant4Kernel()
Default destructor.
Definition: Geant4Kernel.cpp:137
dd4hep::sim::Geant4Kernel::master
Geant4Kernel & master() const
Thread's master context.
Definition: Geant4Kernel.h:158
dd4hep::sim::Geant4Kernel::PhaseSelector::operator=
PhaseSelector & operator=(const PhaseSelector &c)
Assignment operator.
Definition: Geant4Kernel.cpp:75
dd4hep::sim::DD4hep_Stop_Processing
Helper class to indicate the stop of processing.
Definition: Geant4Kernel.h:50
dd4hep::sim::Geant4Kernel::m_actionTerminate
UserCallbacks m_actionTerminate
Registered action callbacks on terminate.
Definition: Geant4Kernel.h:130
dd4hep::sim::Geant4Kernel::m_sensitiveDetectorTypes
std::map< std::string, std::string > m_sensitiveDetectorTypes
Property: Names with specialized factories to create G4VSensitiveDetector instances.
Definition: Geant4Kernel.h:111
dd4hep::sim::Geant4Kernel::applyInterruptHandlers
void applyInterruptHandlers()
(Re-)apply registered interrupt handlers to override potentially later registrations by other librari...
Definition: Geant4Kernel.cpp:206
dd4hep::sim::Geant4Kernel::printProperties
void printProperties() const
Print the property values.
Definition: Geant4Kernel.cpp:283
dd4hep::sim::Geant4Kernel::numWorkers
int numWorkers() const
Access number of workers.
Definition: Geant4Kernel.cpp:251
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201
dd4hep::sim::Geant4Kernel::terminate
virtual int terminate() override
Run the simulation: Terminate Geant4.
Definition: Geant4Kernel.cpp:428