CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes
CSCDDUEventData Class Reference

#include <CSCDDUEventData.h>

Public Member Functions

void add (CSCEventData &, int dmbId, int dduInput, unsigned int format_version=2005)
 for making events. Sets the bxnum and lvl1num inside the chamber event More...
 
bool check () const
 
const std::vector< CSCEventData > & cscData () const
 accessor to data More...
 
 CSCDDUEventData (const CSCDDUHeader &)
 
 CSCDDUEventData (unsigned short *buf, CSCDCCExaminer *examiner=NULL)
 
CSCDCCHeader dccHeader () const
 
CSCDCCTrailer dccTrailer () const
 
void decodeStatus (int status) const
 
void decodeStatus () const
 
CSCDDUHeader header () const
 
boost::dynamic_bitset pack ()
 Alex check this 16 or 64. More...
 
int size () const
 
int sizeInWords () const
 
CSCDDUTrailer trailer () const
 
uint16_t trailer0 () const
 
 ~CSCDDUEventData ()
 

Static Public Member Functions

static void setDebug (bool value)
 
static void setErrorMask (unsigned int value)
 

Public Attributes

long unsigned int errorstat
 trailer info More...
 

Static Public Attributes

static std::atomic< bool > debug {false}
 
static std::atomic< unsigned int > errMask {0xFFFFFFFF}
 

Protected Member Functions

void unpack_data (unsigned short *buf, CSCDCCExaminer *examiner=NULL)
 a good test routine would be to unpack data, then pack it again. More...
 

Protected Attributes

std::vector< CSCEventDatatheData
 
CSCDCCHeader theDCCHeader
 
CSCDCCTrailer theDCCTrailer
 
CSCDDUHeader theDDUHeader
 
CSCDDUTrailer theDDUTrailer
 
uint16_t theDDUTrailer0
 
uint16_t theFormatVersion
 
int theSizeInWords
 

Detailed Description

Author
Rick Wilkinson
A. Tumanov

Definition at line 19 of file CSCDDUEventData.h.

Constructor & Destructor Documentation

CSCDDUEventData::CSCDDUEventData ( const CSCDDUHeader header)
explicit

Definition at line 26 of file CSCDDUEventData.cc.

References header(), and theDDUHeader.

27 {
29 }
CSCDDUHeader header() const
CSCDDUHeader theDDUHeader
CSCDDUEventData::CSCDDUEventData ( unsigned short *  buf,
CSCDCCExaminer examiner = NULL 
)
explicit
CSCDDUEventData::~CSCDDUEventData ( )

Definition at line 37 of file CSCDDUEventData.cc.

38 {
39 }

Member Function Documentation

void CSCDDUEventData::add ( CSCEventData ,
int  dmbId,
int  dduInput,
unsigned int  format_version = 2005 
)

for making events. Sets the bxnum and lvl1num inside the chamber event

Definition at line 42 of file CSCDDUEventData.cc.

References CSCDDUHeader::bxnum(), CSCEventData::dmbHeader(), CSCDDUHeader::lvl1num(), CSCDDUHeader::setDMBDAV(), CSCDMBHeader::setdmbID(), CSCEventData::setEventInformation(), theData, and theDDUHeader.

Referenced by counter.Counter::register().

43 {
44  theDDUHeader.setDMBDAV(dduInput);
45  //@@ Tim: The following sets the word which is supposed to be CSCs in error, with bit 15 set for DMB Full
46  //@@ so I think sim should not set it at all
47  //@@ theDDUTrailer.setDMBDAV(dmbId);
48  theDDUHeader.setDMBDAV(dduInput);
49  cscData.dmbHeader()->setdmbID(dmbId);
50  cscData.setEventInformation(theDDUHeader.bxnum(), theDDUHeader.lvl1num());
51  theData.push_back(cscData);
52 }
void setDMBDAV(int dduInput)
Definition: CSCDDUHeader.cc:35
CSCDDUHeader theDDUHeader
int lvl1num() const
Definition: CSCDDUHeader.h:25
int bxnum() const
Definition: CSCDDUHeader.h:24
const std::vector< CSCEventData > & cscData() const
accessor to data
std::vector< CSCEventData > theData
bool CSCDDUEventData::check ( ) const

