ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCnv
LArByteStream
LArByteStream
LArRodBlockPhysicsV0.h
Go to the documentation of this file.
1
//Dear emacs, this is -*- c++ -*-
2
3
/*
4
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
#ifndef LARBYTESTREAM_LARRODBLOCKPYSICSV0_H
8
#define LARBYTESTREAM_LARRODBLOCKPYSICSV0_H
9
30
31
32
33
#include <stdint.h>
34
#include <vector>
35
#include "
LArByteStream/LArRodBlockStructure.h
"
36
#include "
StoreGate/StoreGateSvc.h
"
37
#include "
AthenaKernel/getMessageSvc.h
"
38
39
40
#ifdef LARBSDBGOUTPUT
41
#define LARBSDBG(text) m_logstr<<MSG::DEBUG<<text<<endmsg
42
#else
43
#define LARBSDBG(text)
44
#endif
45
46
class
LArRodBlockPhysicsV0
:
public
LArRodBlockStructure
47
{
48
public
:
49
// constructor
50
LArRodBlockPhysicsV0
(IMessageSvc* msgSvc);
51
52
protected
:
53
// ----------------- Header words indexes -----------------
54
enum
{
55
NWTot
,
56
NWTot_h
,
57
FEBID
,
58
FEBID_h
,
59
FEB_SN
,
60
FEB_SN_h
,
61
LowEBlkOffset
,
62
HighEBlkOffset
,
63
RawDataBlkOffset
,
64
NGainNSamples
,
//Elements below this are not used by the converter
65
Status1
,
66
Status2
,
67
BCID
,
68
EventID
,
69
RADD1
,
70
RADD2
,
//Could have more RADD's in real data
71
endtag
72
};
73
74
public
:
75
static
std::string
BlockType
() {
return
std::string(
"RodBlockPhysicsV0"
);}
76
// ----------------- Encoding methods -----------------
77
// Never to be used while decoding!
78
virtual
void
initializeFragment
(std::vector<uint32_t>& fragment);
79
virtual
void
initializeFEB
(
const
uint32_t
id
);
80
virtual
void
setNumberOfSamples
(
const
uint8_t n);
81
virtual
void
setNumberOfGains
(
const
uint8_t n);
82
virtual
void
setNextEnergy
(
const
int
channel,
const
int32_t energy,
const
int32_t time,
const
int32_t quality,
const
uint32_t gain);
83
virtual
void
setRawData
(
const
int
channel,
const
std::vector<short>& samples,
const
uint32_t gain);
84
virtual
void
finalizeFEB
();
85
// build full ROD fragment
86
virtual
void
concatinateFEBs
();
87
//Function to sort RawData Container before encoding:
88
using
LArRodBlockStructure::sortDataVector
;
// avoid warnings.
89
virtual
void
sortDataVector
(std::vector<const LArRawChannel*>& );
90
virtual
void
sortDataVector
( std::vector<const LArDigit*>& );
91
// declare capabilities of this Rod Block Structure
92
virtual
bool
canSetEnergy
() {
return
true
;}
93
virtual
bool
canSetRawData
() {
return
true
;}
94
//Ordering relation for channels & digits
95
template
<
class
RAWDATA>
96
bool
operator ()
(
const
RAWDATA* ch1,
const
RAWDATA* ch2)
const
;
97
98
// ----------------- Decoding methods -----------------
99
// Never to be used while encoding!
100
// set full ROD fragment before trying to get anything!
101
// in case there is more than 1 FEB in 1 fragment, jump to next FEB
102
virtual
inline
int
getNextEnergy
(
int
& channelNumber, int32_t& energy, int32_t& time,int32_t& quality,uint32_t& gain);
103
virtual
int
getNextRawData
(
int
& channelNumber, std::vector<short>& samples, uint32_t& gain);
104
105
virtual
inline
uint32_t
hasPhysicsBlock
()
const
{
return
LE_getHeader16
(
LowEBlkOffset
)+
LE_getHeader16
(
HighEBlkOffset
);} ;
106
virtual
inline
uint32_t
hasRawDataBlock
()
const
{
return
LE_getHeader16
(
RawDataBlkOffset
);} ;
107
108
private
:
109
virtual
bool
setPointers
();
110
void
clearBlocks
();
111
virtual
void
resetPointers
();
112
//Separated blocks for encoding
113
std::vector<uint32_t>
m_LowEnergyBlock
;
114
std::vector<uint32_t>
m_HighEnergyBlock
;
115
std::vector<uint32_t>
m_RawDataBlock
;
116
//Counter for channels inside of a FEB
117
int
m_ECounter
= 0;
118
int
m_RawDataCounter
= 0;
119
int
m_LowEIndex
= 0;
120
int
m_RawDataIndex
= 0;
121
int
m_HighEIndex
= 0;
122
int
m_EIndex
= 0;
//For writing....
123
const
int32_t *
m_HighEPtr
;
124
const
uint32_t *
m_FlagPtr
;
125
const
int16_t *
m_LowEPtr
;
126
//Number of flagging words at the beginning of Block 2, 3, and 4 (Depends on the number of channels)
127
unsigned
short
m_NFlaggingWords
;
128
129
const
LArOnlineID
*
m_onlineHelper
;
130
static
const
uint32_t
m_DummyBitMap
[4];
131
//Private functions:
132
inline
int
FebToRodChannel
(
int
ch)
const
;
133
void
setNextEnergy
(
const
int32_t energy,
const
int32_t time,
const
int32_t quality,
const
uint32_t gain);
134
};
135
136
inline
int
LArRodBlockPhysicsV0::FebToRodChannel
(
int
ch)
const
137
//{return ch/8 + 16 * (ch%8);}
138
{
return
(ch>>3) + ((ch&0x7)<<4);}
139
140
inline
int
LArRodBlockPhysicsV0::getNextEnergy
(
int
& channelNumber,int32_t& energy,int32_t& time,int32_t& quality, uint32_t& gain)
141
{
142
LARBSDBG
(
"in LArRodBlockPhysicsV0::getEnergy."
);
143
LARBSDBG
(
"m_ECounter="
<<
m_ECounter
<<
" m_RawDataIndex="
<<
m_EIndex
);
144
LARBSDBG
(
"m_channelsPerFEB="
<<
m_channelsPerFEB
);
145
if
(
m_LowEIndex
+
m_HighEIndex
>=
m_channelsPerFEB
)
//Already beyond maximal number of channels
146
return
0;
147
if
(!
m_FlagPtr
|| !
m_LowEPtr
)
//No data block present
148
return
0;
149
uint32_t gtQ;
150
int
rodChannelNumber=
m_LowEIndex
+
m_HighEIndex
;
//Index of Channel in ROD-Block
151
channelNumber=(rodChannelNumber>>4) + ((rodChannelNumber&0xf)<<3);
//channel number of the FEB
152
if
(
getBit
(
m_FlagPtr
,rodChannelNumber))
//Data in high energy block
153
{energy =
m_HighEPtr
[
m_HighEIndex
*2];
154
gtQ=
m_HighEPtr
[
m_HighEIndex
*2+1];
155
// Q in bits 0-15
156
// t in bits 16-29
157
// gain in bits 30-31
158
quality = gtQ & 0xffff;
159
gtQ = gtQ >> 16;
160
//time = gtQ & 0x3fff;
161
time = gtQ & 0x1fff;
162
if
(gtQ & 0x2000)
163
time*=-1;
164
gain=(gtQ >> 14);
165
m_HighEIndex
++;
166
}
167
else
//Data in low energy block
168
{
if
(!
m_LowEPtr
)
169
return
0;
//Block does not exist;
170
energy=
m_LowEPtr
[
m_LowEIndex
];
171
gain=0;
//=CaloGain::LARHIGHGAIN
172
time=0;
173
quality=-1;
174
m_LowEIndex
++;
175
}
176
return
1;
177
}
178
179
#ifdef LARBSDBGOUTPUT
180
#undef LARBSDBGOUTPUT
181
#endif
182
#undef LARBSDBG
183
184
#endif
LARBSDBG
#define LARBSDBG(text)
This class provides decoding/encoding from/to ROD format.
Definition
LArRodBlockPhysicsV0.h:43
LArRodBlockStructure.h
StoreGateSvc.h
LArOnlineID
Definition
LArOnlineID.h:21
LArRodBlockPhysicsV0::m_HighEPtr
const int32_t * m_HighEPtr
Definition
LArRodBlockPhysicsV0.h:123
LArRodBlockPhysicsV0::hasPhysicsBlock
virtual uint32_t hasPhysicsBlock() const
Definition
LArRodBlockPhysicsV0.h:105
LArRodBlockPhysicsV0::operator()
bool operator()(const RAWDATA *ch1, const RAWDATA *ch2) const
Definition
LArRodBlockPhysicsV0.cxx:400
LArRodBlockPhysicsV0::m_EIndex
int m_EIndex
Definition
LArRodBlockPhysicsV0.h:122
LArRodBlockPhysicsV0::m_RawDataBlock
std::vector< uint32_t > m_RawDataBlock
Definition
LArRodBlockPhysicsV0.h:115
LArRodBlockPhysicsV0::getNextRawData
virtual int getNextRawData(int &channelNumber, std::vector< short > &samples, uint32_t &gain)
Definition
LArRodBlockPhysicsV0.cxx:341
LArRodBlockPhysicsV0::m_ECounter
int m_ECounter
Definition
LArRodBlockPhysicsV0.h:117
LArRodBlockPhysicsV0::m_HighEIndex
int m_HighEIndex
Definition
LArRodBlockPhysicsV0.h:121
LArRodBlockPhysicsV0::setRawData
virtual void setRawData(const int channel, const std::vector< short > &samples, const uint32_t gain)
Definition
LArRodBlockPhysicsV0.cxx:197
LArRodBlockPhysicsV0::LArRodBlockPhysicsV0
LArRodBlockPhysicsV0(IMessageSvc *msgSvc)
Definition
LArRodBlockPhysicsV0.cxx:36
LArRodBlockPhysicsV0::initializeFEB
virtual void initializeFEB(const uint32_t id)
Definition
LArRodBlockPhysicsV0.cxx:257
LArRodBlockPhysicsV0::setNumberOfSamples
virtual void setNumberOfSamples(const uint8_t n)
Definition
LArRodBlockPhysicsV0.cxx:115
LArRodBlockPhysicsV0::finalizeFEB
virtual void finalizeFEB()
Definition
LArRodBlockPhysicsV0.cxx:270
LArRodBlockPhysicsV0::FebToRodChannel
int FebToRodChannel(int ch) const
Definition
LArRodBlockPhysicsV0.h:136
LArRodBlockPhysicsV0::BlockType
static std::string BlockType()
Definition
LArRodBlockPhysicsV0.h:75
LArRodBlockPhysicsV0::canSetEnergy
virtual bool canSetEnergy()
Definition
LArRodBlockPhysicsV0.h:92
LArRodBlockPhysicsV0::m_LowEIndex
int m_LowEIndex
Definition
LArRodBlockPhysicsV0.h:119
LArRodBlockPhysicsV0::canSetRawData
virtual bool canSetRawData()
Definition
LArRodBlockPhysicsV0.h:93
LArRodBlockPhysicsV0::m_NFlaggingWords
unsigned short m_NFlaggingWords
Definition
LArRodBlockPhysicsV0.h:127
LArRodBlockPhysicsV0::m_RawDataCounter
int m_RawDataCounter
Definition
LArRodBlockPhysicsV0.h:118
LArRodBlockPhysicsV0::setPointers
virtual bool setPointers()
Definition
LArRodBlockPhysicsV0.cxx:86
LArRodBlockPhysicsV0::m_DummyBitMap
static const uint32_t m_DummyBitMap[4]
Definition
LArRodBlockPhysicsV0.h:34
LArRodBlockPhysicsV0::setNextEnergy
virtual void setNextEnergy(const int channel, const int32_t energy, const int32_t time, const int32_t quality, const uint32_t gain)
Definition
LArRodBlockPhysicsV0.cxx:128
LArRodBlockPhysicsV0::resetPointers
virtual void resetPointers()
Definition
LArRodBlockPhysicsV0.cxx:75
LArRodBlockPhysicsV0::sortDataVector
virtual void sortDataVector(std::vector< const LArRawChannel * > &)
Definition
LArRodBlockPhysicsV0.cxx:418
LArRodBlockPhysicsV0::Status2
@ Status2
Definition
LArRodBlockPhysicsV0.h:66
LArRodBlockPhysicsV0::FEB_SN_h
@ FEB_SN_h
Definition
LArRodBlockPhysicsV0.h:60
LArRodBlockPhysicsV0::FEBID
@ FEBID
Definition
LArRodBlockPhysicsV0.h:57
LArRodBlockPhysicsV0::FEBID_h
@ FEBID_h
Definition
LArRodBlockPhysicsV0.h:58
LArRodBlockPhysicsV0::RADD2
@ RADD2
Definition
LArRodBlockPhysicsV0.h:70
LArRodBlockPhysicsV0::Status1
@ Status1
Definition
LArRodBlockPhysicsV0.h:65
LArRodBlockPhysicsV0::endtag
@ endtag
Definition
LArRodBlockPhysicsV0.h:71
LArRodBlockPhysicsV0::RADD1
@ RADD1
Definition
LArRodBlockPhysicsV0.h:69
LArRodBlockPhysicsV0::NWTot_h
@ NWTot_h
Definition
LArRodBlockPhysicsV0.h:56
LArRodBlockPhysicsV0::RawDataBlkOffset
@ RawDataBlkOffset
Definition
LArRodBlockPhysicsV0.h:63
LArRodBlockPhysicsV0::BCID
@ BCID
Definition
LArRodBlockPhysicsV0.h:67
LArRodBlockPhysicsV0::EventID
@ EventID
Definition
LArRodBlockPhysicsV0.h:68
LArRodBlockPhysicsV0::NWTot
@ NWTot
Definition
LArRodBlockPhysicsV0.h:55
LArRodBlockPhysicsV0::FEB_SN
@ FEB_SN
Definition
LArRodBlockPhysicsV0.h:59
LArRodBlockPhysicsV0::LowEBlkOffset
@ LowEBlkOffset
Definition
LArRodBlockPhysicsV0.h:61
LArRodBlockPhysicsV0::HighEBlkOffset
@ HighEBlkOffset
Definition
LArRodBlockPhysicsV0.h:62
LArRodBlockPhysicsV0::NGainNSamples
@ NGainNSamples
Definition
LArRodBlockPhysicsV0.h:64
LArRodBlockPhysicsV0::hasRawDataBlock
virtual uint32_t hasRawDataBlock() const
Definition
LArRodBlockPhysicsV0.h:106
LArRodBlockPhysicsV0::m_RawDataIndex
int m_RawDataIndex
Definition
LArRodBlockPhysicsV0.h:120
LArRodBlockPhysicsV0::m_LowEPtr
const int16_t * m_LowEPtr
Definition
LArRodBlockPhysicsV0.h:125
LArRodBlockPhysicsV0::getNextEnergy
virtual int getNextEnergy(int &channelNumber, int32_t &energy, int32_t &time, int32_t &quality, uint32_t &gain)
Definition
LArRodBlockPhysicsV0.h:140
LArRodBlockPhysicsV0::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition
LArRodBlockPhysicsV0.h:129
LArRodBlockPhysicsV0::initializeFragment
virtual void initializeFragment(std::vector< uint32_t > &fragment)
Definition
LArRodBlockPhysicsV0.cxx:230
LArRodBlockPhysicsV0::setNumberOfGains
virtual void setNumberOfGains(const uint8_t n)
Definition
LArRodBlockPhysicsV0.cxx:121
LArRodBlockPhysicsV0::concatinateFEBs
virtual void concatinateFEBs()
Definition
LArRodBlockPhysicsV0.cxx:324
LArRodBlockPhysicsV0::m_LowEnergyBlock
std::vector< uint32_t > m_LowEnergyBlock
Definition
LArRodBlockPhysicsV0.h:113
LArRodBlockPhysicsV0::m_FlagPtr
const uint32_t * m_FlagPtr
Definition
LArRodBlockPhysicsV0.h:124
LArRodBlockPhysicsV0::clearBlocks
void clearBlocks()
Definition
LArRodBlockPhysicsV0.cxx:68
LArRodBlockPhysicsV0::m_HighEnergyBlock
std::vector< uint32_t > m_HighEnergyBlock
Definition
LArRodBlockPhysicsV0.h:114
LArRodBlockStructure::sortDataVector
virtual void sortDataVector(std::vector< const LArRawChannel * > &)
Definition
LArRodBlockStructure.cxx:206
LArRodBlockStructure::getBit
int getBit(const uint32_t *const p, const unsigned chan) const
Definition
LArRodBlockStructure.h:422
LArRodBlockStructure::m_channelsPerFEB
int m_channelsPerFEB
Definition
LArRodBlockStructure.h:219
LArRodBlockStructure::LArRodBlockStructure
LArRodBlockStructure(IMessageSvc *msgSvc, const std::string &blockType)
Definition
LArRodBlockStructure.cxx:18
LArRodBlockStructure::LE_getHeader16
uint16_t LE_getHeader16(const unsigned n) const
Definition
LArRodBlockStructure.h:394
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
Generated on
for ATLAS Offline Software by
1.17.0