7#ifndef EVENTPROC_ECALVETOPROCESSOR_H_
8#define EVENTPROC_ECALVETOPROCESSOR_H_
13#include "Ecal/Event/EcalHit.h"
15#include "Framework/Configure/Parameters.h"
17#include "Tools/ONNXRuntime.h"
23#include "Tracking/Event/Track.h"
37 typedef std::pair<ldmx::EcalID, float> CellEnergyPair;
39 typedef std::pair<float, float> XYCoords;
76 void clearProcessor();
80 const std::vector<ldmx::EcalHit>& ecalRecHits,
float& showerRMS);
83 void fillHitMap(
const std::vector<ldmx::EcalHit>& ecalRecHits,
84 std::map<ldmx::EcalID, float>& cellMap_);
87 void fillIsolatedHitMap(
const std::vector<ldmx::EcalHit>& ecalRecHits,
89 std::map<ldmx::EcalID, float>& cellMap,
90 std::map<ldmx::EcalID, float>& cellMapIso,
91 bool doTight =
false);
93 std::vector<XYCoords> getTrajectory(std::array<float, 3> momentum,
94 std::array<float, 3> position);
109 float distTwoLines(TVector3 v1, TVector3 v2, TVector3 w1, TVector3 w2);
119 float distPtToLine(TVector3 h1, TVector3 p1, TVector3 p2);
128 std::vector<float>
trackProp(
const ldmx::Tracks& tracks,
129 ldmx::TrackStateType ts_type,
130 const std::string& ts_title);
134 float processing_time_{0.};
136 std::map<std::string, float> profiling_map_;
137 std::map<ldmx::EcalID, float> cellMap_;
138 std::map<ldmx::EcalID, float> cellMapTightIso_;
140 std::vector<float> ecalLayerEdepRaw_;
141 std::vector<float> ecalLayerEdepReadout_;
142 std::vector<float> ecalLayerTime_;
144 std::vector<std::vector<float>> roc_range_values_;
147 int nReadoutHits_{0};
148 int deepestLayerHit_{0};
151 float summedTightIso_{0};
152 float maxCellDep_{0};
156 float avgLayerHit_{0};
157 float stdLayerHit_{0};
158 float ecalBackEnergy_{0};
186 float beamEnergyMeV_{0};
187 bool run_lin_reg_{
true};
188 float linreg_radius_{0};
190 std::string bdtFileName_;
191 std::string rocFileName_;
192 std::vector<float> bdtFeatures_;
193 std::string featureListName_;
196 std::string sp_pass_name_;
197 std::string rec_pass_name_;
198 std::string rec_coll_name_;
199 bool recoil_from_tracking_;
200 std::string track_pass_name_;
201 std::string track_collection_;
202 bool inverse_skim_{
false};
207 std::unique_ptr<ldmx::Ort::ONNXRuntime> rt_;
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.
std::vector< float > trackProp(const ldmx::Tracks &tracks, ldmx::TrackStateType ts_type, const std::string &ts_title)
Return a vector of parameters for a propagated recoil track.
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 ¶meters) 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 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 photonTerritoryHits_
Number of hits in the photon territory.
float epDotAtTarget_
Dot product of the photon and electron momenta unit vectors at Target.
float epAng_
Angular separation between the projected photon and electron trajectories as projected at ECAL.
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 at Ecal.
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 onProcessEnd() override
Callback for the EventProcessor to take any necessary action when the processing of events finishes,...
void fillHitMap(const std::vector< ldmx::EcalHit > &ecalRecHits, std::map< ldmx::EcalID, float > &cellMap_)
Function to load up empty vector of hit maps.
float epAngAtTarget_
Angular separation between the projected photon and electron trajectories as at Target.
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.
Class which represents the process under execution.
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.
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.