ATLAS Offline Software
ZdcL1CaloUserHeader.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGT1CALOBYTESTREAM_ZDCL1CALOUSERHEADER_H
6 #define TRIGT1CALOBYTESTREAM_ZDCL1CALOUSERHEADER_H
7 
8 #include <stdint.h>
9 
10 //namespace LVL1BS {
11 
19  // Remove pre version 2 stuff ?
21 
22  public:
23 
26 
28  uint32_t header() const;
29 
31  int words() const;
32 
33  // Return triggered slice offsets
34  int jepCmm() const;
35  int cpCmm() const;
36  int jem() const;
37  int cpm() const;
38  int ppmLut() const;
39  int ppmFadc() const;
40 
42  int lowerBound() const;
43 
44  // Set triggered slice offsets
45  void setJepCmm(int offset);
46  void setCpCmm(int offset);
47  void setJem(int offset);
48  void setCpm(int offset);
49  void setPpmLut(int offset);
50  void setPpmFadc(int offset);
51 
53  void setLowerBound(int bound);
54 
56  void setVersion(int minorVersion);
57 
59  static bool isValid(uint32_t word);
60 
61  private:
62  // Packed word bit positions version 1
63  static const int s_wordIdBit = 28;
64  static const int s_jepCmmBit = 24;
65  static const int s_cpCmmBit = 20;
66  static const int s_jemBit = 16;
67  static const int s_cpmBit = 12;
68  static const int s_ppmLutBit = 8;
69  static const int s_ppmFadcBit = 4;
70  // Packed word bit positions version 2 (no cmms)
71  static const int s_lowerBoundBit = 20;
72  static const int s_ppmLutBitV2 = 9;
73  static const int s_ppmFadcBitV2 = 4;
75  static const uint32_t s_mask = 0xf;
76  // Version 2 masks
77  static const uint32_t s_lowerBoundMask = 0xff;
78  static const uint32_t s_ppmLutMaskV2 = 0x7;
79  static const uint32_t s_ppmFadcMaskV2 = 0x1f;
81  static const int s_version1 = 0x1001;
85  bool m_version2;
86 
87 };
88 
90 {
91  return m_header;
92 }
93 
94 inline int ZdcL1CaloUserHeader::words() const
95 {
96  return m_header & s_mask;
97 }
98 
99 inline int ZdcL1CaloUserHeader::jepCmm() const
100 {
101  return (m_version2) ? (m_header >> s_jemBit ) & s_mask
102  : (m_header >> s_jepCmmBit) & s_mask;
103 }
104 
105 inline int ZdcL1CaloUserHeader::cpCmm() const
106 {
107  return (m_version2) ? (m_header >> s_cpmBit ) & s_mask
108  : (m_header >> s_cpCmmBit) & s_mask;
109 }
110 
111 inline int ZdcL1CaloUserHeader::jem() const
112 {
113  return (m_header >> s_jemBit) & s_mask;
114 }
115 
116 inline int ZdcL1CaloUserHeader::cpm() const
117 {
118  return (m_header >> s_cpmBit) & s_mask;
119 }
120 
121 inline int ZdcL1CaloUserHeader::ppmLut() const
122 {
124  : (m_header >> s_ppmLutBit ) & s_mask;
125 }
126 
128 {
130  : (m_header >> s_ppmFadcBit ) & s_mask;
131 }
132 
134 {
136  : 0;
137 }
138 
140 {
141  if (!m_version2) m_header |= (s_mask & offset) << s_jepCmmBit;
142 }
143 
144 inline void ZdcL1CaloUserHeader::setCpCmm(const int offset)
145 {
146  if (!m_version2) m_header |= (s_mask & offset) << s_cpCmmBit;
147 }
148 
149 inline void ZdcL1CaloUserHeader::setJem(const int offset)
150 {
151  m_header |= (s_mask & offset) << s_jemBit;
152 }
153 
154 inline void ZdcL1CaloUserHeader::setCpm(const int offset)
155 {
156  m_header |= (s_mask & offset) << s_cpmBit;
157 }
158 
160 {
162  : (s_mask & offset) << s_ppmLutBit;
163 }
164 
166 {
168  : (s_mask & offset) << s_ppmFadcBit;
169 }
170 
171 inline void ZdcL1CaloUserHeader::setLowerBound(const int bound)
172 {
174 }
175 
176 inline void ZdcL1CaloUserHeader::setVersion(const int minorVersion)
177 {
178  m_version2 = (minorVersion > s_version1);
179 }
180 
181 //} // end namespace
182 
183 #endif
ZdcL1CaloUserHeader::s_mask
static const uint32_t s_mask
Field mask.
Definition: ZdcL1CaloUserHeader.h:75
ZdcL1CaloUserHeader::setPpmFadc
void setPpmFadc(int offset)
Definition: ZdcL1CaloUserHeader.h:165
header
Definition: hcg.cxx:526
ZdcL1CaloUserHeader::s_jepCmmBit
static const int s_jepCmmBit
Definition: ZdcL1CaloUserHeader.h:64
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ZdcL1CaloUserHeader::ppmFadc
int ppmFadc() const
Definition: ZdcL1CaloUserHeader.h:127
ZdcL1CaloUserHeader::setCpm
void setCpm(int offset)
Definition: ZdcL1CaloUserHeader.h:154
ZdcL1CaloUserHeader::s_jemBit
static const int s_jemBit
Definition: ZdcL1CaloUserHeader.h:66
ZdcL1CaloUserHeader::s_cpCmmBit
static const int s_cpCmmBit
Definition: ZdcL1CaloUserHeader.h:65
ZdcL1CaloUserHeader::setPpmLut
void setPpmLut(int offset)
Definition: ZdcL1CaloUserHeader.h:159
ZdcL1CaloUserHeader::lowerBound
int lowerBound() const
Return FADC lower bound.
Definition: ZdcL1CaloUserHeader.h:133
ZdcL1CaloUserHeader::setJepCmm
void setJepCmm(int offset)
Definition: ZdcL1CaloUserHeader.h:139
ZdcL1CaloUserHeader::s_lowerBoundBit
static const int s_lowerBoundBit
Definition: ZdcL1CaloUserHeader.h:71
ZdcL1CaloUserHeader::setJem
void setJem(int offset)
Definition: ZdcL1CaloUserHeader.h:149
ZdcL1CaloUserHeader::cpCmm
int cpCmm() const
Definition: ZdcL1CaloUserHeader.h:105
ZdcL1CaloUserHeader::s_cpmBit
static const int s_cpmBit
Definition: ZdcL1CaloUserHeader.h:67
ZdcL1CaloUserHeader::s_ppmFadcBit
static const int s_ppmFadcBit
Definition: ZdcL1CaloUserHeader.h:69
ZdcL1CaloUserHeader::setVersion
void setVersion(int minorVersion)
Set version flag.
Definition: ZdcL1CaloUserHeader.h:176
ZdcL1CaloUserHeader::s_wordIdBit
static const int s_wordIdBit
Definition: ZdcL1CaloUserHeader.h:63
ZdcL1CaloUserHeader::isValid
static bool isValid(uint32_t word)
Test for valid header word.
ZdcL1CaloUserHeader::words
int words() const
Return number of header words (should be one)
Definition: ZdcL1CaloUserHeader.h:94
ZdcL1CaloUserHeader::jem
int jem() const
Definition: ZdcL1CaloUserHeader.h:111
ZdcL1CaloUserHeader::s_ppmLutBitV2
static const int s_ppmLutBitV2
Definition: ZdcL1CaloUserHeader.h:72
ZdcL1CaloUserHeader::m_header
uint32_t m_header
Packed Header.
Definition: ZdcL1CaloUserHeader.h:83
ZdcL1CaloUserHeader::s_ppmLutBit
static const int s_ppmLutBit
Definition: ZdcL1CaloUserHeader.h:68
ZdcL1CaloUserHeader::s_ppmFadcBitV2
static const int s_ppmFadcBitV2
Definition: ZdcL1CaloUserHeader.h:73
ZdcL1CaloUserHeader::ZdcL1CaloUserHeader
ZdcL1CaloUserHeader(uint32_t header=0xf0000001)
Constructor - default just sets word ID and number of header words.
ZdcL1CaloUserHeader::s_version1
static const int s_version1
Version 1 minor format version number.
Definition: ZdcL1CaloUserHeader.h:81
ZdcL1CaloUserHeader::s_ppmLutMaskV2
static const uint32_t s_ppmLutMaskV2
Definition: ZdcL1CaloUserHeader.h:78
ZdcL1CaloUserHeader::s_ppmFadcMaskV2
static const uint32_t s_ppmFadcMaskV2
Definition: ZdcL1CaloUserHeader.h:79
ZdcL1CaloUserHeader
L1Calo User Header class.
Definition: ZdcL1CaloUserHeader.h:20
ZdcL1CaloUserHeader::m_version2
bool m_version2
Version flag.
Definition: ZdcL1CaloUserHeader.h:85
ZdcL1CaloUserHeader::cpm
int cpm() const
Definition: ZdcL1CaloUserHeader.h:116
ZdcL1CaloUserHeader::jepCmm
int jepCmm() const
Definition: ZdcL1CaloUserHeader.h:99
ZdcL1CaloUserHeader::s_lowerBoundMask
static const uint32_t s_lowerBoundMask
Definition: ZdcL1CaloUserHeader.h:77
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
ZdcL1CaloUserHeader::header
uint32_t header() const
Return packed header.
Definition: ZdcL1CaloUserHeader.h:89
ZdcL1CaloUserHeader::ppmLut
int ppmLut() const
Definition: ZdcL1CaloUserHeader.h:121
ZdcL1CaloUserHeader::setLowerBound
void setLowerBound(int bound)
Set FADC lower bound.
Definition: ZdcL1CaloUserHeader.h:171
ZdcL1CaloUserHeader::setCpCmm
void setCpCmm(int offset)
Definition: ZdcL1CaloUserHeader.h:144