Definition at line 335 of file CSCDDUEventData.cc.

References CSCDDUTrailer::check(), CSCDDUHeader::check(), debug, LogTrace, sizeInWords(), theDDUHeader, theDDUTrailer, and CSCDDUTrailer::wordcount().

Referenced by CSCDCCEventData::unpack_data().

336 {
337  // the trailer counts in 64-bit words
338  if (debug)
339  {
340  LogTrace ("CSCDDUEventData|CSCRawToDigi") << sizeInWords();
341  LogTrace ("CSCDDUEventData|CSCRawToDigi") << "wordcount = " << theDDUTrailer.wordcount()*4;
342  }
343 
344  return theDDUHeader.check() && theDDUTrailer.check();
345 }
bool check() const
Definition: CSCDDUHeader.cc:54
CSCDDUHeader theDDUHeader
bool check() const
Definition: CSCDDUTrailer.h:30
#define LogTrace(id)
unsigned wordcount() const
Definition: CSCDDUTrailer.h:42
CSCDDUTrailer theDDUTrailer
static std::atomic< bool > debug
int sizeInWords() const
const std::vector<CSCEventData>& CSCDDUEventData::cscData ( ) const
inline

accessor to data

Definition at line 34 of file CSCDDUEventData.h.

References theData.

Referenced by CSCDDUDataItr::CSCDDUDataItr(), CSCDDUDataItr::operator*(), and cscdqm::EventProcessor::processDDU().

34 {return theData;}
std::vector< CSCEventData > theData
CSCDCCHeader CSCDDUEventData::dccHeader ( ) const
inline

Definition at line 40 of file CSCDDUEventData.h.

References theDCCHeader.

40 {return theDCCHeader;}
CSCDCCHeader theDCCHeader
CSCDCCTrailer CSCDDUEventData::dccTrailer ( ) const
inline

Definition at line 41 of file CSCDDUEventData.h.

References theDCCTrailer.

41 {return theDCCTrailer;}
CSCDCCTrailer theDCCTrailer
void CSCDDUEventData::decodeStatus ( int  status) const

prints out the error associated with this status from the header or trailer

this is a mask for printing out errors

Definition at line 59 of file CSCDDUEventData.cc.

References errMask, and LogTrace.

