LDMX Software
TargetDarkBremFilter.h
Go to the documentation of this file.
1
10#ifndef BIASING_TARGETDARKBREMFILTER_H_
11#define BIASING_TARGETDARKBREMFILTER_H_
12
13//----------------//
14// C++ StdLib //
15//----------------//
16#include <algorithm>
17
18//------------//
19// Geant4 //
20//------------//
21#include "G4RunManager.hh"
22#include "G4VPhysicalVolume.hh"
23
24//------------//
25// LDMX //
26//------------//
27#include "SimCore/UserAction.h"
28
29namespace biasing {
30
45 public:
51 TargetDarkBremFilter(const std::string& name,
53
58
64 std::vector<simcore::TYPE> getTypes() override {
65 return {simcore::TYPE::STEPPING, simcore::TYPE::EVENT};
66 }
67
73 void BeginOfEventAction(const G4Event* e) override;
74
86 void stepping(const G4Step* step) override;
87
94 void EndOfEventAction(const G4Event* event) override;
95
96 private:
105 inline bool isOutsideTargetRegion(const G4VPhysicalVolume* vol) const {
106 return vol ? isOutsideTargetRegion(vol->GetLogicalVolume()) : true;
107 }
108
118 inline bool isOutsideTargetRegion(const G4LogicalVolume* vol) const {
119 if (!vol) return true;
120 auto region = vol->GetRegion();
121 return region ? (region->GetName().compareTo("target") != 0) : true;
122 }
123
132 void AbortEvent(const std::string& reason) const;
133
134 private:
144
149
150}; // TargetDarkBremFilter
151} // namespace biasing
152
153#endif // BIASING_TARGETDARKBREMFILTER_H__
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.
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.
void EndOfEventAction(const G4Event *event) override
Check flag signaling finding of A', if false, abort the event so it isn't saved.
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 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.
Definition Parameters.h:27
Interface that defines a user action.
Definition UserAction.h:42