1#include "Biasing/MidShowerNuclearBkgdFilter.h"
3#include "G4EventManager.hh"
4#include "G4RunManager.hh"
6#include "SimCore/UserTrackInformation.h"
12 : simcore::UserAction(name, parameters) {
35 double pre_energy = step->GetPreStepPoint()->GetTotalEnergy();
36 double post_energy = step->GetPostStepPoint()->GetTotalEnergy();
39 const G4Track* track = step->GetTrack();
54 }
else if (
const G4Track * track{step->GetTrack()};
55 track->GetCurrentStepNumber() == 1 and
70 AbortEvent(
"Not enough energy went to the input process.");
75 const G4Step* step)
const {
77 auto reg{step->GetTrack()->GetVolume()->GetLogicalVolume()->GetRegion()};
78 if (reg)
return (reg->GetName() !=
"CalorimeterRegion");
85 const G4VProcess* proc)
const {
87 const G4String& proc_name{proc->GetProcessName()};
89 if (proc_name.contains(option))
return true;
102 if (G4RunManager::GetRunManager()->GetVerboseLevel() > 1) {
103 std::cout <<
"[ MidShowerNuclearBkgdFilter ]: "
105 << G4EventManager::GetEventManager()
106 ->GetConstCurrentEvent()
108 <<
") " << reason <<
" Aborting event." << std::endl;
110 G4RunManager::GetRunManager()->AbortEvent();
115DECLARE_ACTION(biasing, MidShowerNuclearBkgdFilter)
void save(const G4Track *track) const
Helper to save the passed track.
void AbortEvent(const std::string &reason) const
Helper to abort an event with a message.
void BeginOfEventAction(const G4Event *event) override
Reset the total energy going to the configured process.
bool isOutsideCalorimeterRegion(const G4Step *step) const
Checks if the passed step is outside of the CalorimeterRegion.
void NewStage() override
When using the PartialEnergySorter, the first time that a new stage begins is when all particles are ...
MidShowerNuclearBkgdFilter(const std::string &name, framework::config::Parameters ¶meters)
Class constructor.
bool isNuclearProcess(const G4VProcess *proc) const
Checks if the passed process is any of the nuclear interactions.
void stepping(const G4Step *step) override
We follow the simulation along each step and check if any secondaries of the input process were creat...
double threshold_
Minimum energy [MeV] that the process products need to have to keep the event.
std::vector< std::string > nuclear_processes_
Processes to look for.
double total_process_energy_
Total energy gone to the process in the current event.
Class encapsulating parameters for configuring a processor.
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
UserEventInformation * getEventInfo() const
Get a handle to the event information.