1#include "Biasing/PhotoNuclearTopologyFilters.h"
3#include <G4RunManager.hh>
5#include "SimCore/G4User/UserTrackInformation.h"
9bool NothingHardFilter::rejectEvent(
10 const std::vector<G4Track*>& secondaries)
const {
11 for (
const auto& secondary : secondaries) {
14 std::abs(secondary->GetParticleDefinition()->GetPDGEncoding())};
18 auto energy{secondary->GetKineticEnergy()};
19 if (energy > hard_particle_threshold_) {
25bool SingleNeutronFilter::rejectEvent(
26 const std::vector<G4Track*>& secondaries)
const {
27 int hard_particles{0};
29 for (
const auto& secondary : secondaries) {
32 std::abs(secondary->GetParticleDefinition()->GetPDGEncoding())};
36 auto energy{secondary->GetKineticEnergy()};
37 if (energy > hard_particle_threshold_) {
39 if (isNeutron(pdg_id)) {
44 auto reject{hard_particles != hard_neutrons || hard_particles != 1};
50 : UserAction{name, parameters},
51 count_light_ions_{parameters.get<bool>(
"count_light_ions")},
52 hard_particle_threshold_{
53 parameters.get<double>(
"hard_particle_threshold")} {}
57 auto track{step->GetTrack()};
65 if ((track_info !=
nullptr) && !track_info->isPNGamma())
return;
68 auto secondaries{step->GetSecondary()};
70 if (rejectEvent(*secondaries)) {
71 track->SetTrackStatus(fKillTrackAndSecondaries);
72 G4RunManager::GetRunManager()->AbortEvent();
78 track_info->tagPNGamma(
false);
#define DECLARE_ACTION(CLASS)
register a new UserAction with its factory
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.