6#include "G4EventManager.hh"
7#include "G4RunManager.hh"
15#include "SimCore/UserEventInformation.h"
16#include "SimCore/UserTrackInformation.h"
20bool nonFiducial_ =
false;
24 : simcore::UserAction(name, parameters) {
31 auto track{step->GetTrack()};
34 if (
auto pdgID{track->GetParticleDefinition()->GetPDGEncoding()};
40 int parentID{step->GetTrack()->GetParentID()};
46 auto volume{track->GetVolume()->GetLogicalVolume()
47 ? track->GetVolume()->GetLogicalVolume()->GetName()
52 if (electronCheck->isRecoilElectron() ==
true) {
55 track->SetTrackStatus(fKillTrackAndSecondaries);
56 G4RunManager::GetRunManager()->AbortEvent();
57 ldmx_log(debug) <<
" Recoil track momentum is too high, expected to be "
58 "fiducial, exiting\n";
63 auto isInEcal{((volume.contains(
"Si") || volume.contains(
"W") ||
64 volume.contains(
"PCB") || volume.contains(
"strongback") ||
65 volume.contains(
"Glue") || volume.contains(
"CFMix") ||
66 volume.contains(
"Al") || volume.contains(
"C")) &&
67 volume.contains(
"volume")) ||
68 (volume.contains(
"nohole_motherboard"))};
75 track->SetTrackStatus(fKillTrackAndSecondaries);
76 G4RunManager::GetRunManager()->AbortEvent();
77 ldmx_log(debug) <<
">> This event is fiducial, exiting";
89 if (volume.compareTo(
"recoil") == 0) {
95 ldmx_log(debug) <<
" >> This track is the recoil electron, tagging it";
103 ldmx_log(debug) <<
" >> This event is non-fiducial in ECAL, keeping it";
105 ldmx_log(debug) <<
">> This event is fiducial, exiting";
Class defining a UserActionPlugin that allows a user to filter out non-fiducial events,...
void stepping(const G4Step *step) override
Implement the stepping action which performs the target volume biasing.
NonFiducialFilter(const std::string &name, framework::config::Parameters ¶meters)
Constructor.
void EndOfEventAction(const G4Event *) override
Method called at the end of every event.
bool abort_fiducial_
If turned on, this aborts fiducial events.
double recoil_max_p_
Recoil electron threshold.
Class encapsulating parameters for configuring a processor.
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.