12#include "G4DarkBreM/G4APrime.h"
13#include "G4DarkBreM/G4DarkBremsstrahlung.h"
14#include "G4LogicalVolumeStore.hh"
15#include "SimCore/G4User/UserTrackInformation.h"
21 :
simcore::UserAction(name, parameters) {
29 for (G4LogicalVolume* volume : *G4LogicalVolumeStore::GetInstance()) {
30 G4String volume_name = volume->GetName();
32 if (volume_name.contains(
"volume") and
33 (volume_name.contains(
"Si") or volume_name.contains(
"W") or
34 volume_name.contains(
"CFMix") or volume_name.contains(
"PCB") or
35 volume_name.contains(
"Al"))) {
40 ldmx_log(trace) <<
"Looking for A' in: ";
41 for (
auto const& volume :
volumes_) {
42 ldmx_log(trace) <<
"\t" << volume->GetName() <<
", ";
52 const G4Track* aTrack,
const G4ClassificationOfNewTrack& cl) {
53 if (aTrack->GetParticleDefinition() == G4APrime::APrime()) {
55 ldmx_log(trace) <<
"Found A', still need to check if it originated in "
63 abortEvent(
"Found more than one A' during filtering.");
65 abortEvent(
"A' was not produced above the required threshold.");
80 ldmx_log(trace) << track->GetTrackID() <<
" "
81 << track->GetParticleDefinition()->GetPDGEncoding();
83 const G4VProcess* creator = track->GetCreatorProcess();
85 creator->GetProcessName().contains(G4DarkBremsstrahlung::PROCESS_NAME)) {
91 if (track->GetParticleDefinition() == G4APrime::APrime()) {
94 abortEvent(
"A' wasn't produced inside of the requested volume.");
108 auto in_vol = track->GetLogicalVolumeAtVertex();
109 for (
auto const& volume :
volumes_) {
110 if (in_vol == volume)
return true;
#define DECLARE_ACTION(CLASS)
register a new UserAction with its factory
This class is meant to filter for events that produce a dark brem occuring within the ECal and produc...
void newStage() override
When using the PartialEnergySorter, the first time that a new stage begins is when all particles are ...
void postUserTrackingAction(const G4Track *track) override
Make sure A' is saved.
bool found_ap_
Have we found the A' yet?
double threshold_
Minimum energy [MeV] that the A' should have to keep the event.
bool inDesiredVolume(const G4Track *) const
Check if input volume is in the desired volume name.
std::vector< G4LogicalVolume * > volumes_
The volumes that the filter will be applied to.
void beginOfEventAction(const G4Event *event) override
Reset flag on if A' has been found.
G4ClassificationOfNewTrack classifyNewTrack(const G4Track *aTrack, const G4ClassificationOfNewTrack ¤tTrackClass) override
We return the classification of the track done by the PartialEnergySorter, but we can check here if t...
EcalDarkBremFilter(const std::string &name, framework::config::Parameters ¶meters)
Class constructor.
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 ...