60 {
61  // JRG is Jason Gilmore
62  // JRG, low-order 16-bit status (most serious errors):
63  if((code&errMask)>0)
64  {
65  // JRG, low-order 16-bit status (most serious errors):
66  if((code&0x0000F000)>0)
67  {
68  if((0x00008000&code)>0)
69  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Critical Error, ** needs reset **";
70  if((0x00004000&code)>0)
71  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Single Error, bad event";
72  if((0x00002000&code)>0)
73  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Single Warning";
74  if((0x00001000&code)>0)
75  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Near Full Warning";
76  }
77  if((code&0x00000F00)>0)
78  {
79  if((0x00000800&code)>0)
80  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU 64-bit Alignment Error";
81  if((0x00000400&code)>0)
82  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Control DLL Error occured";
83  if((0x00000200&code)>0)
84  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU DMB Error occurred";
85  if((0x00000100&code)>0)
86  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Lost In Event Error";
87  }
88  if((code&0x000000F0)>0)
89  {
90  if((0x00000080&code)>0)
91  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Lost In Data Error occurred";
92  if((0x00000040&code)>0)
93  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Timeout Error";
94  if((0x00000020&code)>0)
95  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " TMB or ALCT CRC Error";
96  if((0x00000010&code)>0)
97  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Multiple Transmit Errors";
98  }
99  if((code&0x0000000F)>0)
100  {
101  if((0x00000008&code)>0)
102  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Sync Lost or FIFO Full Error";
103  if((0x00000004&code)>0)
104  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Fiber/FIFO Connection Error";
105  if((0x00000002&code)>0)
106  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU L1A Match Error";
107  if((0x00000001&code)>0)
108  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU DMB or CFEB CRC Error";
109  }
110  if((code&0xF0000000)>0)
111  {
112  // JRG, high-order 16-bit status (not-so-serious errors):
113  if((0x80000000&code)>0)
114  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU DMB LCT/DAV/Movlp Mismatch";
115  if((0x40000000&code)>0)
116  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU-CFEB L1 Mismatch";
117  if((0x20000000&code)>0)
118  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU saw no good DMB CRCs";
119  if((0x10000000&code)>0)
120  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU CFEB Count Error";
121  }
122  if((code&0x0F000000)>0)
123  {
124  if((0x08000000&code)>0)
125  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU FirstDat Error";
126  if((0x04000000&code)>0)
127  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU L1A-FIFO Full Error";
128  if((0x02000000&code)>0)
129  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Data Stuck in FIFO";
130  if((0x01000000&code)>0)
131  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU NoLiveFibers Error";
132  }
133  if((code&0x00F00000)>0)
134  {
135  if((0x00800000&code)>0)
136  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Spwd single-bit Warning";
137  if((0x00400000&code)>0)
138  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Input FPGA Error";
139  if((0x00200000&code)>0)
140  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU DAQ Stop bit set";
141  if((0x00100000&code)>0)
142  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU DAQ says Not Ready";
143  if((0x00300000&code)==0x00200000)
144  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU DAQ Applied Backpressure";
145  }
146  if((code&0x000F0000)>0)
147  {
148  if((0x00080000&code)>0)
149  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU TMB Error";
150  if((0x00040000&code)>0)
151  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU ALCT Error";
152  if((0x00020000&code)>0)
153  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Trigger Readout Wordcount Error";
154  if((0x00010000&code)>0)
155  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " DDU Trigger L1A Match Error";
156  }
157  }
158 }
#define LogTrace(id)
static std::atomic< unsigned int > errMask
void CSCDDUEventData::decodeStatus ( ) const

Definition at line 54 of file CSCDDUEventData.cc.

References CSCDDUTrailer::errorstat(), and theDDUTrailer.

Referenced by unpack_data().

55 {
57 }
unsigned errorstat() const
Definition: CSCDDUTrailer.h:41
void decodeStatus() const
CSCDDUTrailer theDDUTrailer
CSCDDUHeader CSCDDUEventData::header ( ) const
inline

Definition at line 36 of file CSCDDUEventData.h.

References theDDUHeader.

Referenced by CSCDDUEventData(), and cscdqm::EventProcessor::processDDU().

36 {return theDDUHeader;}
CSCDDUHeader theDDUHeader
boost::dynamic_bitset CSCDDUEventData::pack ( )

Alex check this 16 or 64.

returns packed event data

Definition at line 347 of file CSCDDUEventData.cc.

References bitset_utilities::append(), CSCDDUTrailer::data(), CSCDDUHeader::data(), i, mps_fire::result, CSCDDUTrailer::setWordCount(), CSCDDUTrailer::sizeInWords(), CSCDDUHeader::sizeInWords(), theData, theDDUHeader, theDDUTrailer, theSizeInWords, and bitset_utilities::ushortToBitset().

Referenced by pyrootRender.interactiveRender::draw().

