LDMX Software
Public Member Functions | List of all members
biasing::SingleNeutronFilter Class Reference

Public Member Functions

 SingleNeutronFilter (const std::string &name, framework::config::Parameters &parameters)
 
bool rejectEvent (const std::vector< G4Track * > &secondaries) const override
 
- Public Member Functions inherited from biasing::PhotoNuclearTopologyFilter
 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.
 
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.
 

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 biasing::PhotoNuclearTopologyFilter
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 inherited from biasing::PhotoNuclearTopologyFilter
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.
 

Detailed Description

Definition at line 103 of file PhotoNuclearTopologyFilters.h.

Constructor & Destructor Documentation

◆ SingleNeutronFilter()

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

Definition at line 105 of file PhotoNuclearTopologyFilters.h.

107 : PhotoNuclearTopologyFilter{name, parameters} {}
PhotoNuclearTopologyFilter(const std::string &name, framework::config::Parameters &parameters)
Constructor.

Member Function Documentation

◆ rejectEvent()

bool biasing::SingleNeutronFilter::rejectEvent ( const std::vector< G4Track * > &  secondaries) const
overridevirtual

Implements biasing::PhotoNuclearTopologyFilter.

Definition at line 21 of file PhotoNuclearTopologyFilters.cxx.

22 {
23 int hard_particles{0};
24 int hard_neutrons{0};
25 for (const auto& secondary : secondaries) {
26 // Get the PDG ID of the track
27 const auto pdgID{
28 std::abs(secondary->GetParticleDefinition()->GetPDGEncoding())};
29 if (skipCountingParticle(pdgID)) {
30 continue;
31 }
32 auto energy{secondary->GetKineticEnergy()};
33 if (energy > hard_particle_threshold_) {
34 hard_particles++;
35 if (isNeutron(pdgID)) {
36 hard_neutrons++;
37 }
38 }
39 }
40 auto reject{hard_particles != hard_neutrons || hard_particles != 1};
41 return reject;
42}
constexpr bool skipCountingParticle(const int pdgcode) const
Whether or not to include a particular particle type in any counting.

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