LDMX Software
EcalVetoProcessor.h
Go to the documentation of this file.
1
7#ifndef EVENTPROC_ECALVETOPROCESSOR_H_
8#define EVENTPROC_ECALVETOPROCESSOR_H_
9
10// LDMX
12#include "DetDescr/EcalID.h"
13#include "Ecal/Event/EcalHit.h"
15#include "Framework/Configure/Parameters.h"
17#include "Tools/ONNXRuntime.h"
18
19// ROOT (MIP tracking)
20#include "TVector3.h"
21
22// C++
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
48 void configure(framework::config::Parameters& parameters) override;
49
50 void produce(framework::Event& event) override;
51
52 // MIP tracking: Class for storing hit information for tracking in a
53 // convenient way
54 struct HitData {
55 int layer;
56 TVector3 pos;
57 };
58
59 private:
60 void clearProcessor();
61
62 /* Function to calculate the energy weighted shower centroid */
63 ldmx::EcalID GetShowerCentroidIDAndRMS(
64 const std::vector<ldmx::EcalHit>& ecalRecHits, double& showerRMS);
65
66 /* Function to load up empty vector of hit maps */
67 void fillHitMap(const std::vector<ldmx::EcalHit>& ecalRecHits,
68 std::map<ldmx::EcalID, float>& cellMap_);
69
70 /* Function to take loaded hit maps and find isolated hits in them */
71 void fillIsolatedHitMap(const std::vector<ldmx::EcalHit>& ecalRecHits,
72 ldmx::EcalID globalCentroid,
73 std::map<ldmx::EcalID, float>& cellMap,
74 std::map<ldmx::EcalID, float>& cellMapIso,
75 bool doTight = false);
76
77 std::vector<XYCoords> getTrajectory(std::vector<double> momentum,
78 std::vector<float> position);
79
81
82 // MIP tracking
93 float distTwoLines(TVector3 v1, TVector3 v2, TVector3 w1, TVector3 w2);
103 float distPtToLine(TVector3 h1, TVector3 p1, TVector3 p2);
104
105 private:
106 std::map<ldmx::EcalID, float> cellMap_;
107 std::map<ldmx::EcalID, float> cellMapTightIso_;
108
109 std::vector<float> ecalLayerEdepRaw_;
110 std::vector<float> ecalLayerEdepReadout_;
111 std::vector<float> ecalLayerTime_;
112
113 std::vector<std::vector<double>> roc_range_values_;
114
115 int nEcalLayers_{0};
116 int nReadoutHits_{0};
117 int deepestLayerHit_{0};
118
119 double summedDet_{0};
120 double summedTightIso_{0};
121 double maxCellDep_{0};
122 double showerRMS_{0};
123 double xStd_{0};
124 double yStd_{0};
125 double avgLayerHit_{0};
126 double stdLayerHit_{0};
127 double ecalBackEnergy_{0};
128 // MIP tracking
139 float epAng_{0};
142 float epSep_{0};
144 float epDot_{0};
147
148 double bdtCutVal_{0};
149
150 double beamEnergyMeV_{0};
151
152 bool verbose_{false};
153
154 std::string bdtFileName_;
155 std::string rocFileName_;
156 std::vector<float> bdtFeatures_;
157 std::string featureListName_;
158
159 std::string rec_pass_name_;
160 std::string rec_coll_name_;
161
163 std::string collectionName_{"EcalVeto"};
164
165 std::unique_ptr<ldmx::Ort::ONNXRuntime> rt_;
166
169};
170
171} // namespace ecal
172
173#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 epSep_
Distance between the projected photon and electron trajectories at the ECal face.
float distTwoLines(TVector3 v1, TVector3 v2, TVector3 w1, TVector3 w2)
Returns the distance between the lines v and w, with v defined to pass through the points (v1,...
void configure(framework::config::Parameters &parameters) override
Configure the processor using the given user specified parameters.
void produce(framework::Event &event) override
Process the event and put new data products into it.
void buildBDTFeatureVector(const ldmx::EcalVetoResult &result)
int photonTerritoryHits_
Number of hits in the photon territory.
float epAng_
Angular separation between the projected photon and electron trajectories (currently unused)
int nStraightTracks_
Number of "straight" tracks found in the event.
int nLinregTracks_
Number of "linreg" tracks found in the event.
int firstNearPhLayer_
First ECal layer in which a hit is found near the photon.
float epDot_
Dot product of the photon and electron momenta unit vectors.
float distPtToLine(TVector3 h1, TVector3 p1, TVector3 p2)
Return the minimum distance between the point h1 and the line passing through points p1 and p2.
std::string collectionName_
Name of the collection which will containt the results.
void fillHitMap(const std::vector< ldmx::EcalHit > &ecalRecHits, std::map< ldmx::EcalID, float > &cellMap_)
Function to load up empty vector of hit maps.
int nNearPhHits_
Number of hits near the photon trajectory.
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:41
Class which represents the process under execution.
Definition Process.h:36
Base class for a module which produces a data product.
Producer(const std::string &name, Process &process)
Class constructor.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
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