CMS 3D CMS Logo

RPCMP7Record.h
Go to the documentation of this file.
1 #ifndef EventFilter_RPCRawToDigi_RPCMP7Record_h
2 #define EventFilter_RPCRawToDigi_RPCMP7Record_h
3 
4 #include <cstdint>
5 
7 
8 namespace rpcmp7 {
9 
10 class Header
11  : public rpcamc::Header
12 {
13 public:
14  static unsigned int const l1a_type_ = 0xd0;
15 
16 protected:
17  // Second word
18  static std::uint64_t const event_type_mask_ = 0x0000ffff00000000;
19  static unsigned int const event_type_offset_ = 32;
20 
21 public:
22  Header();
23  Header(std::uint64_t const record[2]);
24  Header(unsigned int amc_number
25  , unsigned int event_counter
26  , unsigned int bx_counter
27  , unsigned int data_length
28  , unsigned int orbit_counter
29  , unsigned int board_id
30  , unsigned int event_type = l1a_type_);
31  ~Header();
32 
33  void reset();
34 
35  unsigned int getEventType() const;
36 
37  void setEventType(unsigned int event_type);
38 };
39 
40 class SubHeader
41 {
42 protected:
43  static std::uint64_t const algo_rev_mask_ = 0xffffffff00000000;
44  static std::uint64_t const fw_rev_mask_ = 0x0000000000ffffff;
45 
46  static unsigned int const algo_rev_offset_ = 32;
47  static unsigned int const fw_rev_offset_ = 0;
48 
49 public:
50  SubHeader(std::uint64_t const record = 0x0);
51 
52  void set(std::uint64_t const word);
53  void reset();
54 
55  std::uint64_t const & getRecord() const;
56 
57  unsigned int getAlgoVersion() const;
58  unsigned int getFirmwareVersion() const;
59 
60  void setAlgoVersion(unsigned int algo_rev);
61  void setFirmwareVersion(unsigned int fw_rev);
62 
63 protected:
65 };
66 
68 {
69 protected:
70  static std::uint32_t const id_mask_ = 0xff000000;
71  static std::uint32_t const length_mask_ = 0x00ff0000;
72  static std::uint32_t const caption_id_mask_ = 0x0000ff00;
73  static std::uint32_t const zs_per_bx_mask_ = 0x00000002;
74  static std::uint32_t const is_zs_mask_ = 0x00000001;
75 
76  static unsigned int const id_offset_ = 24;
77  static unsigned int const length_offset_ = 16;
78  static unsigned int const caption_id_offset_ = 8;
79  static unsigned int const zs_per_bx_offset_ = 1;
80  static unsigned int const is_zs_offset_ = 0;
81 
82 public:
83  BlockHeader(std::uint32_t const record = 0x0);
84 
85  void set(std::uint32_t const record);
86  void reset();
87 
88  std::uint32_t const & getRecord() const;
89 
90  unsigned int getId() const;
91  unsigned int getLength() const;
92  unsigned int getCaptionId() const;
93  bool hasZeroSuppressionPerBX() const;
94  bool isZeroSuppressed() const;
95 
96  bool isZeroSuppressionInverted() const;
97 
98  void setId(unsigned int id);
99  void setLength(unsigned int length);
100  void setCaptionId(unsigned int caption_id);
101  void setZeroSuppressionPerBX(bool zs_per_bx);
102  void setZeroSuppressed(bool is_zs);
103 
104  void setZeroSuppressionInverted(bool zs_inverted);
105 
106 protected:
107  std::uint32_t record_;
108 };
109 
110 class BXHeader
111 {
112 protected:
113  static std::uint32_t const first_word_mask_ = 0xff000000;
114  static std::uint32_t const total_length_mask_ = 0x00ff0000;
115  static std::uint32_t const is_zs_mask_ = 0x00000001;
116 
117  static unsigned int const first_word_offset_ = 24;
118  static unsigned int const total_length_offset_ = 16;
119  static unsigned int const is_zs_offset_ = 0;
120 
121 public:
122  BXHeader(std::uint32_t const record = 0x0);
123 
124  void set(std::uint32_t const record);
125  void reset();
126 
127  std::uint32_t const & getRecord() const;
128 
129  unsigned int getFirstWord() const;
130  unsigned int getTotalLength() const;
131  bool isZeroSuppressed() const;
132 
133  // https://twiki.cern.ch/twiki/pub/CMS/MP7ZeroSuppression/mp7_zs_payload_formats.pdf
134  unsigned int getBXId() const;
135  unsigned int getTotalBX() const;
136 
137  void setFirstWord(unsigned int first_word);
138  void setTotalLength(unsigned int length);
139  void setZeroSuppressed(bool zs);
140 
141 protected:
142  std::uint32_t record_;
143 };
144 
145 } // namespace rpcmp7
146 
147 #include "EventFilter/RPCRawToDigi/interface/RPCMP7Record.icc"
148 
149 #endif // EventFilter_RPCRawToDigi_RPCMP7Record_h
static unsigned int getId()
JetCorrectorParameters::Record record
Definition: classes.h:7
static std::uint64_t const event_type_mask_
Definition: RPCMP7Record.h:18
static unsigned int const l1a_type_
Definition: RPCMP7Record.h:14
static unsigned int const event_type_offset_
Definition: RPCMP7Record.h:19
std::uint32_t record_
Definition: RPCMP7Record.h:142
unsigned long long uint64_t
Definition: Time.h:15
void setEventType(unsigned int event_type)
std::uint32_t record_
Definition: RPCMP7Record.h:107
unsigned int getEventType() const
std::uint64_t const * getRecord() const
std::uint64_t record_
Definition: RPCMP7Record.h:64