1#include "Biasing/PhotoNuclearTopologyFilters.h"
5bool NothingHardFilter::rejectEvent(
6 const std::vector<G4Track*>& secondaries)
const {
7 for (
const auto& secondary : secondaries) {
10 std::abs(secondary->GetParticleDefinition()->GetPDGEncoding())};
14 auto energy{secondary->GetKineticEnergy()};
15 if (energy > hard_particle_threshold_) {
21bool SingleNeutronFilter::rejectEvent(
22 const std::vector<G4Track*>& secondaries)
const {
23 int hard_particles{0};
25 for (
const auto& secondary : secondaries) {
28 std::abs(secondary->GetParticleDefinition()->GetPDGEncoding())};
32 auto energy{secondary->GetKineticEnergy()};
33 if (energy > hard_particle_threshold_) {
35 if (isNeutron(pdgID)) {
40 auto reject{hard_particles != hard_neutrons || hard_particles != 1};
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")} {}
53 auto track{step->GetTrack()};
61 if ((trackInfo !=
nullptr) && !trackInfo->isPNGamma())
return;
64 auto secondaries{step->GetSecondary()};
66 if (rejectEvent(*secondaries)) {
67 track->SetTrackStatus(fKillTrackAndSecondaries);
68 G4RunManager::GetRunManager()->AbortEvent();
80DECLARE_ACTION(biasing, NothingHardFilter)
81DECLARE_ACTION(biasing, SingleNeutronFilter)
PhotoNuclearTopologyFilter(const std::string &name, framework::config::Parameters ¶meters)
Constructor.
void stepping(const G4Step *step) override
Callback that allows a user to take some actions at the end of a step.
constexpr bool skipCountingParticle(const int pdgcode) const
Whether or not to include a particular particle type in any counting.
Class encapsulating parameters for configuring a processor.