ATLAS Offline Software
CpmSubBlockV1.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_CPMSUBBLOCKV1_H
6 #define TRIGT1CALOBYTESTREAM_CPMSUBBLOCKV1_H
7 
8 #include <stdint.h>
9 #include <vector>
10 
11 #include "L1CaloSubBlock.h"
12 
13 namespace LVL1BS {
14 
23 class CpmSubBlockV1 : public L1CaloSubBlock {
24 
25  public:
26  CpmSubBlockV1();
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 
129 inline int CpmSubBlockV1::dataId(const uint32_t word) const
130 {
131  return (word >> s_dataIdBit) & s_dataIdMask;
132 }
133 
134 inline bool CpmSubBlockV1::anyTowerData(const int channel) const
135 {
136  return m_chanPresent[channel];
137 }
138 
139 } // end namespace
140 
141 #endif
LVL1BS::CpmSubBlockV1::s_linkDownABit
static const int s_linkDownABit
Definition: CpmSubBlockV1.h:73
LVL1BS::CpmSubBlockV1::m_ttData
std::vector< uint32_t > m_ttData
Trigger tower data.
Definition: CpmSubBlockV1.h:119
LVL1BS::CpmSubBlockV1::s_ttDataMask
static const uint32_t s_ttDataMask
Definition: CpmSubBlockV1.h:79
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
LVL1BS::CpmSubBlockV1::unpack
bool unpack()
Unpack data.
Definition: CpmSubBlockV1.cxx:209
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1BS::CpmSubBlockV1::s_indicatorBit
static const int s_indicatorBit
Definition: CpmSubBlockV1.h:83
LVL1BS::CpmSubBlockV1::m_chanPresent
std::vector< int > m_chanPresent
Channel present flags vector.
Definition: CpmSubBlockV1.h:123
LVL1BS::CpmSubBlockV1::s_pairsPerPin
static const int s_pairsPerPin
Definition: CpmSubBlockV1.h:87
LVL1BS::CpmSubBlockV1::index
int index(int slice) const
Return data index appropriate to format.
Definition: CpmSubBlockV1.cxx:290
LVL1BS::CpmSubBlockV1::s_threshWordId
static const uint32_t s_threshWordId
Definition: CpmSubBlockV1.h:84
LVL1BS::CpmSubBlockV1::s_glinkBitsPerSlice
static const int s_glinkBitsPerSlice
Definition: CpmSubBlockV1.h:94
LVL1BS::CpmSubBlockV1::setCpmHeader
void setCpmHeader(int version, int format, int slice, int crate, int module, int timeslices)
Store CPM header.
Definition: CpmSubBlockV1.cxx:65
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
LVL1BS::CpmSubBlockV1::m_channels
int m_channels
Number of Trigger tower channels per module.
Definition: CpmSubBlockV1.h:125
LVL1BS::CpmSubBlockV1::hits
unsigned int hits(int slice, int offset) const
Return hit counts with given offset.
Definition: CpmSubBlockV1.cxx:279
LVL1BS::L1CaloSubBlock::slice
int slice() const
Definition: L1CaloSubBlock.h:258
LVL1BS::CpmSubBlockV1::hits1
unsigned int hits1(int slice) const
Return tau hit counts.
Definition: CpmSubBlockV1.cxx:168
LVL1BS::CpmSubBlockV1::packNeutral
bool packNeutral()
Pack neutral data.
Definition: CpmSubBlockV1.cxx:308
dq_defect_copy_defect_database.channels
def channels
Definition: dq_defect_copy_defect_database.py:56
LVL1BS::CpmSubBlockV1::s_wordIdVal
static const int s_wordIdVal
CPM header word ID.
Definition: CpmSubBlockV1.h:65
LVL1BS::L1CaloSubBlock::crate
int crate() const
Definition: L1CaloSubBlock.h:263
LVL1BS::CpmSubBlockV1::resize
void resize(std::vector< uint32_t > &vec, int channels)
Resize a data vector according to format.
Definition: CpmSubBlockV1.cxx:297
LVL1BS::CpmSubBlockV1::emError
int emError(int slice, int channel) const
Return Em error for given channel.
Definition: CpmSubBlockV1.cxx:147
LVL1BS::CpmSubBlockV1::m_hitData
std::vector< uint32_t > m_hitData
Hit counts.
Definition: CpmSubBlockV1.h:121
LVL1BS::CpmSubBlockV1::s_pairBit
static const int s_pairBit
Definition: CpmSubBlockV1.h:75
LVL1BS::CpmSubBlockV1::clear
void clear()
Clear all data.
Definition: CpmSubBlockV1.cxx:55
L1CaloSubBlock.h
LVL1BS::CpmSubBlockV1::packUncompressed
bool packUncompressed()
Pack uncompressed data.
Definition: CpmSubBlockV1.cxx:348
LVL1BS::CpmSubBlockV1
Sub-Block class for CPM data.
Definition: CpmSubBlockV1.h:23
LVL1BS::L1CaloSubBlock::format
int format() const
Definition: L1CaloSubBlock.h:248
LVL1BS::CpmSubBlockV1::s_parityABit
static const int s_parityABit
Definition: CpmSubBlockV1.h:71
LVL1BS::CpmSubBlockV1::error
int error(int slice, int channel, int offset) const
Return error for given channel and pin offset.
Definition: CpmSubBlockV1.cxx:255
LVL1BS::CpmSubBlockV1::s_dataIdBit
static const int s_dataIdBit
Definition: CpmSubBlockV1.h:77
LVL1BS::CpmSubBlockV1::fillTowerData
void fillTowerData(int slice, int channel, int em, int had, int emErr, int hadErr)
Store trigger tower data.
Definition: CpmSubBlockV1.cxx:74
LVL1BS::CpmSubBlockV1::pack
bool pack()
Pack data.
Definition: CpmSubBlockV1.cxx:187
LVL1BS::CpmSubBlockV1::CpmSubBlockV1
CpmSubBlockV1()
Definition: CpmSubBlockV1.cxx:44
LVL1BS::CpmSubBlockV1::s_glinkPins
static const int s_glinkPins
Definition: CpmSubBlockV1.h:93
LVL1BS::CpmSubBlockV1::s_ttWordId
static const int s_ttWordId
Definition: CpmSubBlockV1.h:78
LVL1BS::CpmSubBlockV1::s_dataIdMask
static const uint32_t s_dataIdMask
Definition: CpmSubBlockV1.h:81
LVL1BS::CpmSubBlockV1::timeslices
int timeslices() const
Return number of timeslices.
Definition: CpmSubBlockV1.cxx:175
LVL1BS::CpmSubBlockV1::hits0
unsigned int hits0(int slice) const
Return e/gamma hit counts.
Definition: CpmSubBlockV1.cxx:161
LVL1BS::L1CaloSubBlock::version
int version() const
Definition: L1CaloSubBlock.h:243
LVL1BS::CpmSubBlockV1::unpackNeutral
bool unpackNeutral()
Unpack neutral data.
Definition: CpmSubBlockV1.cxx:366
LVL1BS::CpmSubBlockV1::hadError
int hadError(int slice, int channel) const
Return Had error for given channel.
Definition: CpmSubBlockV1.cxx:154
LVL1BS::CpmSubBlockV1::dataId
int dataId(uint32_t word) const
Return data WordID.
Definition: CpmSubBlockV1.h:129
LVL1BS::L1CaloSubBlock::module
int module() const
Definition: L1CaloSubBlock.h:268
LVL1BS::CpmSubBlockV1::s_wordsPerPin
static const int s_wordsPerPin
Definition: CpmSubBlockV1.h:88
LVL1BS::CpmSubBlockV1::~CpmSubBlockV1
~CpmSubBlockV1()
Definition: CpmSubBlockV1.cxx:49
LVL1BS::L1CaloSubBlock
L1Calo Sub-Block base class.
Definition: L1CaloSubBlock.h:24
LVL1BS::CpmSubBlockV1::s_ttBits
static const int s_ttBits
Definition: CpmSubBlockV1.h:89
LVL1BS::CpmSubBlockV1::s_pairPinMask
static const uint32_t s_pairPinMask
Definition: CpmSubBlockV1.h:80
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
LVL1BS::CpmSubBlockV1::anyTowerData
bool anyTowerData(int channel) const
Return true if there is tower data for given channel.
Definition: CpmSubBlockV1.h:134
LVL1BS::CpmSubBlockV1::s_ttDataBBit
static const int s_ttDataBBit
Definition: CpmSubBlockV1.h:70
LVL1BS::CpmSubBlockV1::s_hitBits
static const int s_hitBits
Definition: CpmSubBlockV1.h:91
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LVL1BS::CpmSubBlockV1::s_wordLength
static const int s_wordLength
Data word length.
Definition: CpmSubBlockV1.h:67
LVL1BS::CpmSubBlockV1::s_threshMask
static const uint32_t s_threshMask
Definition: CpmSubBlockV1.h:85
LVL1BS::CpmSubBlockV1::unpackUncompressed
bool unpackUncompressed()
Unpack uncompressed data.
Definition: CpmSubBlockV1.cxx:420
LVL1BS::CpmSubBlockV1::s_linkDownBBit
static const int s_linkDownBBit
Definition: CpmSubBlockV1.h:74
LVL1BS::CpmSubBlockV1::s_fpgaBit
static const int s_fpgaBit
Definition: CpmSubBlockV1.h:76
LVL1BS::CpmSubBlockV1::s_ttDataABit
static const int s_ttDataABit
Definition: CpmSubBlockV1.h:69
LVL1BS::CpmSubBlockV1::hadData
int hadData(int slice, int channel) const
Return Had data for given channel.
Definition: CpmSubBlockV1.cxx:140
LVL1BS::CpmSubBlockV1::setHits
void setHits(int slice, unsigned int hit0, unsigned int hit1)
Store hit counts.
Definition: CpmSubBlockV1.cxx:112
LVL1BS::CpmSubBlockV1::s_errBits
static const int s_errBits
Definition: CpmSubBlockV1.h:90
LVL1BS::CpmSubBlockV1::s_parityBBit
static const int s_parityBBit
Definition: CpmSubBlockV1.h:72
LVL1BS::CpmSubBlockV1::s_hitWords
static const int s_hitWords
Definition: CpmSubBlockV1.h:92
LVL1BS::CpmSubBlockV1::data
int data(int slice, int channel, int offset) const
Return data for given channel and pin offset.
Definition: CpmSubBlockV1.cxx:235
LVL1BS::CpmSubBlockV1::emData
int emData(int slice, int channel) const
Return Em data for given channel.
Definition: CpmSubBlockV1.cxx:133