ATLAS Offline Software
CpmSubBlockV2.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_CPMSUBBLOCKV2_H
6 #define TRIGT1CALOBYTESTREAM_CPMSUBBLOCKV2_H
7 
8 #include <stdint.h>
9 #include <vector>
10 
11 #include "L1CaloSubBlock.h"
12 
13 namespace LVL1BS {
14 
23 class CpmSubBlockV2 : public L1CaloSubBlock {
24 
25  public:
26  CpmSubBlockV2();
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);
38 
40  int emData(int slice, int channel) const;
42  int hadData(int slice, int channel) const;
44  int emError(int slice, int channel) const;
46  int hadError(int slice, int channel) const;
48  int timeslices() const;
50  bool anyTowerData(int channel) const;
51 
53  bool pack();
55  bool unpack();
56 
57  private:
59  static const int s_wordIdVal = 0xc;
61  static const int s_wordLength = 32;
62  // Trigger tower data word bit positions and masks
63  static const int s_ttDataABit = 0;
64  static const int s_ttDataBBit = 9;
65  static const int s_parityABit = 8;
66  static const int s_parityBBit = 17;
67  static const int s_linkDownABit = 19;
68  static const int s_linkDownBBit = 20;
69  static const int s_pairBit = 21;
70  static const int s_fpgaBit = 23;
71  static const int s_dataIdBit = 30;
72  static const int s_ttWordId = 0x1;
73  static const uint32_t s_ttDataMask = 0xff;
74  static const uint32_t s_pairPinMask = 0x7f;
75  static const uint32_t s_dataIdMask = 0x3;
76  // G-Link/Neutral format
77  static const int s_pairsPerPin = 4;
78  static const int s_wordsPerPin = 8;
79  static const int s_ttBits = 8;
80  static const int s_errBits = 2;
81  static const int s_bcnBits = 3;
82  static const int s_bcnPin = 16;
83  static const int s_glinkPins = 20;
84  static const int s_glinkBitsPerSlice = 84;
85 
87  int dataId(uint32_t word) const;
89  int data(int slice, int channel, int offset) const;
91  int error(int slice, int channel, int offset) const;
93  int index(int slice) const;
95  void resize(std::vector<uint32_t>& vec, int channels);
96 
98  bool packNeutral();
100  bool packUncompressed();
102  bool unpackNeutral();
104  bool unpackUncompressed();
105 
107  std::vector<uint32_t> m_ttData;
109  std::vector<int> m_chanPresent;
112 
113 };
114 
115 inline int CpmSubBlockV2::dataId(const uint32_t word) const
116 {
117  return (word >> s_dataIdBit) & s_dataIdMask;
118 }
119 
120 inline bool CpmSubBlockV2::anyTowerData(const int channel) const
121 {
122  return m_chanPresent[channel];
123 }
124 
125 } // end namespace
126 
127 #endif
LVL1BS::CpmSubBlockV2::pack
bool pack()
Pack data.
Definition: CpmSubBlockV2.cxx:155
LVL1BS::CpmSubBlockV2::s_bcnBits
static const int s_bcnBits
Definition: CpmSubBlockV2.h:81
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
LVL1BS::CpmSubBlockV2::packUncompressed
bool packUncompressed()
Pack uncompressed data.
Definition: CpmSubBlockV2.cxx:318
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1BS::CpmSubBlockV2::hadData
int hadData(int slice, int channel) const
Return Had data for given channel.
Definition: CpmSubBlockV2.cxx:121
LVL1BS::CpmSubBlockV2::s_linkDownBBit
static const int s_linkDownBBit
Definition: CpmSubBlockV2.h:68
LVL1BS::CpmSubBlockV2::s_ttDataBBit
static const int s_ttDataBBit
Definition: CpmSubBlockV2.h:64
LVL1BS::CpmSubBlockV2::s_ttDataABit
static const int s_ttDataABit
Definition: CpmSubBlockV2.h:63
LVL1BS::CpmSubBlockV2::s_wordsPerPin
static const int s_wordsPerPin
Definition: CpmSubBlockV2.h:78
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
LVL1BS::CpmSubBlockV2
Sub-Block class for CPM data post LS1.
Definition: CpmSubBlockV2.h:23
LVL1BS::L1CaloSubBlock::slice
int slice() const
Definition: L1CaloSubBlock.h:258
LVL1BS::CpmSubBlockV2::resize
void resize(std::vector< uint32_t > &vec, int channels)
Resize a data vector according to format.
Definition: CpmSubBlockV2.cxx:261
LVL1BS::CpmSubBlockV2::s_pairPinMask
static const uint32_t s_pairPinMask
Definition: CpmSubBlockV2.h:74
LVL1BS::CpmSubBlockV2::s_pairBit
static const int s_pairBit
Definition: CpmSubBlockV2.h:69
dq_defect_copy_defect_database.channels
def channels
Definition: dq_defect_copy_defect_database.py:56
LVL1BS::L1CaloSubBlock::crate
int crate() const
Definition: L1CaloSubBlock.h:263
LVL1BS::CpmSubBlockV2::s_glinkBitsPerSlice
static const int s_glinkBitsPerSlice
Definition: CpmSubBlockV2.h:84
LVL1BS::CpmSubBlockV2::s_errBits
static const int s_errBits
Definition: CpmSubBlockV2.h:80
LVL1BS::CpmSubBlockV2::timeslices
int timeslices() const
Return number of timeslices.
Definition: CpmSubBlockV2.cxx:142
L1CaloSubBlock.h
LVL1BS::CpmSubBlockV2::m_channels
int m_channels
Number of Trigger tower channels per module.
Definition: CpmSubBlockV2.h:111
LVL1BS::CpmSubBlockV2::data
int data(int slice, int channel, int offset) const
Return data for given channel and pin offset.
Definition: CpmSubBlockV2.cxx:203
LVL1BS::L1CaloSubBlock::format
int format() const
Definition: L1CaloSubBlock.h:248
LVL1BS::CpmSubBlockV2::packNeutral
bool packNeutral()
Pack neutral data.
Definition: CpmSubBlockV2.cxx:273
LVL1BS::CpmSubBlockV2::error
int error(int slice, int channel, int offset) const
Return error for given channel and pin offset.
Definition: CpmSubBlockV2.cxx:226
LVL1BS::CpmSubBlockV2::unpack
bool unpack()
Unpack data.
Definition: CpmSubBlockV2.cxx:179
LVL1BS::CpmSubBlockV2::fillTowerData
void fillTowerData(int slice, int channel, int em, int had, int emErr, int hadErr)
Store trigger tower data.
Definition: CpmSubBlockV2.cxx:70
LVL1BS::CpmSubBlockV2::s_wordIdVal
static const int s_wordIdVal
CPM header word ID.
Definition: CpmSubBlockV2.h:59
LVL1BS::CpmSubBlockV2::s_parityABit
static const int s_parityABit
Definition: CpmSubBlockV2.h:65
LVL1BS::CpmSubBlockV2::setCpmHeader
void setCpmHeader(int version, int format, int slice, int crate, int module, int timeslices)
Store CPM header.
Definition: CpmSubBlockV2.cxx:61
LVL1BS::CpmSubBlockV2::CpmSubBlockV2
CpmSubBlockV2()
Definition: CpmSubBlockV2.cxx:41
LVL1BS::CpmSubBlockV2::hadError
int hadError(int slice, int channel) const
Return Had error for given channel.
Definition: CpmSubBlockV2.cxx:135
LVL1BS::CpmSubBlockV2::s_fpgaBit
static const int s_fpgaBit
Definition: CpmSubBlockV2.h:70
LVL1BS::CpmSubBlockV2::m_chanPresent
std::vector< int > m_chanPresent
Channel present flags vector.
Definition: CpmSubBlockV2.h:109
LVL1BS::CpmSubBlockV2::index
int index(int slice) const
Return data index appropriate to format.
Definition: CpmSubBlockV2.cxx:254
LVL1BS::L1CaloSubBlock::version
int version() const
Definition: L1CaloSubBlock.h:243
LVL1BS::CpmSubBlockV2::emData
int emData(int slice, int channel) const
Return Em data for given channel.
Definition: CpmSubBlockV2.cxx:114
LVL1BS::CpmSubBlockV2::s_parityBBit
static const int s_parityBBit
Definition: CpmSubBlockV2.h:66
LVL1BS::CpmSubBlockV2::s_pairsPerPin
static const int s_pairsPerPin
Definition: CpmSubBlockV2.h:77
LVL1BS::CpmSubBlockV2::clear
void clear()
Clear all data.
Definition: CpmSubBlockV2.cxx:52
LVL1BS::CpmSubBlockV2::~CpmSubBlockV2
~CpmSubBlockV2()
Definition: CpmSubBlockV2.cxx:46
LVL1BS::CpmSubBlockV2::s_dataIdBit
static const int s_dataIdBit
Definition: CpmSubBlockV2.h:71
LVL1BS::L1CaloSubBlock::module
int module() const
Definition: L1CaloSubBlock.h:268
LVL1BS::CpmSubBlockV2::s_ttDataMask
static const uint32_t s_ttDataMask
Definition: CpmSubBlockV2.h:73
LVL1BS::L1CaloSubBlock
L1Calo Sub-Block base class.
Definition: L1CaloSubBlock.h:24
LVL1BS::CpmSubBlockV2::s_ttWordId
static const int s_ttWordId
Definition: CpmSubBlockV2.h:72
LVL1BS::CpmSubBlockV2::s_ttBits
static const int s_ttBits
Definition: CpmSubBlockV2.h:79
LVL1BS::CpmSubBlockV2::s_linkDownABit
static const int s_linkDownABit
Definition: CpmSubBlockV2.h:67
LVL1BS::CpmSubBlockV2::s_dataIdMask
static const uint32_t s_dataIdMask
Definition: CpmSubBlockV2.h:75
LVL1BS::CpmSubBlockV2::m_ttData
std::vector< uint32_t > m_ttData
Trigger tower data.
Definition: CpmSubBlockV2.h:107
LVL1BS
Definition: ZdcModifySlices.h:10
LVL1BS::CpmSubBlockV2::anyTowerData
bool anyTowerData(int channel) const
Return true if there is tower data for given channel.
Definition: CpmSubBlockV2.h:120
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LVL1BS::CpmSubBlockV2::s_bcnPin
static const int s_bcnPin
Definition: CpmSubBlockV2.h:82
LVL1BS::CpmSubBlockV2::unpackUncompressed
bool unpackUncompressed()
Unpack uncompressed data.
Definition: CpmSubBlockV2.cxx:390
LVL1BS::CpmSubBlockV2::s_glinkPins
static const int s_glinkPins
Definition: CpmSubBlockV2.h:83
LVL1BS::CpmSubBlockV2::dataId
int dataId(uint32_t word) const
Return data WordID.
Definition: CpmSubBlockV2.h:115
LVL1BS::CpmSubBlockV2::s_wordLength
static const int s_wordLength
Data word length.
Definition: CpmSubBlockV2.h:61
LVL1BS::CpmSubBlockV2::emError
int emError(int slice, int channel) const
Return Em error for given channel.
Definition: CpmSubBlockV2.cxx:128
LVL1BS::CpmSubBlockV2::unpackNeutral
bool unpackNeutral()
Unpack neutral data.
Definition: CpmSubBlockV2.cxx:332