ATLAS Offline Software
ZdcUserHeader.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 ZDCUSERHEADER_H
6 #define ZDCUSERHEADER_H
7 
8 #include <stdint.h>
9 
25 
26  public:
27 
29  ZdcUserHeader(uint32_t header = 0xf0000001);
30 
32  uint32_t header() const;
33 
35  int words() const;
36 
37  // Return triggered slice offsets
38  int ppmLut() const;
39  int ppmFadc() const;
40 
42  int lowerBound() const;
43 
44  // Set triggered slice offsets
45  void setPpmLut(int offset);
46  void setPpmFadc(int offset);
47 
49  void setLowerBound(int bound);
50 
52  void setVersion(int minorVersion);
53 
55  static bool isValid(uint32_t word);
56 
57  private:
58  // Packed word bit positions version 1
59  static const int s_wordIdBit = 28;
60  static const int s_ppmLutBit = 8;
61  static const int s_ppmFadcBit = 4;
62  // Packed word bit positions version 2 (no cmms)
63  static const int s_lowerBoundBit = 20;
64  static const int s_ppmLutBitV2 = 9;
65  static const int s_ppmFadcBitV2 = 4;
67  static const uint32_t s_mask = 0xf;
68  // Version 2 masks
69  static const uint32_t s_lowerBoundMask = 0xff;
70  static const uint32_t s_ppmLutMaskV2 = 0x7;
71  static const uint32_t s_ppmFadcMaskV2 = 0x1f;
73  static const int s_version1 = 0x1001;
77  bool m_version2;
78 
79 };
80 
82 {
83  return m_header;
84 }
85 
86 inline int ZdcUserHeader::words() const
87 {
88  return m_header & s_mask;
89 }
90 
91 
92 inline int ZdcUserHeader::ppmLut() const
93 {
95  : (m_header >> s_ppmLutBit ) & s_mask;
96 }
97 
98 inline int ZdcUserHeader::ppmFadc() const
99 {
101  : (m_header >> s_ppmFadcBit ) & s_mask;
102 }
103 
104 inline int ZdcUserHeader::lowerBound() const
105 {
107  : 0;
108 }
109 
110 inline void ZdcUserHeader::setPpmLut(const int offset)
111 {
113  : (s_mask & offset) << s_ppmLutBit;
114 }
115 
116 inline void ZdcUserHeader::setPpmFadc(const int offset)
117 {
119  : (s_mask & offset) << s_ppmFadcBit;
120 }
121 
122 inline void ZdcUserHeader::setLowerBound(const int bound)
123 {
125 }
126 
127 inline void ZdcUserHeader::setVersion(const int minorVersion)
128 {
129  m_version2 = (minorVersion > s_version1);
130 }
131 
132 #endif
ZdcUserHeader::s_version1
static const int s_version1
Version 1 minor format version number.
Definition: ZdcUserHeader.h:73
ZdcUserHeader::s_lowerBoundMask
static const uint32_t s_lowerBoundMask
Definition: ZdcUserHeader.h:69
header
Definition: hcg.cxx:526
ZdcUserHeader::setVersion
void setVersion(int minorVersion)
Set version flag.
Definition: ZdcUserHeader.h:127
ZdcUserHeader::s_ppmFadcMaskV2
static const uint32_t s_ppmFadcMaskV2
Definition: ZdcUserHeader.h:71
ZdcUserHeader::lowerBound
int lowerBound() const
Return FADC lower bound.
Definition: ZdcUserHeader.h:104
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ZdcUserHeader::s_mask
static const uint32_t s_mask
Field mask.
Definition: ZdcUserHeader.h:67
ZdcUserHeader::setPpmFadc
void setPpmFadc(int offset)
Definition: ZdcUserHeader.h:116
ZdcUserHeader::ppmFadc
int ppmFadc() const
Definition: ZdcUserHeader.h:98
ZdcUserHeader::header
uint32_t header() const
Return packed header.
Definition: ZdcUserHeader.h:81
ZdcUserHeader::s_ppmFadcBit
static const int s_ppmFadcBit
Definition: ZdcUserHeader.h:61
ZdcUserHeader::s_ppmFadcBitV2
static const int s_ppmFadcBitV2
Definition: ZdcUserHeader.h:65
ZdcUserHeader::m_version2
bool m_version2
Version flag.
Definition: ZdcUserHeader.h:77
ZdcUserHeader::setLowerBound
void setLowerBound(int bound)
Set FADC lower bound.
Definition: ZdcUserHeader.h:122
ZdcUserHeader::s_ppmLutBit
static const int s_ppmLutBit
ZdcUserHeader.
Definition: ZdcUserHeader.h:60
ZdcUserHeader::s_wordIdBit
static const int s_wordIdBit
Definition: ZdcUserHeader.h:59
ZdcUserHeader::ppmLut
int ppmLut() const
Definition: ZdcUserHeader.h:92
ZdcUserHeader::m_header
uint32_t m_header
Packed Header.
Definition: ZdcUserHeader.h:75
ZdcUserHeader::isValid
static bool isValid(uint32_t word)
Test for valid header word.
Definition: ZdcUserHeader.cxx:43
ZdcUserHeader::s_lowerBoundBit
static const int s_lowerBoundBit
Definition: ZdcUserHeader.h:63
ZdcUserHeader
L1Calo User Header class.
Definition: ZdcUserHeader.h:24
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
ZdcUserHeader::s_ppmLutBitV2
static const int s_ppmLutBitV2
Definition: ZdcUserHeader.h:64
ZdcUserHeader::setPpmLut
void setPpmLut(int offset)
Definition: ZdcUserHeader.h:110
ZdcUserHeader::words
int words() const
Return number of header words (should be one)
Definition: ZdcUserHeader.h:86
ZdcUserHeader::ZdcUserHeader
ZdcUserHeader(uint32_t header=0xf0000001)
Constructor - default just sets word ID and number of header words.
Definition: ZdcUserHeader.cxx:36
ZdcUserHeader::s_ppmLutMaskV2
static const uint32_t s_ppmLutMaskV2
Definition: ZdcUserHeader.h:70