LDMX Software
tracking::TrackerVetoProcessor Class Reference

Flags events that pass the tracker veto by applying specific selection criteria. More...

#include <TrackerVetoProcessor.h>

Public Member Functions

 TrackerVetoProcessor (const std::string &name, framework::Process &process)
 Class constructor.
 
virtual ~TrackerVetoProcessor ()=default
 Class destructor.
 
void configure (framework::config::Parameters &parameters) override
 Configure the processor using the given user-specified parameters.
 
void produce (framework::Event &event) override
 Process an event and apply tracker veto selection criteria.
 
- Public Member Functions inherited from framework::Producer
 Producer (const std::string &name, Process &process)
 Class constructor.
 
virtual void beforeNewRun (ldmx::RunHeader &header)
 Handle allowing producers to modify run headers before the run begins.
 
- Public Member Functions inherited from framework::EventProcessor
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &runHeader)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessStart ()
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

float max_d0_
 Maximum allowed transverse impact parameter (d0) for tracks.
 
float max_z0_
 Maximum allowed longitudinal impact parameter (z0) for tracks.
 
float max_chi2_per_ndf_
 Max chi2/ndf required for tracks.
 
float min_tagger_momentum_
 Minimum required momentum for tagger tracks.
 
int min_recoil_n_
 Minimum number of recoil tracks required.
 
int max_recoil_n_
 Maximum number of recoil tracks allowed.
 
int min_tagger_hits_
 Min number of hits for tagger tracks required.
 
int min_recoil_hits_
 Min number of hits for recoil tracks required.
 
std::string tagger_track_collection_name_
 The name of the tagger track collection.
 
std::string recoil_track_collection_name_
 The name of the recoil track collection.
 
std::string input_tagger_pass_name_
 The pass name of the input tagger collections.
 
std::string input_recoil_pass_name_
 The pass name of the input recoil collections.
 
bool inverse_skim_ {false}
 Boolean flag to invert the selection criteria for skimming purposes.
 
std::string output_collection_
 

Additional Inherited Members

- Static Public Member Functions inherited from framework::EventProcessor
static void declare (const std::string &classname, int classtype, EventProcessorMaker *)
 Internal function which is part of the PluginFactory machinery.
 
- Static Public Attributes inherited from framework::Producer
static const int CLASSTYPE {1}
 Constant used to track EventProcessor types by the PluginFactory.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramHelper histograms_
 Interface class for making and filling histograms.
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger theLog_
 The logger for this EventProcessor.
 

Detailed Description

Flags events that pass the tracker veto by applying specific selection criteria.

This processor evaluates tracker events based on recoil and tagger track properties, applying configurable selection criteria to determine whether an event should be flagged.

Definition at line 26 of file TrackerVetoProcessor.h.

Constructor & Destructor Documentation

◆ TrackerVetoProcessor()

tracking::TrackerVetoProcessor::TrackerVetoProcessor ( const std::string & name,
framework::Process & process )
inline

Class constructor.

Parameters
nameName of the processor.
processReference to the framework process.

Definition at line 33 of file TrackerVetoProcessor.h.

34 : framework::Producer(name, process) {}
Base class for a module which produces a data product.

Member Function Documentation

◆ configure()

void tracking::TrackerVetoProcessor::configure ( framework::config::Parameters & parameters)
overridevirtual

Configure the processor using the given user-specified parameters.

This function allows the user to set parameters such as track collection names, selection thresholds, and filtering options.

Parameters
parametersSet of parameters used to configure this processor.

Reimplemented from framework::EventProcessor.

Definition at line 11 of file TrackerVetoProcessor.cxx.

