LDMX Software
StackingAction.cxx
1#include "SimCore/G4User/StackingAction.h"
2
3namespace simcore {
4namespace g4user {
5
6G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(
7 const G4Track* track) {
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}
24
26 for (auto& stackingAction : stackingActions_) stackingAction->NewStage();
27}
28
30 for (auto& stackingAction : stackingActions_)
31 stackingAction->PrepareNewEvent();
32}
33
34} // namespace g4user
35} // namespace simcore
void PrepareNewEvent() override
Invoked for a new event.
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *track) override
Classify a new track.
std::vector< UserAction * > stackingActions_
Collection of user stacking actions.
void NewStage() override
Invoked when there is a new stacking stage.
This namespace is meant to contain all the standard user actions that allow a Geant4 user to interfac...