1#include "Biasing/PrimaryToEcalFilter.h"
3#include "G4EventManager.hh"
4#include "G4RunManager.hh"
5#include "SimCore/G4User/PtrRetrieval.h"
11 :
simcore::UserAction(name, parameters) {
17 if (
int parent_id{step->GetTrack()->GetParentID()}; parent_id != 0)
return;
19 if (G4EventManager::GetEventManager()->GetConstCurrentEvent()->IsAborted())
25 step->GetTrack()->GetVolume()->GetLogicalVolume()->GetRegion();
26 auto calorimeter_region =
27 simcore::g4user::ptrretrieval::getRegion(
"CalorimeterRegion");
28 if (!calorimeter_region) {
30 <<
"Region 'CalorimeterRegion' not found in Geant4 region store";
32 if (current_region == calorimeter_region)
return;
36 if (
auto energy{step->GetPostStepPoint()->GetTotalEnergy()};
38 ldmx_log(trace) <<
"Aborting "
39 << G4EventManager::GetEventManager()
40 ->GetConstCurrentEvent()
43 step->GetTrack()->SetTrackStatus(fKillTrackAndSecondaries);
44 G4RunManager::GetRunManager()->AbortEvent();
#define DECLARE_ACTION(CLASS)
register a new UserAction with its factory
User stepping action used to filter events where the primary particle falls below a threshold before ...
void stepping(const G4Step *step) override
Only process if the track is a primary (parentID == 0) and if the event is not aborted and the partic...
double threshold_
Energy [MeV] below which a primary should be vetoed.
PrimaryToEcalFilter(const std::string &name, framework::config::Parameters ¶meters)
Constructor.
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 ...