ATLAS Offline Software
Loading...
Searching...
No Matches
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
13namespace LVL1BS {
14
22
23class 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
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
88inline int CmmCpSubBlock::sourceId(const uint32_t word) const
89{
90 return (word >> s_sourceIdBit) & s_sourceIdMask;
91}
92
93} // end namespace
94
95#endif
static const int s_fifoOverflowPin
static const int s_sourceIdBit
static const int s_bunchCrossingBits
static const int s_maxHits
static const int s_paddingBits
static const uint32_t s_errorMask
static const int s_threshBit
static const int s_wordLength
Data word length.
bool unpackNeutral()
Unpack neutral data.
static const int s_hitsBits
static const int s_dataWordIdBit
static const int s_threshErrorBit
bool unpack()
Unpack data.
void clear()
Clear all data.
static const int s_dataWordId
unsigned int hits(int slice, int source) const
Return hit counts for given CPM or source ID.
void setHits(int slice, int source, unsigned int hits, int error)
Store hit counts for given CPM or source ID.
static const int s_hitsErrorBits
bool unpackUncompressed()
Unpack uncompressed data.
static const uint32_t s_threshMask
int hitsError(int slice, int source) const
Return hit error for given CPM or source ID.
bool packNeutral()
Pack neutral data.
std::vector< uint32_t > m_hitsData
CPM hits and sums data.
bool packUncompressed()
Pack uncompressed data.
int sourceId(uint32_t word) const
static const uint32_t s_sourceIdMask
bool pack()
Pack data.
Definition index.py:1