348 {
349  boost::dynamic_bitset<> result = bitset_utilities::ushortToBitset( theDDUHeader.sizeInWords()*16,
350  theDDUHeader.data());
351  //std::cout <<"SANDRIK inside DDUEvdata check = ";
352  //theDDUHeader.check();
353  //std::cout <<std::endl;
354  //std::cout <<"printing out ddu header words"<<std::endl;
355  //for (unsigned int i=0;i<theDDUHeader.sizeInWords();i++) {
356  // unsigned short * buf = theDDUHeader.data();
357  // printf("%04x %04x %04x %04x\n",buf[i+3],buf[i+2],buf[i+1],buf[i]);
358  // i+=3;
359  //}
360  //std::cout <<"printing out ddu header words via bitset"<<std::endl;
361  //bitset_utilities::printWords(result);
362 
363  for(unsigned int i = 0; i < theData.size(); ++i)
364  {
365  result = bitset_utilities::append(result,theData[i].pack());
366  }
367  theSizeInWords = result.size()/16 + theDDUTrailer.sizeInWords();
368  // 64-bit word count
370  boost::dynamic_bitset<> dduTrailer = bitset_utilities::ushortToBitset ( theDDUTrailer.sizeInWords()*16,
371  theDDUTrailer.data());
372  result = bitset_utilities::append(result,dduTrailer);
373 
374  return result;
375 }
int i
Definition: DBlmapReader.cc:9
static unsigned sizeInWords()
Definition: CSCDDUTrailer.h:28
CSCDDUHeader theDDUHeader
void setWordCount(unsigned wordcount)
Definition: CSCDDUTrailer.h:43
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
tuple result
Definition: mps_fire.py:95
unsigned short * data()
Definition: CSCDDUTrailer.h:37
static unsigned sizeInWords()
Definition: CSCDDUHeader.h:32
std::vector< CSCEventData > theData
boost::dynamic_bitset ushortToBitset(const unsigned int numberOfBits, unsigned short *buf)
this method takes numberOfBits bits from unsigned short * array and returns them in the bitset obj...
CSCDDUTrailer theDDUTrailer
unsigned short * data()
Definition: CSCDDUHeader.h:45
boost::dynamic_bitset pack()
Alex check this 16 or 64.
static void CSCDDUEventData::setDebug ( bool  value)
inlinestatic

Definition at line 30 of file CSCDDUEventData.h.

References debug, and relativeConstraints::value.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

30 {debug = value;}
static std::atomic< bool > debug
static void CSCDDUEventData::setErrorMask ( unsigned int  value)
inlinestatic

Definition at line 31 of file CSCDDUEventData.h.

References errMask, and relativeConstraints::value.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

31 {errMask = value;}
static std::atomic< unsigned int > errMask
int CSCDDUEventData::size ( void  ) const
inline

Definition at line 57 of file CSCDDUEventData.h.

References theSizeInWords.

Referenced by unpack_data().

57 {return theSizeInWords*16;}
int CSCDDUEventData::sizeInWords ( ) const
inline

Definition at line 56 of file CSCDDUEventData.h.

References theSizeInWords.

Referenced by check(), cscdqm::EventProcessor::processDDU(), and CSCDCCEventData::unpack_data().

56 {return theSizeInWords;}
CSCDDUTrailer CSCDDUEventData::trailer ( ) const
inline

Definition at line 37 of file CSCDDUEventData.h.

References theDDUTrailer.

Referenced by cscdqm::EventProcessor::processDDU().

37 {return theDDUTrailer;}
CSCDDUTrailer theDDUTrailer
uint16_t CSCDDUEventData::trailer0 ( ) const
inline

Definition at line 38 of file CSCDDUEventData.h.

References theDDUTrailer0.

38 {return theDDUTrailer0;}
uint16_t theDDUTrailer0
void CSCDDUEventData::unpack_data ( unsigned short *  buf,
CSCDCCExaminer examiner = NULL 
)
protected

a good test routine would be to unpack data, then pack it again.

To pack trailer 0

New Data Format 2013

Older Data format before 2013

Pack Trailer 0 (to access TTS)

Definition at line 160 of file CSCDDUEventData.cc.

