CMS 3D CMS Logo

CSCDDUTrailer.h
Go to the documentation of this file.
1 #ifndef CSCDDUTrailer_h
2 #define CSCDDUTrailer_h
3 
4 #include <iostream>
5 #include <cstdint>
6 #include <cstring> // bzero
8 
13 public:
15  bzero(this, sizeInWords() * 2);
16  trailer2_1 = trailer2_2 = trailer2_4 = 0x8000;
17  trailer2_3 = 0xFFFF;
18  }
19  CSCDDUTrailer(const CSCDDUStatusDigi& digi) { memcpy(this, digi.trailer(), sizeInWords() * 2); }
20 
21  void setFromBuffer(uint16_t const* buf) { memcpy(this, buf, sizeInWords() * 2); }
22 
23  static unsigned sizeInWords() { return 12; }
24 
25  bool check() const {
26  //std::cout << std:: hex << "DDUTRAILER CHECK " << trailer2_1 << " "
27  // << trailer2_2 << " " << trailer2_3 << " "
28  // << trailer2_4 << std:: dec << std::endl;
29  return trailer2_1 == 0x8000 && trailer2_2 == 0x8000 && trailer2_3 == 0xFFFF && trailer2_4 == 0x8000;
30  }
31 
32  unsigned short* data() { return (unsigned short*)this; }
33 
34  //These are accessors to use for calling private members
35 
36  unsigned errorstat() const { return errorstat_; }
37  unsigned wordcount() const { return word_count_; }
39  //@@ Tim: This seems wrong to me so just pull it
40  //@@ void setDMBDAV(int dmbId) {dmb_full_ |= (1 << dmbId);}
41  unsigned dmb_warn() const { return dmb_warn_; }
42  unsigned dmb_full() const { return dmb_full_; }
43  unsigned reserved() const { return whatever; }
44 
45 private:
47  unsigned trailer2_1 : 16;
48  unsigned trailer2_2 : 16;
49  unsigned trailer2_3 : 16;
50  unsigned trailer2_4 : 16;
51 
53  unsigned dmb_warn_ : 16;
54  unsigned dmb_full_ : 16;
55  unsigned errorstat_ : 32;
56 
57  // DDU2004
58  // unsigned reserved_bits : 4;
59  //unsigned ddu_tts_status : 4;
60  //unsigned event_status : 8;
61  //unsigned event_crc : 16;
62  //
63 
64  //DDU2000
65  //unsigned s_link_status : 4;
66  //unsigned crc_check_word : 16;
67  //unsigned whatever : 4;
68  //unsigned event_status : 8;
69  //
70 
71  //the following bits change their meaning in DDU2004
72  unsigned word1 : 4;
73  unsigned word2 : 4;
74  unsigned word3 : 4;
75  unsigned word4 : 4;
76 
77  unsigned word5 : 4;
78  unsigned word6 : 4;
79  unsigned word7 : 4;
80  unsigned word8 : 4;
81 
84  unsigned word_count_ : 24;
85  unsigned whatever : 4;
87  unsigned cms_directive_0xA : 4;
88 };
89 #endif
CSCDDUTrailer::setWordCount
void setWordCount(unsigned wordcount)
Definition: CSCDDUTrailer.h:38
CSCDDUTrailer::word3
unsigned word3
Definition: CSCDDUTrailer.h:74
CSCDDUTrailer::cms_directive_0xA
unsigned cms_directive_0xA
constant, should be 1010
Definition: CSCDDUTrailer.h:87
CSCDDUTrailer
Definition: CSCDDUTrailer.h:12
CSCDDUStatusDigi.h
CSCDDUTrailer::check
bool check() const
Definition: CSCDDUTrailer.h:25
CSCDDUTrailer::errorstat
unsigned errorstat() const
Definition: CSCDDUTrailer.h:36
CSCDDUTrailer::trailer2_1
unsigned trailer2_1
should be 8000/8000/FFFF/8000
Definition: CSCDDUTrailer.h:47
CSCDDUTrailer::word_count_
unsigned word_count_
Definition: CSCDDUTrailer.h:84
CSCDDUTrailer::reserved
unsigned reserved() const
Definition: CSCDDUTrailer.h:43
CSCDDUTrailer::trailer2_4
unsigned trailer2_4
Definition: CSCDDUTrailer.h:50
CSCDDUStatusDigi::trailer
const uint16_t * trailer() const
Definition: CSCDDUStatusDigi.h:25
CSCDDUStatusDigi
Definition: CSCDDUStatusDigi.h:15
CSCDDUTrailer::word8
unsigned word8
Definition: CSCDDUTrailer.h:80
CSCDDUTrailer::word5
unsigned word5
Definition: CSCDDUTrailer.h:77
CSCDDUTrailer::whatever
unsigned whatever
Definition: CSCDDUTrailer.h:85
CSCDDUTrailer::dmb_full
unsigned dmb_full() const
Definition: CSCDDUTrailer.h:42
CSCDDUTrailer::trailer2_2
unsigned trailer2_2
Definition: CSCDDUTrailer.h:48
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCDDUTrailer::word2
unsigned word2
Definition: CSCDDUTrailer.h:73
CSCDDUTrailer::dmb_warn
unsigned dmb_warn() const
Definition: CSCDDUTrailer.h:41
CSCDDUTrailer::sizeInWords
static unsigned sizeInWords()
Definition: CSCDDUTrailer.h:23
CSCDDUTrailer::data
unsigned short * data()
Definition: CSCDDUTrailer.h:32
CSCDDUTrailer::word1
unsigned word1
Definition: CSCDDUTrailer.h:72
CSCDDUTrailer::dmb_full_
unsigned dmb_full_
Definition: CSCDDUTrailer.h:54
CSCDDUTrailer::trailer2_3
unsigned trailer2_3
Definition: CSCDDUTrailer.h:49
CSCDDUTrailer::errorstat_
unsigned errorstat_
Definition: CSCDDUTrailer.h:55
CSCDDUTrailer::setFromBuffer
void setFromBuffer(uint16_t const *buf)
Definition: CSCDDUTrailer.h:21
CSCDDUTrailer::wordcount
unsigned wordcount() const
Definition: CSCDDUTrailer.h:37
CSCDDUTrailer::CSCDDUTrailer
CSCDDUTrailer()
Definition: CSCDDUTrailer.h:14
CSCDDUTrailer::word7
unsigned word7
Definition: CSCDDUTrailer.h:79
CSCDDUTrailer::word6
unsigned word6
Definition: CSCDDUTrailer.h:78
CSCDDUTrailer::word4
unsigned word4
Definition: CSCDDUTrailer.h:75
CSCDDUTrailer::CSCDDUTrailer
CSCDDUTrailer(const CSCDDUStatusDigi &digi)
Definition: CSCDDUTrailer.h:19
CSCDDUTrailer::dmb_warn_
unsigned dmb_warn_
Active DMB Count (4 bits)
Definition: CSCDDUTrailer.h:53