16 :
simcore::UserAction(name, parameters) {
24 for (G4LogicalVolume* volume : *G4LogicalVolumeStore::GetInstance()) {
25 G4String volume_name = volume->GetName();
27 if (volume_name.contains(
"volume") and
28 (volume_name.contains(
"Si") or volume_name.contains(
"W") or
29 volume_name.contains(
"CFMix") or volume_name.contains(
"PCB") or
30 volume_name.contains(
"Al"))) {
35 ldmx_log(trace) <<
"Looking for A' in: ";
36 for (
auto const& volume :
volumes_) {
37 ldmx_log(trace) <<
"\t" << volume->GetName() <<
", ";
47 const G4Track* aTrack,
const G4ClassificationOfNewTrack& cl) {
48 if (aTrack->GetParticleDefinition() == G4APrime::APrime()) {
50 ldmx_log(trace) <<
"Found A', still need to check if it originated in "
58 AbortEvent(
"Found more than one A' during filtering.");
60 AbortEvent(
"A' was not produced above the required threshold.");
75 ldmx_log(trace) << track->GetTrackID() <<
" "
76 << track->GetParticleDefinition()->GetPDGEncoding();
78 const G4VProcess* creator = track->GetCreatorProcess();
80 creator->GetProcessName().contains(G4DarkBremsstrahlung::PROCESS_NAME)) {
86 if (track->GetParticleDefinition() == G4APrime::APrime()) {
89 AbortEvent(
"A' wasn't produced inside of the requested volume.");
103 auto in_vol = track->GetLogicalVolumeAtVertex();
104 for (
auto const& volume :
volumes_) {
105 if (in_vol == volume)
return true;
114 << G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID()
115 <<
") " << reason <<
" Aborting event.";
117 G4RunManager::GetRunManager()->AbortEvent();
#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 BeginOfEventAction(const G4Event *event) override
Reset flag on if A' has been found.
void NewStage() override
When using the PartialEnergySorter, the first time that a new stage begins is when all particles are ...
bool found_ap_
Have we found the A' yet?
double threshold_
Minimum energy [MeV] that the A' should have to keep the event.
void PostUserTrackingAction(const G4Track *track) override
Make sure A' is saved.
void AbortEvent(const std::string &reason) const
Helper to abort an event with a message.
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.
EcalDarkBremFilter(const std::string &name, framework::config::Parameters ¶meters)
Class constructor.
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...
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 ...