6#include "G4EventManager.hh"
7#include "G4RunManager.hh"
15#include "SimCore/UserEventInformation.h"
16#include "SimCore/UserTrackInformation.h"
22 : simcore::UserAction(name, parameters) {
27 parameters.
getParameter<
bool>(
"require_photon_fromTarget");
32 photonFromTarget_ =
false;
37 auto track{step->GetTrack()};
40 auto processName = track->GetCreatorProcess()
41 ? track->GetCreatorProcess()->GetProcessName()
43 auto PDGid = track->GetParticleDefinition()->GetPDGEncoding();
47 if (processName.contains(
"unknown"))
return;
55 auto volume{track->GetVolume()->GetLogicalVolume()
56 ? track->GetVolume()->GetLogicalVolume()->GetName()
61 if (processName.contains(
"eBrem") and (track->GetParentID() == 1)) {
64 trackInfo->setSaveFlag(
true);
65 if (volume.contains(
"target")) {
66 photonFromTarget_ =
true;
77 bool hasProcessNeeded{
false};
81 if (processName.contains(process)) {
82 hasProcessNeeded =
true;
87 if (not hasProcessNeeded)
return;
93 auto isInEcal{((volume.contains(
"Si") || volume.contains(
"W") ||
94 volume.contains(
"PCB") || volume.contains(
"strongback") ||
95 volume.contains(
"Glue") || volume.contains(
"CFMix") ||
96 volume.contains(
"Al") || volume.contains(
"C")) &&
97 volume.contains(
"volume")) ||
98 (volume.contains(
"nohole_motherboard"))};
102 if (not isInEcal)
return;
106 auto zPosition = step->GetPreStepPoint()->GetPosition().z();
109 ldmx_log(debug) <<
" Particle ID " << PDGid <<
" with energy "
110 << track->GetKineticEnergy() <<
" on " << volume <<
" from "
111 << processName <<
" at Z = " << zPosition;
121 ldmx_log(debug) <<
"> Event with a hard deep conversion found, yaaay!";
122 ldmx_log(debug) <<
"> -----------------------------------------";
125 G4RunManager::GetRunManager()->AbortEvent();
Class defining a UserActionPlugin that allows a user to filter out events where the interaction happe...
void NewStage() override
Method called at the beginning of a new stage.
bool hasDeepEcalProcess_
member used to help tag events that have a deep-ecal process ocurr
DeepEcalProcessFilter(const std::string &name, framework::config::Parameters ¶meters)
Constructor.
void stepping(const G4Step *step) override
Implement the stepping action which performs the target volume biasing.
double bias_threshold_
Minimal energy the products should have.
std::vector< std::string > processes_
The allowed processes that can happen deep inside the ECAL, default is conversion (conv) and photoele...
void BeginOfEventAction(const G4Event *event) override
Method to set flags in the beginning of the event.
double ecal_min_Z_
Minimum Z location where the deep process should happen.
bool require_photon_fromTarget_
Require that the hard brem photon originates from the target.
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.