LDMX Software
TrigEnergySum.h
1#ifndef TRIGGER_EVENT_TRIGENERGYSUM_H_
2#define TRIGGER_EVENT_TRIGENERGYSUM_H_
3
4// ldmx-sw
5#include <stdint.h> //uint32_t
6
7// ROOT
8#include "TObject.h" //For ClassDef
9
10namespace trigger {
11
12// Forward declaration needed by typedef
13class TrigEnergySum;
14
18typedef std::vector<TrigEnergySum> TrigEnergySumCollection;
19
25 public:
32 TrigEnergySum() = default;
33
43 TrigEnergySum(int layer, int hwEnergy = 0);
44 TrigEnergySum(int layer, int module, float energy);
45
53 virtual ~TrigEnergySum() = default;
54
62 bool operator<(const TrigEnergySum &sum) {
63 return hw_energy_ < sum.hw_energy_;
64 }
65
66 void clear() {
67 energy_ = 0;
68 hw_energy_ = 0;
69 layer_ = 0;
70 module_ = 0;
71 }
72
73 void setLayer(int layer) { layer_ = layer; }
74 int layer() const { return layer_; }
75
76 void setModule(int module) { module_ = module; }
77 int module() const { return module_; }
78
79 void setEnergy(float energy) { energy_ = energy; }
80 float energy() const { return energy_; }
81
82 void setHwEnergy(int hwEnergy) { hw_energy_ = hwEnergy; }
83 int hwEnergy() const { return hw_energy_; }
84 // inline float pe() const { return hwEnergy_*pe_per_adc_; }
85 // inline float hadEnergy() const { return
86 // hwEnergy_*pe_per_adc_*mev_per_pe_*had_sample_frac_; }
87
99 friend std::ostream &operator<<(std::ostream &o, const TrigEnergySum &d);
100
111 friend std::ostream &operator<<(std::ostream &o,
112 const TrigEnergySumCollection &c);
113
114 private:
116 int layer_{0};
117 int module_{0};
118 int hw_energy_{0};
119 float energy_{0};
120 /* const float pe_per_adc_{1.2/5}; // gain * pe/mV */
121 /* const float mev_per_pe_{4.66/68}; // MeV/PE (MIP) */
122 /* const float had_sample_frac_{0.109813*0.818731}; */
123 // const float had_samp_frac = (20/77.07)/(20/77.07 + 25/16.77); // 0.148266
124 // const float em_samp_frac = (20/41.31)/(20/41.31 + 25/1.757); // 0.032906
125 // const float samp_frac = (em_samp_frac + 2*had_samp_frac)/3; // 0.109813
126 // const float attn = exp(-1/5.); // 0.818731 5m attenuation length, 1m
127 // half-bar
128
131};
132} // namespace trigger
133
134#endif // TRIGGER_EVENT_CALOTRIGPRIM_H_
Contains the trigger output for generic calo objects.
bool operator<(const TrigEnergySum &sum)
Sort the collection to trig digis by the raw ID.
TrigEnergySum()=default
Default Constructor.
int layer_
the raw ID for this trigger channel
virtual ~TrigEnergySum()=default
Destructor.
ClassDef(TrigEnergySum, 2)
ROOT Dictionary class definition macro.
friend std::ostream & operator<<(std::ostream &o, const TrigEnergySum &d)
Stream the input digi.