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
37 void Print(Option_t *option = "") const;
38
43 void Clear(Option_t *option = "");
44
49 bool operator<(const QIEStream &rhs) const {
50 return this->chanID_ < rhs.chanID_;
51 }
52
56 int getChannelID() const { return chanID_; }
57
61 uint8_t getElectronicsID() const { return electronicsID_; }
62
66 std::vector<int> getADC() const { return adcs_; }
67
71 std::vector<int> getTDC() const { return tdcs_; }
72
76 std::vector<int> getCID() const { return cids_; }
77
81 void setChannelID(const int chanid) { chanID_ = chanid; }
82
86 void setElectronicsID(const int elecid) { electronicsID_ = elecid; }
87
92 void setADC(const std::vector<int> adc) { adcs_ = adc; }
93
98 void setTDC(const std::vector<int> tdc) { tdcs_ = tdc; }
99
104 void setCID(const std::vector<int> cid) { cids_ = cid; }
105
106 public:
107 // use these to define positions and sizes of error flags etc other header
108 // words relative to each other
109 // these simply state the order:
110 //{UTC time stamp, time stamp clock(), time since spill, triggerID, error,
111 // checksum == 0 (empty)}
112 const static int TIMESTAMP_POS{0};
113 const static int TIMESTAMP_LEN_BYTES{4};
114 const static int TIMESTAMPCLOCK_POS{TIMESTAMP_POS + TIMESTAMP_LEN_BYTES};
115 const static int TIMESTAMPCLOCK_LEN_BYTES{4};
116 const static int TIMESINCESPILL_POS{TIMESTAMPCLOCK_POS +
117 TIMESTAMPCLOCK_LEN_BYTES};
118 const static int TIMESINCESPILL_LEN_BYTES{4};
119 const static int TRIGID_POS{TIMESINCESPILL_POS + TIMESINCESPILL_LEN_BYTES};
120 const static int TRIGID_LEN_BYTES{3};
121 const static int ERROR_POS{TRIGID_POS + TRIGID_LEN_BYTES};
122 const static int ERROR_LEN_BYTES{1};
123 // and positions of error bits/flags in the errors word
124 const static int FLAG_SIZE_BITS{1};
125 const static int CRC0_ERR_POS{0};
126 const static int CRC1_ERR_POS{1};
127 const static int CID_UNSYNC_POS{2};
128 const static int CID_SKIP_POS{3};
129 const static int CHECKSUM_POS{
130 CID_SKIP_POS +
131 FLAG_SIZE_BITS}; //+ERROR_LEN_BYTES}; //included it in the error word
132 const static int CHECKSUM_SIZE_BITS{
133 4}; //+ERROR_LEN_BYTES}; //included it in the error word
134 // the number of time samples making up a readout event
135 const static int NUM_SAMPLES{5};
136
137 private:
143 std::vector<int> adcs_;
145 std::vector<int> tdcs_;
147 std::vector<int> cids_;
148
149 ClassDef(QIEStream, 1);
150};
151} // namespace trigscint
152#endif
class for storing QIE output as a binary stream
Definition QIEStream.h:25
QIEStream()=default
Default constructor.
void setADC(const std::vector< int > adc)
Store adcs of all time samples.
Definition QIEStream.h:92
void Clear(Option_t *option="")
A dummy function.
std::vector< int > cids_
Capacitor IDs.
Definition QIEStream.h:147
std::vector< int > getTDC() const
Get TDCs of all time samples.
Definition QIEStream.h:71
int electronicsID_
electronics ID
Definition QIEStream.h:141
std::vector< int > getCID() const
Get Cap IDs of all time samples.
Definition QIEStream.h:76
int getChannelID() const
Get channel ID.
Definition QIEStream.h:56
void setElectronicsID(const int elecid)
Store the electronics ID.
Definition QIEStream.h:86
bool operator<(const QIEStream &rhs) const
A dummy operator overloading.
Definition QIEStream.h:49
std::vector< int > getADC() const
Get ADCs of all time samples.
Definition QIEStream.h:66
std::vector< int > adcs_
Analog to Digital counts.
Definition QIEStream.h:143
void setCID(const std::vector< int > cid)
Store cids of all time samples.
Definition QIEStream.h:104
uint8_t getElectronicsID() const
Get electronics ID.
Definition QIEStream.h:61
void setChannelID(const int chanid)
Store the channel ID.
Definition QIEStream.h:81
virtual ~QIEStream()=default
Default destructor.
std::vector< int > tdcs_
Time to Digital counts.
Definition QIEStream.h:145
int chanID_
detector channel ID (bar nb)
Definition QIEStream.h:139
void setTDC(const std::vector< int > tdc)
Store tdcs of all time samples.
Definition QIEStream.h:98
void Print(Option_t *option="") const
Print ifo about the class.