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// Geant4 //
15//------------//
16#include "G4RunManager.hh"
17#include "G4VPhysicalVolume.hh"
18
19//------------//
20// LDMX //
21//------------//
22#include "SimCore/G4User/PtrRetrieval.h"
24
25/*~~~~~~~~~~*/
26/* Core */
27/*~~~~~~~~~~*/
28#include "Framework/Logger.h"
29
30namespace biasing {
31
46 public:
52 TargetDarkBremFilter(const std::string& name,
54
59
65 std::vector<simcore::TYPE> getTypes() override {
66 return {simcore::TYPE::STEPPING, simcore::TYPE::EVENT};
67 }
68
74 void beginOfEventAction(const G4Event* e) override;
75
87 void stepping(const G4Step* step) override;
88
95 void endOfEventAction(const G4Event* event) override;
96
97 private:
106 inline bool isOutsideTargetRegion(const G4VPhysicalVolume* vol) const {
107 return vol ? isOutsideTargetRegion(vol->GetLogicalVolume()) : true;
108 }
109
119 inline bool isOutsideTargetRegion(const G4LogicalVolume* vol) const {
120 if (!vol) return true;
121 auto target_region = simcore::g4user::ptrretrieval::getRegion("target");
122 if (!target_region) {
123 ldmx_log(warn) << "Region 'target' not found in Geant4 region store";
124 }
125 auto region = vol->GetRegion();
126 return region ? (region != target_region) : true;
127 }
128
129 private:
139
144
145}; // TargetDarkBremFilter
146} // namespace biasing
147
148#endif // BIASING_TARGETDARKBREMFILTER_H__
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 &parameters)
Class constructor.
void endOfEventAction(const G4Event *event) override
Check flag signaling finding of A', if false, abort the event so it isn't saved.
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.
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.
void beginOfEventAction(const G4Event *e) override
Reset flag signaling finding of A' to false.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
Interface that defines a user action.
Definition UserAction.h:46