LDMX Software
QIEStream.h
1#ifndef TRIGSCINT_EVENT_QIESTREAM_H
2#define TRIGSCINT_EVENT_QIESTREAM_H
3
4//---< ROOT >---//
5#include "TObject.h"
6#include "TrigScint/Event/TrigScintQIEDigis.h"
7
8template <uint32_t N>
9struct Mask {
10 static const uint32_t ONE{1};
11 static const uint32_t M = (ONE << N) - ONE;
12};
13template <uint8_t n>
14struct Mask8 {
15 static const uint8_t ONE{1};
16 static const uint8_t M = (ONE << n) - ONE;
17};
18
19namespace trigscint {
20
25class QIEStream {
26 public:
28 QIEStream() = default;
29
31 virtual ~QIEStream() = default;
32
36 friend std::ostream &operator<<(std::ostream &o, const QIEStream &d);
37
42 void clear(Option_t *option = "");
43
48 bool operator<(const QIEStream &rhs) const {
49 return this->chan_id_ < rhs.chan_id_;
50 }
51
55 int getChannelID() const { return chan_id_; }
56
60 uint8_t getElectronicsID() const { return electronics_id_; }
61
65 std::vector<int> getADC() const { return adcs_; }
66
70 std::vector<int> getTDC() const { return tdcs_; }
71
75 std::vector<int> getCID() const { return cids_; }
76
80 void setChannelID(const int chanid) { chan_id_ = chanid; }
81
85 void setElectronicsID(const int elecid) { electronics_id_ = elecid; }
86
91 void setADC(const std::vector<int> adc) { adcs_ = adc; }
92
97 void setTDC(const std::vector<int> tdc) { tdcs_ = tdc; }
98
103 void setCID(const std::vector<int> cid) { cids_ = cid; }
104
105 public:
106 // use these to define positions and sizes of error flags etc other header
107 // words relative to each other
108 // these simply state the order:
109 //{UTC time stamp, time stamp clock(), time since spill, triggerID, error,
110 // checksum == 0 (empty)}
111 const static int TIMESTAMP_POS{0};
112 const static int TIMESTAMP_LEN_BYTES{4};
113 const static int TIMESTAMPCLOCK_POS{TIMESTAMP_POS + TIMESTAMP_LEN_BYTES};
114 const static int TIMESTAMPCLOCK_LEN_BYTES{4};
115 const static int TIMESINCESPILL_POS{TIMESTAMPCLOCK_POS +
116 TIMESTAMPCLOCK_LEN_BYTES};
117 const static int TIMESINCESPILL_LEN_BYTES{4};
118 const static int TRIGID_POS{TIMESINCESPILL_POS + TIMESINCESPILL_LEN_BYTES};
119 const static int TRIGID_LEN_BYTES{3};
120 const static int ERROR_POS{TRIGID_POS + TRIGID_LEN_BYTES};
121 const static int ERROR_LEN_BYTES{1};
122 // and positions of error bits/flags in the errors word
123 const static int FLAG_SIZE_BITS{1};
124 const static int CRC0_ERR_POS{0};
125 const static int CRC1_ERR_POS{1};
126 const static int CID_UNSYNC_POS{2};
127 const static int CID_SKIP_POS{3};
128 const static int CHECKSUM_POS{CID_SKIP_POS + FLAG_SIZE_BITS};
129 //+ERROR_LEN_BYTES}; //included it in the error word
130 const static int CHECKSUM_SIZE_BITS{4};
131 //+ERROR_LEN_BYTES}; //included it in the error word
132 // the number of time samples making up a readout event
133 const static int NUM_SAMPLES{5};
134
135 private:
141 std::vector<int> adcs_;
143 std::vector<int> tdcs_;
145 std::vector<int> cids_;
146
147 ClassDef(QIEStream, 2);
148};
149} // namespace trigscint
150#endif
class for storing QIE output as a binary stream
Definition QIEStream.h:25
QIEStream()=default
Default constructor.
int electronics_id_
electronics ID
Definition QIEStream.h:139
void setADC(const std::vector< int > adc)
Store adcs of all time samples.
Definition QIEStream.h:91
std::vector< int > cids_
Capacitor IDs.
Definition QIEStream.h:145
std::vector< int > getTDC() const
Get TDCs of all time samples.
Definition QIEStream.h:70
std::vector< int > getCID() const
Get Cap IDs of all time samples.
Definition QIEStream.h:75
int getChannelID() const
Get channel ID.
Definition QIEStream.h:55
void clear(Option_t *option="")
A dummy function.
void setElectronicsID(const int elecid)
Store the electronics ID.
Definition QIEStream.h:85
bool operator<(const QIEStream &rhs) const
A dummy operator overloading.
Definition QIEStream.h:48
std::vector< int > getADC() const
Get ADCs of all time samples.
Definition QIEStream.h:65
std::vector< int > adcs_
Analog to Digital counts.
Definition QIEStream.h:141
void setCID(const std::vector< int > cid)
Store cids of all time samples.
Definition QIEStream.h:103
uint8_t getElectronicsID() const
Get electronics ID.
Definition QIEStream.h:60
void setChannelID(const int chanid)
Store the channel ID.
Definition QIEStream.h:80
virtual ~QIEStream()=default
Default destructor.
friend std::ostream & operator<<(std::ostream &o, const QIEStream &d)
Print ifo about the class.
std::vector< int > tdcs_
Time to Digital counts.
Definition QIEStream.h:143
int chan_id_
detector channel ID (bar nb)
Definition QIEStream.h:137
void setTDC(const std::vector< int > tdc)
Store tdcs of all time samples.
Definition QIEStream.h:97