DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
dd4hep::sim::Geant4Kernel Class Reference

Class, which allows all Geant4Action derivatives to access the DDG4 kernel structures. More...

#include <Geant4Kernel.h>

Inheritance diagram for dd4hep::sim::Geant4Kernel:
dd4hep::sim::Geant4ActionContainer

Classes

class  PhaseSelector
 Embedded helper class to facilitate map access to the phases. More...
 

Public Types

enum  event_loop_status { EVENTLOOP_HALT = 0, EVENTLOOP_RUNNING = 1 }
 
enum  State { SETTING_UP, INITIALIZED }
 
typedef std::map< unsigned long, Geant4Kernel * > Workers
 
typedef std::map< std::string, Geant4ActionPhase * > Phases
 
typedef std::map< std::string, Geant4Action * > GlobalActions
 
typedef std::map< std::string, int > ClientOutputLevels
 
typedef std::pair< void *, const std::type_info * > UserFramework
 
using UserCallbacks = std::vector< std::function< void()> >
 

Public Member Functions

 Geant4Kernel (Detector &description)
 Standard constructor for the master instance. More...
 
Geant4Kernelmaster () const
 Thread's master context. More...
 
bool isMultiThreaded () const
 
virtual ~Geant4Kernel ()
 Default destructor. More...
 
const Phasesphases () const
 Access phase phases. More...
 
DetectordetectorDescription () const
 Access to detector description. More...
 
G4TrackingManager * trackMgr () const
 Access the tracking manager. More...
 
void setTrackMgr (G4TrackingManager *mgr)
 Access the tracking manager. More...
 
const std::string & directoryName () const
 Access the command directory. More...
 
unsigned long id () const
 Access worker identifier. More...
 
G4RunManager & runManager ()
 Access to the Geant4 run manager. More...
 
UserFrameworkuserFramework ()
 Generic framework access. More...
 
template<typename T >
void setUserFramework (T *object)
 Set the framework context to the kernel object. More...
 
const std::string defaultSensitiveDetectorType () const
 Property access: Name of the default factory to create G4VSensitiveDetector instances. More...
 
const std::map< std::string, std::string > & sensitiveDetectorTypes () const
 Property access: Names with specialized factories to create G4VSensitiveDetector instances. More...
 
void defineSensitiveDetectorType (const std::string &type, const std::string &factory)
 Add new sensitive type to factory list. More...
 
G4VPhysicalVolume * world () const
 Access to geometry world. More...
 
void setWorld (G4VPhysicalVolume *volume)
 Set the geometry world. More...
 
PropertyManagerproperties ()
 Access to the properties of the object. More...
 
void printProperties () const
 Print the property values. More...
 
template<typename T >
Geant4KerneldeclareProperty (const std::string &nam, T &val)
 Declare property. More...
 
template<typename T >
Geant4KerneldeclareProperty (const char *nam, T &val)
 Declare property. More...
 
bool hasProperty (const std::string &name) const
 Check property for existence. More...
 
Propertyproperty (const std::string &name)
 Access single property. More...
 
PrintLevel outputLevel () const
 Access the output level. More...
 
PrintLevel setOutputLevel (PrintLevel new_level)
 Set the global output level of the kernel object; returns previous value. More...
 
void setOutputLevel (const std::string object, PrintLevel new_level)
 Fill cache with the global output level of a named object. Must be set before instantiation. More...
 
PrintLevel getOutputLevel (const std::string object) const
 Retrieve the global output level of a named object. More...
 
void register_configure (const std::function< void()> &callback)
 Register configure callback. Signature: (function)() More...
 
void register_initialize (const std::function< void()> &callback)
 Register initialize callback. Signature: (function)() More...
 
void register_terminate (const std::function< void()> &callback)
 Register terminate callback. Signature: (function)() More...
 
Geant4InterruptsinterruptHandler () const
 Access interrupt handler. Will be created on the first call. More...
 
void triggerStop ()
 Trigger smooth end-of-event-loop with finishing currently processing event. More...
 
bool processEvents () const
 Check if event processing should be continued. More...
 
bool registerInterruptHandler (int sig_num)
 Install DDG4 default handler for a given signal. If no handler: return false. More...
 
void applyInterruptHandlers ()
 (Re-)apply registered interrupt handlers to override potentially later registrations by other libraries More...
 
Geant4KernelregisterGlobalAction (Geant4Action *action)
 Register action by name to be retrieved when setting up and connecting action objects. More...
 
Geant4ActionglobalAction (const std::string &action_name, bool throw_if_not_present=true)
 Retrieve action from repository. More...
 
