12#include "G4DarkBreM/G4APrime.h"
13#include "G4Electron.hh"
19 :
simcore::UserAction(name, parameters) {
29 if (G4EventManager::GetEventManager()->GetConstCurrentEvent()->IsAborted())
33 auto track{step->GetTrack()};
36 auto particle_def{track->GetParticleDefinition()};
37 if (particle_def != G4Electron::Electron()) {
38 if (particle_def == G4APrime::APrime() and
39 track->GetCurrentStepNumber() == 1) {
53 abortEvent(
"A' was not created within target.");
61 if (track->GetParentID() != 0)
return;
68 track->GetTrackStatus() == fStopAndKill
69 or track->GetKineticEnergy() == 0.
72 const std::vector<G4Track*>* secondaries{step->GetSecondary()};
73 if (not secondaries or secondaries->size() == 0) {
74 abortEvent(
"Primary electron did not create secondaries.");
78 for (
auto& secondary_track : *secondaries) {
79 if (secondary_track->GetParticleDefinition() == G4APrime::APrime()) {
82 if (secondary_track->GetTotalEnergy() <
threshold_) {
84 "A' was not created with total energy above input threshold.");
89 abortEvent(
"A' was not created within target.");
112 abortEvent(
"Primary electron did not create A'.");
123 abortEvent(
"Did not find an A' after entire event was simulated.");
#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.
void endOfEventAction(const G4Event *event) override
Check flag signaling finding of A', if false, abort the event so it isn't saved.
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.
bool found_aprime_
flag to signal that we saw an A'
void beginOfEventAction(const G4Event *e) override
Reset flag signaling finding of A' to false.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
void abortEvent(const std::string &reason) const
Helper to abort an event with a message.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...