ATLAS Offline Software
Loading...
Searching...
No Matches
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
23
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;
75 uint32_t m_header;
78
79};
80
81inline uint32_t ZdcUserHeader::header() const
82{
83 return m_header;
84}
85
86inline int ZdcUserHeader::words() const
87{
88 return m_header & s_mask;
89}
90
91
92inline int ZdcUserHeader::ppmLut() const
93{
95 : (m_header >> s_ppmLutBit ) & s_mask;
96}
97
98inline int ZdcUserHeader::ppmFadc() const
99{
101 : (m_header >> s_ppmFadcBit ) & s_mask;
102}
103
105{
107 : 0;
108}
109
110inline void ZdcUserHeader::setPpmLut(const int offset)
111{
113 : (s_mask & offset) << s_ppmLutBit;
114}
115
116inline void ZdcUserHeader::setPpmFadc(const int offset)
117{
119 : (s_mask & offset) << s_ppmFadcBit;
120}
121
122inline void ZdcUserHeader::setLowerBound(const int bound)
123{
125}
126
127inline void ZdcUserHeader::setVersion(const int minorVersion)
128{
129 m_version2 = (minorVersion > s_version1);
130}
131
132#endif
static const int s_ppmLutBit
ZdcUserHeader.
int words() const
Return number of header words (should be one)
static const uint32_t s_lowerBoundMask
int ppmLut() const
static const int s_ppmLutBitV2
static const int s_wordIdBit
static bool isValid(uint32_t word)
Test for valid header word.
void setPpmLut(int offset)
static const uint32_t s_ppmFadcMaskV2
static const int s_lowerBoundBit
static const int s_ppmFadcBitV2
uint32_t header() const
Return packed header.
void setPpmFadc(int offset)
static const int s_version1
Version 1 minor format version number.
static const uint32_t s_mask
Field mask.
int lowerBound() const
Return FADC lower bound.
bool m_version2
Version flag.
static const uint32_t s_ppmLutMaskV2
static const int s_ppmFadcBit
void setLowerBound(int bound)
Set FADC lower bound.
ZdcUserHeader(uint32_t header=0xf0000001)
Constructor - default just sets word ID and number of header words.
void setVersion(int minorVersion)
Set version flag.
uint32_t m_header
Packed Header.
int ppmFadc() const