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

The sequencer to host Geant4 sensitive actions called if particles interact with sensitive elements. More...

#include <Geant4SensDetAction.h>

Inheritance diagram for dd4hep::sim::Geant4SensDetActionSequence:
dd4hep::sim::Geant4Action

Public Types

typedef Geant4HitCollection *(* create_t) (const std::string &, const std::string &, Geant4Sensitive *)
 
typedef std::pair< std::string, std::pair< Geant4Sensitive *, create_t > > HitCollection
 
typedef std::vector< HitCollectionHitCollections
 

Public Member Functions

 Geant4SensDetActionSequence (Geant4Context *context, const std::string &name)
 Standard constructor. More...
 
virtual ~Geant4SensDetActionSequence ()
 Default destructor. More...
 
virtual const std::string & sensitiveType () const
 Access to the sensitive type of the detector. More...
 
virtual void updateContext (Geant4Context *ctxt) override
 Set or update client context. More...
 
std::size_t defineCollections (Geant4ActionSD *sens_det)
 Called at construction time of the sensitive detector to declare all hit collections. More...
 
std::size_t defineCollection (Geant4Sensitive *owner, const std::string &name, create_t func)
 Initialize the usage of a hit collection. Returns the collection identifier. More...
 
template<typename TYPE >
std::size_t defineCollection (Geant4Sensitive *owner, const std::string &coll_name)
 Define a named collection containing hist of a specified type. More...
 
const std::string & hitCollectionName (std::size_t which) const
 Access HitCollection container names. More...
 
Geant4HitCollectioncollection (std::size_t which) const
 Retrieve the hits collection associated with this detector by its serial number. More...
 
Geant4HitCollectioncollectionByID (std::size_t id) const
 Retrieve the hits collection associated with this detector by its collection identifier. More...
 
template<typename T >
void callAtBegin (T *p, void(T::*f)(G4HCofThisEvent *))
 Register begin-of-event callback. More...
 
template<typename T >
void callAtEnd (T *p, void(T::*f)(G4HCofThisEvent *))
 Register end-of-event callback. More...
 
template<typename T >
void callAtProcess (T *p, void(T::*f)(G4Step *, G4TouchableHistory *))
 Register process-hit callback. More...
 
template<typename T >
void callAtClear (T *p, void(T::*f)(G4HCofThisEvent *))
 Register clear callback. More...
 
void adopt (Geant4Sensitive *sensitive)
 Add an actor responding to all callbacks. Sequence takes ownership. More...
 
void adopt (Geant4Filter *filter)
 Add an actor responding to all callbacks. Sequence takes ownership. More...
 
void adoptFilter (Geant4Action *filter)
 Add an actor responding to all callbacks. Sequence takes ownership. More...
 
bool accept (const G4Step *step) const
 Callback before hit processing starts. Invoke all filters. More...
 
bool accept (const Geant4FastSimSpot *step) const
 GFLASH/FastSim interface: Callback before hit processing starts. Invoke all filters. More...
 
virtual void begin (G4HCofThisEvent *hce)
 G4VSensitiveDetector interface: Method invoked at the begining of each event. More...
 
virtual void end (G4HCofThisEvent *hce)
 G4VSensitiveDetector interface: Method invoked at the end of each event. More...
 
virtual void clear ()
 G4VSensitiveDetector interface: Method invoked if the event was aborted. More...
 
virtual bool process (const G4Step *step, G4TouchableHistory *history)
 G4VSensitiveDetector interface: Method for generating hit(s) using the information of G4Step object. More...
 
virtual bool processFastSim (const Geant4FastSimSpot *spot, G4TouchableHistory *history)
 GFLASH/FastSim interface: Method for generating hit(s) using the information of the fast simulation spot object. More...
 
- Public Member Functions inherited from dd4hep::sim::Geant4Action
 Geant4Action (Geant4Context *context, const std::string &nam)
 Standard constructor. More...
 
long addRef ()
 Increase reference count. More...
 
long release ()
 Decrease reference count. Implicit destruction. More...
 
