LDMX Software
ZCCMOutput.h
1#ifndef TRIGSCINT_EVENT_ZCCMOUTPUT_H
2#define TRIGSCINT_EVENT_ZCCMOUTPUT_H
3
4//---< ROOT >---//
5#include "QIEStream.h" // for definitions of Mask
6#include "TObject.h"
7#include "TrigScint/Event/TrigScintQIEDigis.h"
8
9namespace trigscint {
10
16 public:
18 ZCCMOutput() = default;
19
21 virtual ~ZCCMOutput() = default;
22
26 friend std::ostream &operator<<(std::ostream &o, const ZCCMOutput &d);
27
32 void clear(Option_t *option = "");
33
38 bool operator<(const ZCCMOutput &rhs) const {
39 return this->chan_id_ < rhs.chan_id_;
40 }
41
45 int getChannelID() const { return chan_id_; }
46
50 uint8_t getElectronicsID() const { return electronics_id_; }
51
55 std::vector<int> getADC() const { return adcs_; }
56
60 std::vector<int> getTDC() const { return tdcs_; }
61
65 std::vector<int> getCID() const { return cids_; }
66
70 void setChannelID(const int chanid) { chan_id_ = chanid; }
71
75 void setElectronicsID(const int elecid) { electronics_id_ = elecid; }
76
81 void setADC(const std::vector<int> adc) { adcs_ = adc; }
82
87 void setTDC(const std::vector<int> tdc) { tdcs_ = tdc; }
88
93 void setCID(const std::vector<int> cid) { cids_ = cid; }
94
95 public:
102 const static int TIMESTAMP_POS{0};
103 const static int TIMESTAMP_LEN_BYTES{8};
104 const static int EMPTY_HEADER_WORD_POS{TIMESTAMP_POS + TIMESTAMP_LEN_BYTES};
105 const static int EMPTY_HEADER_WORD_LEN_BYTES{8};
106 // this marks the start of event data (i.e. after end of event header)
107 const static int EVENTDATA_POS{EMPTY_HEADER_WORD_POS +
108 EMPTY_HEADER_WORD_LEN_BYTES};
109 /*
110 the time sample word has ADC, TDC, flags and lane:
111 one for each lane, in every time sample
112 the following positions are within this time sample word, for one lane
113 */
114 // the number of channels sets the length of the ADC and TDC streams
115 const static int NUM_CHAN_PER_LANE{6};
116 const static int ADC_SAMPLE_WORD_POS{0};
117 const static int ADC_LEN_BYTES{1 * NUM_CHAN_PER_LANE};
118 const static int EMPTY_WORD_SAMPLE_WORD_POS{ADC_SAMPLE_WORD_POS +
119 ADC_LEN_BYTES};
120 const static int EMPTY_WORD_LEN_BYTES{2};
121 const static int TDC_SAMPLE_WORD_POS{EMPTY_WORD_SAMPLE_WORD_POS +
122 EMPTY_WORD_LEN_BYTES};
123 const static int TDC_LEN_BYTES{1 * NUM_CHAN_PER_LANE};
124 const static int FLAGS_SAMPLE_WORD_POS{TDC_SAMPLE_WORD_POS + TDC_LEN_BYTES};
125 const static int FLAGS_LEN_BYTES{1};
126 const static int LANE_SAMPLE_WORD_POS{FLAGS_SAMPLE_WORD_POS +
127 FLAGS_LEN_BYTES};
128 const static int LANE_LEN_BYTES{1};
129 // and positions of error bits/flags inside the flags word
130 const static int CAPID_POS_IN_FLAG{0};
131 const static int CAPID_LEN_BITS{2};
132 const static int CE_POS_IN_FLAG{CAPID_POS_IN_FLAG + CAPID_LEN_BITS};
133 const static int CE_LEN_BITS{1};
134 const static int BC0_POS_IN_FLAG{CE_POS_IN_FLAG + CE_LEN_BITS};
135 const static int BC0_LEN_BITS{1};
136 const static int EMPTY_FLAG_WORD_POS_IN_FLAG{BC0_POS_IN_FLAG + BC0_LEN_BITS};
137 const static int EMPTY_FLAG_WORD_LEN_BITS{4};
138
139 // event data concludes the readout.
140
141 // for convenience, define the length of a message (time sample for one lane)
142 const static int SAMPLE_WORD_LEN_BYTES = ADC_LEN_BYTES + TDC_LEN_BYTES +
143 EMPTY_WORD_LEN_BYTES +
144 FLAGS_LEN_BYTES + LANE_LEN_BYTES;
145
146 private:
148 int lane_;
156 std::vector<int> adcs_;
158 std::vector<int> tdcs_;
160 std::vector<int> cids_;
161
162 ClassDef(ZCCMOutput, 1);
163};
164} // namespace trigscint
165#endif
class for storing ZCCM output as a binary output
Definition ZCCMOutput.h:15
virtual ~ZCCMOutput()=default
Default destructor.
int getChannelID() const
Get channel ID.
Definition ZCCMOutput.h:45
void setElectronicsID(const int elecid)
Store the electronics ID.
Definition ZCCMOutput.h:75
friend std::ostream & operator<<(std::ostream &o, const ZCCMOutput &d)
Print ifo about the class.
std::vector< int > getTDC() const
Get TDCs of all time samples.
Definition ZCCMOutput.h:60
void clear(Option_t *option="")
A dummy function.
void setTDC(const std::vector< int > tdc)
Store tdcs of all time samples.
Definition ZCCMOutput.h:87
ZCCMOutput()=default
Default constructor.
uint8_t getElectronicsID() const
Get electronics ID.
Definition ZCCMOutput.h:50
int lane_
detector lane ID (aka fiber)
Definition ZCCMOutput.h:148
int chan_id_
detector channel ID (bar nb)
Definition ZCCMOutput.h:152
void setChannelID(const int chanid)
Store the channel ID.
Definition ZCCMOutput.h:70
std::vector< int > cids_
Capacitor IDs.
Definition ZCCMOutput.h:160
std::vector< int > tdcs_
Time to Digital counts.
Definition ZCCMOutput.h:158
std::vector< int > getCID() const
Get Cap IDs of all time samples.
Definition ZCCMOutput.h:65
void setCID(const std::vector< int > cid)
Store cids of all time samples.
Definition ZCCMOutput.h:93
int electronics_id_
electronics ID
Definition ZCCMOutput.h:154
void setADC(const std::vector< int > adc)
Store adcs of all time samples.
Definition ZCCMOutput.h:81
int module_
detector module ID (aka pad)
Definition ZCCMOutput.h:150
std::vector< int > adcs_
Analog to Digital counts.
Definition ZCCMOutput.h:156
bool operator<(const ZCCMOutput &rhs) const
A dummy operator overloading.
Definition ZCCMOutput.h:38
std::vector< int > getADC() const
Get ADCs of all time samples.
Definition ZCCMOutput.h:55
static const int TIMESTAMP_POS
for each time sample, every lane each sends a message: [ 1B ADC for 6 channels, 2B empty,...
Definition ZCCMOutput.h:102