19 #include "G4Threading.hh"
20 #include "G4AutoLock.hh"
25 using namespace DD4hep::Simulation;
28 G4Mutex action_mutex=G4MUTEX_INITIALIZER;
29 G4Mutex sequence_mutex=G4MUTEX_INITIALIZER;
33 Geant4RunAction::Geant4RunAction(
Geant4Context* ctxt,
const string& nam)
77 throw runtime_error(
"Geant4SharedRunAction: Attempt to use invalid actor!");
83 G4AutoLock protection_lock(&action_mutex); {
93 G4AutoLock protection_lock(&action_mutex); {
135 G4AutoLock protection_lock(&action_mutex);
140 throw runtime_error(
"Geant4RunActionSequence: Attempt to add invalid actor!");
145 G4AutoLock protection_lock(&sequence_mutex);
152 G4AutoLock protection_lock(&sequence_mutex);
Functor to access elements by name.
long release()
Decrease reference count. Implicit destruction.
virtual ~Geant4SharedRunAction()
Default destructor.
Geant4SharedRunAction()=default
Inhibit default constructor.
virtual void end(const G4Run *run)
End-of-run callback.
virtual void configureFiber(Geant4Context *thread_context)
Set or update client for the use in a new thread fiber.
static void decrement(T *)
Decrement count according to type information.
void adopt(const PropertyManager ©)
Export properties of another instance.
Geant4RunAction * get(const std::string &name) const
Get an action by name.
Concrete basic implementation of the Geant4 run action base class.
Geant4Context * context() const
Access the context.
virtual void begin(const G4Run *run)
Begin-of-run callback.
Geant4Context * m_context
Reference to the Geant4 context.
void releasePtr(T &p)
Helper to delete objects from heap and reset the pointer. Saves many many lines of code...
virtual void updateContext(Geant4Context *ctxt)
Set or update client context.
virtual void configureFiber(Geant4Context *thread_context)
Set or update client for the use in a new thread fiber.
PropertyManager & properties()
Access to the properties of the object.
virtual void configureFiber(Geant4Context *thread_context)
Set or update client for the use in a new thread fiber.
CallbackSequence m_begin
Callback sequence for begin-run action.
long addRef()
Increase reference count.
void clear()
Clear the sequence and remove all callbacks.
virtual ~Geant4RunAction()
Default destructor.
virtual void use(Geant4RunAction *action)
Underlying object to be used during the execution of this thread.
virtual ~Geant4RunActionSequence()
Default destructor.
Actors< Geant4RunAction > m_actors
The list of action objects to be called.
bool m_needsControl
Default property: Flag to create control instance.
virtual void end(const G4Run *run)
End-of-run callback.
CallbackSequence m_end
Callback sequence for end-run action.
Geant4RunAction * m_action
Reference to the shared action.
static void increment(T *)
Increment count according to type information.
Functor to update the context of a Geant4Action object.
static TypeName split(const std::string &type_name)
Split string pair according to default delimiter ('/')
virtual void end(const G4Run *run)
End-of-run callback.
Generic context to extend user, run and event information.
void adopt(Geant4RunAction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
PropertyManager m_properties
Property pool.
static const double second
Geant4RunActionSequence()=default
Inhibit default constructor.
Default base class for all Geant 4 actions and derivates thereof.
virtual void begin(const G4Run *run)
Begin-of-run callback.
virtual void begin(const G4Run *run)
Begin-of-run callback.