LDMX Software
EcalVetoProcessor.h
Go to the documentation of this file.
1
8#ifndef EVENTPROC_ECALVETOPROCESSOR_H_
9#define EVENTPROC_ECALVETOPROCESSOR_H_
10
11// LDMX
13#include "DetDescr/EcalID.h"
14#include "Ecal/Event/EcalHit.h"
16#include "Framework/Configure/Parameters.h"
18#include "Tools/ONNXRuntime.h"
19
20// C++
21#include <stdlib.h>
22
23#include <map>
24#include <memory>
25
26namespace ecal {
27
33 public:
34 typedef std::pair<ldmx::EcalID, float> CellEnergyPair;
35
36 typedef std::pair<float, float> XYCoords;
37
38 EcalVetoProcessor(const std::string& name, framework::Process& process)
39 : Producer(name, process) {}
40
41 virtual ~EcalVetoProcessor() {}
42
49 void onNewRun(const ldmx::RunHeader& rh) override;
50
54 void onProcessEnd() override;
55
61 void configure(framework::config::Parameters& parameters) override;
62
63 void produce(framework::Event& event) override;
64
65 private:
66 void clearProcessor();
67
68 /* Function to calculate the energy weighted shower centroid */
69 ldmx::EcalID getShowerCentroidIdAndRms(
70 const std::vector<ldmx::EcalHit>& ecal_rec_hits, float& shower_rms);
71
72 /* Function to load up empty vector of hit maps */
73 void fillHitMap(const std::vector<ldmx::EcalHit>& ecal_rec_hits,
74 std::map<ldmx::EcalID, float>& cell_map_);
75
76 /* Function to take loaded hit maps and find isolated hits in them */
77 void fillIsolatedHitMap(const std::vector<ldmx::EcalHit>& ecal_rec_hits,
78 ldmx::EcalID global_centroid,
79 std::map<ldmx::EcalID, float>& cell_map,
80 std::map<ldmx::EcalID, float>& cell_map_iso,
81 bool doTight = false);
82
83 std::vector<XYCoords> getTrajectory(std::array<float, 3> momentum,
84 std::array<float, 3> position);
85
87
88 private:
89 int nevents_{0};
90 float processing_time_{0.};
91
92 std::map<std::string, float> profiling_map_;
93 std::map<ldmx::EcalID, float> cell_map_;
94 std::map<ldmx::EcalID, float> cell_map_tight_iso_;
95
96 std::vector<float> ecal_layer_edep_raw_;
97 std::vector<float> ecal_layer_edep_readout_;
98 std::vector<float> ecal_layer_time_;
99
100 std::vector<std::vector<float>> roc_range_values_;
101
102 int n_ecal_layers_{0};
103 int n_readout_hits_{0};
104 int deepest_layer_hit_{0};
105
106 float summed_det_{0};
107 float summed_tight_iso_{0};
108 float max_cell_dep_{0};
109 float shower_rms_{0};
110 float x_std_{0};
111 float y_std_{0};
112 float avg_layer_hit_{0};
113 float std_layer_hit_{0};
114 float ecal_back_energy_{0};
115
121 float ep_ang_{0};
127 float ep_sep_{0};
129 float ep_dot_{0};
132
133 float bdt_cut_val_{0};
134
135 float beam_energy_mev_{0};
136
137 std::string bdt_file_name_;
138 std::string bdt_feature_config_;
139 std::string roc_file_name_;
140 std::vector<float> bdt_features_;
141 std::string feature_list_name_;
142
143 // Pass and collection names
144 std::string ecal_sp_coll_name_;
145 std::string target_sp_coll_name_;
146 std::string sp_pass_name_;
147 std::string rec_pass_name_;
148 std::string rec_coll_name_;
149 bool recoil_from_tracking_;
150 std::string track_pass_name_;
151 std::string track_collection_;
152
153 std::string sim_particles_coll_name_;
154 std::string sim_particles_passname_;
155 bool inverse_skim_{false};
156
158 std::string collection_name_{"EcalVeto"};
159
160 std::unique_ptr<ldmx::ort::ONNXRuntime> rt_;
161
164};
165
166} // namespace ecal
167
168#endif
Class that translates raw positions of ECal module hits into cells in a hexagonal readout.
Class that defines an ECal detector ID with a cell number.
Class used to encapsulate the results obtained from EcalVetoProcessor.
Base classes for all user event processing components to extend.
Determines if event is vetoable using ECAL hit information.
float ep_ang_
Angular separation between the projected photon and electron trajectories as projected at ECAL.
std::string collection_name_
Name of the collection which will containt the results.
float ep_ang_at_target_
Angular separation between the projected photon and electron trajectories as at Target.
void configure(framework::config::Parameters &parameters) override
Configure the processor using the given user specified parameters.
float ep_dot_
Dot product of the photon and electron momenta unit vectors at Ecal.
void produce(framework::Event &event) override
Process the event and put new data products into it.
float ep_sep_
Distance between the projected photon and electron trajectories at the ECal face.
void fillHitMap(const std::vector< ldmx::EcalHit > &ecal_rec_hits, std::map< ldmx::EcalID, float > &cell_map_)
Function to load up empty vector of hit maps.
void onNewRun(const ldmx::RunHeader &rh) override
onNewRun is the first function called for each processor after the conditions are fully configured an...
void buildBDTFeatureVector(const ldmx::EcalVetoResult &result)
int n_hits_in_photon_territory_
Number of hits outside of the electron roc in the Ecal or if the electron trajectory is missing,...
float ep_dot_at_target_
Dot product of the photon and electron momenta unit vectors at Target.
void onProcessEnd() override
Callback for the EventProcessor to take any necessary action when the processing of events finishes,...
const ldmx::EcalGeometry * geometry_
handle to current geometry (to share with member functions)
Implements an event buffer system for storing event data.
Definition Event.h:40
Class which represents the process under execution.
Definition Process.h:34
Base class for a module which produces a data product.
Producer(const std::string &name, Process &process)
Class constructor.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
Translation between real-space positions and cell IDs within the ECal.
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.
Definition EcalID.h:20
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:68