ATLAS Offline Software
CmxCpSubBlock.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_CMXCPSUBBLOCK_H
6 #define TRIGT1CALOBYTESTREAM_CMXCPSUBBLOCK_H
7 
8 #include <stdint.h>
9 #include <vector>
10 
11 #include "CmxSubBlock.h"
12 
13 namespace LVL1BS {
14 
23 class CmxCpSubBlock : public CmxSubBlock {
24 
25  public:
26 
31 
32  CmxCpSubBlock();
34 
36  void clear();
37 
39  unsigned int presenceMap(int slice, int cpm) const;
41  int chip(int slice, int cpm, int tob) const;
43  int localCoord(int slice, int cpm, int tob) const;
45  int isolation(int slice, int cpm, int tob) const;
47  int energy(int slice, int cpm, int tob) const;
49  int tobError(int slice, int cpm, int tob) const;
51  unsigned int hits(int slice, int source, int flag) const;
53  int hitsError(int slice, int source, int flag) const;
55  int roiOverflow(int slice, int source) const;
56 
58  void setPresenceMap(int slice, int cpm, unsigned int map);
60  void setTob(int slice, int cpm, int chip, int loc, // NB chip and loc 4 and 2 bits here, as in diagram
61  int energy, int isol, int error);
63  void setHits(int slice, int source, int flag, unsigned int hits, int error);
65  void setRoiOverflow(int slice, int source, int overflow);
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_tobEnergyBit = 0;
77  static const int s_tobIsolationBit = 8;
78  static const int s_tobErrorBit = 13;
79  static const int s_tobOverflowBit = 18;
80  static const int s_tobCoordBit = 19;
81  static const int s_tobChipBit = 21;
82  static const int s_tobCpmBit = 25;
83  static const int s_tobWordId = 0;
84  static const uint32_t s_tobEnergyMask = 0xff;
85  static const uint32_t s_tobIsolationMask = 0x1f;
86  static const uint32_t s_tobErrorMask = 0x3f; // includes RoI overflow
87  static const uint32_t s_tobCoordMask = 0x3;
88  static const uint32_t s_tobChipMask = 0xf;
89  static const uint32_t s_tobCpmMask = 0xf;
90  // EM/Tau hit and topo counts bit positions and masks
91  static const int s_threshBit = 0;
92  static const int s_threshErrorBit = 24;
93  static const int s_hlFlagBit = 25;
94  static const int s_sourceIdBit = 26;
95  static const int s_dataWordIdBit = 29;
96  static const int s_threshWordId = 1;
97  static const uint32_t s_threshMask = 0xffffff;
98  static const uint32_t s_errorMask = 0x1;
99  static const uint32_t s_hlFlagMask = 0x1;
100  static const uint32_t s_sourceIdMask = 0x7;
101  static const uint32_t s_dataWordIdMask = 0x7;
102  // Neutral format
103  static const int s_presenceBits = 16;
104  static const int s_coordBits = 2;
105  static const int s_isolationBits = 5;
106  static const int s_parityErrorBits = 1;
107  static const int s_parityErrorMask = 0x1;
108  static const int s_energyBits = 8;
109  static const int s_hitsBits = 24;
110  static const int s_hitsErrorBits = 1;
111  static const int s_roiOverflowBits = 1;
112  static const int s_paddingBits = 45;
113  static const int s_bunchCrossingBits = 12;
114  static const int s_fifoOverflowBits = 1;
115  static const int s_topoChecksumBits = 16;
116  static const int s_topoMapBits = 14;
117  static const int s_topoCountsBits = 21;
118  static const int s_topoPaddingBits = 11;
119  static const int s_glinkPins = 20;
120  static const int s_modules = 14;
121  static const int s_tobsPerModule = 5;
122  static const int s_muxPhases = 4;
123 
124  int dataWordId(uint32_t word) const;
125  int sourceId(uint32_t word) const;
126  int cpm(uint32_t word) const;
127  int hlFlag(uint32_t word) const;
128  unsigned int mapIndex(int slice, int cpm) const;
129  unsigned int tobIndex(int slice, int cpm, int tob) const;
130  unsigned int hitIndex(int slice, int source, int flag) const;
131  unsigned int ovfIndex(int slice, int source) const;
132  void resize();
133 
135  bool packNeutral();
137  bool packUncompressed();
139  bool unpackNeutral();
141  bool unpackUncompressed();
142 
144  std::vector<uint32_t> m_tobData;
146  std::vector<uint32_t> m_hitsData;
148  std::vector<unsigned int> m_presenceMaps;
150  std::vector<int> m_cpmTobCount;
152  std::vector<int> m_overflow;
153 
154 };
155 
156 inline int CmxCpSubBlock::dataWordId(const uint32_t word) const
157 {
158  return (word >> s_dataWordIdBit) & s_dataWordIdMask;
159 }
160 
161 inline int CmxCpSubBlock::sourceId(const uint32_t word) const
162 {
163  return (word >> s_sourceIdBit) & s_sourceIdMask;
164 }
165 
166 inline int CmxCpSubBlock::cpm(const uint32_t word) const
167 {
168  return (word >> s_tobCpmBit) & s_tobCpmMask;
169 }
170 
171 inline int CmxCpSubBlock::hlFlag(const uint32_t word) const
172 {
173  return (word >> s_hlFlagBit) & s_hlFlagMask;
174 }
175 
176 } // end namespace
177 
178 #endif
LVL1BS::CmxCpSubBlock::s_bunchCrossingBits
static const int s_bunchCrossingBits
Definition: CmxCpSubBlock.h:113
LVL1BS::CmxCpSubBlock::localCoord
int localCoord(int slice, int cpm, int tob) const
Return Local coordinate for given cpm and tob.
Definition: CmxCpSubBlock.cxx:107
LVL1BS::CmxCpSubBlock::s_fifoOverflowBits
static const int s_fifoOverflowBits
Definition: CmxCpSubBlock.h:114
LVL1BS::CmxCpSubBlock::TOPO_CHECKSUM
@ TOPO_CHECKSUM
Definition: CmxCpSubBlock.h:29
LVL1BS::CmxCpSubBlock::s_topoChecksumBits
static const int s_topoChecksumBits
Definition: CmxCpSubBlock.h:115
LVL1BS::CmxCpSubBlock::s_sourceIdMask
static const uint32_t s_sourceIdMask
Definition: CmxCpSubBlock.h:100
LVL1BS::CmxCpSubBlock::clear
void clear()
Clear all data.
Definition: CmxCpSubBlock.cxx:73
LVL1BS::CmxCpSubBlock::hitIndex
unsigned int hitIndex(int slice, int source, int flag) const
Definition: CmxCpSubBlock.cxx:339
LVL1BS::CmxCpSubBlock::s_hitsErrorBits
static const int s_hitsErrorBits
Definition: CmxCpSubBlock.h:110
LVL1BS::CmxCpSubBlock::s_threshWordId
static const int s_threshWordId
Definition: CmxCpSubBlock.h:96
LVL1BS::CmxCpSubBlock::hlFlag
int hlFlag(uint32_t word) const
Definition: CmxCpSubBlock.h:171
LVL1BS::CmxCpSubBlock::s_tobsPerModule
static const int s_tobsPerModule
Definition: CmxCpSubBlock.h:121
LVL1BS::CmxCpSubBlock::REMOTE_2
@ REMOTE_2
Definition: CmxCpSubBlock.h:28
LVL1BS::CmxCpSubBlock::ovfIndex
unsigned int ovfIndex(int slice, int source) const
Definition: CmxCpSubBlock.cxx:349
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1BS::CmxCpSubBlock::m_hitsData
std::vector< uint32_t > m_hitsData
Hits and topo data.
Definition: CmxCpSubBlock.h:146
LVL1BS::CmxCpSubBlock::s_tobWordId
static const int s_tobWordId
Definition: CmxCpSubBlock.h:83
LVL1BS::CmxCpSubBlock::isolation
int isolation(int slice, int cpm, int tob) const
Return isolation for given cpm and tob.
Definition: CmxCpSubBlock.cxx:119
LVL1BS::CmxCpSubBlock::sourceId
int sourceId(uint32_t word) const
Definition: CmxCpSubBlock.h:161
LVL1BS::CmxCpSubBlock::LOCAL
@ LOCAL
Definition: CmxCpSubBlock.h:28
LVL1BS::CmxCpSubBlock::presenceMap
unsigned int presenceMap(int slice, int cpm) const
Return presence map for given CPM.
Definition: CmxCpSubBlock.cxx:84
LVL1BS::CmxCpSubBlock::s_muxPhases
static const int s_muxPhases
Definition: CmxCpSubBlock.h:122
LVL1BS::CmxCpSubBlock::cpm
int cpm(uint32_t word) const
Definition: CmxCpSubBlock.h:166
LVL1BS::CmxCpSubBlock::resize
void resize()
Definition: CmxCpSubBlock.cxx:358
LVL1BS::CmxCpSubBlock::setPresenceMap
void setPresenceMap(int slice, int cpm, unsigned int map)
Store presence map.
Definition: CmxCpSubBlock.cxx:191
LVL1BS::CmxSubBlock
Sub-Block class for CMX data post LS1.
Definition: CmxSubBlock.h:22
LVL1BS::CmxCpSubBlock::TOTAL
@ TOTAL
Definition: CmxCpSubBlock.h:28
LVL1BS::CmxCpSubBlock::s_roiOverflowBits
static const int s_roiOverflowBits
Definition: CmxCpSubBlock.h:111
LVL1BS::CmxCpSubBlock::tobError
int tobError(int slice, int cpm, int tob) const
Return error bits for given cpm and tob.
Definition: CmxCpSubBlock.cxx:143
LVL1BS::CmxCpSubBlock::s_topoCountsBits
static const int s_topoCountsBits
Definition: CmxCpSubBlock.h:117
LVL1BS::CmxCpSubBlock::s_tobOverflowBit
static const int s_tobOverflowBit
Definition: CmxCpSubBlock.h:79
LVL1BS::CmxCpSubBlock::s_hitsBits
static const int s_hitsBits
Definition: CmxCpSubBlock.h:109
LVL1BS::L1CaloSubBlock::slice
int slice() const
Definition: L1CaloSubBlock.h:258
LVL1BS::CmxCpSubBlock::s_energyBits
static const int s_energyBits
Definition: CmxCpSubBlock.h:108
LVL1BS::CmxCpSubBlock::s_tobErrorBit
static const int s_tobErrorBit
Definition: CmxCpSubBlock.h:78
LVL1BS::CmxCpSubBlock::hits
unsigned int hits(int slice, int source, int flag) const
Return hit/topo counts for given source ID and HL flag.
Definition: CmxCpSubBlock.cxx:155
LVL1BS::CmxCpSubBlock::s_coordBits
static const int s_coordBits
Definition: CmxCpSubBlock.h:104
LVL1BS::CmxCpSubBlock::s_parityErrorMask
static const int s_parityErrorMask
Definition: CmxCpSubBlock.h:107
LVL1BS::CmxCpSubBlock::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: CmxCpSubBlock.cxx:239
LVL1BS::CmxCpSubBlock::SourceId
SourceId
Sources of threshold sums.
Definition: CmxCpSubBlock.h:28
LVL1BS::CmxCpSubBlock::setTob
void setTob(int slice, int cpm, int chip, int loc, int energy, int isol, int error)
Store TOB (RoI) data for given CPM, chip, local coord.
Definition: CmxCpSubBlock.cxx:203
LVL1BS::CmxCpSubBlock::s_tobCoordMask
static const uint32_t s_tobCoordMask
Definition: CmxCpSubBlock.h:87
LVL1BS::CmxCpSubBlock::s_errorMask
static const uint32_t s_errorMask
Definition: CmxCpSubBlock.h:98
LVL1BS::CmxCpSubBlock::s_topoPaddingBits
static const int s_topoPaddingBits
Definition: CmxCpSubBlock.h:118
LVL1BS::CmxCpSubBlock::packNeutral
bool packNeutral()
Pack neutral data.
Definition: CmxCpSubBlock.cxx:380
LVL1BS::CmxCpSubBlock::m_cpmTobCount
std::vector< int > m_cpmTobCount
CPM TOB count vector for unpacking.
Definition: CmxCpSubBlock.h:150
LVL1BS::CmxCpSubBlock::unpackNeutral
bool unpackNeutral()
Unpack neutral data.
Definition: CmxCpSubBlock.cxx:482
LVL1BS::CmxCpSubBlock::m_overflow
std::vector< int > m_overflow
RoI overflows for neutral data.
Definition: CmxCpSubBlock.h:152
LVL1BS::CmxCpSubBlock::s_presenceBits
static const int s_presenceBits
Definition: CmxCpSubBlock.h:103
LVL1BS::CmxCpSubBlock::m_presenceMaps
std::vector< unsigned int > m_presenceMaps
Presence maps.
Definition: CmxCpSubBlock.h:148
LVL1BS::CmxCpSubBlock::hitsError
int hitsError(int slice, int source, int flag) const
Return hit error for given source ID and HL flag.
Definition: CmxCpSubBlock.cxx:168
master.flag
bool flag
Definition: master.py:29
CmxSubBlock.h
LVL1BS::CmxCpSubBlock::unpackUncompressed
bool unpackUncompressed()
Unpack uncompressed data.
Definition: CmxCpSubBlock.cxx:583
LVL1BS::CmxCpSubBlock::mapIndex
unsigned int mapIndex(int slice, int cpm) const
Definition: CmxCpSubBlock.cxx:319
LVL1BS::CmxCpSubBlock::pack
bool pack()
Pack data.
Definition: CmxCpSubBlock.cxx:269
LVL1BS::CmxCpSubBlock
Sub-Block class for CMX-CP data post LS1.
Definition: CmxCpSubBlock.h:23
LVL1BS::CmxCpSubBlock::REMOTE_0
@ REMOTE_0
Definition: CmxCpSubBlock.h:28
LVL1BS::CmxCpSubBlock::s_hlFlagMask
static const uint32_t s_hlFlagMask
Definition: CmxCpSubBlock.h:99
LVL1BS::CmxCpSubBlock::setRoiOverflow
void setRoiOverflow(int slice, int source, int overflow)
Store RoI overflow for given source ID.
Definition: CmxCpSubBlock.cxx:257
LVL1BS::CmxCpSubBlock::packUncompressed
bool packUncompressed()
Pack uncompressed data.
Definition: CmxCpSubBlock.cxx:467
LVL1BS::CmxCpSubBlock::roiOverflow
int roiOverflow(int slice, int source) const
Return RoI overflow for given source ID.
Definition: CmxCpSubBlock.cxx:181
LVL1BS::CmxCpSubBlock::s_modules
static const int s_modules
Definition: CmxCpSubBlock.h:120
LVL1BS::CmxCpSubBlock::chip
int chip(int slice, int cpm, int tob) const
Return chip for given cpm and tob.
Definition: CmxCpSubBlock.cxx:95
LVL1BS::CmxCpSubBlock::dataWordId
int dataWordId(uint32_t word) const
Definition: CmxCpSubBlock.h:156
LVL1BS::CmxCpSubBlock::s_tobCpmBit
static const int s_tobCpmBit
Definition: CmxCpSubBlock.h:82
LVL1BS::CmxCpSubBlock::s_tobEnergyBit
static const int s_tobEnergyBit
Definition: CmxCpSubBlock.h:76
LVL1BS::CmxCpSubBlock::TOPO_OCCUPANCY_COUNTS
@ TOPO_OCCUPANCY_COUNTS
Definition: CmxCpSubBlock.h:29
LVL1BS::CmxCpSubBlock::m_tobData
std::vector< uint32_t > m_tobData
TOB data.
Definition: CmxCpSubBlock.h:144
LVL1BS::CmxCpSubBlock::s_hlFlagBit
static const int s_hlFlagBit
Definition: CmxCpSubBlock.h:93
LVL1BS::CmxCpSubBlock::s_dataWordIdMask
static const uint32_t s_dataWordIdMask
Definition: CmxCpSubBlock.h:101
LVL1BS::CmxCpSubBlock::s_glinkPins
static const int s_glinkPins
Definition: CmxCpSubBlock.h:119
LVL1BS::CmxCpSubBlock::s_threshErrorBit
static const int s_threshErrorBit
Definition: CmxCpSubBlock.h:92
LVL1BS::CmxCpSubBlock::tobIndex
unsigned int tobIndex(int slice, int cpm, int tob) const
Definition: CmxCpSubBlock.cxx:329
LVL1BS::CmxCpSubBlock::s_tobIsolationMask
static const uint32_t s_tobIsolationMask
Definition: CmxCpSubBlock.h:85
LVL1BS::CmxCpSubBlock::s_sourceIdBit
static const int s_sourceIdBit
Definition: CmxCpSubBlock.h:94
LVL1BS::CmxCpSubBlock::s_tobCoordBit
static const int s_tobCoordBit
Definition: CmxCpSubBlock.h:80
LVL1BS::CmxCpSubBlock::s_tobIsolationBit
static const int s_tobIsolationBit
Definition: CmxCpSubBlock.h:77
LVL1BS::CmxCpSubBlock::REMOTE_1
@ REMOTE_1
Definition: CmxCpSubBlock.h:28
LVL1BS::CmxCpSubBlock::TOPO_OCCUPANCY_MAP
@ TOPO_OCCUPANCY_MAP
Definition: CmxCpSubBlock.h:29
LVL1BS::CmxCpSubBlock::s_threshMask
static const uint32_t s_threshMask
Definition: CmxCpSubBlock.h:97
LVL1BS::CmxCpSubBlock::s_wordLength
static const int s_wordLength
Data word length.
Definition: CmxCpSubBlock.h:74
LVL1BS::CmxCpSubBlock::s_dataWordIdBit
static const int s_dataWordIdBit
Definition: CmxCpSubBlock.h:95
LVL1BS::CmxCpSubBlock::s_threshBit
static const int s_threshBit
Definition: CmxCpSubBlock.h:91
LVL1BS::CmxCpSubBlock::s_tobChipBit
static const int s_tobChipBit
Definition: CmxCpSubBlock.h:81
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
LVL1BS::CmxCpSubBlock::s_paddingBits
static const int s_paddingBits
Definition: CmxCpSubBlock.h:112
LVL1BS::CmxCpSubBlock::energy
int energy(int slice, int cpm, int tob) const
Return energy for given cpm and tob.
Definition: CmxCpSubBlock.cxx:131
LVL1BS::CmxCpSubBlock::s_topoMapBits
static const int s_topoMapBits
Definition: CmxCpSubBlock.h:116
LVL1BS::CmxCpSubBlock::~CmxCpSubBlock
~CmxCpSubBlock()
Definition: CmxCpSubBlock.cxx:67
LVL1BS::CmxCpSubBlock::s_tobErrorMask
static const uint32_t s_tobErrorMask
Definition: CmxCpSubBlock.h:86
LVL1BS::CmxCpSubBlock::s_parityErrorBits
static const int s_parityErrorBits
Definition: CmxCpSubBlock.h:106
LVL1BS::CmxCpSubBlock::s_isolationBits
static const int s_isolationBits
Definition: CmxCpSubBlock.h:105
LVL1BS::CmxCpSubBlock::s_tobCpmMask
static const uint32_t s_tobCpmMask
Definition: CmxCpSubBlock.h:89
LVL1BS::CmxCpSubBlock::CmxCpSubBlock
CmxCpSubBlock()
Definition: CmxCpSubBlock.cxx:63
error
Definition: IImpactPoint3dEstimator.h:70
LVL1BS::CmxCpSubBlock::s_tobChipMask
static const uint32_t s_tobChipMask
Definition: CmxCpSubBlock.h:88
LVL1BS::CmxCpSubBlock::MAX_SOURCE_ID
@ MAX_SOURCE_ID
Definition: CmxCpSubBlock.h:30
LVL1BS::CmxCpSubBlock::unpack
bool unpack()
Unpack data.
Definition: CmxCpSubBlock.cxx:292
LVL1BS::CmxCpSubBlock::s_tobEnergyMask
static const uint32_t s_tobEnergyMask
Definition: CmxCpSubBlock.h:84