ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkInDet
src
EventInfoBSErrDecorator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Author: Daiki Hayakawa ( daiki.hayakawa@cern.ch )
6
7
#include "
DerivationFrameworkInDet/EventInfoBSErrDecorator.h
"
8
#include "
DerivationFrameworkInDet/DecoratorUtils.h
"
9
#include "
AthenaBaseComps/AthMsgStreamMacros.h
"
10
11
#include "
InDetIdentifier/SCT_ID.h
"
12
13
#include <vector>
14
#include <utility>
15
#include <string>
16
17
namespace
DerivationFramework
{
18
19
StatusCode
EventInfoBSErrDecorator::initialize
()
20
{
21
22
if
(
m_prefix
.empty()) {
23
ATH_MSG_WARNING
(
"No decoration prefix name provided for the output of EventInfoBSErrDecorator!"
);
24
}
25
26
ATH_CHECK
(
m_eventInfoKey
.initialize() );
27
28
// need Atlas id-helpers to identify sub-detectors, take them from detStore
29
if
( detStore()->retrieve(
m_sctId
,
"SCT_ID"
).isFailure() ){
30
ATH_MSG_ERROR
(
"Could not retrieve SCT helper"
);
31
return
StatusCode::FAILURE;
32
}
33
34
CHECK
(
m_byteStreamErrTool
.retrieve() );
35
CHECK
(
m_cabling
.retrieve() );
36
37
{
38
std::vector<std::string> names;
39
names.resize(
kNIntDecor
);
40
names[
kSCT_BSErr_Ntot
] =
"SCT_BSErr_Ntot"
;
41
names[
kSCT_BSErr_bec
] =
"SCT_BSErr_bec"
;
42
names[
kSCT_BSErr_layer
] =
"SCT_BSErr_layer"
;
43
names[
kSCT_BSErr_eta
] =
"SCT_BSErr_eta"
;
44
names[
kSCT_BSErr_phi
] =
"SCT_BSErr_phi"
;
45
names[
kSCT_BSErr_side
] =
"SCT_BSErr_side"
;
46
names[
kSCT_BSErr_rodid
] =
"SCT_BSErr_rodid"
;
47
names[
kSCT_BSErr_channel
] =
"SCT_BSErr_channel"
;
48
names[
kSCT_BSErr_type
] =
"SCT_BSErr_type"
;
49
createDecoratorKeys
(*
this
,
m_eventInfoKey
,
m_prefix
.value()+
"_"
,names,
m_intDecorKeys
);
50
}
51
52
return
StatusCode::SUCCESS;
53
}
54
55
56
StatusCode
EventInfoBSErrDecorator::addBranches
(
const
EventContext& ctx)
const
57
{
58
ATH_MSG_DEBUG
(
"Adding ByteStream errors to EventInfo"
);
59
60
SG::ReadHandle<xAOD::EventInfo>
eventInfo(
m_eventInfoKey
,ctx);
61
CHECK
( eventInfo.
isValid
() ? StatusCode::SUCCESS : StatusCode::FAILURE );
62
63
std::array<std::vector<int>,
kNIntDecor
> scterr;
64
int
totalNumErrors=0;
65
66
// fill BS error information
67
for
(
int
n_type=0; n_type < SCT_ByteStreamErrors::NUM_ERROR_TYPES; ++n_type) {
68
const
std::set<IdentifierHash> errorSet =
m_byteStreamErrTool
->getErrorSet(n_type, ctx);
69
int
eta
=0,
phi
=0,bec=0,layer=0,side=0;
70
// add totalNumErrors to vector
71
totalNumErrors += errorSet.size();
72
scterr[
kSCT_BSErr_Ntot
].push_back(totalNumErrors);
73
74
// loop in errorSet
75
for
(
const
auto
&
error
: errorSet) {
76
ATH_MSG_DEBUG
(
"debugging information"
);
77
Identifier
itId =
m_sctId
->wafer_id(
error
);
78
ATH_MSG_DEBUG
(
error
);
79
ATH_MSG_DEBUG
(n_type);
80
layer =
m_sctId
->layer_disk(itId);
81
side =
m_sctId
->side(itId);
82
eta
=
m_sctId
->eta_module(itId);
83
phi
=
m_sctId
->phi_module(itId);
84
bec =
m_sctId
->barrel_ec(itId);
85
86
// add variables to vector
87
scterr[
kSCT_BSErr_bec
].push_back(bec);
88
scterr[
kSCT_BSErr_layer
].push_back(layer);
89
scterr[
kSCT_BSErr_eta
].push_back(
eta
);
90
scterr[
kSCT_BSErr_phi
].push_back(
phi
);
91
scterr[
kSCT_BSErr_side
].push_back(side);
92
scterr[
kSCT_BSErr_type
].push_back(n_type);
93
94
uint32_t onlineID =
m_cabling
->getOnlineIdFromHash(
error
);
95
SCT_OnlineId
online(onlineID);
96
uint32_t rod = online.rod();
97
uint32_t fibre = online.fibre();
98
scterr[
kSCT_BSErr_rodid
].push_back((
int
)rod);
99
scterr[
kSCT_BSErr_channel
].push_back((
int
)fibre);
100
}
101
}
102
std::vector<SG::WriteDecorHandle<xAOD::EventInfo,std::vector<int> > > int_decor_handles(
createDecorators
<
xAOD::EventInfo
,std::vector<int> >(
m_intDecorKeys
,ctx));
103
104
assert(int_decor_handles.size() ==
kNIntDecor
);
105
// decorate SCT BS error
106
for
(
unsigned
int
decorate_i=0; decorate_i<int_decor_handles.size(); ++decorate_i) {
107
int_decor_handles[decorate_i](*eventInfo) = std::move(scterr[decorate_i]);
108
}
109
return
StatusCode::SUCCESS;
110
}
111
112
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
AthMsgStreamMacros.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DecoratorUtils.h
EventInfoBSErrDecorator.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
DerivationFramework::EventInfoBSErrDecorator::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition
EventInfoBSErrDecorator.h:42
DerivationFramework::EventInfoBSErrDecorator::kSCT_BSErr_eta
@ kSCT_BSErr_eta
Definition
EventInfoBSErrDecorator.h:52
DerivationFramework::EventInfoBSErrDecorator::kSCT_BSErr_layer
@ kSCT_BSErr_layer
Definition
EventInfoBSErrDecorator.h:51
DerivationFramework::EventInfoBSErrDecorator::kNIntDecor
@ kNIntDecor
Definition
EventInfoBSErrDecorator.h:58
DerivationFramework::EventInfoBSErrDecorator::kSCT_BSErr_rodid
@ kSCT_BSErr_rodid
Definition
EventInfoBSErrDecorator.h:55
DerivationFramework::EventInfoBSErrDecorator::kSCT_BSErr_Ntot
@ kSCT_BSErr_Ntot
Definition
EventInfoBSErrDecorator.h:49
DerivationFramework::EventInfoBSErrDecorator::kSCT_BSErr_type
@ kSCT_BSErr_type
Definition
EventInfoBSErrDecorator.h:57
DerivationFramework::EventInfoBSErrDecorator::kSCT_BSErr_channel
@ kSCT_BSErr_channel
Definition
EventInfoBSErrDecorator.h:56
DerivationFramework::EventInfoBSErrDecorator::kSCT_BSErr_bec
@ kSCT_BSErr_bec
Definition
EventInfoBSErrDecorator.h:50
DerivationFramework::EventInfoBSErrDecorator::kSCT_BSErr_phi
@ kSCT_BSErr_phi
Definition
EventInfoBSErrDecorator.h:53
DerivationFramework::EventInfoBSErrDecorator::kSCT_BSErr_side
@ kSCT_BSErr_side
Definition
EventInfoBSErrDecorator.h:54
DerivationFramework::EventInfoBSErrDecorator::m_byteStreamErrTool
ToolHandle< ISCT_ByteStreamErrorsTool > m_byteStreamErrTool
Definition
EventInfoBSErrDecorator.h:46
DerivationFramework::EventInfoBSErrDecorator::m_sctId
const SCT_ID * m_sctId
Definition
EventInfoBSErrDecorator.h:44
DerivationFramework::EventInfoBSErrDecorator::m_cabling
ToolHandle< ISCT_CablingTool > m_cabling
Definition
EventInfoBSErrDecorator.h:47
DerivationFramework::EventInfoBSErrDecorator::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Definition
EventInfoBSErrDecorator.cxx:56
DerivationFramework::EventInfoBSErrDecorator::initialize
virtual StatusCode initialize() override final
Definition
EventInfoBSErrDecorator.cxx:19
DerivationFramework::EventInfoBSErrDecorator::m_prefix
Gaudi::Property< std::string > m_prefix
Definition
EventInfoBSErrDecorator.h:40
DerivationFramework::EventInfoBSErrDecorator::m_intDecorKeys
std::vector< SG::WriteDecorHandleKey< xAOD::EventInfo > > m_intDecorKeys
Definition
EventInfoBSErrDecorator.h:60
SCT_OnlineId
SCT_OnlineId is a class to hold an online id number and provide check on validity,...
Definition
SCT_OnlineId.h:22
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
DerivationFramework::createDecorators
std::vector< SG::WriteDecorHandle< T_Cont, T > > createDecorators(const std::vector< SG::WriteDecorHandleKey< T_Cont > > &keys, const EventContext &ctx)
Definition
DecoratorUtils.h:51
DerivationFramework::createDecoratorKeys
void createDecoratorKeys(T_Parent &parent, const SG::ReadHandleKey< T_Cont > &container_key, const std::string &prefix, const std::vector< std::string > &decor_names, std::vector< SG::WriteDecorHandleKey< T_Cont > > &decor_out)
Definition
DecoratorUtils.h:20
Identifier
Definition
IdentifierFieldParser.cxx:14
error
Definition
IImpactPoint3dEstimator.h:72
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
Generated on
for ATLAS Offline Software by
1.17.0