ATLAS Offline Software
CmxJetSubBlock.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_CMXJETSUBBLOCK_H
6 #define TRIGT1CALOBYTESTREAM_CMXJETSUBBLOCK_H
7 
8 #include <stdint.h>
9 #include <vector>
10 
11 #include "CmxSubBlock.h"
12 
13 namespace LVL1BS {
14 
23 class CmxJetSubBlock : public CmxSubBlock {
24 
25 public:
26  enum SourceId { REMOTE_MAIN = 0, LOCAL_MAIN = 1, TOTAL_MAIN = 2,
29  MAX_SOURCE_ID = 11
30  };
31 
34 
36  void clear();
37 
39  unsigned int presenceMap(int slice, int jem) const;
41  int frame(int slice, int jem, int tob) const;
43  int localCoord(int slice, int jem, int tob) const;
45  int energyLarge(int slice, int jem, int tob) const;
47  int energySmall(int slice, int jem, int tob) const;
49  int tobError(int slice, int jem, int tob) const;
51  int parityBits(int slice, int jem) const;
53  unsigned int hits(int slice, int source, int flag) const;
55  int hitsError(int slice, int source, int flag) const;
56 
58  void setPresenceMap(int slice, int jem, unsigned int map);
60  void setTob(int slice, int jem, int frame, int loc,
61  int energyLarge, int energySmall, int error);
63  void setParityBits(int slice, int jem, int parity);
65  void setHits(int slice, int source, int flag, unsigned int hits, int error);
66 
68  bool pack();
70  bool unpack();
71 
72 private:
74  static const int s_wordLength = 32;
75  // TOB bit positions and masks
76  static const int s_tobEnergyLgBit = 0;
77  static const int s_tobEnergySmBit = 10;
78  static const int s_tobErrorBit = 19;
79  static const int s_tobCoordBit = 20;
80  static const int s_tobFrameBit = 22;
81  static const int s_tobJemBit = 25;
82  static const int s_tobWordId = 0;
83  static const uint32_t s_tobEnergyLgMask = 0x3ff;
84  static const uint32_t s_tobEnergySmMask = 0x1ff;
85  static const uint32_t s_tobErrorMask = 0x1;
86  static const uint32_t s_tobCoordMask = 0x3;
87  static const uint32_t s_tobFrameMask = 0x7;
88  static const uint32_t s_tobJemMask = 0xf;
89  // Jet hit and topo counts bit positions and masks
90  static const int s_threshBit = 0;
91  static const int s_threshErrorBit = 16;
92  static const int s_threshHlFlagBit = 19;
93  static const int s_topoHlFlagBit = 24;
94  static const int s_hlFlagBit = 19;
95  static const int s_sourceIdBit = 25;
96  static const int s_dataWordIdBit = 29;
97  static const int s_threshWordId = 1;
98  static const uint32_t s_threshMainMask = 0x7fff;
99  static const uint32_t s_threshFwdLMask = 0xffff;
100  static const uint32_t s_threshFwdHMask = 0x3fff;
101  static const uint32_t s_errorMask = 0x7; // Includes RoI overflow
102  static const uint32_t s_topoCheckMask = 0xffff;
103  static const uint32_t s_topoMapMask = 0xffff;
104  static const uint32_t s_topoCountsMask = 0xffffff;
105  static const uint32_t s_hlFlagMask = 0x1;
106  static const uint32_t s_sourceIdMask = 0xf;
107  static const uint32_t s_dataWordIdMask = 0x7;
108  // Neutral format
109  static const int s_presenceBits = 8;
110  static const int s_coordBits = 2;
111  static const int s_energyLgBits = 10;
112  //static const int s_energySmBits[8] = {3,6,5,4,7,2,9,0};
113  static const int s_energySmBits[8];
114  static const int s_threshMainBits = 15;
115  static const int s_threshFwdLBits = 16;
116  static const int s_threshFwdHBits = 14;
117  static const int s_parityErrorBits = 1;
118  static const int s_roiOverflowBits = 1;
119  static const int s_paddingBits = 31;
120  static const int s_bunchCrossingBits = 12;
121  static const int s_fifoOverflowBits = 1;
122  static const int s_topoChecksumBits = 16;
123  static const int s_topoMapBits = 16;
124  static const int s_topoCountsBits = 24;
125  static const int s_topoPaddingBits = 3;
126  static const int s_glinkPins = 20;
127  static const int s_modules = 16;
128  static const int s_tobsPerModule = 4;
129  static const int s_muxPhases = 4;
130 
131  int dataWordId(uint32_t word) const;
132  int sourceId(uint32_t word) const;
133  int jem(uint32_t word) const;
134  int hlFlag(uint32_t word) const;
135  unsigned int mapIndex(int slice, int jem) const;
136  unsigned int parIndex(int slice, int jem) const;
137  unsigned int tobIndex(int slice, int jem, int tob) const;
138  unsigned int hitIndex(int slice, int source, int flag) const;
139  void resize();
140 
142  bool packNeutral();
144  bool packUncompressed();
146  bool unpackNeutral();
148  bool unpackUncompressed();
149 
151  std::vector<uint32_t> m_tobData;
153  std::vector<uint32_t> m_hitsData;
155  std::vector<unsigned int> m_presenceMaps;
157  std::vector<int> m_parityBits;
159  std::vector<int> m_jemTobCount;
160 
161 };
162 
163 inline int CmxJetSubBlock::dataWordId(const uint32_t word) const
164 {
165  return (word >> s_dataWordIdBit) & s_dataWordIdMask;
166 }
167 
168 inline int CmxJetSubBlock::sourceId(const uint32_t word) const
169 {
170  return (word >> s_sourceIdBit) & s_sourceIdMask;
171 }
172 
173 inline int CmxJetSubBlock::jem(const uint32_t word) const
174 {
175  return (word >> s_tobJemBit) & s_tobJemMask;
176 }
177 
178 inline int CmxJetSubBlock::hlFlag(const uint32_t word) const
179 {
180  uint8_t shift = (((word >> s_sourceIdBit) & s_sourceIdMask) < 7 ? s_threshHlFlagBit : s_topoHlFlagBit);
181  return (word >> shift) & s_hlFlagMask;
182 }
183 // ============================================================================
184 } // end namespace
185 // ============================================================================
186 #endif
LVL1BS::CmxJetSubBlock::s_tobCoordMask
static const uint32_t s_tobCoordMask
Definition: CmxJetSubBlock.h:86
LVL1BS::CmxJetSubBlock::presenceMap
unsigned int presenceMap(int slice, int jem) const
Return presence map for given JEM.
Definition: CmxJetSubBlock.cxx:89
LVL1BS::CmxJetSubBlock::s_sourceIdBit
static const int s_sourceIdBit
Definition: CmxJetSubBlock.h:95
LVL1BS::CmxJetSubBlock::clear
void clear()
Clear all data.
Definition: CmxJetSubBlock.cxx:78
LVL1BS::CmxJetSubBlock::s_hlFlagBit
static const int s_hlFlagBit
Definition: CmxJetSubBlock.h:94
LVL1BS::CmxJetSubBlock::m_tobData
std::vector< uint32_t > m_tobData
TOB data.
Definition: CmxJetSubBlock.h:151
LVL1BS::CmxJetSubBlock::s_tobEnergySmMask
static const uint32_t s_tobEnergySmMask
Definition: CmxJetSubBlock.h:84
LVL1BS::CmxJetSubBlock::LOCAL_FORWARD
@ LOCAL_FORWARD
Definition: CmxJetSubBlock.h:27
LVL1BS::CmxJetSubBlock::s_tobCoordBit
static const int s_tobCoordBit
Definition: CmxJetSubBlock.h:79
LVL1BS::CmxJetSubBlock::frame
int frame(int slice, int jem, int tob) const
Return frame for given jem and tob.
Definition: CmxJetSubBlock.cxx:100
LVL1BS::CmxJetSubBlock::setTob
void setTob(int slice, int jem, int frame, int loc, int energyLarge, int energySmall, int error)
Store TOB (RoI) data for given JEM, frame, local coord.
Definition: CmxJetSubBlock.cxx:220
LVL1BS::CmxJetSubBlock::s_threshMainBits
static const int s_threshMainBits
Definition: CmxJetSubBlock.h:114
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
LVL1BS::CmxJetSubBlock::s_presenceBits
static const int s_presenceBits
Definition: CmxJetSubBlock.h:109
LVL1BS::CmxJetSubBlock::s_tobJemMask
static const uint32_t s_tobJemMask
Definition: CmxJetSubBlock.h:88
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1BS::CmxJetSubBlock::s_roiOverflowBits
static const int s_roiOverflowBits
Definition: CmxJetSubBlock.h:118
LVL1BS::CmxJetSubBlock::TOPO_OCCUPANCY_COUNTS
@ TOPO_OCCUPANCY_COUNTS
Definition: CmxJetSubBlock.h:28
LVL1BS::CmxJetSubBlock::parityBits
int parityBits(int slice, int jem) const
Return parity bits for given JEM.
Definition: CmxJetSubBlock.cxx:160
LVL1BS::CmxJetSubBlock::unpack
bool unpack()
Unpack data.
Definition: CmxJetSubBlock.cxx:317
LVL1BS::CmxJetSubBlock::s_threshFwdLBits
static const int s_threshFwdLBits
Definition: CmxJetSubBlock.h:115
LVL1BS::CmxJetSubBlock::s_tobFrameBit
static const int s_tobFrameBit
Definition: CmxJetSubBlock.h:80
LVL1BS::CmxJetSubBlock::s_topoMapBits
static const int s_topoMapBits
Definition: CmxJetSubBlock.h:123
LVL1BS::CmxJetSubBlock::MAX_SOURCE_ID
@ MAX_SOURCE_ID
Definition: CmxJetSubBlock.h:29
LVL1BS::CmxSubBlock
Sub-Block class for CMX data post LS1.
Definition: CmxSubBlock.h:22
LVL1BS::CmxJetSubBlock::energyLarge
int energyLarge(int slice, int jem, int tob) const
Return energy large window size for given jem and tob.
Definition: CmxJetSubBlock.cxx:124
LVL1BS::L1CaloSubBlock::slice
int slice() const
Definition: L1CaloSubBlock.h:258
LVL1BS::CmxJetSubBlock::s_energyLgBits
static const int s_energyLgBits
Definition: CmxJetSubBlock.h:111
LVL1BS::CmxJetSubBlock::s_topoCheckMask
static const uint32_t s_topoCheckMask
Definition: CmxJetSubBlock.h:102
LVL1BS::CmxJetSubBlock::s_tobEnergySmBit
static const int s_tobEnergySmBit
Definition: CmxJetSubBlock.h:77
LVL1BS::CmxJetSubBlock::s_topoPaddingBits
static const int s_topoPaddingBits
Definition: CmxJetSubBlock.h:125
LVL1BS::CmxJetSubBlock::s_sourceIdMask
static const uint32_t s_sourceIdMask
Definition: CmxJetSubBlock.h:106
LVL1BS::CmxJetSubBlock::hitIndex
unsigned int hitIndex(int slice, int source, int flag) const
Definition: CmxJetSubBlock.cxx:374
LVL1BS::CmxJetSubBlock::s_threshFwdHMask
static const uint32_t s_threshFwdHMask
Definition: CmxJetSubBlock.h:100
LVL1BS::CmxJetSubBlock::TOPO_CHECKSUM
@ TOPO_CHECKSUM
Definition: CmxJetSubBlock.h:28
LVL1BS::CmxJetSubBlock::s_tobFrameMask
static const uint32_t s_tobFrameMask
Definition: CmxJetSubBlock.h:87
LVL1BS::CmxJetSubBlock::s_threshFwdHBits
static const int s_threshFwdHBits
Definition: CmxJetSubBlock.h:116
LVL1BS::CmxJetSubBlock::s_threshBit
static const int s_threshBit
Definition: CmxJetSubBlock.h:90
LVL1BS::CmxJetSubBlock::unpackUncompressed
bool unpackUncompressed()
Unpack uncompressed data.
Definition: CmxJetSubBlock.cxx:595
LVL1BS::CmxJetSubBlock::s_energySmBits
static const int s_energySmBits[8]
Definition: CmxJetSubBlock.h:113
LVL1BS::CmxJetSubBlock::hits
unsigned int hits(int slice, int source, int flag) const
Return hit/topo counts for given source ID and HL flag.
Definition: CmxJetSubBlock.cxx:170
LVL1BS::CmxJetSubBlock::dataWordId
int dataWordId(uint32_t word) const
Definition: CmxJetSubBlock.h:163
LVL1BS::CmxJetSubBlock::localCoord
int localCoord(int slice, int jem, int tob) const
Return Local coordinate for given jem and tob.
Definition: CmxJetSubBlock.cxx:112
LVL1BS::CmxJetSubBlock::s_tobEnergyLgBit
static const int s_tobEnergyLgBit
Definition: CmxJetSubBlock.h:76
LVL1BS::CmxJetSubBlock::s_paddingBits
static const int s_paddingBits
Definition: CmxJetSubBlock.h:119
master.flag
bool flag
Definition: master.py:29
LVL1BS::CmxJetSubBlock::packUncompressed
bool packUncompressed()
Pack uncompressed data.
Definition: CmxJetSubBlock.cxx:481
CmxSubBlock.h
LVL1BS::CmxJetSubBlock::s_dataWordIdBit
static const int s_dataWordIdBit
Definition: CmxJetSubBlock.h:96
LVL1BS::CmxJetSubBlock::CmxJetSubBlock
CmxJetSubBlock()
Definition: CmxJetSubBlock.cxx:68
LVL1BS::CmxJetSubBlock::s_tobErrorMask
static const uint32_t s_tobErrorMask
Definition: CmxJetSubBlock.h:85
LVL1BS::CmxJetSubBlock::s_tobJemBit
static const int s_tobJemBit
Definition: CmxJetSubBlock.h:81
LVL1BS::CmxJetSubBlock::tobIndex
unsigned int tobIndex(int slice, int jem, int tob) const
Definition: CmxJetSubBlock.cxx:364
LVL1BS::CmxJetSubBlock::s_threshHlFlagBit
static const int s_threshHlFlagBit
Definition: CmxJetSubBlock.h:92
LVL1BS::CmxJetSubBlock::s_wordLength
static const int s_wordLength
Data word length.
Definition: CmxJetSubBlock.h:74
LVL1BS::CmxJetSubBlock::s_tobEnergyLgMask
static const uint32_t s_tobEnergyLgMask
Definition: CmxJetSubBlock.h:83
LVL1BS::CmxJetSubBlock::s_tobWordId
static const int s_tobWordId
Definition: CmxJetSubBlock.h:82
LVL1BS::CmxJetSubBlock::TOPO_OCCUPANCY_MAP
@ TOPO_OCCUPANCY_MAP
Definition: CmxJetSubBlock.h:28
LVL1BS::CmxJetSubBlock::jem
int jem(uint32_t word) const
Definition: CmxJetSubBlock.h:173
LVL1BS::CmxJetSubBlock::s_dataWordIdMask
static const uint32_t s_dataWordIdMask
Definition: CmxJetSubBlock.h:107
LVL1BS::CmxJetSubBlock::s_muxPhases
static const int s_muxPhases
Definition: CmxJetSubBlock.h:129
LVL1BS::CmxJetSubBlock::pack
bool pack()
Pack data.
Definition: CmxJetSubBlock.cxx:294
LVL1BS::CmxJetSubBlock::m_presenceMaps
std::vector< unsigned int > m_presenceMaps
Presence maps.
Definition: CmxJetSubBlock.h:155
LVL1BS::CmxJetSubBlock::REMOTE_MAIN
@ REMOTE_MAIN
Definition: CmxJetSubBlock.h:26
LVL1BS::CmxJetSubBlock::m_parityBits
std::vector< int > m_parityBits
Parity data for neutral format.
Definition: CmxJetSubBlock.h:157
LVL1BS::CmxJetSubBlock::s_topoHlFlagBit
static const int s_topoHlFlagBit
Definition: CmxJetSubBlock.h:93
LVL1BS::CmxJetSubBlock
Sub-Block class for CMX-Jet data post LS1.
Definition: CmxJetSubBlock.h:23
LVL1BS::CmxJetSubBlock::s_threshWordId
static const int s_threshWordId
Definition: CmxJetSubBlock.h:97
LVL1BS::CmxJetSubBlock::tobError
int tobError(int slice, int jem, int tob) const
Return error bit for given jem and tob.
Definition: CmxJetSubBlock.cxx:148
LVL1BS::CmxJetSubBlock::m_jemTobCount
std::vector< int > m_jemTobCount
JEM TOB count vector for unpacking.
Definition: CmxJetSubBlock.h:159
LVL1BS::CmxJetSubBlock::SourceId
SourceId
Definition: CmxJetSubBlock.h:26
LVL1BS::CmxJetSubBlock::~CmxJetSubBlock
~CmxJetSubBlock()
Definition: CmxJetSubBlock.cxx:72
LVL1BS::CmxJetSubBlock::s_bunchCrossingBits
static const int s_bunchCrossingBits
Definition: CmxJetSubBlock.h:120
LVL1BS::CmxJetSubBlock::s_tobErrorBit
static const int s_tobErrorBit
Definition: CmxJetSubBlock.h:78
LVL1BS::CmxJetSubBlock::setPresenceMap
void setPresenceMap(int slice, int jem, unsigned int map)
Store presence map.
Definition: CmxJetSubBlock.cxx:208
LVL1BS::CmxJetSubBlock::s_topoCountsBits
static const int s_topoCountsBits
Definition: CmxJetSubBlock.h:124
LVL1BS::CmxJetSubBlock::s_topoChecksumBits
static const int s_topoChecksumBits
Definition: CmxJetSubBlock.h:122
LVL1BS::CmxJetSubBlock::setParityBits
void setParityBits(int slice, int jem, int parity)
Store parity bits for neutral format.
Definition: CmxJetSubBlock.cxx:256
LVL1BS::CmxJetSubBlock::mapIndex
unsigned int mapIndex(int slice, int jem) const
Definition: CmxJetSubBlock.cxx:344
LVL1BS::CmxJetSubBlock::TOTAL_FORWARD
@ TOTAL_FORWARD
Definition: CmxJetSubBlock.h:27
LVL1BS::CmxJetSubBlock::TOTAL_MAIN
@ TOTAL_MAIN
Definition: CmxJetSubBlock.h:26
LVL1BS::CmxJetSubBlock::unpackNeutral
bool unpackNeutral()
Unpack neutral data.
Definition: CmxJetSubBlock.cxx:496
LVL1BS::CmxJetSubBlock::REMOTE_FORWARD
@ REMOTE_FORWARD
Definition: CmxJetSubBlock.h:27
LVL1BS::CmxJetSubBlock::s_threshMainMask
static const uint32_t s_threshMainMask
Definition: CmxJetSubBlock.h:98
LVL1BS::CmxJetSubBlock::sourceId
int sourceId(uint32_t word) const
Definition: CmxJetSubBlock.h:168
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
LVL1BS::CmxJetSubBlock::s_errorMask
static const uint32_t s_errorMask
Definition: CmxJetSubBlock.h:101
LVL1BS::CmxJetSubBlock::s_parityErrorBits
static const int s_parityErrorBits
Definition: CmxJetSubBlock.h:117
LVL1BS::CmxJetSubBlock::s_glinkPins
static const int s_glinkPins
Definition: CmxJetSubBlock.h:126
LVL1BS::CmxJetSubBlock::s_threshErrorBit
static const int s_threshErrorBit
Definition: CmxJetSubBlock.h:91
LVL1BS::CmxJetSubBlock::s_coordBits
static const int s_coordBits
Definition: CmxJetSubBlock.h:110
copySelective.source
string source
Definition: copySelective.py:32
LVL1BS::CmxJetSubBlock::s_topoMapMask
static const uint32_t s_topoMapMask
Definition: CmxJetSubBlock.h:103
LVL1BS::CmxJetSubBlock::resize
void resize()
Definition: CmxJetSubBlock.cxx:384
LVL1BS::CmxJetSubBlock::hlFlag
int hlFlag(uint32_t word) const
Definition: CmxJetSubBlock.h:178
LVL1BS::CmxJetSubBlock::packNeutral
bool packNeutral()
Pack neutral data.
Definition: CmxJetSubBlock.cxx:406
LVL1BS::CmxJetSubBlock::setHits
void setHits(int slice, int source, int flag, unsigned int hits, int error)
Store hit counts for given source ID and HL flag.
Definition: CmxJetSubBlock.cxx:268
LVL1BS::CmxJetSubBlock::s_tobsPerModule
static const int s_tobsPerModule
Definition: CmxJetSubBlock.h:128
LVL1BS::CmxJetSubBlock::s_threshFwdLMask
static const uint32_t s_threshFwdLMask
Definition: CmxJetSubBlock.h:99
error
Definition: IImpactPoint3dEstimator.h:70
LVL1BS::CmxJetSubBlock::s_topoCountsMask
static const uint32_t s_topoCountsMask
Definition: CmxJetSubBlock.h:104
LVL1BS::CmxJetSubBlock::hitsError
int hitsError(int slice, int source, int flag) const
Return hit error for given source ID and HL flag.
Definition: CmxJetSubBlock.cxx:191
LVL1BS::CmxJetSubBlock::s_modules
static const int s_modules
Definition: CmxJetSubBlock.h:127
LVL1BS::CmxJetSubBlock::s_fifoOverflowBits
static const int s_fifoOverflowBits
Definition: CmxJetSubBlock.h:121
LVL1BS::CmxJetSubBlock::s_hlFlagMask
static const uint32_t s_hlFlagMask
Definition: CmxJetSubBlock.h:105
LVL1BS::CmxJetSubBlock::energySmall
int energySmall(int slice, int jem, int tob) const
Return energy small window size for given jem and tob.
Definition: CmxJetSubBlock.cxx:136
LVL1BS::CmxJetSubBlock::m_hitsData
std::vector< uint32_t > m_hitsData
Hits and topo data.
Definition: CmxJetSubBlock.h:153
LVL1BS::CmxJetSubBlock::parIndex
unsigned int parIndex(int slice, int jem) const
Definition: CmxJetSubBlock.cxx:354
LVL1BS::CmxJetSubBlock::LOCAL_MAIN
@ LOCAL_MAIN
Definition: CmxJetSubBlock.h:26