ATLAS Offline Software
MuonSpectrometer
MuonCnv
MuonTGC_CnvTools
src
TGC_RawDataProviderToolCore.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TGC_RawDataProviderToolCore.h
"
6
7
#include "
MuonRDO/TgcRdoContainer.h
"
8
#include "
MuonTGC_Cabling/MuonTGC_CablingSvc.h
"
9
10
//================ Constructor =================================================
11
12
Muon::TGC_RawDataProviderToolCore::TGC_RawDataProviderToolCore
(
13
const
std::string&
t
,
14
const
std::string&
n
,
15
const
IInterface*
p
) :
16
AthAlgTool
(
t
,
n
,
p
),
17
m_robDataProvider(
"ROBDataProviderSvc"
,
n
)
18
{
19
}
20
21
//================ Initialisation =================================================
22
23
StatusCode
Muon::TGC_RawDataProviderToolCore::initialize
()
24
{
25
ATH_CHECK
(
AthAlgTool::initialize
());
26
ATH_CHECK
(m_idHelperSvc.retrieve());
27
28
ATH_CHECK
(m_decoder.retrieve());
29
ATH_MSG_DEBUG
(
"Retrieved tool "
<< m_decoder );
30
31
// Get ROBDataProviderSvc
32
ATH_CHECK
(m_robDataProvider.retrieve());
33
ATH_MSG_DEBUG
(
"Retrieved service "
<< m_robDataProvider );
34
35
m_maxhashtoUse = m_idHelperSvc->tgcIdHelper().module_hash_max();
36
37
ATH_CHECK
(m_rdoContainerKey.initialize());
38
39
//try to configure the cabling service
40
if
(!getCabling()) {
41
// ??? Is deferred initialization still needed here?
42
ATH_MSG_INFO
(
"TGCCablingServerSvc not yet configured; postpone TGCcabling initialization at first event. "
);
43
}
44
45
m_hid2re.fillAllRobIds();
46
47
return
StatusCode::SUCCESS;
48
}
49
50
//============================================================================================
51
52
StatusCode
Muon::TGC_RawDataProviderToolCore::convertIntoContainer
(
const
std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs,
TgcRdoContainer
& tgcRdoContainer)
const
53
{
54
56
static
thread_local
int
DecodeErrCount = 0;
57
58
// Update to range based loop
59
for
(
const
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
* fragment : vecRobs){
60
if
(m_decoder->fillCollection(*fragment, tgcRdoContainer).isFailure()) {
61
if
(DecodeErrCount < 100) {
62
ATH_MSG_INFO
(
"Problem with TGC ByteStream Decoding!"
);
63
DecodeErrCount++;
64
}
65
else
if
(100 == DecodeErrCount) {
66
ATH_MSG_INFO
(
"Too many Problems with TGC Decoding messages. Turning message off."
);
67
DecodeErrCount++;
68
}
69
}
70
}
71
ATH_MSG_DEBUG
(
"Size of TgcRdoContainer is "
<< tgcRdoContainer.
size
());
72
return
StatusCode::SUCCESS;
73
}
74
75
const
MuonTGC_CablingSvc
*
Muon::TGC_RawDataProviderToolCore::getCabling
()
const
76
{
77
const
MuonTGC_CablingSvc
*
cabling
= m_cabling.get();
78
if
(
cabling
) {
79
return
cabling
;
80
}
81
82
ServiceHandle<MuonTGC_CablingSvc>
TgcCabGet(
"MuonTGC_CablingSvc"
,
name
());
83
if
(TgcCabGet.retrieve().isFailure()) {
84
ATH_MSG_FATAL
(
"Could not get MuonTGC_CablingSvc !"
);
85
return
nullptr
;
86
}
87
88
m_cabling.set(TgcCabGet.get());
89
90
return
m_cabling.get();
91
}
92
93
94
std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>
Muon::TGC_RawDataProviderToolCore::getROBData
(
const
std::vector<IdentifierHash>& rdoIdhVect,
const
EventContext& ctx)
const
95
{
96
std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf;
97
const
MuonTGC_CablingSvc
*
cabling
= getCabling();
98
if
(!
cabling
) {
99
ATH_MSG_ERROR
(
"Could not get cabling, return empty vector of ROB fragments"
);
100
return
vecOfRobf;
101
}
102
103
IdContext
tgcContext = m_idHelperSvc->tgcIdHelper().module_context();
104
105
std::vector<uint32_t> robIds;
106
107
unsigned
int
size
= rdoIdhVect.size();
108
for
(
unsigned
int
i
=0;
i
<
size
; ++
i
) {
109
Identifier
Id;
110
if
(m_idHelperSvc->tgcIdHelper().get_id(rdoIdhVect[
i
], Id, &tgcContext)) {
111
ATH_MSG_WARNING
(
"Unable to get TGC Identifier from collection hash id "
);
112
continue
;
113
}
114
const
Identifier
tgcId = Id;
115
uint32_t
rodId = m_hid2re.getRodID(tgcId,
cabling
);
116
uint32_t
robId = m_hid2re.getRobID(rodId);
117
std::vector<uint32_t>::iterator
it_robId =
std::find
(robIds.begin(), robIds.end(), robId);
118
if
(it_robId==robIds.end()) {
119
robIds.push_back(robId);
120
}
121
}
122
m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
123
ATH_MSG_VERBOSE
(
"Number of ROB fragments "
<< vecOfRobf.size() );
124
return
vecOfRobf;
125
}
xAOD::iterator
JetConstituentVector::iterator iterator
Definition:
JetConstituentVector.cxx:68
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition:
AthMsgStreamMacros.h:34
MuonTGC_CablingSvc.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition:
hcg.cxx:135
xAOD::uint32_t
setEventNumber uint32_t
Definition:
EventInfo_v1.cxx:127
Muon::TGC_RawDataProviderToolCore::TGC_RawDataProviderToolCore
TGC_RawDataProviderToolCore(const std::string &t, const std::string &n, const IInterface *p)
Default constructor.
Definition:
TGC_RawDataProviderToolCore.cxx:12
initialize
void initialize()
Definition:
run_EoverP.cxx:894
ReadCellNoiseFromCool.cabling
cabling
Definition:
ReadCellNoiseFromCool.py:154
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition:
IdentifiableContainerMT.h:209
read_hist_ntuple.t
t
Definition:
read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition:
AthMsgStreamMacros.h:28
python.setupRTTAlg.size
int size
Definition:
setupRTTAlg.py:39
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
TgcRdoContainer
Definition:
TgcRdoContainer.h:25
eformat::ROBFragment
Definition:
L1CaloBsDecoderUtil.h:12
lumiFormat.i
int i
Definition:
lumiFormat.py:85
beamspotman.n
n
Definition:
beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
Muon::TGC_RawDataProviderToolCore::getROBData
std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > getROBData(const std::vector< IdentifierHash > &rdoIdhVect, const EventContext &ctx) const
Function to get the ROB data from a vector of IdentifierHash.
Definition:
TGC_RawDataProviderToolCore.cxx:94
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
Muon::TGC_RawDataProviderToolCore::convertIntoContainer
virtual StatusCode convertIntoContainer(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, TgcRdoContainer &tgcRdoContainer) const
Method that converts the ROBFragments into the passed container.
Definition:
TGC_RawDataProviderToolCore.cxx:52
TgcRdoContainer.h
Muon::TGC_RawDataProviderToolCore::initialize
virtual StatusCode initialize()
Standard AlgTool method.
Definition:
TGC_RawDataProviderToolCore.cxx:23
Muon::TGC_RawDataProviderToolCore::getCabling
const MuonTGC_CablingSvc * getCabling() const
Definition:
TGC_RawDataProviderToolCore.cxx:75
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:221
TGC_RawDataProviderToolCore.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition:
AthMsgStreamMacros.h:32
AthAlgTool
Definition:
AthAlgTool.h:26
MuonTGC_CablingSvc
Definition:
MuonTGC_CablingSvc.h:31
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition:
IdContext.h:26
ServiceHandle< MuonTGC_CablingSvc >
Identifier
Definition:
IdentifierFieldParser.cxx:14
Generated on Thu Nov 7 2024 21:27:34 for ATLAS Offline Software by
1.8.18