LDMX Software
|
Dynamically loaded Geant4 SensitiveDetector for saving hits in specific volumes within the simulation. More...
#include <SensitiveDetector.h>
Public Types | |
using | Factory = ::simcore::Factory< SensitiveDetector, SensitiveDetector *, const std::string &, simcore::ConditionsInterface &, const framework::config::Parameters & > |
The SD Factory. | |
Public Member Functions | |
SensitiveDetector (const std::string &name, simcore::ConditionsInterface &ci, const framework::config::Parameters ¶meters) | |
Constructor. | |
virtual | ~SensitiveDetector ()=default |
Destructor. | |
virtual bool | isSensDet (G4LogicalVolume *lv) const =0 |
Here, we must determine if we should be attached to the input logical volume. | |
virtual G4bool | ProcessHits (G4Step *step, G4TouchableHistory *hist) override=0 |
This is Geant4's handle to tell us that a particle has stepped through our sensitive detector and we should process its interaction with us. | |
virtual void | saveHits (framework::Event &event)=0 |
We are given the event bus here and we must decide now what to persist into the event. | |
virtual void | EndOfEvent (G4HCofThisEvent *) override |
This is Geant4's handle to tell us the event is ending. | |
virtual void | OnFinishedEvent ()=0 |
Cleanup SD and prepare a new-event state. | |
Protected Member Functions | |
template<class T > | |
const T & | getCondition (const std::string &condition_name) |
Record the configuration of this detector into the run header. | |
bool | isGeantino (const G4Step *step) const |
Check if the passed step is a step of a geantino. | |
const TrackMap & | getTrackMap () const |
Get a handle to the current track map. | |
Private Attributes | |
simcore::ConditionsInterface & | conditions_interface_ |
Handle to our interface to conditions objects. | |
Dynamically loaded Geant4 SensitiveDetector for saving hits in specific volumes within the simulation.
Definition at line 22 of file SensitiveDetector.h.
using simcore::SensitiveDetector::Factory = ::simcore::Factory<SensitiveDetector, SensitiveDetector*, const std::string&, simcore::ConditionsInterface&, const framework::config::Parameters&> |
The SD Factory.
We have the factory create raw pointers since the G4SDManager handles destruction of all of the registered SensitiveDetectors.
Definition at line 40 of file SensitiveDetector.h.
simcore::SensitiveDetector::SensitiveDetector | ( | const std::string & | name, |
simcore::ConditionsInterface & | ci, | ||
const framework::config::Parameters & | parameters | ||
) |
Constructor.
[in] | name | unique instance name for this sensitive detector |
[in] | ci | handle to current conditions interface |
[in] | parameters | python configuration parameters |
Definition at line 11 of file SensitiveDetector.cxx.
|
inlineoverridevirtual |
This is Geant4's handle to tell us the event is ending.
Since we are handling the Hit Collections (HC) directly, the input to this function is of no use to us. This is simply here to make sure that we can reset the SD to a new-event state whether or not a given event was serialized.
OnFinishedEvent
Definition at line 94 of file SensitiveDetector.h.
|
inlineprotected |
Record the configuration of this detector into the run header.
[in,out] | header | RunHeader to write configuration to Get a condition object from the conditions interface |
Used in the same way that EventProcessors can retrieve conditions.
in,out] T type of condition to get
[in] | name | name of condition to get |
Definition at line 119 of file SensitiveDetector.h.
References conditions_interface_, and simcore::ConditionsInterface::getCondition().
|
inlineprotected |
Get a handle to the current track map.
The track map is created only after the event begins, so you will get a segmentation violation if you call this function before an event has started.
Definition at line 138 of file SensitiveDetector.h.
References simcore::g4user::TrackingAction::get(), and simcore::g4user::TrackingAction::getTrackMap().
Referenced by simcore::EcalSD::ProcessHits(), and simcore::HcalSD::ProcessHits().
|
protected |
Check if the passed step is a step of a geantino.
[in] | step | Current step to check |
Definition at line 19 of file SensitiveDetector.cxx.
Referenced by simcore::EcalSD::ProcessHits(), simcore::HcalSD::ProcessHits(), simcore::TrackerSD::ProcessHits(), and simcore::TrigScintSD::ProcessHits().
|
pure virtual |
Here, we must determine if we should be attached to the input logical volume.
Return 'true' if we should be attached to it and 'false' otherwise.
[in] | lv | logical volume to check |
Implemented in simcore::EcalSD, simcore::TrigScintSD, simcore::HcalSD, simcore::ScoringPlaneSD, and simcore::TrackerSD.
|
pure virtual |
Cleanup SD and prepare a new-event state.
Implemented in simcore::EcalSD, simcore::HcalSD, simcore::ScoringPlaneSD, simcore::TrackerSD, and simcore::TrigScintSD.
|
overridepure virtual |
This is Geant4's handle to tell us that a particle has stepped through our sensitive detector and we should process its interaction with us.
[in] | step | the step that happened within one of our logical volumes |
[in] | hist | the touchable history of the step |
Implemented in simcore::EcalSD, simcore::HcalSD, simcore::ScoringPlaneSD, simcore::TrackerSD, and simcore::TrigScintSD.
|
pure virtual |
We are given the event bus here and we must decide now what to persist into the event.
This function must perform two tasks.
[in,out] | event | event bus to add thing(s) to |
Implemented in simcore::EcalSD, simcore::HcalSD, simcore::ScoringPlaneSD, simcore::TrackerSD, and simcore::TrigScintSD.
|
private |
Handle to our interface to conditions objects.
Definition at line 144 of file SensitiveDetector.h.
Referenced by getCondition().