LDMX Software
|
Implementation of user tracking action. More...
#include <TrackingAction.h>
Public Member Functions | |
TrackingAction () | |
Class constructor. | |
virtual | ~TrackingAction () |
Class destructor. | |
void | PreUserTrackingAction (const G4Track *aTrack) |
Implementation of pre-tracking action. | |
void | PostUserTrackingAction (const G4Track *aTrack) |
Implementation of post-tracking action. | |
TrackMap & | getTrackMap () |
Get a handle to the current TrackMap for the event. | |
void | registerAction (UserAction *trackingAction) |
Register a user action of type RunAction with this class. | |
Static Public Member Functions | |
static TrackingAction * | get () |
Get a pointer to the current UserTrackingAction from the G4RunManager. | |
Private Attributes | |
std::vector< UserAction * > | trackingActions_ |
custom user actions to be called before and after processing a track | |
TrackMap | trackMap_ |
Stores parentage information for all tracks in the event. | |
Implementation of user tracking action.
Here, we manage the interaction between our track storage machinery (TrackMap) and Geant4's tracking manager (G4TrackingManager).
Definition at line 36 of file TrackingAction.h.
|
inline |
|
inlinevirtual |
|
inlinestatic |
Get a pointer to the current UserTrackingAction from the G4RunManager.
Definition at line 116 of file TrackingAction.h.
Referenced by simcore::g4user::EventAction::BeginOfEventAction(), simcore::UserAction::getCurrentParticleMap(), simcore::SensitiveDetector::getTrackMap(), and biasing::utility::StepPrinter::stepping().
|
inline |
Get a handle to the current TrackMap for the event.
Definition at line 110 of file TrackingAction.h.
References trackMap_.
Referenced by simcore::g4user::EventAction::BeginOfEventAction(), simcore::UserAction::getCurrentParticleMap(), simcore::SensitiveDetector::getTrackMap(), and biasing::utility::StepPrinter::stepping().
void simcore::g4user::TrackingAction::PostUserTrackingAction | ( | const G4Track * | aTrack | ) |
Implementation of post-tracking action.
We start by calling any other tracking actions' PostUserTrackingAction methods.
If the track should be saved (it's save flag is set to true) and it is being stopped, then we save it in the track map.
aTrack | The Geant4 track. |
If a track is to-be saved and it is being killed, save the track into the map. This is where a track is chosen to be put into the output particle map. If its save flag is true for any reason at this point, then it will be in the output map.
Definition at line 68 of file TrackingAction.cxx.
References simcore::UserTrackInformation::get(), simcore::TrackMap::save(), trackingActions_, and trackMap_.
void simcore::g4user::TrackingAction::PreUserTrackingAction | ( | const G4Track * | aTrack | ) |
Implementation of pre-tracking action.
This is called whenever a track is going to start being processed.
We first check if we have seen this track before by looking inside of our track map.
If we have seen it before, then we simply give the track to our PreUserTrackingActions.
If we haven't seen it before, then we must do some setup.
We choose to store the track by default if any of the following are true about the track
No matter what, we insert the track into the track map for book-keeping.
Finally, before we wrap up, we call any other tracking actions' 'PreUserTrackingAction' methods.
aTrack | The Geant4 track. |
Always save a particle if any of the following are true it has gen status == 1 (primary) it is in a region without region info it is in a region that is marked to store secondaries DON'T change the save-status even if these are false The track's save-status is false by default when the track-info is constructed and the track's save-status could have been modified by a user action prior to the track being processed for the first time. For example, this happens if the user wants to save the secondaries of a particular track.
Definition at line 17 of file TrackingAction.cxx.
References simcore::TrackMap::contains(), simcore::UserTrackInformation::get(), simcore::UserPrimaryParticleInformation::getHepEvtStatus(), simcore::UserTrackInformation::initialize(), simcore::TrackMap::insert(), trackingActions_, and trackMap_.
|
inline |
Register a user action of type RunAction with this class.
action | User action of type RunAction |
Definition at line 126 of file TrackingAction.h.
References trackingActions_.
|
private |
custom user actions to be called before and after processing a track
Definition at line 132 of file TrackingAction.h.
Referenced by PostUserTrackingAction(), PreUserTrackingAction(), and registerAction().
|
private |
Stores parentage information for all tracks in the event.
Definition at line 135 of file TrackingAction.h.
Referenced by getTrackMap(), PostUserTrackingAction(), and PreUserTrackingAction().