11 {
13 ps.getParameter<std::string>("tagger_track_collection", "TaggerTracks");
15 ps.getParameter<std::string>("recoil_track_collection", "RecoilTracks");
17 ps.getParameter<std::string>("input_tagger_pass_name", "");
19 ps.getParameter<std::string>("input_recoil_pass_name", "");
20 output_collection_ = ps.getParameter<std::string>("output_collection", "");
21 inverse_skim_ = ps.getParameter<bool>("inverse_skim", false);
22 max_d0_ = ps.getParameter<double>("max_d0", 10.);
23 max_z0_ = ps.getParameter<double>("max_z0", 40.);
24 max_chi2_per_ndf_ = ps.getParameter<double>("max_chi2_per_ndf", 5.);
25 min_tagger_momentum_ = ps.getParameter<double>("min_tagger_momentum", 5600.);
26 min_recoil_n_ = ps.getParameter<int>("min_recoil_n", 1);
27 max_recoil_n_ = ps.getParameter<int>("max_recoil_n", 1);
28 min_tagger_hits_ = ps.getParameter<int>("min_tagger_hits", 4);
29 min_recoil_hits_ = ps.getParameter<int>("min_recoil_hits", 4);
30}
std::string input_tagger_pass_name_
The pass name of the input tagger collections.
float max_d0_
Maximum allowed transverse impact parameter (d0) for tracks.
int min_recoil_n_
Minimum number of recoil tracks required.
int min_tagger_hits_
Min number of hits for tagger tracks required.
bool inverse_skim_
Boolean flag to invert the selection criteria for skimming purposes.
float max_z0_
Maximum allowed longitudinal impact parameter (z0) for tracks.
std::string input_recoil_pass_name_
The pass name of the input recoil collections.
int max_recoil_n_
Maximum number of recoil tracks allowed.
std::string recoil_track_collection_name_
The name of the recoil track collection.
int min_recoil_hits_
Min number of hits for recoil tracks required.
float min_tagger_momentum_
Minimum required momentum for tagger tracks.
std::string tagger_track_collection_name_
The name of the tagger track collection.
float max_chi2_per_ndf_
Max chi2/ndf required for tracks.

References input_recoil_pass_name_, input_tagger_pass_name_, inverse_skim_, max_chi2_per_ndf_, max_d0_, max_recoil_n_, max_z0_, min_recoil_hits_, min_recoil_n_, min_tagger_hits_, min_tagger_momentum_, recoil_track_collection_name_, and tagger_track_collection_name_.

◆ produce()

void tracking::TrackerVetoProcessor::produce ( framework::Event & event)
overridevirtual

Process an event and apply tracker veto selection criteria.

This function checks the properties of tracks in the event and determines whether it passes or fails the tracker veto conditions.

Parameters
eventThe event to run the checks on.

Implements framework::Producer.

Definition at line 32 of file TrackerVetoProcessor.cxx.

