10#ifndef BIASING_TARGETDARKBREMFILTER_H_
11#define BIASING_TARGETDARKBREMFILTER_H_
21#include "G4RunManager.hh"
22#include "G4VPhysicalVolume.hh"
27#include "SimCore/G4User/PtrRetrieval.h"
33#include "Framework/Logger.h"
34#include "G4DarkBreM/G4APrime.h"
35#include "G4Electron.hh"
36#include "SimCore/G4User/UserTrackInformation.h"
73 std::vector<simcore::TYPE>
getTypes()
override {
74 return {simcore::TYPE::STEPPING, simcore::TYPE::EVENT};
95 void stepping(
const G4Step* step)
override;
128 if (!vol)
return true;
129 auto target_region = simcore::g4user::ptrretrieval::getRegion(
"target");
130 if (!target_region) {
131 ldmx_log(warn) <<
"Region 'target' not found in Geant4 region store";
133 auto region = vol->GetRegion();
134 return region ? (region != target_region) :
true;
145 void AbortEvent(
const std::string& reason)
const;
File holding UserAction prototype and supporting macro.
This class is meant to filter for events that produce a dark brem matching originating in the target ...
~TargetDarkBremFilter()=default
Class destructor.
void stepping(const G4Step *step) override
Looking for A' while primary is stepping.
TargetDarkBremFilter(const std::string &name, framework::config::Parameters ¶meters)
Class constructor.
double threshold_
Minimum energy [MeV] that the A' should have to keep the event.
bool isOutsideTargetRegion(const G4VPhysicalVolume *vol) const
Check if the volume is outside the target region.
bool isOutsideTargetRegion(const G4LogicalVolume *vol) const
Check if the volume is outside the target region.
void BeginOfEventAction(const G4Event *e) override
Reset flag signaling finding of A' to false.
void EndOfEventAction(const G4Event *event) override
Check flag signaling finding of A', if false, abort the event so it isn't saved.
void AbortEvent(const std::string &reason) const
Helper to abort an event with a message.
bool found_aprime_
flag to signal that we saw an A'
std::vector< simcore::TYPE > getTypes() override
Get the types of actions this class can do.
Class encapsulating parameters for configuring a processor.
Interface that defines a user action.