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