References CSCDDUTrailer::check(), gather_cfg::cout, CSCDCCExaminer::DDU_block(), CSCDCCExaminer::DDU_size(), debug, TauDecayModes::dec, decodeStatus(), CSCDCCExaminer::DMB_block(), errMask, benchmark_cfg::errors, CSCDCCExaminer::errorsForChamber(), CSCDDUTrailer::errorstat(), errorstat, CSCDDUHeader::format_version(), CSCDCCExaminer::getMask(), i, LogTrace, CSCDDUHeader::ncsc(), NULL, size(), CSCDDUTrailer::sizeInWords(), CSCDDUHeader::sizeInWords(), CSCDDUHeader::source_id(), theData, theDDUHeader, theDDUTrailer, theDDUTrailer0, theFormatVersion, and theSizeInWords.

161 {
162  // just to calculate length
163  uint16_t * inputBuf = buf;
164  uint16_t * inputBuf0 = buf;
165  theData.clear();
166  if (debug) LogTrace ("CSCDDUEventData|CSCRawToDigi") << "CSCDDUEventData::unpack_data() is called";
167  if (debug)
168  for (int i=0;i<6;++i)
169  {
170  LogTrace ("CSCDDUEventData|CSCRawToDigi") << i << std::hex << buf[4*i+3] << buf[4*i+2]
171  << buf[4*i+1] << buf[4*i];
172  std::cout << i << " " << std::hex << buf[4*i+3] << " " << buf[4*i+2] << " "
173  << buf[4*i+1] << " " << buf[4*i] << std::endl;
174  }
175  //std::cout << "DDU Size: " << std::dec << theDDUHeader.sizeInWords() << std::endl;
176 
177  memcpy(&theDDUHeader, buf, theDDUHeader.sizeInWords()*2);
178 
179  if (debug) {
180  LogTrace ("CSCDDUEventData|CSCRawToDigi") << "size of ddu header in words = " << theDDUHeader.sizeInWords();
181  LogTrace ("CSCDDUEventData|CSCRawToDigi") << "sizeof(DDUHeader) = " << sizeof(theDDUHeader);
182  }
183  buf += theDDUHeader.sizeInWords();
184 
185 
186  // if (theDDUHeader.format_version() >= 0x6)
187  if (theDDUHeader.format_version() == 0x7)
188  {
189  theFormatVersion = 2013;
190  }
191  else if (theDDUHeader.format_version() <= 0x6)
192  {
193  theFormatVersion = 2005;
194  }
195  else // Add handling for any other format version
196  {
197  theFormatVersion = 2013;
198  }
199 
200  // std::cout << "Format Version: " << theFormatVersion << std::endl;
201  //std::cout << "sandrik dduID =" << theDDUHeader.source_id() << std::endl;
202  //int i=-1;
203 
204 
205  // we really don't want to copy CSCEventData's while filling the vec
206  theData.clear();
207  theData.reserve(theDDUHeader.ncsc());
208 
209  if (examiner!= NULL) { // Use selective unpacking mode
210 
211  if (debug) LogTrace ("CSCDDUEventData|CSCRawToDigi") << "selective unpacking starting";
212 
213  // Find this DDU in examiner's DDUs list
214  DDUIdType dduID = theDDUHeader.source_id();
215 
216  std::map<DDUIdType,std::map<CSCIdType,const uint16_t*> > ddus = examiner->DMB_block();
217  std::map<DDUIdType,std::map<CSCIdType,const uint16_t*> >::iterator ddu_itr = ddus.find(dduID);
218  uint16_t* dduBlock = (uint16_t*)((examiner->DDU_block())[dduID]);
219  uint32_t dduBufSize = (examiner->DDU_size())[dduID];
220 
221  if (ddu_itr != ddus.end() && dduBufSize!=0 && dduBlock==inputBuf) {
222  std::map<CSCIdType,const uint16_t*> &cscs = ddu_itr->second;
223  std::map<CSCIdType,const uint16_t*>::iterator csc_itr;
224 
225  for (csc_itr=cscs.begin(); csc_itr != cscs.end(); ++csc_itr) {
226  short cscid = csc_itr->first;
227 
228  if(cscid != -1)
229  {
230  uint16_t* pos = (uint16_t*)csc_itr->second;
231 
232 
233  ExaminerStatusType errors = examiner->errorsForChamber(cscid);
234  if ((errors & examiner->getMask()) > 0 ) {
235  if (debug)
236  LogTrace ("CSCDDUEventData|CSCRawToDigi" )
237  << "skip unpacking of CSC " << cscid << " due format errors: 0x" << std::hex << errors << std::dec;
238  continue;
239  }
240 
241  theData.push_back(CSCEventData(pos, theFormatVersion));
242  }
243  }
244 
245  if (debug)
246  {
247  LogTrace ("CSCDDUEventData|CSCRawToDigi") << "size of vector of cscData = " << theData.size();
248  }
249  // std::cout << std::dec << theDDUTrailer.sizeInWords() << std::endl;
250  // decode ddu tail
251  memcpy(&theDDUTrailer, inputBuf+dduBufSize, theDDUTrailer.sizeInWords()*2);
252  // memcpy(&theDDUTrailer, dduBlock+(dduBufSize-theDDUTrailer.sizeInWords())*2, theDDUTrailer.sizeInWords()*2);
253  if (debug) LogTrace ("CSCDDUEventData|CSCRawToDigi") << theDDUTrailer.check();
255  if ((errorstat&errMask) != 0)
256  {
257  if (theDDUTrailer.check())
258  {
259  if (debug) LogTrace ("CSCDDUEventData|CSCRawToDigi")
260  << "+++ CSCDDUEventData warning: DDU Trailer errors = " << std::hex << errorstat << " +++ ";
261  if (debug) decodeStatus(errorstat);
262  }
263  else
264  {
265  if (debug) LogTrace ("CSCDDUEventData|CSCRawToDigi" )
266  << " Unpacking lost DDU trailer - check() failed and 8 8 ffff 8 was not found ";
267  }
268  }
269 
270  if (debug) {
271  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " Final errorstat " << std::hex << errorstat << std::dec ;
272  }
273  // the trailer counts in 64-bit words
274 
275  // theSizeInWords = dduBufSize;
276  // buf=inputBuf+dduBufSize;
277 
278  }
279  theSizeInWords = dduBufSize+12;
280  buf=inputBuf+dduBufSize;
281 
282  } else {
283 
284 
285  while( (((buf[0]&0xf000) == 0x9000)||((buf[0]&0xf000) == 0xa000))
286  && (buf[3] != 0x8000)) {
287  // ++i;
288  if (debug) LogTrace ("CSCDDUEventData|CSCRawToDigi") << "unpack csc data loop started";
289  theData.push_back(CSCEventData(buf));
290  buf += (theData.back()).size();
291  if (debug) {
292  LogTrace ("CSCDDUEventData|CSCRawToDigi") << "size of vector of cscData = " << theData.size();
293  }
294  }
295 
296  if (debug) {
297  LogTrace ("CSCDDUEventData|CSCRawToDigi") << "unpacking ddu trailer ";
298  LogTrace ("CSCDDUEventData|CSCRawToDigi") << std::hex << buf[3]<<" " << buf[2]
299  <<" " << buf[1]<<" " << buf[0];
300  }
301 
302  // decode ddu tail
303  memcpy(&theDDUTrailer, buf, theDDUTrailer.sizeInWords()*2);
304  if (debug) LogTrace ("CSCDDUEventData|CSCRawToDigi") << theDDUTrailer.check();
306  if ((errorstat&errMask) != 0)
307  {
308  if (theDDUTrailer.check())
309  {
310  if (debug) LogTrace ("CSCDDUEventData|CSCRawToDigi")
311  << "+++ CSCDDUEventData warning: DDU Trailer errors = " << std::hex << errorstat << " +++ ";
312  if (debug) decodeStatus(errorstat);
313  }
314  else
315  {
316  if (debug) LogTrace ("CSCDDUEventData|CSCRawToDigi" )
317  << " Unpacking lost DDU trailer - check() failed and 8 8 ffff 8 was not found ";
318  }
319  }
320 
321  if (debug)
322  LogTrace ("CSCDDUEventData|CSCRawToDigi") << " Final errorstat " << std::hex << errorstat << std::dec ;
323  // the trailer counts in 64-bit words
324  buf += theDDUTrailer.sizeInWords();
325 
326  theSizeInWords = buf - inputBuf;
327  }
328 
329 //std::cout << "DDUevData Size: " << theSizeInWords << " BUFlast: " << std::hex << inputBuf0[theSizeInWords-4] << //std::endl;
331 theDDUTrailer0 = inputBuf0[theSizeInWords-4];
332 }
uint16_t theFormatVersion
int i
Definition: DBlmapReader.cc:9
int format_version() const
Definition: CSCDDUHeader.h:22
static unsigned sizeInWords()
Definition: CSCDDUTrailer.h:28
CSCDDUHeader theDDUHeader
unsigned errorstat() const
Definition: CSCDDUTrailer.h:41
ExaminerStatusType errorsForChamber(CSCIdType chamber) const
#define NULL
Definition: scimark2.h:8
std::map< DDUIdType, std::map< CSCIdType, const uint16_t * > > DMB_block(void) const
bool check() const
Definition: CSCDDUTrailer.h:30
std::map< DDUIdType, uint32_t > DDU_size(void) const
#define LogTrace(id)
std::map< DDUIdType, const uint16_t * > DDU_block(void) const
static std::atomic< unsigned int > errMask
ExaminerMaskType getMask() const
uint16_t theDDUTrailer0
uint32_t ExaminerStatusType
int size() const
static unsigned sizeInWords()
Definition: CSCDDUHeader.h:32
int16_t DDUIdType
std::vector< CSCEventData > theData
tuple cout
Definition: gather_cfg.py:145
int ncsc() const
Definition: CSCDDUHeader.h:27
int source_id() const
Definition: CSCDDUHeader.h:23
void decodeStatus() const
CSCDDUTrailer theDDUTrailer
static std::atomic< bool > debug
long unsigned int errorstat
trailer info

