LDMX Software
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
simcore::UserAction Class Referenceabstract

Interface that defines a user action. More...

#include <UserAction.h>

Public Types

using Factory = ::simcore::Factory< UserAction, std::shared_ptr< UserAction >, const std::string &, framework::config::Parameters & >
 factory for user actions
 

Public Member Functions

 UserAction (const std::string &name, framework::config::Parameters &parameters)
 Constructor.
 
virtual ~UserAction ()=default
 Destructor.
 
virtual void BeginOfEventAction (const G4Event *)
 Method called at the beginning of every event.
 
virtual void EndOfEventAction (const G4Event *)
 Method called at the end of every event.
 
virtual void BeginOfRunAction (const G4Run *)
 Method called at the beginning of a run.
 
virtual void EndOfRunAction (const G4Run *)
 Method called at the end of a run.
 
virtual void PreUserTrackingAction (const G4Track *)
 Method called before the UserTrackingAction.
 
virtual void PostUserTrackingAction (const G4Track *)
 Method called after the UserTrackingAction.
 
virtual void stepping (const G4Step *)
 Method called after each simulation step.
 
virtual G4ClassificationOfNewTrack ClassifyNewTrack (const G4Track *, const G4ClassificationOfNewTrack &cl)
 Method called when a track is updated.
 
virtual void NewStage ()
 Method called at the beginning of a new stage.
 
virtual void PrepareNewEvent ()
 Method called at the beginning of a new event.
 
virtual std::vector< TYPE > getTypes ()=0
 

Protected Member Functions

UserEventInformationgetEventInfo () const
 Get a handle to the event information.
 
const std::map< int, ldmx::SimParticle > & getCurrentParticleMap () const
 Get the current particle map.
 

Protected Attributes

std::string name_ {""}
 Name of the UserAction.
 
framework::config::Parameters parameters_
 The set of parameters used to configure this class.
 

Detailed Description

Interface that defines a user action.

Definition at line 42 of file UserAction.h.

Member Typedef Documentation

◆ Factory

factory for user actions

Definition at line 53 of file UserAction.h.

Constructor & Destructor Documentation

◆ UserAction()

simcore::UserAction::UserAction ( const std::string &  name,
framework::config::Parameters parameters 
)

Constructor.

Parameters
nameName given the to class instance.

Definition at line 16 of file UserAction.cxx.

17 {
18 name_ = name;
19 parameters_ = parameters;
20}
std::string name_
Name of the UserAction.
Definition UserAction.h:181
framework::config::Parameters parameters_
The set of parameters used to configure this class.
Definition UserAction.h:184

References name_, and parameters_.

Member Function Documentation

◆ BeginOfEventAction()

virtual void simcore::UserAction::BeginOfEventAction ( const G4Event *  )
inlinevirtual

Method called at the beginning of every event.

TYPE::EVENT

Parameters
eventGeant4 event object.

Reimplemented in biasing::TaggerVetoFilter, biasing::TargetDarkBremFilter, biasing::DeepEcalProcessFilter, biasing::EcalDarkBremFilter, biasing::MidShowerDiMuonBkgdFilter, biasing::MidShowerNuclearBkgdFilter, and biasing::utility::PartialEnergySorter.

Definition at line 67 of file UserAction.h.

67{};

◆ BeginOfRunAction()

virtual void simcore::UserAction::BeginOfRunAction ( const G4Run *  )
inlinevirtual

Method called at the beginning of a run.

TYPE::RUN

Parameters
runCurrent Geant4 run object.

Definition at line 85 of file UserAction.h.

85{};

◆ ClassifyNewTrack()

virtual G4ClassificationOfNewTrack simcore::UserAction::ClassifyNewTrack ( const G4Track *  ,
const G4ClassificationOfNewTrack &  cl 
)
inlinevirtual

Method called when a track is updated.

TYPE::STEPPING

Parameters
currentGeant4 track
currenttracks' classification

Reimplemented in biasing::EcalDarkBremFilter, biasing::EcalProcessFilter, biasing::TargetBremFilter, biasing::TargetProcessFilter, and biasing::utility::PartialEnergySorter.

Definition at line 131 of file UserAction.h.

132 {
133 return cl;
134 };

◆ EndOfEventAction()

virtual void simcore::UserAction::EndOfEventAction ( const G4Event *  )
inlinevirtual

Method called at the end of every event.

TYPE::EVENT

Parameters
eventGeant4 event object.

Reimplemented in biasing::NonFiducialFilter, biasing::TaggerVetoFilter, biasing::TargetBremFilter, biasing::TargetENProcessFilter, biasing::TargetProcessFilter, biasing::TaggerHitFilter, and biasing::TargetDarkBremFilter.

Definition at line 76 of file UserAction.h.

76{};

◆ EndOfRunAction()

virtual void simcore::UserAction::EndOfRunAction ( const G4Run *  )
inlinevirtual

Method called at the end of a run.

TYPE::RUN

Parameters
runCurrent Geant4 run object.

Definition at line 94 of file UserAction.h.

94{};

◆ getCurrentParticleMap()

const std::map< int, ldmx::SimParticle > & simcore::UserAction::getCurrentParticleMap ( ) const
protected

Get the current particle map.

Note
The current particle map will only have the particles already fully processed and chosen to be saved. The ancestry of the particles will not have been traced yet.

Definition at line 27 of file UserAction.cxx.

28 {
30}
std::map< int, ldmx::SimParticle > & getParticleMap()
Get the map of particles to be stored in output event.
Definition TrackMap.h:101
TrackMap & getTrackMap()
Get a handle to the current TrackMap for the event.
static TrackingAction * get()
Get a pointer to the current UserTrackingAction from the G4RunManager.

References simcore::g4user::TrackingAction::get(), simcore::TrackMap::getParticleMap(), and simcore::g4user::TrackingAction::getTrackMap().

Referenced by biasing::utility::DecayChildrenKeeper::PostUserTrackingAction().

◆ getEventInfo()

UserEventInformation * simcore::UserAction::getEventInfo ( ) const
protected

Get a handle to the event information.

This is static just to point out that it doesn't depend on any of the member variables of this class. It is just a helper function for shortening any code that interacts with our event information.

Returns
pointer to the current event information

Definition at line 22 of file UserAction.cxx.

22 {
23 return static_cast<UserEventInformation*>(
24 G4EventManager::GetEventManager()->GetUserInformation());
25}

Referenced by biasing::DeepEcalProcessFilter::stepping(), biasing::MidShowerNuclearBkgdFilter::stepping(), biasing::TargetBremFilter::stepping(), and biasing::TargetProcessFilter::stepping().

◆ getTypes()

virtual std::vector< TYPE > simcore::UserAction::getTypes ( )
pure virtual

◆ NewStage()

virtual void simcore::UserAction::NewStage ( )
inlinevirtual

Method called at the beginning of a new stage.

TYPE::STACKING

Reimplemented in biasing::DeepEcalProcessFilter, biasing::EcalDarkBremFilter, biasing::MidShowerDiMuonBkgdFilter, biasing::MidShowerNuclearBkgdFilter, and biasing::utility::PartialEnergySorter.

Definition at line 141 of file UserAction.h.

141{};

◆ PostUserTrackingAction()

virtual void simcore::UserAction::PostUserTrackingAction ( const G4Track *  )
inlinevirtual

Method called after the UserTrackingAction.

TYPE::TRACKING

Parameters
trackcurrent Geant4 track

Reimplemented in biasing::EcalDarkBremFilter, biasing::utility::DecayChildrenKeeper, and biasing::utility::TrackProcessFilter.

Definition at line 112 of file UserAction.h.

112{};

◆ PrepareNewEvent()

virtual void simcore::UserAction::PrepareNewEvent ( )
inlinevirtual

Method called at the beginning of a new event.

TYPE::STACKING

Definition at line 148 of file UserAction.h.

148{};

◆ PreUserTrackingAction()

virtual void simcore::UserAction::PreUserTrackingAction ( const G4Track *  )
inlinevirtual

Method called before the UserTrackingAction.

TYPE::TRACKING

Parameters
trackcurrent Geant4 track

Definition at line 103 of file UserAction.h.

103{};

◆ stepping()

virtual void simcore::UserAction::stepping ( const G4Step *  )
inlinevirtual

Member Data Documentation

◆ name_

std::string simcore::UserAction::name_ {""}
protected

Name of the UserAction.

Definition at line 181 of file UserAction.h.

181{""};

Referenced by UserAction().

◆ parameters_

framework::config::Parameters simcore::UserAction::parameters_
protected

The set of parameters used to configure this class.

Definition at line 184 of file UserAction.h.

Referenced by UserAction().


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