LDMX Software
TrigEcalEnergySum.cxx
2
3#include "../../../Algo_HLS/Ecal/src/TotalEnergy.cpp"
4#include "../../../Algo_HLS/Ecal/src/data.h"
7#include "Recon/Event/HgcrocTrigDigi.h"
8
9namespace trigger {
10
12 hit_coll_name_ = ps.get<std::string>("hitCollName");
13 hit_coll_passname_ = ps.get<std::string>("hit_coll_passname");
14 hit_collname_events_passname_ =
15 ps.get<std::string>("hit_collname_events_passname");
16}
17
19 if (!event.exists(hit_coll_name_, hit_collname_events_passname_)) return;
20 auto ecal_trig_digis{event.getObject<ldmx::HgcrocTrigDigiCollection>(
21 hit_coll_name_, hit_coll_passname_)};
22
23 // floating point algorithm
24 // float total_e = 0;
25 // e_t total_e_trunc=0;
26
27 // run the firmware (hls) algorithm directly
28 EcalTP input_t_ps_hw[N_INPUT_TP];
29 e_t energy_hw;
30 int i_tp = 0;
31 EcalTpToE cvt;
32 for (const auto& trig_digi : ecal_trig_digis) {
33 // HgcrocTrigDigi
34
35 ldmx::EcalTriggerID tid(trig_digi.getId()); // raw value
36 float e = cvt.calc(trig_digi.linearPrimitive(), tid.layer());
37 // // compressed ECal digis are 8xADCs (HCal will be 4x)
38 // float sie = 8 * trigDigi.linearPrimitive() * gain *
39 // mVtoMeV; // in MeV, before layer corrections
40 // float e = (sie / mipSiEnergy * layerWeights.at(tid.layer()) + sie) *
41 // secondOrderEnergyCorrection;
42 // total_e += e;
43 // total_e_trunc = total_e_trunc + e_t(e);
44
45 if (i_tp < N_INPUT_TP) {
46 input_t_ps_hw[i_tp].tid_ = trig_digi.getId();
47 input_t_ps_hw[i_tp].tp_ = e_t(e);
48 }
49 i_tp++;
50 }
51
52 TotalEnergy_hw(input_t_ps_hw, energy_hw);
53
54 // std::cout << "Total ECal energy: " << total_e << " MeV (hw: " << energy_hw
55 // << " MeV)" << std::endl;
56}
57
58} // namespace trigger
59
Class that translates raw positions of ECal module hits into cells in a hexagonal readout.
#define DECLARE_PRODUCER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Class that represents a digitized hit in a calorimeter cell readout by an HGCROC.
EcalEnergySum algo.
Implements an event buffer system for storing event data.
Definition Event.h:42
bool exists(const std::string &name, const std::string &passName, bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.
Definition Event.cxx:92
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78
Extension of DetectorID providing access to ECal trigger cell information.
int layer() const
Get the value of the layer field from the ID.
virtual void configure(framework::config::Parameters &ps)
Callback for the EventProcessor to configure itself from the given set of parameters.
virtual void produce(framework::Event &event)
Process the event and put new data products into it.
Definition data.h:17