32 {
33 auto tagger_track_collection{event.getCollection<ldmx::Track>(
35 auto recoil_track_collection{event.getCollection<ldmx::Track>(
37
38 bool passes_veto{false}, passes_tagger_veto{false}, passes_recoil_veto{false};
39
40 // Start with tagger tracks
41 int tagger_n{0};
42 for (const auto& trk : tagger_track_collection) {
43 if ((std::abs(trk.getD0()) < max_d0_) &&
44 (std::abs(trk.getZ0()) < max_z0_)) {
45 auto charge_over_momentum = trk.getQoP();
46 auto tagger_momentum = 1000. / std::abs(charge_over_momentum);
47 float chi2_per_ndf = trk.getChi2() / trk.getNdf();
48 if ((tagger_momentum > min_tagger_momentum_) &&
49 (chi2_per_ndf < max_chi2_per_ndf_) &&
50 (trk.getNhits() > min_tagger_hits_)) {
51 tagger_n++;
52 passes_tagger_veto = true;
53 }
54 }
55 }
56
57 ldmx_log(info) << "Tagger requirements passed for " << tagger_n << " tracks";
58
59 // Recoil tracks now
60 int recoil_n{0};
61 for (const auto& trk : recoil_track_collection) {
62 float chi2_per_ndf = trk.getChi2() / trk.getNdf();
63 if ((std::abs(trk.getD0()) < max_d0_) &&
64 (std::abs(trk.getZ0()) < max_z0_) &&
65 (chi2_per_ndf < max_chi2_per_ndf_) &&
66 (trk.getNhits() > min_recoil_hits_)) {
67 // we may wanna use these in the future, keeping them commented
68 // auto charge_over_momentum = trk.getQoP();
69 // recoil_momentum = 1000. / abs(charge_over_momentum);
70 recoil_n++;
71 };
72 }
73
74 ldmx_log(info) << "Recoil requirements passed for " << recoil_n << " tracks";
75
76 if ((min_recoil_n_ <= recoil_n) && (recoil_n <= max_recoil_n_)) {
77 passes_recoil_veto = true;
78 }
79
80 passes_veto = passes_tagger_veto && passes_recoil_veto;
81
83 result.setVetoResult(passes_veto);
84 result.setTaggerVetoResult(passes_tagger_veto);
85 result.setRecoilVetoResult(passes_recoil_veto);
86
87 event.add(output_collection_, result);
88
89 if (!inverse_skim_) {
90 if (passes_veto) {
91 ldmx_log(info) << "Tracker veto passed, skim will keep the event";
93 } else {
94 ldmx_log(info) << "Tracker veto failed";
96 }
97 } else {
98 if (passes_veto) {
99 ldmx_log(info) << "Inverse tracker veto passed";
101 } else {
102 ldmx_log(info) << "Inverse tracker veto failed, skim will keep the event";
104 }
105 }
106} // produce
void setStorageHint(framework::StorageControl::Hint hint)
Mark the current event as having the given storage control hint from this module.
Implementation of a track object.
Definition Track.h:53
Class that holds reco-level tracking veto decision.
void setRecoilVetoResult(bool passes_recoil_veto)
Sets whether the Recoil Tracker veto was passed or not.
void setTaggerVetoResult(bool passes_tagger_veto)
Sets whether the Tagger Tracker veto was passed or not.
void setVetoResult(bool passes_veto)
Sets whether the Tracker veto was passed or not.
constexpr StorageControl::Hint hint_shouldKeep
storage control hint alias for backwards compatibility
constexpr StorageControl::Hint hint_shouldDrop
storage control hint alias for backwards compatibility

References framework::hint_shouldDrop, framework::hint_shouldKeep, input_recoil_pass_name_, inverse_skim_, max_chi2_per_ndf_, max_d0_, max_recoil_n_, max_z0_, min_recoil_hits_, min_recoil_n_, min_tagger_hits_, min_tagger_momentum_, recoil_track_collection_name_, ldmx::TrackerVetoResult::setRecoilVetoResult(), framework::EventProcessor::setStorageHint(), ldmx::TrackerVetoResult::setTaggerVetoResult(), ldmx::TrackerVetoResult::setVetoResult(), and tagger_track_collection_name_.

Member Data Documentation

◆ input_recoil_pass_name_

std::string tracking::TrackerVetoProcessor::input_recoil_pass_name_
private

The pass name of the input recoil collections.

Definition at line 96 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().

◆ input_tagger_pass_name_

std::string tracking::TrackerVetoProcessor::input_tagger_pass_name_
private

The pass name of the input tagger collections.

Definition at line 93 of file TrackerVetoProcessor.h.

Referenced by configure().

◆ inverse_skim_

bool tracking::TrackerVetoProcessor::inverse_skim_ {false}
private

Boolean flag to invert the selection criteria for skimming purposes.

Definition at line 99 of file TrackerVetoProcessor.h.

99{false};

Referenced by configure(), and produce().

◆ max_chi2_per_ndf_

float tracking::TrackerVetoProcessor::max_chi2_per_ndf_
private

Max chi2/ndf required for tracks.

Definition at line 69 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().

◆ max_d0_

float tracking::TrackerVetoProcessor::max_d0_
private

Maximum allowed transverse impact parameter (d0) for tracks.

Definition at line 63 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().

◆ max_recoil_n_

int tracking::TrackerVetoProcessor::max_recoil_n_
private

Maximum number of recoil tracks allowed.

Definition at line 78 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().

◆ max_z0_

float tracking::TrackerVetoProcessor::max_z0_
private

Maximum allowed longitudinal impact parameter (z0) for tracks.

Definition at line 66 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().

◆ min_recoil_hits_

int tracking::TrackerVetoProcessor::min_recoil_hits_
private

Min number of hits for recoil tracks required.

Definition at line 84 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().

◆ min_recoil_n_

int tracking::TrackerVetoProcessor::min_recoil_n_
private

Minimum number of recoil tracks required.

Definition at line 75 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().

◆ min_tagger_hits_

int tracking::TrackerVetoProcessor::min_tagger_hits_
private

Min number of hits for tagger tracks required.

Definition at line 81 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().

◆ min_tagger_momentum_

float tracking::TrackerVetoProcessor::min_tagger_momentum_
private

Minimum required momentum for tagger tracks.

Definition at line 72 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().

◆ output_collection_

std::string tracking::TrackerVetoProcessor::output_collection_
private

Definition at line 102 of file TrackerVetoProcessor.h.

◆ recoil_track_collection_name_

std::string tracking::TrackerVetoProcessor::recoil_track_collection_name_
private

The name of the recoil track collection.

Definition at line 90 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().

◆ tagger_track_collection_name_

std::string tracking::TrackerVetoProcessor::tagger_track_collection_name_
private

The name of the tagger track collection.

Definition at line 87 of file TrackerVetoProcessor.h.

Referenced by configure(), and produce().


The documentation for this class was generated from the following files: