LDMX Software
Public Member Functions | Private Attributes | List of all members
simcore::g4user::StackingAction Class Reference

Class implementing a user stacking action. More...

#include <StackingAction.h>

Public Member Functions

 StackingAction ()=default
 Constructor.
 
virtual ~StackingAction ()=default
 Destructor.
 
G4ClassificationOfNewTrack ClassifyNewTrack (const G4Track *track) override
 Classify a new track.
 
void NewStage () override
 Invoked when there is a new stacking stage.
 
void PrepareNewEvent () override
 Invoked for a new event.
 
void registerAction (UserAction *stackingAction)
 Register a user action of type stacking action with this class.
 

Private Attributes

std::vector< UserAction * > stackingActions_
 Collection of user stacking actions.
 

Detailed Description

Class implementing a user stacking action.

Definition at line 32 of file StackingAction.h.

Member Function Documentation

◆ ClassifyNewTrack()

G4ClassificationOfNewTrack simcore::g4user::StackingAction::ClassifyNewTrack ( const G4Track *  track)
override

Classify a new track.

Parameters
aTrackThe track to classify.
Returns
The track classification.

Definition at line 6 of file StackingAction.cxx.

7 {
8 // Default value of a track is fUrgent.
9 G4ClassificationOfNewTrack currentTrackClass =
10 G4ClassificationOfNewTrack::fUrgent;
11
12 // Get proposed new track classification from this plugin.
13 for (auto& stackingAction : stackingActions_) {
14 // Get proposed new track classification from this plugin.
15 G4ClassificationOfNewTrack newTrackClass =
16 stackingAction->ClassifyNewTrack(track, currentTrackClass);
17
18 // Only set the current classification if the plugin changed it.
19 if (newTrackClass != currentTrackClass) currentTrackClass = newTrackClass;
20 }
21
22 return currentTrackClass;
23}
std::vector< UserAction * > stackingActions_
Collection of user stacking actions.

References stackingActions_.

◆ NewStage()

void simcore::g4user::StackingAction::NewStage ( )
override

Invoked when there is a new stacking stage.

Definition at line 25 of file StackingAction.cxx.

25 {
26 for (auto& stackingAction : stackingActions_) stackingAction->NewStage();
27}
void NewStage() override
Invoked when there is a new stacking stage.

References stackingActions_.

◆ PrepareNewEvent()

void simcore::g4user::StackingAction::PrepareNewEvent ( )
override

Invoked for a new event.

Definition at line 29 of file StackingAction.cxx.

29 {
30 for (auto& stackingAction : stackingActions_)
31 stackingAction->PrepareNewEvent();
32}
void PrepareNewEvent() override
Invoked for a new event.

References stackingActions_.

◆ registerAction()

void simcore::g4user::StackingAction::registerAction ( UserAction stackingAction)
inline

Register a user action of type stacking action with this class.

Parameters
actionUser action of type StackingAction

Definition at line 62 of file StackingAction.h.

62 {
63 stackingActions_.push_back(stackingAction);
64 }

References stackingActions_.

Member Data Documentation

◆ stackingActions_

std::vector<UserAction*> simcore::g4user::StackingAction::stackingActions_
private

Collection of user stacking actions.

Definition at line 68 of file StackingAction.h.

Referenced by ClassifyNewTrack(), NewStage(), PrepareNewEvent(), and registerAction().


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