ATLAS Offline Software
L1CaloUserHeader.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_L1CALOUSERHEADER_H
6 #define TRIGT1CALOBYTESTREAM_L1CALOUSERHEADER_H
7 
8 #include <stdint.h>
9 
10 namespace LVL1BS {
11 
19  // Remove pre version 2 stuff ?
21 
22  public:
23 
25  L1CaloUserHeader(uint32_t header = 0xf0000001);
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 L1CaloUserHeader::words() const
95 {
96  return m_header & s_mask;
97 }
98 
99 inline int L1CaloUserHeader::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 L1CaloUserHeader::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 L1CaloUserHeader::jem() const
112 {
113  return (m_header >> s_jemBit) & s_mask;
114 }
115 
116 inline int L1CaloUserHeader::cpm() const
117 {
118  return (m_header >> s_cpmBit) & s_mask;
119 }
120 
121 inline int L1CaloUserHeader::ppmLut() const
122 {
124  : (m_header >> s_ppmLutBit ) & s_mask;
125 }
126 
127 inline int L1CaloUserHeader::ppmFadc() const
128 {
130  : (m_header >> s_ppmFadcBit ) & s_mask;
131 }
132 
134 {
136  : 0;
137 }
138 
139 inline void L1CaloUserHeader::setJepCmm(const int offset)
140 {
141  if (!m_version2) m_header |= (s_mask & offset) << s_jepCmmBit;
142 }
143 
144 inline void L1CaloUserHeader::setCpCmm(const int offset)
145 {
146  if (!m_version2) m_header |= (s_mask & offset) << s_cpCmmBit;
147 }
148 
149 inline void L1CaloUserHeader::setJem(const int offset)
150 {
151  m_header |= (s_mask & offset) << s_jemBit;
152 }
153 
154 inline void L1CaloUserHeader::setCpm(const int offset)
155 {
156  m_header |= (s_mask & offset) << s_cpmBit;
157 }
158 
159 inline void L1CaloUserHeader::setPpmLut(const int offset)
160 {
162  : (s_mask & offset) << s_ppmLutBit;
163 }
164 
165 inline void L1CaloUserHeader::setPpmFadc(const int offset)
166 {
168  : (s_mask & offset) << s_ppmFadcBit;
169 }
170 
171 inline void L1CaloUserHeader::setLowerBound(const int bound)
172 {
174 }
175 
176 inline void L1CaloUserHeader::setVersion(const int minorVersion)
177 {
178  m_version2 = (minorVersion > s_version1);
179 }
180 
181 } // end namespace
182 
183 #endif
LVL1BS::L1CaloUserHeader
L1Calo User Header class.
Definition: L1CaloUserHeader.h:20
header
Definition: hcg.cxx:526
LVL1BS::L1CaloUserHeader::s_ppmLutBitV2
static const int s_ppmLutBitV2
Definition: L1CaloUserHeader.h:72
LVL1BS::L1CaloUserHeader::lowerBound
int lowerBound() const
Return FADC lower bound.
Definition: L1CaloUserHeader.h:133
LVL1BS::L1CaloUserHeader::s_ppmLutBit
static const int s_ppmLutBit
Definition: L1CaloUserHeader.h:68
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1BS::L1CaloUserHeader::jepCmm
int jepCmm() const
Definition: L1CaloUserHeader.h:99
LVL1BS::L1CaloUserHeader::header
uint32_t header() const
Return packed header.
Definition: L1CaloUserHeader.h:89
LVL1BS::L1CaloUserHeader::cpm
int cpm() const
Definition: L1CaloUserHeader.h:116
LVL1BS::L1CaloUserHeader::s_ppmFadcBitV2
static const int s_ppmFadcBitV2
Definition: L1CaloUserHeader.h:73
LVL1BS::L1CaloUserHeader::cpCmm
int cpCmm() const
Definition: L1CaloUserHeader.h:105
LVL1BS::L1CaloUserHeader::s_ppmFadcMaskV2
static const uint32_t s_ppmFadcMaskV2
Definition: L1CaloUserHeader.h:79
LVL1BS::L1CaloUserHeader::setJepCmm
void setJepCmm(int offset)
Definition: L1CaloUserHeader.h:139
LVL1BS::L1CaloUserHeader::setPpmFadc
void setPpmFadc(int offset)
Definition: L1CaloUserHeader.h:165
LVL1BS::L1CaloUserHeader::ppmFadc
int ppmFadc() const
Definition: L1CaloUserHeader.h:127
LVL1BS::L1CaloUserHeader::s_lowerBoundMask
static const uint32_t s_lowerBoundMask
Definition: L1CaloUserHeader.h:77
LVL1BS::L1CaloUserHeader::ppmLut
int ppmLut() const
Definition: L1CaloUserHeader.h:121
LVL1BS::L1CaloUserHeader::s_mask
static const uint32_t s_mask
Field mask.
Definition: L1CaloUserHeader.h:75
LVL1BS::L1CaloUserHeader::s_ppmLutMaskV2
static const uint32_t s_ppmLutMaskV2
Definition: L1CaloUserHeader.h:78
LVL1BS::L1CaloUserHeader::jem
int jem() const
Definition: L1CaloUserHeader.h:111
LVL1BS::L1CaloUserHeader::setLowerBound
void setLowerBound(int bound)
Set FADC lower bound.
Definition: L1CaloUserHeader.h:171
LVL1BS::L1CaloUserHeader::s_lowerBoundBit
static const int s_lowerBoundBit
Definition: L1CaloUserHeader.h:71
LVL1BS::L1CaloUserHeader::setVersion
void setVersion(int minorVersion)
Set version flag.
Definition: L1CaloUserHeader.h:176
LVL1BS::L1CaloUserHeader::s_cpmBit
static const int s_cpmBit
Definition: L1CaloUserHeader.h:67
LVL1BS::L1CaloUserHeader::s_cpCmmBit
static const int s_cpCmmBit
Definition: L1CaloUserHeader.h:65
LVL1BS::L1CaloUserHeader::setJem
void setJem(int offset)
Definition: L1CaloUserHeader.h:149
LVL1BS::L1CaloUserHeader::s_ppmFadcBit
static const int s_ppmFadcBit
Definition: L1CaloUserHeader.h:69
LVL1BS::L1CaloUserHeader::setCpm
void setCpm(int offset)
Definition: L1CaloUserHeader.h:154
LVL1BS::L1CaloUserHeader::words
int words() const
Return number of header words (should be one)
Definition: L1CaloUserHeader.h:94
LVL1BS::L1CaloUserHeader::m_header
uint32_t m_header
Packed Header.
Definition: L1CaloUserHeader.h:83
LVL1BS::L1CaloUserHeader::L1CaloUserHeader
L1CaloUserHeader(uint32_t header=0xf0000001)
Constructor - default just sets word ID and number of header words.
Definition: L1CaloUserHeader.cxx:29
LVL1BS
Definition: ZdcModifySlices.h:10
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LVL1BS::L1CaloUserHeader::s_jemBit
static const int s_jemBit
Definition: L1CaloUserHeader.h:66
LVL1BS::L1CaloUserHeader::s_jepCmmBit
static const int s_jepCmmBit
Definition: L1CaloUserHeader.h:64
LVL1BS::L1CaloUserHeader::setCpCmm
void setCpCmm(int offset)
Definition: L1CaloUserHeader.h:144
LVL1BS::L1CaloUserHeader::s_version1
static const int s_version1
Version 1 minor format version number.
Definition: L1CaloUserHeader.h:81
LVL1BS::L1CaloUserHeader::s_wordIdBit
static const int s_wordIdBit
Definition: L1CaloUserHeader.h:63
LVL1BS::L1CaloUserHeader::m_version2
bool m_version2
Version flag.
Definition: L1CaloUserHeader.h:85
LVL1BS::L1CaloUserHeader::isValid
static bool isValid(uint32_t word)
Test for valid header word.
Definition: L1CaloUserHeader.cxx:36
LVL1BS::L1CaloUserHeader::setPpmLut
void setPpmLut(int offset)
Definition: L1CaloUserHeader.h:159