ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
TRT_RawDataByteStreamCnv
src
TRTRawDataProviderTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
TRTRawDataProviderTool.h
"
7
#include "GaudiKernel/IToolSvc.h"
8
#include "
InDetRawData/TRT_RDORawData.h
"
9
#include "
ByteStreamData/RawEvent.h
"
10
#include "GaudiKernel/ServiceHandle.h"
11
#include "
StoreGate/StoreClearedIncident.h
"
12
#include "
StoreGate/WriteHandle.h
"
13
14
15
using
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
;
16
17
18
// -------------------------------------------------------
19
//
20
21
22
23
// -------------------------------------------------------
24
// default contructor
25
26
TRTRawDataProviderTool::TRTRawDataProviderTool
27
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent )
28
: base_class(
type
, name, parent ),
29
m_decoder
(
"TRT_RodDecoder"
,this)
30
{
31
declareProperty (
"Decoder"
,
m_decoder
);
32
}
33
34
// -------------------------------------------------------
35
// initialize
36
37
StatusCode
TRTRawDataProviderTool::initialize
()
38
{
39
40
ATH_CHECK
( AlgTool::initialize() );
41
42
ATH_CHECK
(
m_decoder
.retrieve() );
43
ATH_MSG_INFO
(
"Retrieved tool "
<<
m_decoder
);
44
45
//initialize write handles
46
ATH_CHECK
(
m_lvl1idkey
.initialize(
m_storeInDetTimeColls
));
47
ATH_CHECK
(
m_bcidkey
.initialize(
m_storeInDetTimeColls
));
48
49
return
StatusCode::SUCCESS;
50
}
51
52
// -------------------------------------------------------
53
// convert method
54
55
StatusCode
TRTRawDataProviderTool::convert
(
const
std::vector<const ROBFragment*>& vecRobs,
56
TRT_RDO_Container
* rdoIdc,
57
TRT_BSErrContainer
* bserr,
58
DataPool<TRT_LoLumRawData>
* dataItemsPool,
59
const
EventContext& ctx)
const
60
{
61
62
static
std::atomic_int DecodeErrCount = 0;
63
64
if
(vecRobs.empty())
65
return
StatusCode::SUCCESS;
66
67
68
std::unique_ptr<InDetTimeCollection> LVL1Collection;
69
std::unique_ptr<InDetTimeCollection> BCCollection;
70
std::vector<const ROBFragment*>::const_iterator rob_it = vecRobs.begin();
71
72
73
if
(
m_storeInDetTimeColls
) {
74
// Create Collections for per ROD vectors on L1ID and BCID
75
LVL1Collection = std::make_unique<InDetTimeCollection>();
76
LVL1Collection->reserve(vecRobs.size());
77
78
BCCollection = std::make_unique<InDetTimeCollection>();
79
BCCollection->reserve(vecRobs.size());
80
}
81
82
// loop over the ROB fragments
83
for
(; rob_it!=vecRobs.end(); ++rob_it)
84
{
85
86
uint32_t robid = (*rob_it)->rod_source_id();
87
88
if
(
m_storeInDetTimeColls
) {
89
/*
90
* Add to vector containing pairs of (ROD ID, [L1ID,BCID])
91
*/
92
93
unsigned
int
lvl1id = (*rob_it)->rod_lvl1_id();
94
LVL1Collection->emplace_back(robid, lvl1id);
95
96
unsigned
int
bcid = (*rob_it)->rod_bc_id();
97
BCCollection->emplace_back(robid, bcid);
98
99
#ifdef TRT_BSC_DEBUG
100
ATH_MSG_DEBUG
(
"Stored LVL1ID "
<< lvl1id <<
" and BCID "
<< bcid <<
" in InDetTimeCollections"
);
101
#endif
102
}
103
StatusCode
sc
=
m_decoder
->fillCollection( &**rob_it, rdoIdc, bserr, dataItemsPool, ctx);
104
if
(
sc
== StatusCode::FAILURE )
105
{
106
if
(DecodeErrCount < 100) {
107
ATH_MSG_INFO
(
"Problem with TRT ByteStream Decoding!"
);
108
DecodeErrCount++;
109
}
else
if
(100 == DecodeErrCount) {
110
ATH_MSG_INFO
(
111
"Too many Problem with TRT Decoding messages. Turning message "
112
"off."
);
113
DecodeErrCount++;
114
}
115
// return sc; Don't return on single ROD failure
116
}
117
}
118
119
/*
120
* record per ROD L1ID and BCID collections
121
*/
122
if
(
m_storeInDetTimeColls
) {
123
124
SG::WriteHandle<InDetTimeCollection>
lvl1id(
m_lvl1idkey
,ctx);
125
ATH_CHECK
(lvl1id.
record
(std::move(LVL1Collection)));
126
127
SG::WriteHandle<InDetTimeCollection>
bcid(
m_bcidkey
,ctx);
128
ATH_CHECK
(bcid.record(std::move(BCCollection)));
129
}
130
131
return
StatusCode::SUCCESS;
132
}
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
RawEvent.h
StoreClearedIncident.h
Incident sent after a store is cleared.
WriteHandle.h
Handle class for recording to StoreGate.
TRTRawDataProviderTool.h
TRT_RDORawData.h
TRT_RDO_Container
InDetRawDataContainer< InDetRawDataCollection< TRT_RDORawData > > TRT_RDO_Container
Definition
TRT_RDO_Container.h:26
DataPool
a typed memory pool that saves time spent allocation small object.
Definition
DataPool.h:63
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.
TRTRawDataProviderTool::m_decoder
ToolHandle< ITRT_RodDecoder > m_decoder
Definition
TRTRawDataProviderTool.h:47
TRTRawDataProviderTool::TRTRawDataProviderTool
TRTRawDataProviderTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition
TRTRawDataProviderTool.cxx:27
TRTRawDataProviderTool::initialize
virtual StatusCode initialize() override
initialize
Definition
TRTRawDataProviderTool.cxx:37
TRTRawDataProviderTool::m_lvl1idkey
SG::WriteHandleKey< InDetTimeCollection > m_lvl1idkey
Definition
TRTRawDataProviderTool.h:49
TRTRawDataProviderTool::convert
virtual StatusCode convert(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, TRT_RDO_Container *rdoIdc, TRT_BSErrContainer *bsErrCont, DataPool< TRT_LoLumRawData > *dataItemsPool, const EventContext &ctx) const override
this is the main decoding method
Definition
TRTRawDataProviderTool.cxx:55
TRTRawDataProviderTool::m_bcidkey
SG::WriteHandleKey< InDetTimeCollection > m_bcidkey
Definition
TRTRawDataProviderTool.h:50
TRTRawDataProviderTool::m_storeInDetTimeColls
Gaudi::Property< bool > m_storeInDetTimeColls
Definition
TRTRawDataProviderTool.h:51
TRT_BSErrContainer
Definition
TRT_BSErrContainer.h:20
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
eformat::ROBFragment< PointerType > ROBFragment
Definition
RawEvent.h:27
type
Generated on
for ATLAS Offline Software by
1.17.0