ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCnv
LArByteStream
LArByteStream
LArRodBlockPhysicsV1.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_LARRODBLOCKPYSICSV1_H
8
#define LARBYTESTREAM_LARRODBLOCKPYSICSV1_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
LArRodBlockPhysicsV1
:
public
LArRodBlockStructure
47
{
48
public
:
49
// constructor
50
LArRodBlockPhysicsV1
(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(
"RodBlockPhysicsV1"
);}
76
// ----------------- Encoding methods -----------------
77
// Never to be used while decoding!
78
//Header setting methods (different from base class for backward compatibility)
79
virtual
void
initializeFragment
(std::vector<uint32_t>& fragment);
80
virtual
void
initializeFEB
(
const
uint32_t
id
);
81
virtual
void
setNumberOfSamples
(
const
uint8_t n);
82
virtual
void
setNumberOfGains
(
const
uint8_t n);
83
virtual
void
setNextEnergy
(
const
int
channel,
const
int32_t energy,
const
int32_t time,
const
int32_t quality,
const
uint32_t gain);
84
virtual
void
setRawData
(
const
int
channel,
const
std::vector<short>& samples,
const
uint32_t gain);
85
virtual
void
finalizeFEB
();
86
// build full ROD fragment
87
virtual
void
concatinateFEBs
();
88
//Function to sort RawData Container before encoding:
89
using
LArRodBlockStructure::sortDataVector
;
// avoid warnings.
90
virtual
void
sortDataVector
(std::vector<const LArRawChannel*>& );
91
virtual
void
sortDataVector
( std::vector<const LArDigit*>& );
92
// declare capabilities of this Rod Block Structure
93
virtual
bool
canSetEnergy
() {
return
true
;}
94
virtual
bool
canSetRawData
() {
return
true
;}
95
//Ordering relation for channels & digits
96
template
<
class
RAWDATA>
97
bool
operator ()
(
const
RAWDATA* ch1,
const
RAWDATA* ch2)
const
;
98
99
// ----------------- Decoding methods -----------------
100
// Never to be used while encoding!
101
// set full ROD fragment before trying to get anything!
102
// in case there is more than 1 FEB in 1 fragment, jump to next FEB
103
virtual
bool
setPointers
();
104
virtual
inline
int
getNextEnergy
(
int
& channelNumber, int32_t& energy, int32_t& time,int32_t& quality,uint32_t& gain);
105
virtual
int
getNextRawData
(
int
& channelNumber, std::vector<short>& samples, uint32_t& gain);
106
107
virtual
inline
uint32_t
hasPhysicsBlock
()
const
{
return
getHeader16
(
LowEBlkOffset
);} ;
108
virtual
inline
uint32_t
hasRawDataBlock
()
const
{
return
getHeader16
(
RawDataBlkOffset
);} ;
109
110
private
:
111
void
clearBlocks
();
112
virtual
void
resetPointers
();
113
//Separated blocks for encoding
114
std::vector<uint32_t>
m_LowEnergyBlock
;
115
std::vector<uint32_t>
m_HighEnergyBlock
;
116
std::vector<uint32_t>
m_RawDataBlock
;
117
//Counter for channels inside of a FEB
118
int
m_ECounter
= 0;
119
int
m_RawDataCounter
= 0;
120
int
m_LowEIndex
= 0;
121
int
m_RawDataIndex
= 0;
122
int
m_HighEIndex
= 0;
123
int
m_EIndex
= 0;
//For writing....
124
const
int32_t *
m_HighEPtr
;
125
const
uint32_t *
m_FlagPtr
;
126
const
int16_t *
m_LowEPtr
;
127
//Number of flagging words at the beginning of Block 2, 3, and 4 (Depends on the number of channels)
128
unsigned
short
m_NFlaggingWords
;
129
130
const
LArOnlineID
*
m_onlineHelper
;
131
static
const
uint32_t
m_DummyBitMap
[4];
132
//Private functions:
133
inline
int
FebToRodChannel
(
int
ch)
const
;
134
void
setNextEnergy
(
const
int32_t energy,
const
int32_t time,
const
int32_t quality,
const
uint32_t gain);
135
};
136
137
inline
int
LArRodBlockPhysicsV1::FebToRodChannel
(
int
ch)
const
138
//{return ch/8 + 16 * (ch%8);}
139
{
return
(ch>>3) + ((ch&0x7)<<4);}
140
141
inline
int
LArRodBlockPhysicsV1::getNextEnergy
(
int
& channelNumber,int32_t& energy,int32_t& time,int32_t& quality, uint32_t& gain)
142
{
143
LARBSDBG
(
"in LArRodBlockPhysicsV1::getEnergy."
);
144
LARBSDBG
(
"m_LowEIndex="
<<
m_LowEIndex
<<
" m_HighEIndex"
<<
m_HighEIndex
);
145
LARBSDBG
(
"m_channelsPerFEB="
<<
m_channelsPerFEB
);
146
if
(
m_LowEIndex
+
m_HighEIndex
>=
m_channelsPerFEB
)
//Already beyond maximal number of channels
147
return
0;
148
if
(!
m_FlagPtr
|| !
m_LowEPtr
)
//No data block present
149
return
0;
150
uint32_t gtQ;
151
channelNumber=
m_LowEIndex
+
m_HighEIndex
;
//Index of Channel in ROD-Block
152
if
(
getBit
(
m_FlagPtr
,channelNumber))
//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
LARBSDBG
(
"Channel "
<< channelNumber <<
" Reading Raw data form High E block. E="
<< energy <<
" Q="
<< quality);
167
}
168
else
//Data in low energy block
169
{
if
(!
m_LowEPtr
)
170
return
0;
//Block does not exist;
171
energy=
m_LowEPtr
[
m_LowEIndex
];
172
gain=0;
//=CaloGain::LARHIGHGAIN
173
time=0;
174
quality=-1;
175
m_LowEIndex
++;
176
LARBSDBG
(
"Channel "
<< channelNumber <<
" Reading Raw data form Low E block. E="
<< energy);
177
}
178
return
1;
179
}
180
181
#ifdef LARBSDBGOUTPUT
182
#undef LARBSDBGOUTPUT
183
#endif
184
#undef LARBSDBG
185
186
#endif
LARBSDBG
#define LARBSDBG(text)
This class provides decoding/encoding from/to ROD format.
Definition
LArRodBlockPhysicsV1.h:43
LArRodBlockStructure.h
StoreGateSvc.h
LArOnlineID
Definition
LArOnlineID.h:21
LArRodBlockPhysicsV1::m_LowEIndex
int m_LowEIndex
Definition
LArRodBlockPhysicsV1.h:120
LArRodBlockPhysicsV1::initializeFEB
virtual void initializeFEB(const uint32_t id)
Definition
LArRodBlockPhysicsV1.cxx:255
LArRodBlockPhysicsV1::hasRawDataBlock
virtual uint32_t hasRawDataBlock() const
Definition
LArRodBlockPhysicsV1.h:108
LArRodBlockPhysicsV1::EventID
@ EventID
Definition
LArRodBlockPhysicsV1.h:68
LArRodBlockPhysicsV1::FEB_SN
@ FEB_SN
Definition
LArRodBlockPhysicsV1.h:59
LArRodBlockPhysicsV1::RADD2
@ RADD2
Definition
LArRodBlockPhysicsV1.h:70
LArRodBlockPhysicsV1::NWTot_h
@ NWTot_h
Definition
LArRodBlockPhysicsV1.h:56
LArRodBlockPhysicsV1::FEB_SN_h
@ FEB_SN_h
Definition
LArRodBlockPhysicsV1.h:60
LArRodBlockPhysicsV1::NGainNSamples
@ NGainNSamples
Definition
LArRodBlockPhysicsV1.h:64
LArRodBlockPhysicsV1::NWTot
@ NWTot
Definition
LArRodBlockPhysicsV1.h:55
LArRodBlockPhysicsV1::Status2
@ Status2
Definition
LArRodBlockPhysicsV1.h:66
LArRodBlockPhysicsV1::FEBID_h
@ FEBID_h
Definition
LArRodBlockPhysicsV1.h:58
LArRodBlockPhysicsV1::RawDataBlkOffset
@ RawDataBlkOffset
Definition
LArRodBlockPhysicsV1.h:63
LArRodBlockPhysicsV1::HighEBlkOffset
@ HighEBlkOffset
Definition
LArRodBlockPhysicsV1.h:62
LArRodBlockPhysicsV1::Status1
@ Status1
Definition
LArRodBlockPhysicsV1.h:65
LArRodBlockPhysicsV1::endtag
@ endtag
Definition
LArRodBlockPhysicsV1.h:71
LArRodBlockPhysicsV1::LowEBlkOffset
@ LowEBlkOffset
Definition
LArRodBlockPhysicsV1.h:61
LArRodBlockPhysicsV1::FEBID
@ FEBID
Definition
LArRodBlockPhysicsV1.h:57
LArRodBlockPhysicsV1::BCID
@ BCID
Definition
LArRodBlockPhysicsV1.h:67
LArRodBlockPhysicsV1::RADD1
@ RADD1
Definition
LArRodBlockPhysicsV1.h:69
LArRodBlockPhysicsV1::getNextRawData
virtual int getNextRawData(int &channelNumber, std::vector< short > &samples, uint32_t &gain)
Definition
LArRodBlockPhysicsV1.cxx:339
LArRodBlockPhysicsV1::BlockType
static std::string BlockType()
Definition
LArRodBlockPhysicsV1.h:75
LArRodBlockPhysicsV1::canSetEnergy
virtual bool canSetEnergy()
Definition
LArRodBlockPhysicsV1.h:93
LArRodBlockPhysicsV1::m_HighEPtr
const int32_t * m_HighEPtr
Definition
LArRodBlockPhysicsV1.h:124
LArRodBlockPhysicsV1::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition
LArRodBlockPhysicsV1.h:130
LArRodBlockPhysicsV1::m_DummyBitMap
static const uint32_t m_DummyBitMap[4]
Definition
LArRodBlockPhysicsV1.h:34
LArRodBlockPhysicsV1::clearBlocks
void clearBlocks()
Definition
LArRodBlockPhysicsV1.cxx:68
LArRodBlockPhysicsV1::setNumberOfGains
virtual void setNumberOfGains(const uint8_t n)
Definition
LArRodBlockPhysicsV1.cxx:122
LArRodBlockPhysicsV1::m_ECounter
int m_ECounter
Definition
LArRodBlockPhysicsV1.h:118
LArRodBlockPhysicsV1::getNextEnergy
virtual int getNextEnergy(int &channelNumber, int32_t &energy, int32_t &time, int32_t &quality, uint32_t &gain)
Definition
LArRodBlockPhysicsV1.h:141
LArRodBlockPhysicsV1::resetPointers
virtual void resetPointers()
Definition
LArRodBlockPhysicsV1.cxx:75
LArRodBlockPhysicsV1::LArRodBlockPhysicsV1
LArRodBlockPhysicsV1(IMessageSvc *msgSvc)
Definition
LArRodBlockPhysicsV1.cxx:36
LArRodBlockPhysicsV1::operator()
bool operator()(const RAWDATA *ch1, const RAWDATA *ch2) const
Definition
LArRodBlockPhysicsV1.cxx:398
LArRodBlockPhysicsV1::m_RawDataIndex
int m_RawDataIndex
Definition
LArRodBlockPhysicsV1.h:121
LArRodBlockPhysicsV1::initializeFragment
virtual void initializeFragment(std::vector< uint32_t > &fragment)
Definition
LArRodBlockPhysicsV1.cxx:228
LArRodBlockPhysicsV1::FebToRodChannel
int FebToRodChannel(int ch) const
Definition
LArRodBlockPhysicsV1.h:137
LArRodBlockPhysicsV1::setPointers
virtual bool setPointers()
Definition
LArRodBlockPhysicsV1.cxx:86
LArRodBlockPhysicsV1::m_RawDataBlock
std::vector< uint32_t > m_RawDataBlock
Definition
LArRodBlockPhysicsV1.h:116
LArRodBlockPhysicsV1::m_LowEnergyBlock
std::vector< uint32_t > m_LowEnergyBlock
Definition
LArRodBlockPhysicsV1.h:114
LArRodBlockPhysicsV1::setNextEnergy
virtual void setNextEnergy(const int channel, const int32_t energy, const int32_t time, const int32_t quality, const uint32_t gain)
Definition
LArRodBlockPhysicsV1.cxx:129
LArRodBlockPhysicsV1::m_NFlaggingWords
unsigned short m_NFlaggingWords
Definition
LArRodBlockPhysicsV1.h:128
LArRodBlockPhysicsV1::m_EIndex
int m_EIndex
Definition
LArRodBlockPhysicsV1.h:123
LArRodBlockPhysicsV1::hasPhysicsBlock
virtual uint32_t hasPhysicsBlock() const
Definition
LArRodBlockPhysicsV1.h:107
LArRodBlockPhysicsV1::m_HighEIndex
int m_HighEIndex
Definition
LArRodBlockPhysicsV1.h:122
LArRodBlockPhysicsV1::setRawData
virtual void setRawData(const int channel, const std::vector< short > &samples, const uint32_t gain)
Definition
LArRodBlockPhysicsV1.cxx:195
LArRodBlockPhysicsV1::m_RawDataCounter
int m_RawDataCounter
Definition
LArRodBlockPhysicsV1.h:119
LArRodBlockPhysicsV1::setNumberOfSamples
virtual void setNumberOfSamples(const uint8_t n)
Definition
LArRodBlockPhysicsV1.cxx:116
LArRodBlockPhysicsV1::m_HighEnergyBlock
std::vector< uint32_t > m_HighEnergyBlock
Definition
LArRodBlockPhysicsV1.h:115
LArRodBlockPhysicsV1::sortDataVector
virtual void sortDataVector(std::vector< const LArRawChannel * > &)
Definition
LArRodBlockPhysicsV1.cxx:416
LArRodBlockPhysicsV1::m_FlagPtr
const uint32_t * m_FlagPtr
Definition
LArRodBlockPhysicsV1.h:125
LArRodBlockPhysicsV1::finalizeFEB
virtual void finalizeFEB()
Definition
LArRodBlockPhysicsV1.cxx:269
LArRodBlockPhysicsV1::concatinateFEBs
virtual void concatinateFEBs()
Definition
LArRodBlockPhysicsV1.cxx:322
LArRodBlockPhysicsV1::m_LowEPtr
const int16_t * m_LowEPtr
Definition
LArRodBlockPhysicsV1.h:126
LArRodBlockPhysicsV1::canSetRawData
virtual bool canSetRawData()
Definition
LArRodBlockPhysicsV1.h:94
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::getHeader16
uint16_t getHeader16(const unsigned n) const
Definition
LArRodBlockStructure.h:345
LArRodBlockStructure::LArRodBlockStructure
LArRodBlockStructure(IMessageSvc *msgSvc, const std::string &blockType)
Definition
LArRodBlockStructure.cxx:18
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
Generated on
for ATLAS Offline Software by
1.17.0