CMS 3D CMS Logo

CSCDDUTrailer.h
Go to the documentation of this file.
1 #ifndef EventFilter_CSCRawToDigi_CSCDDUTrailer_h
2 #define EventFilter_CSCRawToDigi_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
unsigned word7
Definition: CSCDDUTrailer.h:79
unsigned dmb_full() const
Definition: CSCDDUTrailer.h:42
unsigned reserved() const
Definition: CSCDDUTrailer.h:43
CSCDDUTrailer(const CSCDDUStatusDigi &digi)
Definition: CSCDDUTrailer.h:19
unsigned word5
Definition: CSCDDUTrailer.h:77
static unsigned sizeInWords()
Definition: CSCDDUTrailer.h:23
unsigned trailer2_4
Definition: CSCDDUTrailer.h:50
void setWordCount(unsigned wordcount)
Definition: CSCDDUTrailer.h:38
const uint16_t * trailer() const
unsigned errorstat_
Definition: CSCDDUTrailer.h:55
unsigned dmb_warn_
Active DMB Count (4 bits)
Definition: CSCDDUTrailer.h:53
unsigned wordcount() const
Definition: CSCDDUTrailer.h:37
unsigned short * data()
Definition: CSCDDUTrailer.h:32
unsigned trailer2_2
Definition: CSCDDUTrailer.h:48
unsigned dmb_full_
Definition: CSCDDUTrailer.h:54
unsigned word8
Definition: CSCDDUTrailer.h:80
unsigned word3
Definition: CSCDDUTrailer.h:74
void setFromBuffer(uint16_t const *buf)
Definition: CSCDDUTrailer.h:21
unsigned trailer2_1
should be 8000/8000/FFFF/8000
Definition: CSCDDUTrailer.h:47
bool check() const
Definition: CSCDDUTrailer.h:25
unsigned trailer2_3
Definition: CSCDDUTrailer.h:49
unsigned word2
Definition: CSCDDUTrailer.h:73
unsigned cms_directive_0xA
constant, should be 1010
Definition: CSCDDUTrailer.h:87
unsigned word4
Definition: CSCDDUTrailer.h:75
unsigned dmb_warn() const
Definition: CSCDDUTrailer.h:41
unsigned word1
Definition: CSCDDUTrailer.h:72
unsigned errorstat() const
Definition: CSCDDUTrailer.h:36
unsigned word6
Definition: CSCDDUTrailer.h:78
unsigned whatever
Definition: CSCDDUTrailer.h:85
unsigned word_count_
Definition: CSCDDUTrailer.h:84