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 hitCollName_ = ps.getParameter<std::string>("hitCollName");
13}
14
16 if (!event.exists(hitCollName_)) return;
17 auto ecalTrigDigis{
18 event.getObject<ldmx::HgcrocTrigDigiCollection>(hitCollName_)};
19
20 // floating point algorithm
21 // float total_e = 0;
22 // e_t total_e_trunc=0;
23
24 // run the firmware (hls) algorithm directly
25 EcalTP Input_TPs_hw[N_INPUT_TP];
26 e_t energy_hw;
27 int iTP = 0;
28 ecalTpToE cvt;
29 for (const auto& trigDigi : ecalTrigDigis) {
30 // HgcrocTrigDigi
31
32 ldmx::EcalTriggerID tid(trigDigi.getId()); // raw value
33 float e = cvt.calc(trigDigi.linearPrimitive(), tid.layer());
34 // // compressed ECal digis are 8xADCs (HCal will be 4x)
35 // float sie = 8 * trigDigi.linearPrimitive() * gain *
36 // mVtoMeV; // in MeV, before layer corrections
37 // float e = (sie / mipSiEnergy * layerWeights.at(tid.layer()) + sie) *
38 // secondOrderEnergyCorrection;
39 // total_e += e;
40 // total_e_trunc = total_e_trunc + e_t(e);
41
42 if (iTP < N_INPUT_TP) {
43 Input_TPs_hw[iTP].tid = trigDigi.getId();
44 Input_TPs_hw[iTP].tp = e_t(e);
45 }
46 iTP++;
47 }
48
49 TotalEnergy_hw(Input_TPs_hw, energy_hw);
50
51 // std::cout << "Total ECal energy: " << total_e << " MeV (hw: " << energy_hw
52 // << " MeV)" << std::endl;
53}
54
55} // namespace trigger
56
57DECLARE_PRODUCER_NS(trigger, TrigEcalEnergySum);
Class that translates raw positions of ECal module hits into cells in a hexagonal readout.
#define DECLARE_PRODUCER_NS(NS, 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:41
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:27
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
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