LDMX Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
biasing::PhotoNuclearTopologyFilter Class Referenceabstract

Abstract base class for a user action used to filter out photo-nuclear events that don't match the topology the user is interested in studying. More...

#include <PhotoNuclearTopologyFilters.h>

Public Member Functions

 PhotoNuclearTopologyFilter (const std::string &name, framework::config::Parameters &parameters)
 Constructor.
 
 ~PhotoNuclearTopologyFilter ()=default
 Destructor.
 
void stepping (const G4Step *step) override
 Callback that allows a user to take some actions at the end of a step.
 
virtual bool rejectEvent (const std::vector< G4Track * > &secondaries) const =0
 
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.
 

Protected Member Functions

constexpr bool isLightIon (const int pdgCode) const
 Check if the PDG code corresponds to a light ion nucleus.
 
constexpr bool skipCountingParticle (const int pdgcode) const
 Whether or not to include a particular particle type in any counting.
 
constexpr bool isNeutron (const int pdgID) const
 
- 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

bool count_light_ions_
 
double hard_particle_threshold_
 
- 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.
 

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
 

Detailed Description

Abstract base class for a user action used to filter out photo-nuclear events that don't match the topology the user is interested in studying.

Derived classes implement the event rejection

Similar to the PhotoNuclearProductsFilter, 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.

Definition at line 31 of file PhotoNuclearTopologyFilters.h.

Constructor & Destructor Documentation

◆ PhotoNuclearTopologyFilter()

biasing::PhotoNuclearTopologyFilter::PhotoNuclearTopologyFilter ( 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 44 of file PhotoNuclearTopologyFilters.cxx.

46 : UserAction{name, parameters},
47 count_light_ions_{parameters.getParameter<bool>("count_light_ions")},
48 hard_particle_threshold_{
49 parameters.getParameter<double>("hard_particle_threshold")} {}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
UserAction(const std::string &name, framework::config::Parameters &parameters)
Constructor.

Member Function Documentation

◆ getTypes()

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

Retrieve the type of actions this class defines.

Implements simcore::UserAction.

Definition at line 57 of file PhotoNuclearTopologyFilters.h.

57 {
58 return {simcore::TYPE::STEPPING};
59 }

◆ isLightIon()

constexpr bool biasing::PhotoNuclearTopologyFilter::isLightIon ( const int  pdgCode) const
inlineconstexprprotected

Check if the PDG code corresponds to a light ion nucleus.

Nuclear PDG codes are given by ±10LZZZAAAI So to find the atomic number, we first divide by 10 (to lose the I-component) and then take the modulo with 1000.

TODO: Repeated code from SimCore, could probably live elsewhere.

Definition at line 72 of file PhotoNuclearTopologyFilters.h.

72 {
73 if (pdgCode > 1000000000) {
74 // Check if the atomic number is less than or equal to 4
75 return ((pdgCode / 10) % 1000) <= 4;
76 }
77 return false;
78 }

Referenced by skipCountingParticle().

◆ isNeutron()

constexpr bool biasing::PhotoNuclearTopologyFilter::isNeutron ( const int  pdgID) const
inlineconstexprprotected

Definition at line 97 of file PhotoNuclearTopologyFilters.h.

97{ return pdgID == 2112; }

◆ skipCountingParticle()

constexpr bool biasing::PhotoNuclearTopologyFilter::skipCountingParticle ( const int  pdgcode) const
inlineconstexprprotected

Whether or not to include a particular particle type in any counting.

Unless count_light_ions_ is set, we don't count anything with a nuclear PDG code. This is consistent with the counting behaviour used in the PhotoNuclearDQM.

If count_light_ions_ is set, we also match PDG codes for nuclei with atomic number < 4. 

TODO: Repeated code from SimCore, could probably live elsewhere.

See also
isLightIon

Definition at line 93 of file PhotoNuclearTopologyFilters.h.

93 {
94 return !(pdgcode < 10000 || (count_light_ions_ && isLightIon(pdgcode)));
95 }
constexpr bool isLightIon(const int pdgCode) const
Check if the PDG code corresponds to a light ion nucleus.

References isLightIon().

◆ stepping()

void biasing::PhotoNuclearTopologyFilter::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 51 of file PhotoNuclearTopologyFilters.cxx.

51 {
52 // Get the track associated with this step.
53 auto track{step->GetTrack()};
54
55 // Get the track info and check if this track has been tagged as the
56 // photon that underwent a photo-nuclear reaction. Only those tracks
57 // tagged as PN photos will be processed. The track is currently only
58 // tagged by the UserAction ECalProcessFilter which needs to be run
59 // before this UserAction.
60 auto trackInfo{simcore::UserTrackInformation::get(track)};
61 if ((trackInfo != nullptr) && !trackInfo->isPNGamma()) return;
62
63 // Get the PN photon daughters.
64 auto secondaries{step->GetSecondary()};
65
66 if (rejectEvent(*secondaries)) {
67 track->SetTrackStatus(fKillTrackAndSecondaries);
68 G4RunManager::GetRunManager()->AbortEvent();
69 }
70
71 // Once the PN gamma has been procesed, untag it so its not reprocessed
72 // again.
73 if (trackInfo) {
74 trackInfo->tagPNGamma(false);
75 }
76}
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(), and simcore::UserTrackInformation::tagPNGamma().

Member Data Documentation

◆ count_light_ions_

bool biasing::PhotoNuclearTopologyFilter::count_light_ions_
protected

Definition at line 99 of file PhotoNuclearTopologyFilters.h.

◆ hard_particle_threshold_

double biasing::PhotoNuclearTopologyFilter::hard_particle_threshold_
protected

Definition at line 100 of file PhotoNuclearTopologyFilters.h.


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