DD4hep  1.38.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 };
142 
143  bool isMaster() const { return this == m_master; }
144  bool isWorker() const { return this != m_master; }
145 
146 #ifndef __CINT__
147  Geant4Kernel(Geant4Kernel* m, unsigned long identifier);
149 #endif
150 
151  public:
153  Geant4Kernel(Detector& description);
154 
156  Geant4Kernel& master() const { return *m_master; }
157 
158  //bool isMultiThreaded() const { return m_multiThreaded; }
159  bool isMultiThreaded() const { return m_numThreads > 0; }
160  int numThreads() const { return m_numThreads; }
161 
163  static unsigned long int thread_self();
164 
165  public:
166 
168 
174  public:
178  PhaseSelector(Geant4Kernel* kernel);
180  PhaseSelector(const PhaseSelector& c);
184  Geant4ActionPhase& operator[](const std::string& name) const;
185  } phase;
186 
187  enum State {
189  };
191  virtual ~Geant4Kernel();
192 
193 #ifndef __CINT__
194  static Geant4Kernel& instance(Detector& description);
196 #endif
197  const Phases& phases() const { return m_phases; }
200  Detector& detectorDescription() const { return *m_detDesc; }
202  G4TrackingManager* trackMgr() const { return m_trackMgr; }
204  void setTrackMgr(G4TrackingManager* mgr) { m_trackMgr = mgr; }
206  const std::string& directoryName() const { return m_controlName; }
208  unsigned long id() const { return m_ident; }
210  G4RunManager& runManager();
214  template <typename T> void setUserFramework(T* object) {
215  m_userFramework = UserFramework(object,&typeid(T));
216  }
218  const std::string defaultSensitiveDetectorType() const {
220  }
222  const std::map<std::string, std::string>& sensitiveDetectorTypes() const {
224  }
226 
231  void defineSensitiveDetectorType(const std::string& type, const std::string& factory);
233  G4VPhysicalVolume* world() const;
235  void setWorld(G4VPhysicalVolume* volume);
236 
241  void printProperties() const;
243  template <typename T> Geant4Kernel& declareProperty(const std::string& nam, T& val);
245  template <typename T> Geant4Kernel& declareProperty(const char* nam, T& val);
247  bool hasProperty(const std::string& name) const;
249  Property& property(const std::string& name);
250 
252  PrintLevel outputLevel() const { return (PrintLevel)m_outputLevel; }
255  PrintLevel setOutputLevel(PrintLevel new_level);
257  void setOutputLevel(const std::string object, PrintLevel new_level);
259  PrintLevel getOutputLevel(const std::string object) const;
260 
262  void register_configure(const std::function<void()>& callback);
264  void register_initialize(const std::function<void()>& callback);
266  void register_terminate(const std::function<void()>& callback);
267 
269  Geant4Interrupts& interruptHandler() const;
271  void triggerStop();
273  bool processEvents() const;
275  bool registerInterruptHandler(int sig_num);
277 
279  void applyInterruptHandlers();
280 
282 
286  Geant4Kernel& registerGlobalAction(Geant4Action* action);
288  Geant4Action* globalAction(const std::string& action_name, bool throw_if_not_present = true);
290 
294  Geant4Kernel& registerGlobalFilter(Geant4Action* filter);
296  Geant4Action* globalFilter(const std::string& filter_name, bool throw_if_not_present = true);
297 
299  Geant4ActionPhase* getPhase(const std::string& name);
300 
302  virtual Geant4ActionPhase* addSimplePhase(const std::string& name, bool throw_on_exist);
303 
305  virtual Geant4ActionPhase* addPhase(const std::string& name, const std::type_info& arg1, const std::type_info& arg2,
306  const std::type_info& arg3, bool throw_on_exist);
308  template <typename A0> Geant4ActionPhase* addPhase(const std::string& name, bool throw_on_exist = true) {
309  return addPhase(name, typeid(A0), typeid(void), typeid(void), throw_on_exist);
310  }
312  template <typename A0, typename A1>
313  Geant4ActionPhase* addPhase(const std::string& name, bool throw_on_exist = true) {
314  return addPhase(name, typeid(A0), typeid(A1), typeid(void), throw_on_exist);
315  }
317  template <typename A0, typename A1, typename A2>
318  Geant4ActionPhase* addPhase(const std::string& name, bool throw_on_exist = true) {
319  return addPhase(name, typeid(A0), typeid(A1), typeid(A2), throw_on_exist);
320  }
322  virtual bool removePhase(const std::string& name);
324  virtual void destroyPhases();
325 
327  virtual bool executePhase(const std::string& name, const void** args) const;
328 
330  virtual void loadGeometry(const std::string& compact_file);
332  virtual void loadXML(const char* fname);
334  virtual long runPlugin(const std::string& plgin, const std::vector<std::string>& args);
335 
337  virtual Geant4Kernel& createWorker();
340  Geant4Kernel& worker(unsigned long thread_identifier, bool create_if=false);
342  int numWorkers() const;
343 
345  virtual int configure();
347  virtual int initialize();
349  virtual int run();
351  virtual int runEvents(int num_events);
353  virtual int terminate() override;
354  };
356  template <typename T> Geant4Kernel& Geant4Kernel::declareProperty(const std::string& nam, T& val) {
357  m_properties.add(nam, val);
358  return *this;
359  }
360 
362  template <typename T> Geant4Kernel& Geant4Kernel::declareProperty(const char* nam, T& val) {
363  m_properties.add(nam, val);
364  return *this;
365  }
366 
368  class Geant4Exec {
369  public:
371  static int configure(Geant4Kernel& kernel);
373  static int initialize(Geant4Kernel& kernel);
375  static int run(Geant4Kernel& kernel);
377  static int terminate(Geant4Kernel& kernel);
378  };
379 
380  } // End namespace sim
381 } // End namespace dd4hep
382 #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:313
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:206
dd4hep::sim::Geant4Kernel::configure
virtual int configure()
Run the simulation: Configure Geant4.
Definition: Geant4Kernel.cpp:395
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:176
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:546
dd4hep::sim::Geant4Kernel::outputLevel
PrintLevel outputLevel() const
Access the output level.
Definition: Geant4Kernel.h:253
dd4hep::Property
The property class to assign options to actions.
Definition: ComponentProperties.h:45
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:173
dd4hep::sim::Geant4Kernel::destroyPhases
virtual void destroyPhases()
Destroy all phases. To be called only at shutdown.
Definition: Geant4Kernel.cpp:579
dd4hep::sim::Geant4Kernel::id
unsigned long id() const
Access worker identifier.
Definition: Geant4Kernel.h:208
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:356
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::runPlugin
virtual long runPlugin(const std::string &plgin, const std::vector< std::string > &args)
Run dd4hep plugin with arguments.
Definition: Geant4Kernel.cpp:370
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:551
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:467
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:529
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:188
dd4hep::sim::Geant4Kernel::m_interrupts
Geant4Interrupts * m_interrupts
Interrupt/signal handler: only on master instance.
Definition: Geant4Kernel.h:141
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:569
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:385
dd4hep::sim::Geant4Kernel::detectorDescription
Detector & detectorDescription() const
Access to detector description.
Definition: Geant4Kernel.h:200
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:308
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:318
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:501
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:390
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:222
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:538
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:218
dd4hep::sim::Geant4Kernel::trackMgr
G4TrackingManager * trackMgr() const
Access the tracking manager.
Definition: Geant4Kernel.h:202
dd4hep::sim::Geant4Kernel::UserCallbacks
std::vector< std::function< void()> > UserCallbacks
Definition: Geant4Kernel.h:71
dd4hep::sim::Geant4Kernel::numThreads
int numThreads() const
Definition: Geant4Kernel.h:160
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:198
dd4hep::sim::Geant4Kernel::properties
PropertyManager & properties()
Access to the properties of the object.
Definition: Geant4Kernel.h:239
dd4hep::sim::Geant4Kernel::m_phases
Phases m_phases
Action phases.
Definition: Geant4Kernel.h:93
dd4hep::sim::Geant4Kernel::isMaster
bool isMaster() const
Definition: Geant4Kernel.h:143
dd4hep::sim::Geant4Kernel::globalFilter
Geant4Action * globalFilter(const std::string &filter_name, bool throw_if_not_present=true)
Retrieve filter from repository.
Definition: Geant4Kernel.cpp:518
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:380
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:144
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:187
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:159
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:486
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:406
dd4hep::sim::Geant4Kernel::userFramework
UserFramework & userFramework()
Generic framework access.
Definition: Geant4Kernel.h:212
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:417
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:368
dd4hep::sim::Geant4Kernel::setUserFramework
void setUserFramework(T *object)
Set the framework context to the kernel object.
Definition: Geant4Kernel.h:214
dd4hep::PropertyManager
Manager to ease the handling of groups of properties.
Definition: ComponentProperties.h:171
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:188
dd4hep::sim::Geant4Kernel::setTrackMgr
void setTrackMgr(G4TrackingManager *mgr)
Access the tracking manager.
Definition: Geant4Kernel.h:204
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:433
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:89
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:156
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::Geant4Kernel::terminate
virtual int terminate() override
Run the simulation: Terminate Geant4.
Definition: Geant4Kernel.cpp:438