23 #include "G4Threading.hh"
24 #include "G4AutoLock.hh"
25 #include "G4TrackingManager.hh"
26 #include "G4VUserTrackInformation.hh"
32 using namespace DD4hep;
33 using namespace DD4hep::Simulation;
35 class G4TouchableHistory;
37 G4Mutex action_mutex=G4MUTEX_INITIALIZER;
41 Geant4TrackingActionSequence::Geant4TrackingActionSequence(
Geant4Context* ctxt,
const string& nam)
77 G4AutoLock protection_lock(&action_mutex);
82 throw runtime_error(
"Geant4TrackingActionSequence: Attempt to add invalid actor!");
121 if ( truth ) truth->
mark(track,
true);
150 throw runtime_error(
"Geant4SharedTrackingAction: Attempt to use invalid actor!");
156 G4AutoLock protection_lock(&action_mutex); {
166 G4AutoLock protection_lock(&action_mutex); {
Functor to access elements by name.
virtual void use(Geant4TrackingAction *action)
Underlying object to be used during the execution of this thread.
CallbackSequence m_front
Callback sequence for pre tracking action.
virtual void mark(const G4Track *track)=0
Mark a Geant4 track to be kept for later MC truth analysis.
Geant4TrackingAction * get(const std::string &name) const
Get an action by name.
long release()
Decrease reference count. Implicit destruction.
Geant4Event & event() const
Access the geant4 event – valid only between BeginEvent() and EndEvent()!
Geant4TrackingAction * m_action
Reference to the shared action.
void adopt(Geant4TrackingAction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Default Interface class to handle monte carlo truth records.
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.
Default base class for all geant 4 tracking actions used in DDG4.
virtual void configureFiber(Geant4Context *thread_context)
Set or update client for the use in a new thread fiber.
virtual void end(const G4Track *track)
Post-tracking action callback.
void mark(const G4Track *track) const
Mark the track to be kept for MC truth propagation.
Actors< Geant4TrackingAction > m_actors
The list of action objects to be called.
Geant4Context * context() const
Access the context.
CallbackSequence m_final
Callback sequence for pre tracking action.
virtual void begin(const G4Track *track)
Pre-track action callback.
Geant4Context * m_context
Reference to the Geant4 context.
virtual void end(const G4Track *track)
End-of-track callback.
void releasePtr(T &p)
Helper to delete objects from heap and reset the pointer. Saves many many lines of code...
PropertyManager & properties()
Access to the properties of the object.
virtual ~Geant4TrackingActionSequence()
Default destructor.
virtual void configureFiber(Geant4Context *thread_context)
Set or update client for the use in a new thread fiber.
CallbackSequence m_end
Callback sequence for post tracking action.
long addRef()
Increase reference count.
void clear()
Clear the sequence and remove all callbacks.
CallbackSequence m_begin
Callback sequence for pre tracking action.
T * extension(bool alert=true)
Access to type safe extension object. Exception is thrown if the object is invalid.
bool m_needsControl
Default property: Flag to create control instance.
Geant4SharedTrackingAction(const Geant4TrackingAction ©)=delete
Inhibit copy constructor.
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 updateContext(Geant4Context *ctxt)
Set or update client context.
Generic context to extend user, run and event information.
virtual void begin(const G4Track *track)
Begin-of-track callback.
PropertyManager m_properties
Property pool.
virtual void end(const G4Track *track)
Post-track action callback.
static const double second
virtual ~Geant4TrackingAction()
Default destructor.
Geant4TrackingAction(const Geant4TrackingAction ©)=delete
Inhibit copy constructor.
virtual ~Geant4SharedTrackingAction()
Default destructor.
Default base class for all Geant 4 actions and derivates thereof.
virtual void begin(const G4Track *track)
Pre-tracking action callback.