Member Data Documentation

std::atomic< bool > CSCDDUEventData::debug {false}
static
std::atomic< uint32_t > CSCDDUEventData::errMask {0xFFFFFFFF}
static

Definition at line 67 of file CSCDDUEventData.h.

Referenced by decodeStatus(), setErrorMask(), and unpack_data().

long unsigned int CSCDDUEventData::errorstat

trailer info

Definition at line 48 of file CSCDDUEventData.h.

Referenced by unpack_data().

std::vector<CSCEventData> CSCDDUEventData::theData
protected

Definition at line 76 of file CSCDDUEventData.h.

Referenced by add(), cscData(), pack(), and unpack_data().

CSCDCCHeader CSCDDUEventData::theDCCHeader
protected

Definition at line 73 of file CSCDDUEventData.h.

Referenced by dccHeader().

CSCDCCTrailer CSCDDUEventData::theDCCTrailer
protected

Definition at line 78 of file CSCDDUEventData.h.

Referenced by dccTrailer().

CSCDDUHeader CSCDDUEventData::theDDUHeader
protected

Definition at line 74 of file CSCDDUEventData.h.

Referenced by add(), check(), CSCDDUEventData(), header(), pack(), and unpack_data().

CSCDDUTrailer CSCDDUEventData::theDDUTrailer
protected

Definition at line 77 of file CSCDDUEventData.h.

Referenced by check(), decodeStatus(), pack(), trailer(), and unpack_data().

uint16_t CSCDDUEventData::theDDUTrailer0
protected

Definition at line 79 of file CSCDDUEventData.h.

Referenced by trailer0(), and unpack_data().

uint16_t CSCDDUEventData::theFormatVersion
protected

Definition at line 81 of file CSCDDUEventData.h.

Referenced by unpack_data().

int CSCDDUEventData::theSizeInWords
protected

Definition at line 80 of file CSCDDUEventData.h.

Referenced by pack(), size(), sizeInWords(), and unpack_data().