1 #ifndef EUDAQ_INCLUDED_StandardEvent
2 #define EUDAQ_INCLUDED_StandardEvent
4 #include "eudaq/Event.hh"
17 FLAG_ACCUMULATE = 0x8,
19 FLAG_WITHPIVOT = 0x10000,
20 FLAG_WITHSUBMAT = 0x20000,
24 typedef double pixel_t;
25 typedef double coord_t;
27 const std::string &sensor =
"");
31 void SetSizeRaw(
unsigned w,
unsigned h,
unsigned frames = 1,
int flags = 0);
32 void SetSizeZS(
unsigned w,
unsigned h,
unsigned npix,
unsigned frames = 1,
36 void SetPixel(
unsigned index,
unsigned x,
unsigned y, T pix,
37 bool pivot =
false,
unsigned frame = 0) {
38 SetPixelHelper(index, x, y, (
double)pix, pivot, frame);
41 void SetPixel(
unsigned index,
unsigned x,
unsigned y, T pix,
43 SetPixelHelper(index, x, y, (
double)pix,
false, frame);
46 void PushPixel(
unsigned x,
unsigned y, T pix,
bool pivot =
false,
48 PushPixelHelper(x, y, (
double)pix, pivot, frame);
51 void PushPixel(
unsigned x,
unsigned y, T pix,
unsigned frame) {
52 PushPixelHelper(x, y, (
double)pix,
false, frame);
55 void SetPixelHelper(
unsigned index,
unsigned x,
unsigned y,
double pix,
56 bool pivot,
unsigned frame);
57 void PushPixelHelper(
unsigned x,
unsigned y,
double pix,
bool pivot,
59 double GetPixel(
unsigned index,
unsigned frame)
const;
60 double GetPixel(
unsigned index)
const;
61 double GetX(
unsigned index,
unsigned frame)
const;
62 double GetX(
unsigned index)
const;
63 double GetY(
unsigned index,
unsigned frame)
const;
64 double GetY(
unsigned index)
const;
65 bool GetPivot(
unsigned index,
unsigned frame = 0)
const;
66 void SetPivot(
unsigned index,
unsigned frame,
bool PivotFlag);
68 template <
typename T> std::vector<T> GetPixels()
const {
70 std::vector<T> result(m_result_pix->size());
71 for (
size_t i = 0; i < result.size(); ++i) {
72 result[i] =
static_cast<T
>((*m_result_pix)[i] * Polarity());
76 const std::vector<coord_t> &XVector(
unsigned frame)
const;
77 const std::vector<coord_t> &XVector()
const;
78 const std::vector<coord_t> &YVector(
unsigned frame)
const;
79 const std::vector<coord_t> &YVector()
const;
80 const std::vector<pixel_t> &PixVector(
unsigned frame)
const;
81 const std::vector<pixel_t> &PixVector()
const;
83 void SetXSize(
unsigned x);
84 void SetYSize(
unsigned y);
85 void SetTLUEvent(
unsigned ev);
86 void SetPivotPixel(
unsigned p);
87 void SetFlags(FLAGS flags);
90 const std::string &Type()
const;
91 const std::string &Sensor()
const;
92 unsigned XSize()
const;
93 unsigned YSize()
const;
94 unsigned NumFrames()
const;
95 unsigned TotalPixels()
const;
96 unsigned HitPixels(
unsigned frame)
const;
97 unsigned HitPixels()
const;
99 unsigned PivotPixel()
const;
101 int GetFlags(
int f)
const;
102 bool NeedsCDS()
const;
103 int Polarity()
const;
105 void Print(std::ostream &)
const;
108 const std::vector<pixel_t> &
109 GetFrame(
const std::vector<std::vector<pixel_t>> &v,
unsigned f)
const;
110 void SetupResult()
const;
112 std::string m_type, m_sensor;
113 unsigned m_id, m_tluevent;
114 unsigned m_xsize, m_ysize;
115 unsigned m_flags, m_pivotpixel;
116 std::vector<std::vector<pixel_t>> m_pix;
117 std::vector<std::vector<coord_t>> m_x, m_y;
118 std::vector<std::vector<bool>> m_pivot;
119 std::vector<unsigned> m_mat;
121 mutable const std::vector<pixel_t> *m_result_pix;
122 mutable const std::vector<coord_t> *m_result_x, *m_result_y;
124 mutable std::vector<pixel_t> m_temp_pix;
125 mutable std::vector<coord_t> m_temp_x, m_temp_y;
133 uint64_t timestamp = NOTIMESTAMP);
136 void SetTimestamp(uint64_t);
139 size_t NumPlanes()
const;
143 virtual void Print(std::ostream &)
const;
148 std::vector<StandardPlane> m_planes;
152 inline std::ostream &operator<<(std::ostream &os,
const StandardPlane &pl) {
156 inline std::ostream &operator<<(std::ostream &os,
const StandardEvent &ev) {
163 #endif // EUDAQ_INCLUDED_StandardEvent
Definition: TLUEvent.hh:10
Definition: Serializer.hh:156
Definition: Serializable.hh:13
Definition: StandardEvent.hh:10
Definition: StandardEvent.hh:128
Definition: Serializer.hh:19