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

User action used to filter out photo-nuclear events that don't see the photo-nuclear gamma produce specific products. More...

#include <PhotoNuclearProductsFilter.h>

Public Member Functions

 PhotoNuclearProductsFilter (const std::string &name, framework::config::Parameters &parameters)
 Constructor.
 
 ~PhotoNuclearProductsFilter ()
 Destructor.
 
void stepping (const G4Step *step) override
 Callback that allows a user to take some actions at the end of a step.
 
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 PostUserTrackingAction (const G4Track *)
 Method called after the UserTrackingAction.
 
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::vector< int > productsPdgID_
 Container to hold the PDG IDs of products of interest.
 
double min_e
 

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

User action used to filter out photo-nuclear events that don't see the photo-nuclear gamma produce specific products.

This user action will only process steps whose associated track has been tagged as a "PN Gamma". This tag is currently only set in ECalProcessFilter and needs to be placed in the UserAction pipeline before this class. The desired products are passed to this class through the parameter vector<int> parameter "pdg_ids".

Definition at line 30 of file PhotoNuclearProductsFilter.h.

Constructor & Destructor Documentation

◆ PhotoNuclearProductsFilter()

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

Constructor.

Parameters
[in]nameThe name of this class instance.
[in]parametersThe parameters used to configure this class.

Definition at line 22 of file PhotoNuclearProductsFilter.cxx.

24 : simcore::UserAction(name, parameters) {
25 productsPdgID_ = parameters.getParameter<std::vector<int> >("pdg_ids");
26 min_e = parameters.getParameter<double>("min_e");
27}
std::vector< int > productsPdgID_
Container to hold the PDG IDs of products of interest.
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 productsPdgID_.

◆ ~PhotoNuclearProductsFilter()

biasing::PhotoNuclearProductsFilter::~PhotoNuclearProductsFilter ( )

Destructor.

Definition at line 29 of file PhotoNuclearProductsFilter.cxx.

29{}

Member Function Documentation

◆ getTypes()

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

Retrieve the type of actions this class defines.

Implements simcore::UserAction.

Definition at line 54 of file PhotoNuclearProductsFilter.h.

54 {
55 return {simcore::TYPE::STEPPING};
56 }

◆ stepping()

void biasing::PhotoNuclearProductsFilter::stepping ( const G4Step *  step)
overridevirtual

Callback that allows a user to take some actions at the end of a step.

Parameters
[in]stepThe Geant4 step containing transient information about the step taken by a track.

Reimplemented from simcore::UserAction.

Definition at line 31 of file PhotoNuclearProductsFilter.cxx.

31 {
32 // Get the track associated with this step.
33 auto track{step->GetTrack()};
34
35 // Get the track info and check if this track has been tagged as the
36 // photon that underwent a photo-nuclear reaction. Only those tracks
37 // tagged as PN photos will be processed. The track is currently only
38 // tagged by the UserAction ECalProcessFilter which needs to be run
39 // before this UserAction.
40 auto trackInfo{simcore::UserTrackInformation::get(track)};
41 if ((trackInfo != nullptr) && !trackInfo->isPNGamma()) return;
42
43 // Get the PN photon daughters.
44 auto secondaries{step->GetSecondary()};
45
46 // Loop through all of the secondaries and check for the product of
47 // interest. This is done by getting the PDG ID of a daughter and
48 // checking that it's in the vector of PDG IDs passed to this
49 // UserAction.
50 bool productFound{false};
51 for (const auto& secondary : *secondaries) {
52 // Get the PDG ID of the track
53 auto pdgID{std::abs(secondary->GetParticleDefinition()->GetPDGEncoding())};
54
55 // Check if the PDG ID is in the list of products of interest
56 if (std::find(productsPdgID_.begin(), productsPdgID_.end(), pdgID) !=
57 productsPdgID_.end()) {
58 if (secondary->GetKineticEnergy() > min_e) {
59 productFound = true;
60 }
61 break;
62 }
63 }
64
65 // If the product of interest was not found, kill the track and abort
66 // the event.
67 if (!productFound) {
68 track->SetTrackStatus(fKillTrackAndSecondaries);
69 G4RunManager::GetRunManager()->AbortEvent();
70 return;
71 }
72
73 // Once the PN gamma has been procesed, untag it so its not reprocessed
74 // again.
75 if (trackInfo) {
76 trackInfo->tagPNGamma(false);
77 }
78}
static UserTrackInformation * get(const G4Track *track)
get
void tagPNGamma(bool isPNGamma=true)
Tag this track as a photon that has undergone a photo-nuclear reaction.

References simcore::UserTrackInformation::get(), productsPdgID_, and simcore::UserTrackInformation::tagPNGamma().

Member Data Documentation

◆ min_e

double biasing::PhotoNuclearProductsFilter::min_e
private

Definition at line 61 of file PhotoNuclearProductsFilter.h.

◆ productsPdgID_

std::vector<int> biasing::PhotoNuclearProductsFilter::productsPdgID_
private

Container to hold the PDG IDs of products of interest.

Definition at line 60 of file PhotoNuclearProductsFilter.h.

Referenced by PhotoNuclearProductsFilter(), and stepping().


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