CMS 3D CMS Logo

CSCDDUHeader.h
Go to the documentation of this file.
1 /* CSCDDUHeader 4/24/03 A.Tumanov
2  * documented at http://www.physics.ohio-state.edu/~cms/ddu/
3  */
4 
5 #ifndef CSCDDUHeader_h
6 #define CSCDDUHeader_h
8 #include <cstring>
9 #include <cstdint>
10 
11 class CSCDDUHeader {
12 
13  public:
14  CSCDDUHeader();
15  CSCDDUHeader(unsigned bx, unsigned l1num, unsigned sourceId, unsigned fmt_version = 0x6);
17  {
18  memcpy(this, digi.header(), sizeInWords()*2);
19  }
20 
21  void setFromBuffer(uint16_t const* buf) {
22  memcpy(this, buf, sizeInWords()*2);
23  }
24 
25  // Getters
26  int s_link_status() const { return s_link_status_;}
27  int format_version() const { return format_version_;}
28  int source_id() const { return source_id_;}
29  int bxnum() const { return bxnum_;}
30  int lvl1num() const { return lvl1num_;}
31  int event_type() const { return event_type_;}
32  int ncsc() const { return ncsc_;}
33  int dmb_dav() const { return dmb_dav_;}
34  int dmb_full() const { return dmb_full_;}
35  int live_cscs() const {return live_cscs_;}
36  int output_path_status() const {return output_path_;}
37  static unsigned sizeInWords() {return 12;}
38 
39  // Setters
40  void setDMBDAV(int dduInput);
41  void setSourceId(unsigned sourceId) {source_id_ = sourceId;}
42  void setFormatVersion(unsigned version) {format_version_ = version & 0xF;}
43  void setBXN(unsigned bxn) {bxnum_ = bxn & 0xFFF;}
44  void setL1A(unsigned l1a) {lvl1num_ = l1a & 0xFFFFFF;}
45  void setEventType(unsigned evt_type) {event_type_ = evt_type & 0xF;}
46  void setTTSStatus(unsigned status) {tts_status_ = status & 0xF;}
47  void setBOEStatus(unsigned status) {boe_status_ = status & 0x7F;}
48  void setOutputPathStatus(unsigned status) {output_path_ = status & 0xFF;}
49 
50  unsigned short * data() {return (unsigned short *) this;}
51  bool check() const;
52 
53  // gets some data filled by the event data
54  friend class CSCDDUEventData;
55  private:
57  void init();
58 
59  unsigned s_link_status_ : 4;
60  unsigned format_version_ : 4;
61  unsigned source_id_ : 12;
62  unsigned bxnum_ : 12;
63 
64  unsigned lvl1num_ : 24;
65  unsigned event_type_ : 4;
67  unsigned bit64_ : 4;
68 
70  unsigned dmb_full_ : 16;
71  unsigned header2_1_ : 16;
72  unsigned header2_2_ : 16;
73  unsigned header2_3_ : 16;
74 
75 
76  unsigned ncsc_ : 4;
77  unsigned tts_status_ : 4;
78  unsigned boe_status_ : 8;
79  unsigned dmb_dav_ : 16;
80  unsigned output_path_ : 16;
81  unsigned live_cscs_ : 16;
82 
83 };
84 #endif
unsigned source_id_
Definition: CSCDDUHeader.h:61
unsigned dmb_dav_
Definition: CSCDDUHeader.h:79
void setFromBuffer(uint16_t const *buf)
Definition: CSCDDUHeader.h:21
unsigned lvl1num_
Definition: CSCDDUHeader.h:64
void setSourceId(unsigned sourceId)
Definition: CSCDDUHeader.h:41
void setBXN(unsigned bxn)
Definition: CSCDDUHeader.h:43
bool check() const
Definition: CSCDDUHeader.cc:54
unsigned s_link_status_
Definition: CSCDDUHeader.h:59
int format_version() const
Definition: CSCDDUHeader.h:27
void setDMBDAV(int dduInput)
Definition: CSCDDUHeader.cc:35
int lvl1num() const
Definition: CSCDDUHeader.h:30
unsigned header2_3_
Definition: CSCDDUHeader.h:73
int bxnum() const
Definition: CSCDDUHeader.h:29
int output_path_status() const
Definition: CSCDDUHeader.h:36
int dmb_dav() const
Definition: CSCDDUHeader.h:33
unsigned output_path_
Definition: CSCDDUHeader.h:80
unsigned header2_2_
Definition: CSCDDUHeader.h:72
unsigned ncsc_
Definition: CSCDDUHeader.h:76
unsigned event_type_
Definition: CSCDDUHeader.h:65
unsigned header2_1_
Definition: CSCDDUHeader.h:71
void setBOEStatus(unsigned status)
Definition: CSCDDUHeader.h:47
unsigned live_cscs_
Definition: CSCDDUHeader.h:81
void setOutputPathStatus(unsigned status)
Definition: CSCDDUHeader.h:48
unsigned format_version_
Definition: CSCDDUHeader.h:60
const uint16_t * header() const
Data Accessors.
int event_type() const
Definition: CSCDDUHeader.h:31
unsigned bit64_
should always be 5
Definition: CSCDDUHeader.h:67
void init()
initializes constants
Definition: CSCDDUHeader.cc:27
int s_link_status() const
Definition: CSCDDUHeader.h:26
unsigned dmb_full_
should be 8000/0001/8000
Definition: CSCDDUHeader.h:70
int dmb_full() const
Definition: CSCDDUHeader.h:34
void setTTSStatus(unsigned status)
Definition: CSCDDUHeader.h:46
static unsigned sizeInWords()
Definition: CSCDDUHeader.h:37
int ncsc() const
Definition: CSCDDUHeader.h:32
int source_id() const
Definition: CSCDDUHeader.h:28
int live_cscs() const
Definition: CSCDDUHeader.h:35
unsigned boe_status_
Definition: CSCDDUHeader.h:78
unsigned bxnum_
Definition: CSCDDUHeader.h:62
CSCDDUHeader(const CSCDDUStatusDigi &digi)
Definition: CSCDDUHeader.h:16
unsigned tts_status_
Definition: CSCDDUHeader.h:77
unsigned short * data()
Definition: CSCDDUHeader.h:50
void setL1A(unsigned l1a)
Definition: CSCDDUHeader.h:44
void setEventType(unsigned evt_type)
Definition: CSCDDUHeader.h:45
void setFormatVersion(unsigned version)
Definition: CSCDDUHeader.h:42