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) { return hwEnergy_ < sum.hwEnergy_; }
63
64 void Clear() {
65 energy_ = 0;
66 hwEnergy_ = 0;
67 layer_ = 0;
68 module_ = 0;
69 }
70
71 void setLayer(int layer) { layer_ = layer; }
72 int layer() const { return layer_; }
73
74 void setModule(int module) { module_ = module; }
75 int module() const { return module_; }
76
77 void setEnergy(float energy) { energy_ = energy; }
78 float energy() const { return energy_; }
79
80 void setHwEnergy(int hwEnergy) { hwEnergy_ = hwEnergy; }
81 int hwEnergy() const { return hwEnergy_; }
82 // inline float pe() const { return hwEnergy_*pe_per_adc_; }
83 // inline float hadEnergy() const { return
84 // hwEnergy_*pe_per_adc_*mev_per_pe_*had_sample_frac_; }
85
89 void Print() const;
90
102 friend std::ostream &operator<<(std::ostream &o, const TrigEnergySum &d);
103
114 friend std::ostream &operator<<(std::ostream &o,
115 const TrigEnergySumCollection &c);
116
117 private:
119 int layer_{0};
120 int module_{0};
121 int hwEnergy_{0};
122 float energy_{0};
123 /* const float pe_per_adc_{1.2/5}; // gain * pe/mV */
124 /* const float mev_per_pe_{4.66/68}; // MeV/PE (MIP) */
125 /* const float had_sample_frac_{0.109813*0.818731}; */
126 // const float had_samp_frac = (20/77.07)/(20/77.07 + 25/16.77); // 0.148266
127 // const float em_samp_frac = (20/41.31)/(20/41.31 + 25/1.757); // 0.032906
128 // const float samp_frac = (em_samp_frac + 2*had_samp_frac)/3; // 0.109813
129 // const float attn = exp(-1/5.); // 0.818731 5m attenuation length, 1m
130 // half-bar
131
134};
135} // namespace trigger
136
137#endif // TRIGGER_EVENT_CALOTRIGPRIM_H_
Contains the trigger output for generic calo objects.
void Print() const
Print a description of this object.
ClassDef(TrigEnergySum, 1)
ROOT Dictionary class definition macro.
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.
friend std::ostream & operator<<(std::ostream &o, const TrigEnergySum &d)
Stream the input digi.