ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
PixelRawDataByteStreamCnv
src
PixelRawDataProviderTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
PixelRawDataProviderTool.h
"
6
#include "
StoreGate/WriteHandle.h
"
7
#include "
PixelRodDecoder.h
"
8
9
using
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
;
10
11
//#define PIXEL_DEBUG
12
//#define PLOTS
13
14
// -------------------------------------------------------
15
// default contructor
16
17
PixelRawDataProviderTool::PixelRawDataProviderTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent):
18
AthAlgTool
(
type
,name,parent),
19
m_DecodeErrCount
(0)
20
{
21
declareInterface<IPixelRawDataProviderTool>(
this
);
22
}
23
24
StatusCode
PixelRawDataProviderTool::initialize
() {
25
ATH_CHECK
(AthAlgTool::initialize());
26
ATH_CHECK
(
m_decoder
.retrieve());
27
28
ATH_CHECK
(
m_LVL1CollectionKey
.initialize(
m_storeInDetTimeColls
));
29
ATH_CHECK
(
m_BCIDCollectionKey
.initialize(
m_storeInDetTimeColls
));
30
31
return
StatusCode::SUCCESS;
32
}
33
34
StatusCode
PixelRawDataProviderTool::convert
(std::vector<const ROBFragment*>& vecRobs,
IPixelRDO_Container
* rdoIdc,
35
IDCInDetBSErrContainer
& decodingErrors,
const
EventContext& ctx )
const
{
36
if
(vecRobs.size()==0) {
return
StatusCode::SUCCESS; }
37
38
std::vector<const ROBFragment*>::const_iterator rob_it = vecRobs.begin();
39
40
#ifdef PIXEL_DEBUG
41
ATH_MSG_DEBUG
(
" New ROD collection found: LVL1="
<< (*rob_it)->rod_lvl1_id() <<
" Size="
<< vecRobs.size());
42
#endif
43
#ifdef PLOTS
44
std::cout <<
" New ROD collection found: LVL1="
<< (*rob_it)->rod_lvl1_id() <<
" Size="
<< vecRobs.size() << std::endl;
45
#endif
46
47
SG::WriteHandle<InDetTimeCollection>
LVL1Collection;
48
SG::WriteHandle<InDetTimeCollection>
BCIDCollection;
49
50
if
(
m_storeInDetTimeColls
) {
51
// are we working on a new event ?
52
LVL1Collection =
SG::makeHandle
(
m_LVL1CollectionKey
,ctx);
53
ATH_CHECK
(LVL1Collection.
record
(std::make_unique<InDetTimeCollection>()));
54
ATH_MSG_DEBUG
(
"InDetTimeCollection "
<< LVL1Collection.
name
() <<
" registered in StoreGate"
);
55
LVL1Collection->reserve(vecRobs.size());
56
57
BCIDCollection =
SG::makeHandle
(
m_BCIDCollectionKey
,ctx);
58
ATH_CHECK
(BCIDCollection.
record
(std::make_unique<InDetTimeCollection>()));
59
ATH_MSG_DEBUG
(
"InDetTimeCollection "
<< BCIDCollection.
name
() <<
" registered in StoreGate"
);
60
BCIDCollection->reserve(vecRobs.size());
61
}
62
63
#ifdef PIXEL_DEBUG
64
ATH_MSG_DEBUG
(
" New event, reset the collection set"
);
65
#endif
66
67
// loop over the ROB fragments
68
for
(; rob_it!=vecRobs.end(); ++rob_it) {
69
uint32_t robid = (*rob_it)->rob_source_id();
70
#ifdef PIXEL_DEBUG
71
ATH_MSG_DEBUG
(
"Found ROB "
<< std::hex << robid << std::dec);
72
#endif
73
74
if
(
m_storeInDetTimeColls
) {
75
unsigned
int
lvl1id = (*rob_it)->rod_lvl1_id();
76
LVL1Collection->emplace_back(robid,lvl1id) ;
77
78
unsigned
int
bcid = (*rob_it)->rod_bc_id();
79
BCIDCollection->emplace_back(robid,bcid);
80
81
#ifdef PIXEL_DEBUG
82
ATH_MSG_DEBUG
(
"Stored LVL1ID "
<<lvl1id<<
" and BCID "
<<bcid<<
" in InDetTimeCollections"
);
83
#endif
84
85
}
86
87
// here the code for the timing monitoring should be reinserted
88
// using 1 container per event and subdetector
89
StatusCode
sc
=
m_decoder
->fillCollection(&**rob_it, rdoIdc, decodingErrors,
nullptr
,ctx);
90
91
const
int
issuesMessageCountLimit = 100;
92
if
(
sc
==StatusCode::FAILURE) {
93
if
(
m_DecodeErrCount
< issuesMessageCountLimit) {
94
ATH_MSG_INFO
(
"Problem with Pixel ByteStream Decoding!"
);
95
m_DecodeErrCount
++;
96
}
97
else
if
(issuesMessageCountLimit ==
m_DecodeErrCount
) {
98
ATH_MSG_INFO
(
"Too many Problems with Pixel Decoding messages. Turning message off."
);
99
m_DecodeErrCount
++;
100
}
101
}
102
}
103
return
StatusCode::SUCCESS;
104
}
105
106
int
PixelRawDataProviderTool::SizeOfIDCInDetBSErrContainer
()
const
{
107
//=========================================================
108
// Size of Pixel BS Error container
109
//
110
// The error would be stored not only for module but also each FE (x16) per module.
111
// In addition, IBL FEI4 provides error counter between trigger, this also extends
112
// the size beyond nominal module + FE ID. These numbers come from the hardware
113
// specification so that there is no easy way to document in the header file.
114
// Rather, put the hardcoded number here.
115
//
116
// Total number of pixel modules: 2048
117
// Number of FE chips per module: 16
118
// -------------------------------------
119
// 2048 x 17 (module + FE) = 34816
120
//
121
// IBL extra error information :
122
// 280(module) x 2(FE) x 32(error counter) = 17920
123
// -------------------------------------
124
//
125
// isActive status : 2048
126
// -------------------------------------
127
// Total : 54784
128
//=========================================================
129
return
PixelRodDecoder::ERROR_CONTAINER_MAX
;
130
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
IPixelRDO_Container
EventContainers::IIdentifiableCont< InDetRawDataCollection< PixelRDORawData > > IPixelRDO_Container
Definition
PixelRDO_Container.h:34
PixelRawDataProviderTool.h
PixelRodDecoder.h
WriteHandle.h
Handle class for recording to StoreGate.
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
IDCInDetBSErrContainer
IDC like storage for BS errors, TODO, customise implementation further so that we store int rather th...
Definition
IDCInDetBSErrContainer.h:19
PixelRawDataProviderTool::m_LVL1CollectionKey
SG::WriteHandleKey< InDetTimeCollection > m_LVL1CollectionKey
Definition
PixelRawDataProviderTool.h:47
PixelRawDataProviderTool::m_DecodeErrCount
std::atomic_int m_DecodeErrCount
Definition
PixelRawDataProviderTool.h:51
PixelRawDataProviderTool::m_storeInDetTimeColls
Gaudi::Property< bool > m_storeInDetTimeColls
Definition
PixelRawDataProviderTool.h:49
PixelRawDataProviderTool::initialize
StatusCode initialize() override
initialize
Definition
PixelRawDataProviderTool.cxx:24
PixelRawDataProviderTool::PixelRawDataProviderTool
PixelRawDataProviderTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition
PixelRawDataProviderTool.cxx:17
PixelRawDataProviderTool::m_BCIDCollectionKey
SG::WriteHandleKey< InDetTimeCollection > m_BCIDCollectionKey
Definition
PixelRawDataProviderTool.h:48
PixelRawDataProviderTool::SizeOfIDCInDetBSErrContainer
int SizeOfIDCInDetBSErrContainer() const final
Size of IDCInDetBSErrContainer.
Definition
PixelRawDataProviderTool.cxx:106
PixelRawDataProviderTool::m_decoder
ToolHandle< IPixelRodDecoder > m_decoder
Definition
PixelRawDataProviderTool.h:44
PixelRawDataProviderTool::convert
StatusCode convert(std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, IPixelRDO_Container *rdoIdc, IDCInDetBSErrContainer &decodingErrors, const EventContext &ctx) const final
this is the main decoding method
Definition
PixelRawDataProviderTool.cxx:34
PixelRodDecoder::ERROR_CONTAINER_MAX
static constexpr size_t ERROR_CONTAINER_MAX
Definition
PixelRodDecoder.h:111
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
eformat::ROBFragment< PointerType > ROBFragment
Definition
RawEvent.h:27
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
type
Generated on
for ATLAS Offline Software by
1.17.0