LDMX Software
Public Member Functions | Private Attributes | List of all members
biasing::utility::TrackProcessFilter Class Reference

Filter used to tag tracks for persistence based on the process they were created from. More...

#include <TrackProcessFilter.h>

Public Member Functions

 TrackProcessFilter (const std::string &name, framework::config::Parameters &parameters)
 Constructor.
 
 ~TrackProcessFilter ()
 Destructor.
 
void PostUserTrackingAction (const G4Track *track) override
 Method called when a track is done being processed.
 
std::vector< simcore::TYPE > getTypes () override
 Retrieve the type of actions this class defines.
 
- Public Member Functions inherited from simcore::UserAction
 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 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.
 

Private Attributes

std::string process_ {""}
 The process to filter on.
 

Additional Inherited Members

- Public Types inherited from simcore::UserAction
using Factory = ::simcore::Factory< UserAction, std::shared_ptr< UserAction >, const std::string &, framework::config::Parameters & >
 factory for user actions
 
- Protected Member Functions inherited from simcore::UserAction
UserEventInformationgetEventInfo () const
 Get a handle to the event information.
 
const std::map< int, ldmx::SimParticle > & getCurrentParticleMap () const
 Get the current particle map.
 
- Protected Attributes inherited from simcore::UserAction
std::string name_ {""}
 Name of the UserAction.
 
framework::config::Parameters parameters_
 The set of parameters used to configure this class.
 

Detailed Description

Filter used to tag tracks for persistence based on the process they were created from.

All tracks are checked during the post user tracking action stage and are tagged to be persisted if the process used to create them match the user specified process. The process name specified by the user needs to match the names assigned by Geant4.

Note
Any track created through a process not the same as the configured process will not be saved.

Definition at line 30 of file TrackProcessFilter.h.

Constructor & Destructor Documentation

◆ TrackProcessFilter()

biasing::utility::TrackProcessFilter::TrackProcessFilter ( const std::string &  name,
framework::config::Parameters parameters 
)

Constructor.

Parameters
[in]namethe name of the instance of this UserAction.
[in]parametersthe parameters used to configure this UserAction.

Definition at line 17 of file TrackProcessFilter.cxx.

19 : simcore::UserAction(name, parameters) {
20 process_ = parameters.getParameter<std::string>("process");
21}
std::string process_
The process to filter on.
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
Interface that defines a user action.
Definition UserAction.h:42

References framework::config::Parameters::getParameter(), and process_.

◆ ~TrackProcessFilter()

biasing::utility::TrackProcessFilter::~TrackProcessFilter ( )

Destructor.

Definition at line 23 of file TrackProcessFilter.cxx.

23{}

Member Function Documentation

◆ getTypes()

std::vector< simcore::TYPE > biasing::utility::TrackProcessFilter::getTypes ( )
inlineoverridevirtual

Retrieve the type of actions this class defines.

Implements simcore::UserAction.

Definition at line 53 of file TrackProcessFilter.h.

53 {
54 return {simcore::TYPE::TRACKING};
55 }

◆ PostUserTrackingAction()

void biasing::utility::TrackProcessFilter::PostUserTrackingAction ( const G4Track *  track)
overridevirtual

Method called when a track is done being processed.

Parameters
[in]trackGeant4 track associated with a particle.

Reimplemented from simcore::UserAction.

Definition at line 25 of file TrackProcessFilter.cxx.

25 {
26 if (const G4VProcess * process{track->GetCreatorProcess()}; process) {
27 auto name{process->GetProcessName()};
28 auto trackInfo{simcore::UserTrackInformation::get(track)};
29 if (name.contains(process_)) trackInfo->setSaveFlag(true);
30 } // does this track have a creator process
31}
static UserTrackInformation * get(const G4Track *track)
get
void setSaveFlag(bool saveFlag)
Set the save flag so the associated track will be persisted as a Trajectory.

References simcore::UserTrackInformation::get(), process_, and simcore::UserTrackInformation::setSaveFlag().

Member Data Documentation

◆ process_

std::string biasing::utility::TrackProcessFilter::process_ {""}
private

The process to filter on.

Definition at line 59 of file TrackProcessFilter.h.

59{""};

Referenced by PostUserTrackingAction(), and TrackProcessFilter().


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