DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
|
The sequencer to host Geant4 sensitive actions called if particles interact with sensitive elements. More...
#include <Geant4SensDetAction.h>
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< HitCollection > | HitCollections |
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... | |
Geant4HitCollection * | collection (std::size_t which) const |
Retrieve the hits collection associated with this detector by its serial number. More... | |
Geant4HitCollection * | collectionByID (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... | |
Geant4Context * | context () 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... | |
PropertyManager & | properties () |
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... | |
Geant4UIMessenger * | control () const |
Access to the UI messenger. More... | |
virtual void | enableUI () |
Enable and install UI messenger. More... | |
template<typename T > | |
Geant4Action & | declareProperty (const std::string &nam, T &val) |
Declare property. More... | |
template<typename T > | |
Geant4Action & | declareProperty (const char *nam, T &val) |
Declare property. More... | |
bool | hasProperty (const std::string &name) const |
Check property for existence. More... | |
Property & | property (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... | |
Geant4RunActionSequence & | runAction () const |
Access to the main run action sequence from the kernel object. More... | |
Geant4EventActionSequence & | eventAction () const |
Access to the main event action sequence from the kernel object. More... | |
Geant4SteppingActionSequence & | steppingAction () const |
Access to the main stepping action sequence from the kernel object. More... | |
Geant4TrackingActionSequence & | trackingAction () const |
Access to the main tracking action sequence from the kernel object. More... | |
Geant4StackingActionSequence & | stackingAction () const |
Access to the main stacking action sequence from the kernel object. More... | |
Geant4GeneratorActionSequence & | generatorAction () 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< Geant4Sensitive > | m_actors |
The list of sensitive detector objects. More... | |
Actors< Geant4Filter > | m_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... | |
Geant4ActionSD * | m_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 | |
Geant4Context * | m_context { nullptr } |
Reference to the Geant4 context. More... | |
Geant4UIMessenger * | m_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... | |
The sequencer to host Geant4 sensitive actions called if particles interact with sensitive elements.
Concrete implementation of the sensitive detector action sequence
Definition at line 317 of file Geant4SensDetAction.h.
typedef Geant4HitCollection*(* dd4hep::sim::Geant4SensDetActionSequence::create_t) (const std::string &, const std::string &, Geant4Sensitive *) |
Definition at line 319 of file Geant4SensDetAction.h.
typedef std::pair<std::string, std::pair<Geant4Sensitive*,create_t> > dd4hep::sim::Geant4SensDetActionSequence::HitCollection |
Definition at line 320 of file Geant4SensDetAction.h.
typedef std::vector<HitCollection> dd4hep::sim::Geant4SensDetActionSequence::HitCollections |
Definition at line 321 of file Geant4SensDetAction.h.
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.
|
virtual |
Default destructor.
Definition at line 333 of file Geant4SensDetAction.cpp.
|
inlinestaticprotected |
Create a new typed hit collection.
Definition at line 349 of file Geant4SensDetAction.h.
bool Geant4SensDetActionSequence::accept | ( | const G4Step * | step | ) | const |
Callback before hit processing starts. Invoke all filters.
Definition at line 426 of file Geant4SensDetAction.cpp.
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.
void Geant4SensDetActionSequence::adopt | ( | Geant4Filter * | filter | ) |
Add an actor responding to all callbacks. Sequence takes ownership.
Definition at line 365 of file Geant4SensDetAction.cpp.
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.
void Geant4SensDetActionSequence::adoptFilter | ( | Geant4Action * | filter | ) |
Add an actor responding to all callbacks. Sequence takes ownership.
Definition at line 349 of file Geant4SensDetAction.cpp.
|
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.
|
inline |
Register begin-of-event callback.
Definition at line 393 of file Geant4SensDetAction.h.
|
inline |
Register clear callback.
Definition at line 408 of file Geant4SensDetAction.h.
|
inline |
Register end-of-event callback.
Definition at line 398 of file Geant4SensDetAction.h.
|
inline |
Register process-hit callback.
Definition at line 403 of file Geant4SensDetAction.h.
|
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.
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.
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.
|
protected |
Define standard assignments and constructors.
|
inline |
Define a named collection containing hist of a specified type.
Definition at line 379 of file Geant4SensDetAction.h.
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.
std::size_t dd4hep::sim::Geant4SensDetActionSequence::defineCollections | ( | Geant4ActionSD * | sens_det | ) |
Called at construction time of the sensitive detector to declare all hit collections.
|
virtual |
G4VSensitiveDetector interface: Method invoked at the end of each event.
Definition at line 478 of file Geant4SensDetAction.cpp.
const std::string & Geant4SensDetActionSequence::hitCollectionName | ( | std::size_t | which | ) | const |
Access HitCollection container names.
Definition at line 394 of file Geant4SensDetAction.cpp.
|
virtual |
G4VSensitiveDetector interface: Method for generating hit(s) using the information of G4Step object.
Definition at line 440 of file Geant4SensDetAction.cpp.
|
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.
|
inlinevirtual |
Access to the sensitive type of the detector.
Definition at line 365 of file Geant4SensDetAction.h.
|
overridevirtual |
Set or update client context.
Reimplemented from dd4hep::sim::Geant4Action.
Definition at line 342 of file Geant4SensDetAction.cpp.
|
protected |
The list of sensitive detector objects.
Definition at line 335 of file Geant4SensDetAction.h.
|
protected |
Callback sequence for event initialization action.
Definition at line 327 of file Geant4SensDetAction.h.
|
protected |
Callback sequence to invoke the event deletion.
Definition at line 333 of file Geant4SensDetAction.h.
|
protected |
Hit collection creators.
Definition at line 340 of file Geant4SensDetAction.h.
|
protected |
Reference to G4 sensitive detector.
Definition at line 344 of file Geant4SensDetAction.h.
|
protected |
Callback sequence for event finalization action.
Definition at line 329 of file Geant4SensDetAction.h.
|
protected |
The list of sensitive detector filter objects.
Definition at line 337 of file Geant4SensDetAction.h.
|
protected |
Geant4 hit collection context.
Definition at line 325 of file Geant4SensDetAction.h.
|
protected |
Callback sequence for step processing.
Definition at line 331 of file Geant4SensDetAction.h.
|
protected |
Reference to the sensitive detector element.
Definition at line 342 of file Geant4SensDetAction.h.
|
protected |
The true sensitive type of the detector.
Definition at line 346 of file Geant4SensDetAction.h.