Geant4Contextcontext () const
 Access the context. More...
 
virtual void configureFiber (Geant4Context *thread_context)
 Set or update client for the use in a new thread fiber. More...
 
const std::string & name () const
 Access name of the action. More...
 
const char * c_name () const
 Access name of the action. More...
 
void setName (const std::string &new_name)
 Set the object name. More...
 
PropertyManagerproperties ()
 Access to the properties of the object. More...
 
PrintLevel outputLevel () const
 Access the output level. More...
 
PrintLevel setOutputLevel (PrintLevel new_level)
 Set the output level; returns previous value. More...
 
Geant4UIMessengercontrol () const
 Access to the UI messenger. More...
 
virtual void enableUI ()
 Enable and install UI messenger. More...
 
template<typename T >
Geant4ActiondeclareProperty (const std::string &nam, T &val)
 Declare property. More...
 
template<typename T >
Geant4ActiondeclareProperty (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...
 
virtual void installMessengers ()
 Install property control messenger if wanted. More...
 
virtual void installCommandMessenger ()
 Install command control messenger if wanted. More...
 
virtual void installPropertyMessenger ()
 Install property control messenger if wanted. More...
 
void print (const char *fmt,...) const
 Support for messages with variable output level using output level. More...
 
void printM1 (const char *fmt,...) const
 Support for messages with variable output level using output level-1. More...
 
void printM2 (const char *fmt,...) const
 Support for messages with variable output level using output level-2. More...
 
void printP1 (const char *fmt,...) const
 Support for messages with variable output level using output level+1. More...
 
void printP2 (const char *fmt,...) const
 Support for messages with variable output level using output level+2. More...
 
void always (const char *fmt,...) const
 Support of always printed messages. More...
 
void debug (const char *fmt,...) const
 Support of debug messages. More...
 
void info (const char *fmt,...) const
 Support of info messages. More...
 
void warning (const char *fmt,...) const
 Support of warning messages. More...
 
void error (const char *fmt,...) const
 Support of error messages. More...
 
bool return_error (bool return_value, const char *fmt,...) const
 Action to support error messages. More...
 
void fatal (const char *fmt,...) const
 Support of fatal messages. Throws exception. More...
 
void except (const char *fmt,...) const
 Support of exceptions: Print fatal message and throw runtime_error. More...
 
void abortRun (const std::string &exception, const char *fmt,...) const
 Abort Geant4 Run by throwing a G4Exception with type RunMustBeAborted. More...
 
Geant4RunActionSequencerunAction () const
 Access to the main run action sequence from the kernel object. More...
 
Geant4EventActionSequenceeventAction () const
 Access to the main event action sequence from the kernel object. More...
 
Geant4SteppingActionSequencesteppingAction () const
 Access to the main stepping action sequence from the kernel object. More...
 
Geant4TrackingActionSequencetrackingAction () const
 Access to the main tracking action sequence from the kernel object. More...
 
Geant4StackingActionSequencestackingAction () const
 Access to the main stacking action sequence from the kernel object. More...
 
Geant4GeneratorActionSequencegeneratorAction () const
 Access to the main generator action sequence from the kernel object. More...
 

Protected Member Functions

 DDG4_DEFINE_ACTION_CONSTRUCTORS (Geant4SensDetActionSequence)
 Define standard assignments and constructors. More...
 
- Protected Member Functions inherited from dd4hep::sim::Geant4Action
 DDG4_DEFINE_ACTION_CONSTRUCTORS (Geant4Action)
 Define standard assignments and constructors. More...
 
virtual ~Geant4Action ()
 Default destructor. More...
 

Static Protected Member Functions

template<typename TYPE >
static Geant4HitCollection_create (const std::string &det, const std::string &coll, Geant4Sensitive *sd)
 Create a new typed hit collection. More...
 

Protected Attributes

G4HCofThisEvent * m_hce = 0
 Geant4 hit collection context. More...
 
CallbackSequence m_begin
 Callback sequence for event initialization action. More...
 
CallbackSequence m_end
 Callback sequence for event finalization action. More...
 
CallbackSequence m_process
 Callback sequence for step processing. More...
 
CallbackSequence m_clear
 Callback sequence to invoke the event deletion. More...
 
Actors< Geant4Sensitivem_actors
 The list of sensitive detector objects. More...
 
Actors< Geant4Filterm_filters
 The list of sensitive detector filter objects. More...
 
HitCollections m_collections
 Hit collection creators. More...
 
SensitiveDetector m_sensitive
 Reference to the sensitive detector element. More...
 
Geant4ActionSDm_detector
 Reference to G4 sensitive detector. More...
 
std::string m_sensitiveType
 The true sensitive type of the detector. More...
 
- Protected Attributes inherited from dd4hep::sim::Geant4Action
Geant4Contextm_context { nullptr }
 Reference to the Geant4 context. More...
 
Geant4UIMessengerm_control { nullptr }
 Control directory of this action. More...
 
int m_outputLevel { 3 }
 Default property: Output level. More...
 
bool m_needsControl { false }
 Default property: Flag to create control instance. More...
 
std::string m_name { }
 Action name. More...
 
PropertyManager m_properties { }
 Property pool. More...
 
long m_refCount { 1 }
 Reference count. Initial value: 1. More...
 

Detailed Description

The sequencer to host Geant4 sensitive actions called if particles interact with sensitive elements.

Concrete implementation of the sensitive detector action sequence

Author
M.Frank
Version
1.0

Definition at line 317 of file Geant4SensDetAction.h.

Member Typedef Documentation

◆ create_t

typedef Geant4HitCollection*(* dd4hep::sim::Geant4SensDetActionSequence::create_t) (const std::string &, const std::string &, Geant4Sensitive *)

Definition at line 319 of file Geant4SensDetAction.h.

◆ HitCollection

Definition at line 320 of file Geant4SensDetAction.h.

◆ HitCollections

Definition at line 321 of file Geant4SensDetAction.h.

Constructor & Destructor Documentation

◆ Geant4SensDetActionSequence()

Geant4SensDetActionSequence::Geant4SensDetActionSequence ( Geant4Context context,
const std::string &  name 
)

Standard constructor.

Update the sensitive detector type, so that the proper instance is created

Definition at line 321 of file Geant4SensDetAction.cpp.

◆ ~Geant4SensDetActionSequence()

Geant4SensDetActionSequence::~Geant4SensDetActionSequence ( )
virtual

Default destructor.

Definition at line 333 of file Geant4SensDetAction.cpp.

Member Function Documentation

◆ _create()

template<typename TYPE >
static Geant4HitCollection* dd4hep::sim::Geant4SensDetActionSequence::_create ( const std::string &  det,
const std::string &  coll,
Geant4Sensitive sd 
)
inlinestaticprotected

Create a new typed hit collection.

Definition at line 349 of file Geant4SensDetAction.h.

◆ accept() [1/2]

bool Geant4SensDetActionSequence::accept ( const G4Step *  step) const

Callback before hit processing starts. Invoke all filters.

Definition at line 426 of file Geant4SensDetAction.cpp.

◆ accept() [2/2]

bool Geant4SensDetActionSequence::accept ( const Geant4FastSimSpot step) const

GFLASH/FastSim interface: Callback before hit processing starts. Invoke all filters.

Callback before hit processing starts. Invoke all filters.

Definition at line 433 of file Geant4SensDetAction.cpp.

◆ adopt() [1/2]

void Geant4SensDetActionSequence::adopt ( Geant4Filter filter)

Add an actor responding to all callbacks. Sequence takes ownership.

Definition at line 365 of file Geant4SensDetAction.cpp.

◆ adopt() [2/2]

void Geant4SensDetActionSequence::adopt ( Geant4Sensitive sensitive)

Add an actor responding to all callbacks. Sequence takes ownership.

Add an actor responding to all callbacks.

Definition at line 355 of file Geant4SensDetAction.cpp.

◆ adoptFilter()

void Geant4SensDetActionSequence::adoptFilter ( Geant4Action filter)

Add an actor responding to all callbacks. Sequence takes ownership.

Definition at line 349 of file Geant4SensDetAction.cpp.

◆ begin()

void Geant4SensDetActionSequence::begin ( G4HCofThisEvent *  hce)
virtual

G4VSensitiveDetector interface: Method invoked at the begining of each event.

The hits collection(s) created by this sensitive detector must be set to the G4HCofThisEvent object at one of these two methods.

G4VSensitiveDetector interface: Method invoked at the begining of each event. The hits collection(s) created by this sensitive detector must be set to the G4HCofThisEvent object at one of these two methods.

Definition at line 465 of file Geant4SensDetAction.cpp.

◆ callAtBegin()

template<typename T >
void dd4hep::sim::Geant4SensDetActionSequence::callAtBegin ( T *  p,
void(T::*)(G4HCofThisEvent *)  f 
)
inline

Register begin-of-event callback.

Definition at line 393 of file Geant4SensDetAction.h.

◆ callAtClear()

template<typename T >
void dd4hep::sim::Geant4SensDetActionSequence::callAtClear ( T *  p,
void(T::*)(G4HCofThisEvent *)  f 
)
inline

Register clear callback.

Definition at line 408 of file Geant4SensDetAction.h.

◆ callAtEnd()

template<typename T >
void dd4hep::sim::Geant4SensDetActionSequence::callAtEnd ( T *  p,
void(T::*)(G4HCofThisEvent *)  f 
)
inline

Register end-of-event callback.

Definition at line 398 of file Geant4SensDetAction.h.

◆ callAtProcess()

template<typename T >
void dd4hep::sim::Geant4SensDetActionSequence::callAtProcess ( T *  p,
void(T::*)(G4Step *, G4TouchableHistory *)  f 
)
inline

Register process-hit callback.

Definition at line 403 of file Geant4SensDetAction.h.

◆ clear()

void Geant4SensDetActionSequence::clear ( )
virtual

G4VSensitiveDetector interface: Method invoked if the event was aborted.

Hits collections created but not beibg set to G4HCofThisEvent at the event should be deleted. Collection(s) which have already set to G4HCofThisEvent will be deleted automatically.

Hits collections created but not being set to G4HCofThisEvent at the event should be deleted. Collection(s) which have already set to G4HCofThisEvent will be deleted automatically.

Definition at line 490 of file Geant4SensDetAction.cpp.

◆ collection()

Geant4HitCollection * Geant4SensDetActionSequence::collection ( std::size_t  which) const

Retrieve the hits collection associated with this detector by its serial number.

Definition at line 404 of file Geant4SensDetAction.cpp.

◆ collectionByID()

Geant4HitCollection * Geant4SensDetActionSequence::collectionByID ( std::size_t  id) const

Retrieve the hits collection associated with this detector by its collection identifier.

Definition at line 417 of file Geant4SensDetAction.cpp.

◆ DDG4_DEFINE_ACTION_CONSTRUCTORS()

dd4hep::sim::Geant4SensDetActionSequence::DDG4_DEFINE_ACTION_CONSTRUCTORS ( Geant4SensDetActionSequence  )
protected

Define standard assignments and constructors.

◆ defineCollection() [1/2]

template<typename TYPE >
std::size_t dd4hep::sim::Geant4SensDetActionSequence::defineCollection ( Geant4Sensitive owner,
const std::string &  coll_name 
)
inline

Define a named collection containing hist of a specified type.

Definition at line 379 of file Geant4SensDetAction.h.

◆ defineCollection() [2/2]

std::size_t Geant4SensDetActionSequence::defineCollection ( Geant4Sensitive owner,
const std::string &  name,
create_t  func 
)

Initialize the usage of a hit collection. Returns the collection identifier.

Definition at line 375 of file Geant4SensDetAction.cpp.

◆ defineCollections()

std::size_t dd4hep::sim::Geant4SensDetActionSequence::defineCollections ( Geant4ActionSD sens_det)

Called at construction time of the sensitive detector to declare all hit collections.

◆ end()

void Geant4SensDetActionSequence::end ( G4HCofThisEvent *  hce)
virtual

G4VSensitiveDetector interface: Method invoked at the end of each event.

Definition at line 478 of file Geant4SensDetAction.cpp.

◆ hitCollectionName()

const std::string & Geant4SensDetActionSequence::hitCollectionName ( std::size_t  which) const

Access HitCollection container names.

Definition at line 394 of file Geant4SensDetAction.cpp.

◆ process()

bool Geant4SensDetActionSequence::process ( const G4Step *  step,
G4TouchableHistory *  history 
)
virtual

G4VSensitiveDetector interface: Method for generating hit(s) using the information of G4Step object.

Definition at line 440 of file Geant4SensDetAction.cpp.

◆ processFastSim()

bool Geant4SensDetActionSequence::processFastSim ( const Geant4FastSimSpot spot,
G4TouchableHistory *  history 
)
virtual

GFLASH/FastSim interface: Method for generating hit(s) using the information of the fast simulation spot object.

GFLASH/FastSim interface: Method for generating hit(s) using the information of the Geant4FastSimSpot object.

Definition at line 451 of file Geant4SensDetAction.cpp.

◆ sensitiveType()

virtual const std::string& dd4hep::sim::Geant4SensDetActionSequence::sensitiveType ( ) const
inlinevirtual

Access to the sensitive type of the detector.

Definition at line 365 of file Geant4SensDetAction.h.

◆ updateContext()

void Geant4SensDetActionSequence::updateContext ( Geant4Context ctxt)
overridevirtual

Set or update client context.

Reimplemented from dd4hep::sim::Geant4Action.

Definition at line 342 of file Geant4SensDetAction.cpp.

Member Data Documentation

◆ m_actors

Actors<Geant4Sensitive> dd4hep::sim::Geant4SensDetActionSequence::m_actors
protected

The list of sensitive detector objects.

Definition at line 335 of file Geant4SensDetAction.h.

◆ m_begin

CallbackSequence dd4hep::sim::Geant4SensDetActionSequence::m_begin
protected

Callback sequence for event initialization action.

Definition at line 327 of file Geant4SensDetAction.h.

◆ m_clear

CallbackSequence dd4hep::sim::Geant4SensDetActionSequence::m_clear
protected

Callback sequence to invoke the event deletion.

Definition at line 333 of file Geant4SensDetAction.h.

◆ m_collections

HitCollections dd4hep::sim::Geant4SensDetActionSequence::m_collections
protected

Hit collection creators.

Definition at line 340 of file Geant4SensDetAction.h.

◆ m_detector

Geant4ActionSD* dd4hep::sim::Geant4SensDetActionSequence::m_detector
protected

Reference to G4 sensitive detector.

Definition at line 344 of file Geant4SensDetAction.h.

◆ m_end

CallbackSequence dd4hep::sim::Geant4SensDetActionSequence::m_end
protected

Callback sequence for event finalization action.

Definition at line 329 of file Geant4SensDetAction.h.

◆ m_filters

Actors<Geant4Filter> dd4hep::sim::Geant4SensDetActionSequence::m_filters
protected

The list of sensitive detector filter objects.

Definition at line 337 of file Geant4SensDetAction.h.

◆ m_hce

G4HCofThisEvent* dd4hep::sim::Geant4SensDetActionSequence::m_hce = 0
protected

Geant4 hit collection context.

Definition at line 325 of file Geant4SensDetAction.h.

◆ m_process

CallbackSequence dd4hep::sim::Geant4SensDetActionSequence::m_process
protected

Callback sequence for step processing.

Definition at line 331 of file Geant4SensDetAction.h.

◆ m_sensitive

SensitiveDetector dd4hep::sim::Geant4SensDetActionSequence::m_sensitive
protected

Reference to the sensitive detector element.

Definition at line 342 of file Geant4SensDetAction.h.

◆ m_sensitiveType

std::string dd4hep::sim::Geant4SensDetActionSequence::m_sensitiveType
protected

The true sensitive type of the detector.

Definition at line 346 of file Geant4SensDetAction.h.


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