Geant4KernelregisterGlobalFilter (Geant4Action *filter)
 Register filter by name to be retrieved when setting up and connecting filter objects. More...
 
Geant4ActionglobalFilter (const std::string &filter_name, bool throw_if_not_present=true)
 Retrieve filter from repository. More...
 
Geant4ActionPhasegetPhase (const std::string &name)
 Access phase by name. More...
 
virtual Geant4ActionPhaseaddSimplePhase (const std::string &name, bool throw_on_exist)
 Add a new phase to the phase. More...
 
virtual Geant4ActionPhaseaddPhase (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. More...
 
template<typename A0 >
Geant4ActionPhaseaddPhase (const std::string &name, bool throw_on_exist=true)
 Add a new phase to the phase. More...
 
template<typename A0 , typename A1 >
Geant4ActionPhaseaddPhase (const std::string &name, bool throw_on_exist=true)
 Add a new phase to the phase. More...
 
template<typename A0 , typename A1 , typename A2 >
Geant4ActionPhaseaddPhase (const std::string &name, bool throw_on_exist=true)
 Add a new phase to the phase. More...
 
virtual bool removePhase (const std::string &name)
 Remove an existing phase from the phase. If not existing returns false. More...
 
virtual void destroyPhases ()
 Destroy all phases. To be called only at shutdown. More...
 
virtual bool executePhase (const std::string &name, const void **args) const
 Execute phase action if it exists. More...
 
virtual void loadGeometry (const std::string &compact_file)
 Construct detector geometry using description plugin. More...
 
virtual void loadXML (const char *fname)
 Load XML file. More...
 
virtual Geant4KernelcreateWorker ()
 Create identified worker instance. More...
 
Geant4Kernelworker (unsigned long thread_identifier, bool create_if=false)
 Access worker instance by its identifier. More...
 
int numWorkers () const
 Access number of workers. More...
 
virtual int configure ()
 Run the simulation: Configure Geant4. More...
 
virtual int initialize ()
 Run the simulation: Initialize Geant4. More...
 
virtual int run ()
 Run the simulation: Simulate the number of events given by the property "NumEvents". More...
 
virtual int runEvents (int num_events)
 Run the simulation: Simulate the number of events "num_events" and modify the property "NumEvents". More...
 
virtual int terminate () override
 Run the simulation: Terminate Geant4. More...
 
- Public Member Functions inherited from dd4hep::sim::Geant4ActionContainer
Geant4ContextworkerContext ()
 Thread's Geant4 execution context. More...
 
Geant4GeneratorActionSequencegeneratorAction (bool create)
 Access generator action sequence. More...
 
Geant4GeneratorActionSequencegeneratorAction ()
 Access generator action sequence. More...
 
Geant4RunActionSequencerunAction (bool create)
 Access run action sequence. More...
 
Geant4RunActionSequencerunAction ()
 Access run action sequence. More...
 
Geant4EventActionSequenceeventAction (bool create)
 Access run action sequence. More...
 
Geant4EventActionSequenceeventAction ()
 Access run action sequence. More...
 
Geant4SteppingActionSequencesteppingAction (bool create)
 Access stepping action sequence. More...
 
Geant4SteppingActionSequencesteppingAction ()
 Access stepping action sequence. More...
 
Geant4TrackingActionSequencetrackingAction (bool create)
 Access tracking action sequence. More...
 
Geant4TrackingActionSequencetrackingAction ()
 Access tracking action sequence. More...
 
Geant4StackingActionSequencestackingAction (bool create)
 Access stacking action sequence. More...
 
Geant4StackingActionSequencestackingAction ()
 Access stacking action sequence. More...
 
Geant4DetectorConstructionSequencedetectorConstruction (bool create)
 Access detector construcion action sequence (geometry+sensitives+field) More...
 
Geant4DetectorConstructionSequencedetectorConstruction ()
 Access detector construcion action sequence (geometry+sensitives+field) More...
 
Geant4SensDetSequencessensitiveActions () const
 Access to the sensitive detector sequences from the actioncontainer object. More...
 
Geant4SensDetActionSequencesensitiveAction (const std::string &name)
 Access to the sensitive detector action from the actioncontainer object. More...
 
Geant4PhysicsListActionSequencephysicsList (bool create)
 Access to the physics list. More...
 
Geant4PhysicsListActionSequencephysicsList ()
 Access to the physics list. More...
 
Geant4UserInitializationSequenceuserInitialization (bool create)
 Access to the user initialization object. More...
 
Geant4UserInitializationSequenceuserInitialization ()
 Access to the user initialization object. More...
 

Static Public Member Functions

static unsigned long int thread_self ()
 Access thread identifier. More...
 
static Geant4Kernelinstance (Detector &description)
 Instance accessor. More...
 

Public Attributes

class dd4hep::sim::Geant4Kernel::PhaseSelector phase
 

Protected Member Functions

bool isMaster () const
 
bool isWorker () const
 
 Geant4Kernel (Geant4Kernel *m, unsigned long identifier)
 Standard constructor for workers. More...
 
- Protected Member Functions inherited from dd4hep::sim::Geant4ActionContainer
template<typename C >
bool registerSequence (C *&seq, const std::string &name)
 Helper to register an action sequence. More...
 
 Geant4ActionContainer (Geant4Context *ctxt=0)
 Standard constructor. More...
 
virtual ~Geant4ActionContainer ()
 Default destructor. More...
 
void setContext (Geant4Context *ctxt)
 Set the thread's context. More...
 

Protected Attributes

G4RunManager * m_runManager { nullptr }
 Reference to the run manager. More...
 
G4UIdirectory * m_control { nullptr }
 Top level control directory. More...
 
G4TrackingManager * m_trackMgr { nullptr }
 Reference to Geant4 track manager. More...
 
Detectorm_detDesc { nullptr }
 Detector description object. More...
 
PropertyManager m_properties { }
 Property pool. More...
 
UserFramework m_userFramework { }
 Reference to the user framework. More...
 
Phases m_phases { }
 Action phases. More...
 
Workers m_workers { }
 Worker threads. More...
 
GlobalActions m_globalActions { }
 Globally registered actions. More...
 
GlobalActions m_globalFilters { }
 Globally registered filters of sensitive detectors. More...
 
ClientOutputLevels m_clientLevels { }
 Property: Client output levels. More...
 
std::string m_controlName { }
 Property: Name of the G4UI command tree. More...
 
std::string m_uiName { }
 Property: Name of the UI action. Must be member of the global actions. More...
 
std::string m_runManagerType
 Property: Name of the G4 run manager factory to be used. Default: Geant4RunManager. More...
 
std::string m_dfltSensitiveDetectorType
 Property: Name of the default factory to create G4VSensitiveDetector instances. More...
 
std::map< std::string, std::string > m_sensitiveDetectorTypes
 Property: Names with specialized factories to create G4VSensitiveDetector instances. More...
 
long m_numEvent = 10
 Property: Number of events to be executed in batch mode. More...
 
int m_outputLevel = 0
 Property: Output level. More...
 
int m_numThreads = 0
 Master property: Number of execution threads in multi threaded mode. More...
 
int m_haveScoringMgr = false
 Master property: Instantiate the Geant4 scoring manager object. More...
 
int m_processEvents = EVENTLOOP_RUNNING
 Master property: Flag if event loop is enabled. More...
 
UserCallbacks m_actionConfigure { }
 Registered action callbacks on configure. More...
 
UserCallbacks m_actionInitialize { }
 Registered action callbacks on initialize. More...
 
UserCallbacks m_actionTerminate { }
 Registered action callbacks on terminate. More...
 
unsigned long m_id = 0
 Flag: Master instance (id<0) or worker (id >= 0) More...
 
unsigned long m_ident = 0
 
G4VPhysicalVolume * m_world = 0
 Access to geometry world. More...
 
Geant4Kernelm_master { nullptr }
 Parent reference. More...
 
Geant4Contextm_threadContext { nullptr }
 Thread context reference. More...
 
Geant4Interruptsm_interrupts { nullptr }
 Interrupt/signal handler: only on master instance. More...
 
- Protected Attributes inherited from dd4hep::sim::Geant4ActionContainer
Geant4Contextm_context { nullptr }
 Geant4 worker context (thread specific) More...
 
Geant4GeneratorActionSequencem_generatorAction { nullptr }
 Reference to the Geant4 primary generator action. More...
 
Geant4RunActionSequencem_runAction { nullptr }
 Reference to the Geant4 run action. More...
 
Geant4EventActionSequencem_eventAction { nullptr }
 Reference to the Geant4 event action. More...
 
Geant4TrackingActionSequencem_trackingAction { nullptr }
 Reference to the Geant4 track action. More...
 
Geant4SteppingActionSequencem_steppingAction { nullptr }
 Reference to the Geant4 step action. More...
 
Geant4StackingActionSequencem_stackingAction { nullptr }
 Reference to the Geant4 stacking action. More...
 
Geant4DetectorConstructionSequencem_constructionAction { nullptr }
 Reference to the Geant4 detector construction sequence. More...
 
Geant4SensDetSequencesm_sensDetActions { nullptr }
 Reference to the Geant4 sensitive action sequences. More...
 
Geant4PhysicsListActionSequencem_physicsList { nullptr }
 Reference to the Geant4 physics list. More...
 
Geant4UserInitializationSequencem_userInit { nullptr }
 Reference to the user initialization object. More...
 

Detailed Description

Class, which allows all Geant4Action derivatives to access the DDG4 kernel structures.

To implement access to a user specified framework please see class Geant4Context.

Author
M.Frank
Version
1.0

Definition at line 64 of file Geant4Kernel.h.

Member Typedef Documentation

◆ ClientOutputLevels

typedef std::map<std::string,int> dd4hep::sim::Geant4Kernel::ClientOutputLevels

Definition at line 69 of file Geant4Kernel.h.

◆ GlobalActions

typedef std::map<std::string, Geant4Action*> dd4hep::sim::Geant4Kernel::GlobalActions

Definition at line 68 of file Geant4Kernel.h.

◆ Phases

typedef std::map<std::string, Geant4ActionPhase*> dd4hep::sim::Geant4Kernel::Phases

Definition at line 67 of file Geant4Kernel.h.

◆ UserCallbacks

using dd4hep::sim::Geant4Kernel::UserCallbacks = std::vector<std::function<void()> >

Definition at line 71 of file Geant4Kernel.h.

◆ UserFramework

typedef std::pair<void*, const std::type_info*> dd4hep::sim::Geant4Kernel::UserFramework

Definition at line 70 of file Geant4Kernel.h.

◆ Workers

typedef std::map<unsigned long, Geant4Kernel*> dd4hep::sim::Geant4Kernel::Workers

Definition at line 66 of file Geant4Kernel.h.

Member Enumeration Documentation

◆ event_loop_status

Enumerator
EVENTLOOP_HALT 
EVENTLOOP_RUNNING 

Definition at line 73 of file Geant4Kernel.h.

◆ State

Enumerator
SETTING_UP 
INITIALIZED 

Definition at line 188 of file Geant4Kernel.h.

Constructor & Destructor Documentation

◆ Geant4Kernel() [1/2]

Geant4Kernel::Geant4Kernel ( Geant4Kernel m,
unsigned long  identifier 
)
protected

Standard constructor for workers.

Standard constructor.

Definition at line 113 of file Geant4Kernel.cpp.

◆ Geant4Kernel() [2/2]

Geant4Kernel::Geant4Kernel ( Detector description)

Standard constructor for the master instance.

Standard constructor.

Definition at line 90 of file Geant4Kernel.cpp.

◆ ~Geant4Kernel()

Geant4Kernel::~Geant4Kernel ( )
virtual

Default destructor.

Definition at line 137 of file Geant4Kernel.cpp.

Member Function Documentation

◆ addPhase() [1/4]

template<typename A0 >
Geant4ActionPhase* dd4hep::sim::Geant4Kernel::addPhase ( const std::string &  name,
bool  throw_on_exist = true 
)
inline

Add a new phase to the phase.

Definition at line 309 of file Geant4Kernel.h.

◆ addPhase() [2/4]

template<typename A0 , typename A1 >
Geant4ActionPhase* dd4hep::sim::Geant4Kernel::addPhase ( const std::string &  name,
bool  throw_on_exist = true 
)
inline

Add a new phase to the phase.

Definition at line 314 of file Geant4Kernel.h.

◆ addPhase() [3/4]

template<typename A0 , typename A1 , typename A2 >
Geant4ActionPhase* dd4hep::sim::Geant4Kernel::addPhase ( const std::string &  name,
bool  throw_on_exist = true 
)
inline

Add a new phase to the phase.

Definition at line 319 of file Geant4Kernel.h.

◆ addPhase() [4/4]

Geant4ActionPhase * Geant4Kernel::addPhase ( const std::string &  name,
const std::type_info &  arg1,
const std::type_info &  arg2,
const std::type_info &  arg3,
bool  throw_on_exist 
)
virtual

Add a new phase to the phase.

Add a new phase.

Definition at line 541 of file Geant4Kernel.cpp.

◆ addSimplePhase()

Geant4ActionPhase * Geant4Kernel::addSimplePhase ( const std::string &  name,
bool  throw_on_exist 
)
virtual

Add a new phase to the phase.

Definition at line 536 of file Geant4Kernel.cpp.

◆ applyInterruptHandlers()

void Geant4Kernel::applyInterruptHandlers ( )

(Re-)apply registered interrupt handlers to override potentially later registrations by other libraries

In this case we overwrite signal handlers applied by Geant4.

Definition at line 206 of file Geant4Kernel.cpp.

◆ configure()

int Geant4Kernel::configure ( )
virtual

Run the simulation: Configure Geant4.

Configure Geant4 kernel object.

Definition at line 385 of file Geant4Kernel.cpp.

◆ createWorker()

Geant4Kernel & Geant4Kernel::createWorker ( )
virtual

Create identified worker instance.

Geant4 Multi threading support

Definition at line 217 of file Geant4Kernel.cpp.

◆ declareProperty() [1/2]

template<typename T >
Geant4Kernel & dd4hep::sim::Geant4Kernel::declareProperty ( const char *  nam,
T &  val 
)

Declare property.

Definition at line 361 of file Geant4Kernel.h.

◆ declareProperty() [2/2]

template<typename T >
Geant4Kernel & dd4hep::sim::Geant4Kernel::declareProperty ( const std::string &  nam,
T &  val 
)

Declare property.

Definition at line 355 of file Geant4Kernel.h.

◆ defaultSensitiveDetectorType()

const std::string dd4hep::sim::Geant4Kernel::defaultSensitiveDetectorType ( ) const
inline

Property access: Name of the default factory to create G4VSensitiveDetector instances.

Definition at line 219 of file Geant4Kernel.h.

◆ defineSensitiveDetectorType()

void Geant4Kernel::defineSensitiveDetectorType ( const std::string &  type,
const std::string &  factory 
)

Add new sensitive type to factory list.

This is present mainly for debugging purposes and tests. Never necessary in real life! For all practical purpose the default type Geant4SensDet is sufficient.

Definition at line 268 of file Geant4Kernel.cpp.

◆ destroyPhases()

void Geant4Kernel::destroyPhases ( )
virtual

Destroy all phases. To be called only at shutdown.

Definition at line 569 of file Geant4Kernel.cpp.

◆ detectorDescription()

Detector& dd4hep::sim::Geant4Kernel::detectorDescription ( ) const
inline

Access to detector description.

Definition at line 201 of file Geant4Kernel.h.

◆ directoryName()

const std::string& dd4hep::sim::Geant4Kernel::directoryName ( ) const
inline

Access the command directory.

Definition at line 207 of file Geant4Kernel.h.

◆ executePhase()

bool Geant4Kernel::executePhase ( const std::string &  name,
const void **  args 
) const
virtual

Execute phase action if it exists.

Definition at line 519 of file Geant4Kernel.cpp.

◆ getOutputLevel()

dd4hep::PrintLevel Geant4Kernel::getOutputLevel ( const std::string  object) const

Retrieve the global output level of a named object.

Definition at line 308 of file Geant4Kernel.cpp.

◆ getPhase()

Geant4ActionPhase * Geant4Kernel::getPhase ( const std::string &  name)

Access phase by name.

Definition at line 528 of file Geant4Kernel.cpp.

◆ globalAction()

Geant4Action * Geant4Kernel::globalAction ( const std::string &  action_name,
bool  throw_if_not_present = true 
)

Retrieve action from repository.

Definition at line 476 of file Geant4Kernel.cpp.

◆ globalFilter()

Geant4Action * Geant4Kernel::globalFilter ( const std::string &  filter_name,
bool  throw_if_not_present = true 
)

Retrieve filter from repository.

Definition at line 508 of file Geant4Kernel.cpp.

◆ hasProperty()

bool Geant4Kernel::hasProperty ( const std::string &  name) const

Check property for existence.

Definition at line 293 of file Geant4Kernel.cpp.

◆ id()

unsigned long dd4hep::sim::Geant4Kernel::id ( ) const
inline

Access worker identifier.

Definition at line 209 of file Geant4Kernel.h.

◆ initialize()

int Geant4Kernel::initialize ( )
virtual

Run the simulation: Initialize Geant4.

Initialize Geant4 kernel object.

Definition at line 396 of file Geant4Kernel.cpp.

◆ instance()

Geant4Kernel & Geant4Kernel::instance ( Detector description)
static

Instance accessor.

Install here the termination handler

Definition at line 163 of file Geant4Kernel.cpp.

◆ interruptHandler()

Geant4Interrupts & Geant4Kernel::interruptHandler ( ) const

Access interrupt handler. Will be created on the first call.

Definition at line 177 of file Geant4Kernel.cpp.

◆ isMaster()

bool dd4hep::sim::Geant4Kernel::isMaster ( ) const
inlineprotected

Definition at line 145 of file Geant4Kernel.h.

◆ isMultiThreaded()

bool dd4hep::sim::Geant4Kernel::isMultiThreaded ( ) const
inline

Definition at line 161 of file Geant4Kernel.h.

◆ isWorker()

bool dd4hep::sim::Geant4Kernel::isWorker ( ) const
inlineprotected

Definition at line 146 of file Geant4Kernel.h.

◆ loadGeometry()

void Geant4Kernel::loadGeometry ( const std::string &  compact_file)
virtual

Construct detector geometry using description plugin.

Definition at line 357 of file Geant4Kernel.cpp.

◆ loadXML()

void Geant4Kernel::loadXML ( const char *  fname)
virtual

Load XML file.

Definition at line 364 of file Geant4Kernel.cpp.

◆ master()

Geant4Kernel& dd4hep::sim::Geant4Kernel::master ( ) const
inline

Thread's master context.

Definition at line 158 of file Geant4Kernel.h.

◆ numWorkers()

int Geant4Kernel::numWorkers ( ) const

Access number of workers.

Definition at line 251 of file Geant4Kernel.cpp.

◆ outputLevel()

PrintLevel dd4hep::sim::Geant4Kernel::outputLevel ( ) const
inline

Access the output level.

Output level settings

Definition at line 254 of file Geant4Kernel.h.

◆ phases()

const Phases& dd4hep::sim::Geant4Kernel::phases ( ) const
inline

Access phase phases.

Definition at line 199 of file Geant4Kernel.h.

◆ printProperties()

void Geant4Kernel::printProperties ( ) const

Print the property values.

Definition at line 283 of file Geant4Kernel.cpp.

◆ processEvents()

bool Geant4Kernel::processEvents ( ) const

Check if event processing should be continued.

Access flag if event loop is enabled.

Definition at line 193 of file Geant4Kernel.cpp.

◆ properties()

PropertyManager& dd4hep::sim::Geant4Kernel::properties ( )
inline

Access to the properties of the object.

Property access

Definition at line 240 of file Geant4Kernel.h.

◆ property()

dd4hep::Property & Geant4Kernel::property ( const std::string &  name)

Access single property.

Definition at line 298 of file Geant4Kernel.cpp.

◆ register_configure()

void Geant4Kernel::register_configure ( const std::function< void()> &  callback)

Register configure callback. Signature: (function)()

Register configure callback.

Definition at line 370 of file Geant4Kernel.cpp.

◆ register_initialize()

void Geant4Kernel::register_initialize ( const std::function< void()> &  callback)

Register initialize callback. Signature: (function)()

Register initialize callback.

Definition at line 375 of file Geant4Kernel.cpp.

◆ register_terminate()

void Geant4Kernel::register_terminate ( const std::function< void()> &  callback)

Register terminate callback. Signature: (function)()

Register terminate callback.

Definition at line 380 of file Geant4Kernel.cpp.

◆ registerGlobalAction()

Geant4Kernel & Geant4Kernel::registerGlobalAction ( Geant4Action action)

Register action by name to be retrieved when setting up and connecting action objects.

Note: registered actions MUST be unique. However, not all actions need to registered.... Only register those, you later need to retrieve by name.

Definition at line 457 of file Geant4Kernel.cpp.

◆ registerGlobalFilter()

Geant4Kernel & Geant4Kernel::registerGlobalFilter ( Geant4Action filter)

Register filter by name to be retrieved when setting up and connecting filter objects.

Note: registered filters MUST be unique. However, not all filters need to registered.... Only register those, you later need to retrieve by name.

Definition at line 491 of file Geant4Kernel.cpp.

◆ registerInterruptHandler()

bool Geant4Kernel::registerInterruptHandler ( int  sig_num)

Install DDG4 default handler for a given signal. If no handler: return false.

Definition at line 198 of file Geant4Kernel.cpp.

◆ removePhase()

bool Geant4Kernel::removePhase ( const std::string &  name)
virtual

Remove an existing phase from the phase. If not existing returns false.

Definition at line 559 of file Geant4Kernel.cpp.

◆ run()

int Geant4Kernel::run ( )
virtual

Run the simulation: Simulate the number of events given by the property "NumEvents".

Run Geant4.

Definition at line 407 of file Geant4Kernel.cpp.

◆ runEvents()

int Geant4Kernel::runEvents ( int  num_events)
virtual

Run the simulation: Simulate the number of events "num_events" and modify the property "NumEvents".

Definition at line 423 of file Geant4Kernel.cpp.

◆ runManager()

G4RunManager & Geant4Kernel::runManager ( )

Access to the Geant4 run manager.

Definition at line 322 of file Geant4Kernel.cpp.

◆ sensitiveDetectorTypes()

const std::map<std::string, std::string>& dd4hep::sim::Geant4Kernel::sensitiveDetectorTypes ( ) const
inline

Property access: Names with specialized factories to create G4VSensitiveDetector instances.

Definition at line 223 of file Geant4Kernel.h.

◆ setOutputLevel() [1/2]

void Geant4Kernel::setOutputLevel ( const std::string  object,
PrintLevel  new_level 
)

Fill cache with the global output level of a named object. Must be set before instantiation.

Definition at line 303 of file Geant4Kernel.cpp.

◆ setOutputLevel() [2/2]

dd4hep::PrintLevel Geant4Kernel::setOutputLevel ( PrintLevel  new_level)

Set the global output level of the kernel object; returns previous value.

Set the output level; returns previous value.

Definition at line 315 of file Geant4Kernel.cpp.

◆ setTrackMgr()

void dd4hep::sim::Geant4Kernel::setTrackMgr ( G4TrackingManager *  mgr)
inline

Access the tracking manager.

Definition at line 205 of file Geant4Kernel.h.

◆ setUserFramework()

template<typename T >
void dd4hep::sim::Geant4Kernel::setUserFramework ( T *  object)
inline

Set the framework context to the kernel object.

Definition at line 215 of file Geant4Kernel.h.

◆ setWorld()

void Geant4Kernel::setWorld ( G4VPhysicalVolume *  volume)

Set the geometry world.

Definition at line 262 of file Geant4Kernel.cpp.

◆ terminate()

int Geant4Kernel::terminate ( )
overridevirtual

Run the simulation: Terminate Geant4.

Reimplemented from dd4hep::sim::Geant4ActionContainer.

Definition at line 428 of file Geant4Kernel.cpp.

◆ thread_self()

unsigned long int Geant4Kernel::thread_self ( )
static

Access thread identifier.

Definition at line 211 of file Geant4Kernel.cpp.

◆ trackMgr()

G4TrackingManager* dd4hep::sim::Geant4Kernel::trackMgr ( ) const
inline

Access the tracking manager.

Definition at line 203 of file Geant4Kernel.h.

◆ triggerStop()

void Geant4Kernel::triggerStop ( )

Trigger smooth end-of-event-loop with finishing currently processing event.

Definition at line 184 of file Geant4Kernel.cpp.

◆ userFramework()

UserFramework& dd4hep::sim::Geant4Kernel::userFramework ( )
inline

Generic framework access.

Definition at line 213 of file Geant4Kernel.h.

◆ worker()

Geant4Kernel & Geant4Kernel::worker ( unsigned long  thread_identifier,
bool  create_if = false 
)

Access worker instance by its identifier.

Definition at line 230 of file Geant4Kernel.cpp.

◆ world()

G4VPhysicalVolume * Geant4Kernel::world ( ) const

Access to geometry world.

Definition at line 256 of file Geant4Kernel.cpp.

Member Data Documentation

◆ m_actionConfigure

UserCallbacks dd4hep::sim::Geant4Kernel::m_actionConfigure { }
protected

Registered action callbacks on configure.

Definition at line 126 of file Geant4Kernel.h.

◆ m_actionInitialize

UserCallbacks dd4hep::sim::Geant4Kernel::m_actionInitialize { }
protected

Registered action callbacks on initialize.

Definition at line 128 of file Geant4Kernel.h.

◆ m_actionTerminate

UserCallbacks dd4hep::sim::Geant4Kernel::m_actionTerminate { }
protected

Registered action callbacks on terminate.

Definition at line 130 of file Geant4Kernel.h.

◆ m_clientLevels

ClientOutputLevels dd4hep::sim::Geant4Kernel::m_clientLevels { }
protected

Property: Client output levels.

Definition at line 101 of file Geant4Kernel.h.

◆ m_control

G4UIdirectory* dd4hep::sim::Geant4Kernel::m_control { nullptr }
protected

Top level control directory.

Definition at line 82 of file Geant4Kernel.h.

◆ m_controlName

std::string dd4hep::sim::Geant4Kernel::m_controlName { }
protected

Property: Name of the G4UI command tree.

Definition at line 103 of file Geant4Kernel.h.

◆ m_detDesc

Detector* dd4hep::sim::Geant4Kernel::m_detDesc { nullptr }
protected

Detector description object.

Definition at line 86 of file Geant4Kernel.h.

◆ m_dfltSensitiveDetectorType

std::string dd4hep::sim::Geant4Kernel::m_dfltSensitiveDetectorType
protected

Property: Name of the default factory to create G4VSensitiveDetector instances.

Definition at line 109 of file Geant4Kernel.h.

◆ m_globalActions

GlobalActions dd4hep::sim::Geant4Kernel::m_globalActions { }
protected

Globally registered actions.

Definition at line 97 of file Geant4Kernel.h.

◆ m_globalFilters

GlobalActions dd4hep::sim::Geant4Kernel::m_globalFilters { }
protected

Globally registered filters of sensitive detectors.

Definition at line 99 of file Geant4Kernel.h.

◆ m_haveScoringMgr

int dd4hep::sim::Geant4Kernel::m_haveScoringMgr = false
protected

Master property: Instantiate the Geant4 scoring manager object.

Definition at line 120 of file Geant4Kernel.h.

◆ m_id

unsigned long dd4hep::sim::Geant4Kernel::m_id = 0
protected

Flag: Master instance (id<0) or worker (id >= 0)

Definition at line 134 of file Geant4Kernel.h.

◆ m_ident

unsigned long dd4hep::sim::Geant4Kernel::m_ident = 0
protected

Definition at line 134 of file Geant4Kernel.h.

◆ m_interrupts

Geant4Interrupts* dd4hep::sim::Geant4Kernel::m_interrupts { nullptr }
protected

Interrupt/signal handler: only on master instance.

Definition at line 143 of file Geant4Kernel.h.

◆ m_master

Geant4Kernel* dd4hep::sim::Geant4Kernel::m_master { nullptr }
protected

Parent reference.

Definition at line 139 of file Geant4Kernel.h.

◆ m_numEvent

long dd4hep::sim::Geant4Kernel::m_numEvent = 10
protected

Property: Number of events to be executed in batch mode.

Definition at line 113 of file Geant4Kernel.h.

◆ m_numThreads

int dd4hep::sim::Geant4Kernel::m_numThreads = 0
protected

Master property: Number of execution threads in multi threaded mode.

Definition at line 118 of file Geant4Kernel.h.

◆ m_outputLevel

int dd4hep::sim::Geant4Kernel::m_outputLevel = 0
protected

Property: Output level.

Definition at line 115 of file Geant4Kernel.h.

◆ m_phases

Phases dd4hep::sim::Geant4Kernel::m_phases { }
protected

Action phases.

Definition at line 93 of file Geant4Kernel.h.

◆ m_processEvents

int dd4hep::sim::Geant4Kernel::m_processEvents = EVENTLOOP_RUNNING
protected

Master property: Flag if event loop is enabled.

Definition at line 122 of file Geant4Kernel.h.

◆ m_properties

PropertyManager dd4hep::sim::Geant4Kernel::m_properties { }
protected

Property pool.

Definition at line 88 of file Geant4Kernel.h.

◆ m_runManager

G4RunManager* dd4hep::sim::Geant4Kernel::m_runManager { nullptr }
protected

Reference to the run manager.

Definition at line 80 of file Geant4Kernel.h.

◆ m_runManagerType

std::string dd4hep::sim::Geant4Kernel::m_runManagerType
protected

Property: Name of the G4 run manager factory to be used. Default: Geant4RunManager.

Definition at line 107 of file Geant4Kernel.h.

◆ m_sensitiveDetectorTypes

std::map<std::string, std::string> dd4hep::sim::Geant4Kernel::m_sensitiveDetectorTypes
protected

Property: Names with specialized factories to create G4VSensitiveDetector instances.

Definition at line 111 of file Geant4Kernel.h.

◆ m_threadContext

Geant4Context* dd4hep::sim::Geant4Kernel::m_threadContext { nullptr }
protected

Thread context reference.

Definition at line 141 of file Geant4Kernel.h.

◆ m_trackMgr

G4TrackingManager* dd4hep::sim::Geant4Kernel::m_trackMgr { nullptr }
protected

Reference to Geant4 track manager.

Definition at line 84 of file Geant4Kernel.h.

◆ m_uiName

std::string dd4hep::sim::Geant4Kernel::m_uiName { }
protected

Property: Name of the UI action. Must be member of the global actions.

Definition at line 105 of file Geant4Kernel.h.

◆ m_userFramework

UserFramework dd4hep::sim::Geant4Kernel::m_userFramework { }
protected

Reference to the user framework.

Definition at line 90 of file Geant4Kernel.h.

◆ m_workers

Workers dd4hep::sim::Geant4Kernel::m_workers { }
protected

Worker threads.

Definition at line 95 of file Geant4Kernel.h.

◆ m_world

G4VPhysicalVolume* dd4hep::sim::Geant4Kernel::m_world = 0
protected

Access to geometry world.

Definition at line 136 of file Geant4Kernel.h.

◆ phase

class dd4hep::sim::Geant4Kernel::PhaseSelector dd4hep::sim::Geant4Kernel::phase

The documentation for this class was generated from the following files: