ATLAS Offline Software
Loading...
Searching...
No Matches
CpmSubBlock.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGT1CALOBYTESTREAM_CPMSUBBLOCK_H
6#define TRIGT1CALOBYTESTREAM_CPMSUBBLOCK_H
7
8#include <stdint.h>
9#include <vector>
10
11#include "L1CaloSubBlock.h"
12
13namespace LVL1BS {
14
22
24
25 public:
28
30 void clear();
31
33 void setCpmHeader(int version, int format, int slice, int crate,
34 int module, int timeslices);
36 void fillTowerData(int slice, int channel, int em, int had,
37 int emErr, int hadErr);
39 void setHits(int slice, unsigned int hit0, unsigned int hit1);
40
42 int emData(int slice, int channel) const;
44 int hadData(int slice, int channel) const;
46 int emError(int slice, int channel) const;
48 int hadError(int slice, int channel) const;
50 unsigned int hits0(int slice) const;
52 unsigned int hits1(int slice) const;
54 int timeslices() const;
56 bool anyTowerData(int channel) const;
57
59 bool pack();
61 bool unpack();
62
63 private:
65 static const int s_wordIdVal = 0xc;
67 static const int s_wordLength = 32;
68 // Trigger tower data word bit positions and masks
69 static const int s_ttDataABit = 0;
70 static const int s_ttDataBBit = 9;
71 static const int s_parityABit = 8;
72 static const int s_parityBBit = 17;
73 static const int s_linkDownABit = 19;
74 static const int s_linkDownBBit = 20;
75 static const int s_pairBit = 21;
76 static const int s_fpgaBit = 23;
77 static const int s_dataIdBit = 30;
78 static const int s_ttWordId = 0x1;
79 static const uint32_t s_ttDataMask = 0xff;
80 static const uint32_t s_pairPinMask = 0x7f;
81 static const uint32_t s_dataIdMask = 0x3;
82 // Hit counts bit positions and masks
83 static const int s_indicatorBit = 24;
84 static const uint32_t s_threshWordId = 0x2;
85 static const uint32_t s_threshMask = 0xffffff;
86 // G-Link/Neutral format
87 static const int s_pairsPerPin = 4;
88 static const int s_wordsPerPin = 8;
89 static const int s_ttBits = 8;
90 static const int s_errBits = 2;
91 static const int s_hitBits = 3;
92 static const int s_hitWords = 8;
93 static const int s_glinkPins = 20;
94 static const int s_glinkBitsPerSlice = 84;
95
97 int dataId(uint32_t word) const;
99 int data(int slice, int channel, int offset) const;
101 int error(int slice, int channel, int offset) const;
103 unsigned int hits(int slice, int offset) const;
105 int index(int slice) const;
107 void resize(std::vector<uint32_t>& vec, int channels);
108
110 bool packNeutral();
112 bool packUncompressed();
114 bool unpackNeutral();
116 bool unpackUncompressed();
117
119 std::vector<uint32_t> m_ttData;
121 std::vector<uint32_t> m_hitData;
123 std::vector<int> m_chanPresent;
126
127};
128
129inline int CpmSubBlock::dataId(const uint32_t word) const
130{
131 return (word >> s_dataIdBit) & s_dataIdMask;
132}
133
134inline bool CpmSubBlock::anyTowerData(const int channel) const
135{
136 return m_chanPresent[channel];
137}
138
139} // end namespace
140
141#endif
std::vector< size_t > vec
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
bool unpack()
Unpack data.
int timeslices() const
Return number of timeslices.
static const int s_ttBits
Definition CpmSubBlock.h:89
static const int s_fpgaBit
Definition CpmSubBlock.h:76
static const int s_parityABit
Definition CpmSubBlock.h:71
static const int s_wordIdVal
CPM header word ID.
Definition CpmSubBlock.h:65
static const uint32_t s_threshMask
Definition CpmSubBlock.h:85
static const int s_ttWordId
Definition CpmSubBlock.h:78
void setCpmHeader(int version, int format, int slice, int crate, int module, int timeslices)
Store CPM header.
static const int s_pairsPerPin
Definition CpmSubBlock.h:87
static const int s_ttDataABit
Definition CpmSubBlock.h:69
static const int s_pairBit
Definition CpmSubBlock.h:75
static const int s_errBits
Definition CpmSubBlock.h:90
static const int s_wordsPerPin
Definition CpmSubBlock.h:88
static const int s_wordLength
Data word length.
Definition CpmSubBlock.h:67
static const int s_indicatorBit
Definition CpmSubBlock.h:83
int emData(int slice, int channel) const
Return Em data for given channel.
static const int s_ttDataBBit
Definition CpmSubBlock.h:70
std::vector< uint32_t > m_ttData
Trigger tower data.
static const uint32_t s_dataIdMask
Definition CpmSubBlock.h:81
static const int s_hitWords
Definition CpmSubBlock.h:92
static const int s_linkDownABit
Definition CpmSubBlock.h:73
bool anyTowerData(int channel) const
Return true if there is tower data for given channel.
int emError(int slice, int channel) const
Return Em error for given channel.
bool packUncompressed()
Pack uncompressed data.
bool packNeutral()
Pack neutral data.
static const uint32_t s_threshWordId
Definition CpmSubBlock.h:84
static const int s_glinkPins
Definition CpmSubBlock.h:93
void clear()
Clear all data.
std::vector< uint32_t > m_hitData
Hit counts.
bool unpackNeutral()
Unpack neutral data.
int hadError(int slice, int channel) const
Return Had error for given channel.
static const uint32_t s_pairPinMask
Definition CpmSubBlock.h:80
static const int s_hitBits
Definition CpmSubBlock.h:91
std::vector< int > m_chanPresent
Channel present flags vector.
static const int s_linkDownBBit
Definition CpmSubBlock.h:74
static const int s_glinkBitsPerSlice
Definition CpmSubBlock.h:94
static const int s_parityBBit
Definition CpmSubBlock.h:72
unsigned int hits(int slice, int offset) const
Return hit counts with given offset.
bool unpackUncompressed()
Unpack uncompressed data.
int m_channels
Number of Trigger tower channels per module.
unsigned int hits0(int slice) const
Return e/gamma hit counts.
unsigned int hits1(int slice) const
Return tau hit counts.
static const uint32_t s_ttDataMask
Definition CpmSubBlock.h:79
void resize(std::vector< uint32_t > &vec, int channels)
Resize a data vector according to format.
static const int s_dataIdBit
Definition CpmSubBlock.h:77
int hadData(int slice, int channel) const
Return Had data for given channel.
int dataId(uint32_t word) const
Return data WordID.
void setHits(int slice, unsigned int hit0, unsigned int hit1)
Store hit counts.
void fillTowerData(int slice, int channel, int em, int had, int emErr, int hadErr)
Store trigger tower data.
bool pack()
Pack data.
Definition index.py:1