ATLAS Offline Software
Loading...
Searching...
No Matches
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
10namespace 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;
83 uint32_t m_header;
86
87};
88
89inline uint32_t L1CaloUserHeader::header() const
90{
91 return m_header;
92}
93
94inline int L1CaloUserHeader::words() const
95{
96 return m_header & s_mask;
97}
98
99inline int L1CaloUserHeader::jepCmm() const
100{
101 return (m_version2) ? (m_header >> s_jemBit ) & s_mask
102 : (m_header >> s_jepCmmBit) & s_mask;
103}
104
105inline int L1CaloUserHeader::cpCmm() const
106{
107 return (m_version2) ? (m_header >> s_cpmBit ) & s_mask
108 : (m_header >> s_cpCmmBit) & s_mask;
109}
110
111inline int L1CaloUserHeader::jem() const
112{
113 return (m_header >> s_jemBit) & s_mask;
114}
115
116inline int L1CaloUserHeader::cpm() const
117{
118 return (m_header >> s_cpmBit) & s_mask;
119}
120
121inline int L1CaloUserHeader::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
139inline void L1CaloUserHeader::setJepCmm(const int offset)
140{
141 if (!m_version2) m_header |= (s_mask & offset) << s_jepCmmBit;
142}
143
144inline void L1CaloUserHeader::setCpCmm(const int offset)
145{
146 if (!m_version2) m_header |= (s_mask & offset) << s_cpCmmBit;
147}
148
149inline void L1CaloUserHeader::setJem(const int offset)
150{
151 m_header |= (s_mask & offset) << s_jemBit;
152}
153
154inline void L1CaloUserHeader::setCpm(const int offset)
155{
156 m_header |= (s_mask & offset) << s_cpmBit;
157}
158
159inline void L1CaloUserHeader::setPpmLut(const int offset)
160{
162 : (s_mask & offset) << s_ppmLutBit;
163}
164
165inline void L1CaloUserHeader::setPpmFadc(const int offset)
166{
168 : (s_mask & offset) << s_ppmFadcBit;
169}
170
171inline void L1CaloUserHeader::setLowerBound(const int bound)
172{
174}
175
176inline void L1CaloUserHeader::setVersion(const int minorVersion)
177{
178 m_version2 = (minorVersion > s_version1);
179}
180
181} // end namespace
182
183#endif
uint32_t m_header
Packed Header.
static bool isValid(uint32_t word)
Test for valid header word.
static const uint32_t s_ppmLutMaskV2
bool m_version2
Version flag.
L1CaloUserHeader(uint32_t header=0xf0000001)
Constructor - default just sets word ID and number of header words.
void setVersion(int minorVersion)
Set version flag.
static const uint32_t s_lowerBoundMask
static const uint32_t s_ppmFadcMaskV2
static const int s_ppmFadcBit
int lowerBound() const
Return FADC lower bound.
static const uint32_t s_mask
Field mask.
static const int s_ppmLutBit
static const int s_jepCmmBit
static const int s_cpCmmBit
static const int s_ppmLutBitV2
static const int s_lowerBoundBit
static const int s_version1
Version 1 minor format version number.
int words() const
Return number of header words (should be one)
uint32_t header() const
Return packed header.
void setLowerBound(int bound)
Set FADC lower bound.
static const int s_ppmFadcBitV2
static const int s_wordIdBit