LDMX Software
EcalPnetVetoProcessor.h
Go to the documentation of this file.
1
8#ifndef EVENTPROC_ECALPNETVETOPROCESSOR_H_
9#define EVENTPROC_ECALPNETVETOPROCESSOR_H_
10
11// LDMX
13#include "Ecal/Event/EcalHit.h"
14#include "Framework/Configure/Parameters.h"
16#include "Tools/ONNXRuntime.h"
17
18namespace ecal {
19
26 public:
27 EcalPnetVetoProcessor(const std::string& name, framework::Process& process);
28 virtual ~EcalPnetVetoProcessor() = default;
29 void configure(framework::config::Parameters& parameters) override;
30 void produce(framework::Event& event) override;
31
32 private:
37 void makeInputs(const ldmx::EcalGeometry& geom,
38 const std::vector<ldmx::EcalHit>& ecalRecHits,
39 std::array<double, 3> etraj, std::array<double, 3> enorm);
40
46 std::vector<float> logSoftmax(const std::vector<float>& logits);
47
48 private:
51 constexpr static unsigned int MAX_NUM_HITS = 300;
52
53 constexpr static unsigned int N_COORDINATE_DIM = 3;
54 constexpr static unsigned int COORDINATE_X_OFFSET = 0;
55 constexpr static unsigned int COORDINATE_Y_OFFSET = MAX_NUM_HITS;
56 constexpr static unsigned int COORDINATE_Z_OFFSET = 2 * MAX_NUM_HITS;
57
58 constexpr static unsigned int N_FEATURE_DIM = 5;
59 constexpr static unsigned int FEATURE_X_OFFSET = 0;
60 constexpr static unsigned int FEATURE_Y_OFFSET = MAX_NUM_HITS;
61 constexpr static unsigned int FEATURE_Z_OFFSET = 2 * MAX_NUM_HITS;
62 constexpr static unsigned int FEATURE_ENERGY_OFFSET = 3 * MAX_NUM_HITS;
63 constexpr static unsigned int FEATURE_LAYER_ID_OFFSET = 4 * MAX_NUM_HITS;
64
65 const static std::vector<std::string> INPUT_NAMES;
66 const static std::vector<unsigned int> INPUT_SIZES;
67
69 double disc_cut_logit_{0};
70 std::vector<std::vector<float>> data_;
71 std::unique_ptr<ldmx::ort::ONNXRuntime> rt_;
72
74 std::string collection_name_{"EcalPnetVeto"};
75
76 std::string rec_coll_name_;
77 std::string ecal_rec_hits_passname_;
78 std::string ecal_sp_coll_name_;
79 std::string ecal_sp_hits_passname_;
80 std::string track_pass_name_;
81 std::string track_collection_;
82 bool recoil_from_tracking_;
83};
84
85} // namespace ecal
86
87#endif
Class that translates raw positions of ECal module hits into cells in a hexagonal readout.
Base classes for all user event processing components to extend.
Determines if event is vetoable using ECAL hit information w/ a deep neural network.
void produce(framework::Event &event) override
Process the event and put new data products into it.
std::string collection_name_
Name of the collection which will containt the results.
std::vector< float > logSoftmax(const std::vector< float > &logits)
Transform logits to a probability.
void configure(framework::config::Parameters &parameters) override
Callback for the EventProcessor to configure itself from the given set of parameters.
static constexpr unsigned int MAX_NUM_HITS
Maximum number of hits allowed in ECAL.
void makeInputs(const ldmx::EcalGeometry &geom, const std::vector< ldmx::EcalHit > &ecalRecHits, std::array< double, 3 > etraj, std::array< double, 3 > enorm)
Make inputs to the DNN from ECAL RecHits.
double disc_cut_logit_
disc_cut as a logit difference, the probability saturates in float
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.
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.