36 cscData.dmbHeader()->setdmbID(dmbId);
48 if ((code & 0x0000F000) > 0) {
49 if ((0x00008000 & code) > 0)
50 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Critical Error, ** needs reset **";
51 if ((0x00004000 & code) > 0)
52 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Single Error, bad event";
53 if ((0x00002000 & code) > 0)
54 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Single Warning";
55 if ((0x00001000 & code) > 0)
56 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Near Full Warning";
58 if ((code & 0x00000F00) > 0) {
59 if ((0x00000800 & code) > 0)
60 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU 64-bit Alignment Error";
61 if ((0x00000400 & code) > 0)
62 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Control DLL Error occured";
63 if ((0x00000200 & code) > 0)
64 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU DMB Error occurred";
65 if ((0x00000100 & code) > 0)
66 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Lost In Event Error";
68 if ((code & 0x000000F0) > 0) {
69 if ((0x00000080 & code) > 0)
70 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Lost In Data Error occurred";
71 if ((0x00000040 & code) > 0)
72 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Timeout Error";
73 if ((0x00000020 & code) > 0)
74 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" TMB or ALCT CRC Error";
75 if ((0x00000010 & code) > 0)
76 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Multiple Transmit Errors";
78 if ((code & 0x0000000F) > 0) {
79 if ((0x00000008 & code) > 0)
80 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Sync Lost or FIFO Full Error";
81 if ((0x00000004 & code) > 0)
82 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Fiber/FIFO Connection Error";
83 if ((0x00000002 & code) > 0)
84 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU L1A Match Error";
85 if ((0x00000001 & code) > 0)
86 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU DMB or CFEB CRC Error";
88 if ((code & 0xF0000000) > 0) {
90 if ((0x80000000 & code) > 0)
91 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU DMB LCT/DAV/Movlp Mismatch";
92 if ((0x40000000 & code) > 0)
93 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU-CFEB L1 Mismatch";
94 if ((0x20000000 & code) > 0)
95 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU saw no good DMB CRCs";
96 if ((0x10000000 & code) > 0)
97 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU CFEB Count Error";
99 if ((code & 0x0F000000) > 0) {
100 if ((0x08000000 & code) > 0)
101 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU FirstDat Error";
102 if ((0x04000000 & code) > 0)
103 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU L1A-FIFO Full Error";
104 if ((0x02000000 & code) > 0)
105 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Data Stuck in FIFO";
106 if ((0x01000000 & code) > 0)
107 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU NoLiveFibers Error";
109 if ((code & 0x00F00000) > 0) {
110 if ((0x00800000 & code) > 0)
111 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Spwd single-bit Warning";
112 if ((0x00400000 & code) > 0)
113 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Input FPGA Error";
114 if ((0x00200000 & code) > 0)
115 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU DAQ Stop bit set";
116 if ((0x00100000 & code) > 0)
117 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU DAQ says Not Ready";
118 if ((0x00300000 & code) == 0x00200000)
119 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU DAQ Applied Backpressure";
121 if ((code & 0x000F0000) > 0) {
122 if ((0x00080000 & code) > 0)
123 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU TMB Error";
124 if ((0x00040000 & code) > 0)
125 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU ALCT Error";
126 if ((0x00020000 & code) > 0)
127 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Trigger Readout Wordcount Error";
128 if ((0x00010000 & code) > 0)
129 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
" DDU Trigger L1A Match Error";
136 const uint16_t* inputBuf =
buf;
137 const uint16_t* inputBuf0 =
buf;
140 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
"CSCDDUEventData::unpack_data() is called";
142 for (
int i = 0;
i < 6; ++
i) {
143 LogTrace(
"CSCDDUEventData|CSCRawToDigi")
144 <<
i << std::hex <<
buf[4 *
i + 3] <<
buf[4 *
i + 2] <<
buf[4 *
i + 1] <<
buf[4 *
i];
145 std::cout <<
i <<
" " << std::hex <<
buf[4 *
i + 3] <<
" " <<
buf[4 *
i + 2] <<
" " <<
buf[4 *
i + 1] <<
" "
146 <<
buf[4 *
i] << std::endl;
173 if (examiner !=
nullptr) {
176 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
"selective unpacking starting";
181 std::map<DDUIdType, std::map<CSCIdType, const uint16_t*> > ddus = examiner->
DMB_block();
182 std::map<DDUIdType, std::map<CSCIdType, const uint16_t*> >::iterator ddu_itr = ddus.find(dduID);
183 const uint16_t* dduBlock = (
const uint16_t*)((examiner->
DDU_block())[dduID]);
184 uint32_t dduBufSize = (examiner->
DDU_size())[dduID];
186 if (ddu_itr != ddus.end() && dduBufSize != 0 && dduBlock == inputBuf) {
187 std::map<CSCIdType, const uint16_t*>& cscs = ddu_itr->second;
188 std::map<CSCIdType, const uint16_t*>::iterator csc_itr;
190 for (csc_itr = cscs.begin(); csc_itr != cscs.end(); ++csc_itr) {
191 short cscid = csc_itr->first;
194 const uint16_t*
pos = (
const uint16_t*)csc_itr->second;
199 LogTrace(
"CSCDDUEventData|CSCRawToDigi")
200 <<
"skip unpacking of CSC " << cscid <<
" due format errors: 0x" << std::hex <<
errors <<
std::dec;
209 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
"size of vector of cscData = " <<
theData.size();
220 LogTrace(
"CSCDDUEventData|CSCRawToDigi")
221 <<
"+++ CSCDDUEventData warning: DDU Trailer errors = " << std::hex <<
errorstat <<
" +++ ";
226 LogTrace(
"CSCDDUEventData|CSCRawToDigi")
227 <<
" Unpacking lost DDU trailer - check() failed and 8 8 ffff 8 was not found ";
242 while ((((
buf[0] & 0xf000) == 0x9000) || ((
buf[0] & 0xf000) == 0xa000)) && (
buf[3] != 0x8000)) {
245 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
"unpack csc data loop started";
249 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
"size of vector of cscData = " <<
theData.size();
254 LogTrace(
"CSCDDUEventData|CSCRawToDigi") <<
"unpacking ddu trailer ";
255 LogTrace(
"CSCDDUEventData|CSCRawToDigi") << std::hex <<
buf[3] <<
" " <<
buf[2] <<
" " <<
buf[1] <<
" " <<
buf[0];
266 LogTrace(
"CSCDDUEventData|CSCRawToDigi")
267 <<
"+++ CSCDDUEventData warning: DDU Trailer errors = " << std::hex <<
errorstat <<
" +++ ";
272 LogTrace(
"CSCDDUEventData|CSCRawToDigi")
273 <<
" Unpacking lost DDU trailer - check() failed and 8 8 ffff 8 was not found ";
300 boost::dynamic_bitset<>
result =
314 for (
unsigned int i = 0;
i <
theData.size(); ++
i) {
320 boost::dynamic_bitset<> dduTrailer =