ATLAS Offline Software
CmmCpSubBlock.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_CMMCPSUBBLOCK_H
6 #define TRIGT1CALOBYTESTREAM_CMMCPSUBBLOCK_H
7 
8 #include <stdint.h>
9 #include <vector>
10 
11 #include "CmmSubBlock.h"
12 
13 namespace LVL1BS {
14 
23 class CmmCpSubBlock : public CmmSubBlock {
24 
25  public:
26  // Note - because CPMs are numbered 1-14 these are one more
27  // than the stored source ID and corresponding G-Link pin.
28  enum SourceId { REMOTE_0 = 15, REMOTE_1 = 16, REMOTE_2 = 17,
29  LOCAL = 18, TOTAL = 19, MAX_SOURCE_ID };
30 
31  CmmCpSubBlock();
33 
35  void clear();
36 
38  unsigned int hits(int slice, int source) const;
40  int hitsError(int slice, int source) const;
41 
43  void setHits(int slice, int source, unsigned int hits, int error);
44 
46  bool pack();
48  bool unpack();
49 
50  private:
52  static const int s_wordLength = 32;
53  // Jet hit counts bit positions and masks
54  static const int s_threshBit = 0;
55  static const int s_threshErrorBit = 24;
56  static const int s_sourceIdBit = 25;
57  static const int s_dataWordIdBit = 30;
58  static const int s_dataWordId = 0;
59  static const int s_maxHits = 19;
60  static const uint32_t s_threshMask = 0xffffff;
61  static const uint32_t s_errorMask = 0x1;
62  static const uint32_t s_sourceIdMask = 0x1f;
63  // Neutral format
64  static const int s_hitsBits = 24;
65  static const int s_hitsErrorBits = 1;
66  static const int s_bunchCrossingBits = 12;
67  static const int s_paddingBits = 8;
68  static const int s_fifoOverflowPin = 13;
69 
70  int sourceId(uint32_t word) const;
71  int index(int slice, int source) const;
72  void resize();
73 
75  bool packNeutral();
77  bool packUncompressed();
79  bool unpackNeutral();
81  bool unpackUncompressed();
82 
84  std::vector<uint32_t> m_hitsData;
85 
86 };
87 
88 inline int CmmCpSubBlock::sourceId(const uint32_t word) const
89 {
90  return (word >> s_sourceIdBit) & s_sourceIdMask;
91 }
92 
93 } // end namespace
94 
95 #endif
LVL1BS::CmmCpSubBlock::REMOTE_2
@ REMOTE_2
Definition: CmmCpSubBlock.h:28
LVL1BS::CmmCpSubBlock::unpackNeutral
bool unpackNeutral()
Unpack neutral data.
Definition: CmmCpSubBlock.cxx:201
LVL1BS::CmmCpSubBlock::s_sourceIdMask
static const uint32_t s_sourceIdMask
Definition: CmmCpSubBlock.h:62
LVL1BS::CmmCpSubBlock::sourceId
int sourceId(uint32_t word) const
Definition: CmmCpSubBlock.h:88
LVL1BS::CmmCpSubBlock::m_hitsData
std::vector< uint32_t > m_hitsData
CPM hits and sums data.
Definition: CmmCpSubBlock.h:84
LVL1BS::CmmCpSubBlock::unpackUncompressed
bool unpackUncompressed()
Unpack uncompressed data.
Definition: CmmCpSubBlock.cxx:238
LVL1BS::CmmCpSubBlock::s_sourceIdBit
static const int s_sourceIdBit
Definition: CmmCpSubBlock.h:56
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1BS::CmmCpSubBlock
Sub-Block class for CMM-CP data.
Definition: CmmCpSubBlock.h:23
LVL1BS::CmmCpSubBlock::s_maxHits
static const int s_maxHits
Definition: CmmCpSubBlock.h:59
LVL1BS::CmmCpSubBlock::s_threshErrorBit
static const int s_threshErrorBit
Definition: CmmCpSubBlock.h:55
LVL1BS::CmmCpSubBlock::hits
unsigned int hits(int slice, int source) const
Return hit counts for given CPM or source ID.
Definition: CmmCpSubBlock.cxx:49
LVL1BS::CmmCpSubBlock::setHits
void setHits(int slice, int source, unsigned int hits, int error)
Store hit counts for given CPM or source ID.
Definition: CmmCpSubBlock.cxx:76
LVL1BS::CmmCpSubBlock::resize
void resize()
Definition: CmmCpSubBlock.cxx:151
LVL1BS::CmmCpSubBlock::s_dataWordId
static const int s_dataWordId
Definition: CmmCpSubBlock.h:58
LVL1BS::CmmCpSubBlock::s_hitsBits
static const int s_hitsBits
Definition: CmmCpSubBlock.h:64
LVL1BS::CmmCpSubBlock::REMOTE_0
@ REMOTE_0
Definition: CmmCpSubBlock.h:28
LVL1BS::CmmCpSubBlock::s_threshMask
static const uint32_t s_threshMask
Definition: CmmCpSubBlock.h:60
LVL1BS::CmmCpSubBlock::hitsError
int hitsError(int slice, int source) const
Return hit error for given CPM or source ID.
Definition: CmmCpSubBlock.cxx:62
LVL1BS::CmmCpSubBlock::s_errorMask
static const uint32_t s_errorMask
Definition: CmmCpSubBlock.h:61
LVL1BS::CmmSubBlock
Sub-Block class for CMM data.
Definition: CmmSubBlock.h:22
LVL1BS::L1CaloSubBlock::slice
int slice() const
Definition: L1CaloSubBlock.h:258
LVL1BS::CmmCpSubBlock::packNeutral
bool packNeutral()
Pack neutral data.
Definition: CmmCpSubBlock.cxx:162
LVL1BS::CmmCpSubBlock::s_fifoOverflowPin
static const int s_fifoOverflowPin
Definition: CmmCpSubBlock.h:68
LVL1BS::CmmCpSubBlock::pack
bool pack()
Pack data.
Definition: CmmCpSubBlock.cxx:94
LVL1BS::CmmCpSubBlock::s_hitsErrorBits
static const int s_hitsErrorBits
Definition: CmmCpSubBlock.h:65
LVL1BS::CmmCpSubBlock::unpack
bool unpack()
Unpack data.
Definition: CmmCpSubBlock.cxx:116
LVL1BS::CmmCpSubBlock::s_paddingBits
static const int s_paddingBits
Definition: CmmCpSubBlock.h:67
LVL1BS::CmmCpSubBlock::s_threshBit
static const int s_threshBit
Definition: CmmCpSubBlock.h:54
CmmSubBlock.h
LVL1BS::CmmCpSubBlock::~CmmCpSubBlock
~CmmCpSubBlock()
Definition: CmmCpSubBlock.cxx:35
LVL1BS::CmmCpSubBlock::TOTAL
@ TOTAL
Definition: CmmCpSubBlock.h:29
LVL1BS::CmmCpSubBlock::SourceId
SourceId
Definition: CmmCpSubBlock.h:28
LVL1BS::CmmCpSubBlock::CmmCpSubBlock
CmmCpSubBlock()
Definition: CmmCpSubBlock.cxx:31
LVL1BS::CmmCpSubBlock::LOCAL
@ LOCAL
Definition: CmmCpSubBlock.h:29
LVL1BS::CmmCpSubBlock::s_wordLength
static const int s_wordLength
Data word length.
Definition: CmmCpSubBlock.h:52
LVL1BS::CmmCpSubBlock::packUncompressed
bool packUncompressed()
Pack uncompressed data.
Definition: CmmCpSubBlock.cxx:189
LVL1BS::CmmCpSubBlock::MAX_SOURCE_ID
@ MAX_SOURCE_ID
Definition: CmmCpSubBlock.h:29
LVL1BS::CmmCpSubBlock::clear
void clear()
Clear all data.
Definition: CmmCpSubBlock.cxx:41
LVL1BS::CmmCpSubBlock::s_dataWordIdBit
static const int s_dataWordIdBit
Definition: CmmCpSubBlock.h:57
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
LVL1BS::CmmCpSubBlock::index
int index(int slice, int source) const
Definition: CmmCpSubBlock.cxx:142
error
Definition: IImpactPoint3dEstimator.h:70
LVL1BS::CmmCpSubBlock::REMOTE_1
@ REMOTE_1
Definition: CmmCpSubBlock.h:28
LVL1BS::CmmCpSubBlock::s_bunchCrossingBits
static const int s_bunchCrossingBits
Definition: CmmCpSubBlock.h:66