LDMX Software
TrackProcessFilter.cxx
1#include "Biasing/Utility/TrackProcessFilter.h"
2
3/*~~~~~~~~~~~~*/
4/* Geant4 */
5/*~~~~~~~~~~~~*/
6#include "G4Track.hh"
7#include "G4VProcess.hh"
8
9/*~~~~~~~~~~~~~*/
10/* SimCore */
11/*~~~~~~~~~~~~~*/
12#include "SimCore/G4User/UserTrackInformation.h"
13
14namespace biasing {
15namespace utility {
16
18 const std::string& name, framework::config::Parameters& parameters)
19 : simcore::UserAction(name, parameters) {
20 process_ = parameters.get<std::string>("process");
21}
22
24
26 if (const G4VProcess * process{track->GetCreatorProcess()}; process) {
27 auto name{process->GetProcessName()};
28 auto track_info{simcore::UserTrackInformation::get(track)};
29 if (name.contains(process_)) track_info->setSaveFlag(true);
30 } // does this track have a creator process
31}
32
33} // namespace utility
34} // namespace biasing
35
#define DECLARE_ACTION(CLASS)
register a new UserAction with its factory
Definition UserAction.h:206
Filter used to tag tracks for persistence based on the process they were created from.
void PostUserTrackingAction(const G4Track *track) override
Method called when a track is done being processed.
TrackProcessFilter(const std::string &name, framework::config::Parameters &parameters)
Constructor.
std::string process_
The process to filter on.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78
static UserTrackInformation * get(const G4Track *track)
get
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...