16 :
simcore::UserAction(name, parameters) {
26 if (G4EventManager::GetEventManager()->GetConstCurrentEvent()->IsAborted())
30 auto track{step->GetTrack()};
33 auto particle_def{track->GetParticleDefinition()};
34 if (particle_def != G4Electron::Electron()) {
35 if (particle_def == G4APrime::APrime() and
36 track->GetCurrentStepNumber() == 1) {
50 AbortEvent(
"A' was not created within target.");
58 if (track->GetParentID() != 0)
return;
65 track->GetTrackStatus() == fStopAndKill
66 or track->GetKineticEnergy() == 0.
69 const std::vector<G4Track*>* secondaries{step->GetSecondary()};
70 if (not secondaries or secondaries->size() == 0) {
71 AbortEvent(
"Primary electron did not create secondaries.");
75 for (
auto& secondary_track : *secondaries) {
76 if (secondary_track->GetParticleDefinition() == G4APrime::APrime()) {
79 if (secondary_track->GetTotalEnergy() <
threshold_) {
81 "A' was not created with total energy above input threshold.");
86 AbortEvent(
"A' was not created within target.");
109 AbortEvent(
"Primary electron did not create A'.");
120 AbortEvent(
"Did not find an A' after entire event was simulated.");
125 if (G4RunManager::GetRunManager()->GetVerboseLevel() > 1) {
126 std::cout <<
"[ TargetDarkBremFilter ]: " <<
"("
127 << G4EventManager::GetEventManager()
128 ->GetConstCurrentEvent()
130 <<
") " << reason <<
" Aborting event." << std::endl;
132 G4RunManager::GetRunManager()->AbortEvent();
#define DECLARE_ACTION(CLASS)
register a new UserAction with its factory
This class is meant to filter for events that produce a dark brem matching originating in the target ...
void stepping(const G4Step *step) override
Looking for A' while primary is stepping.
TargetDarkBremFilter(const std::string &name, framework::config::Parameters ¶meters)
Class constructor.
double threshold_
Minimum energy [MeV] that the A' should have to keep the event.
bool isOutsideTargetRegion(const G4VPhysicalVolume *vol) const
Check if the volume is outside the target region.
void BeginOfEventAction(const G4Event *e) override
Reset flag signaling finding of A' to false.
void EndOfEventAction(const G4Event *event) override
Check flag signaling finding of A', if false, abort the event so it isn't saved.
void AbortEvent(const std::string &reason) const
Helper to abort an event with a message.
bool found_aprime_
flag to signal that we saw an A'
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...