ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
JetTagging
FlavorTagDiscriminants
src
CaloChargedFlowDecoratorAlg.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
#include "
FlavorTagDiscriminants/CaloChargedFlowDecoratorAlg.h
"
6
#include "
xAODPFlow/FlowElement.h
"
7
#include "
xAODCaloEvent/CaloCluster.h
"
8
#include "
StoreGate/WriteDecorHandle.h
"
9
10
11
namespace
FlavorTagDiscriminants
{
12
13
CaloChargedFlowDecoratorAlg::CaloChargedFlowDecoratorAlg
(
14
const
std::string& name, ISvcLocator* loc)
15
:
AthReentrantAlgorithm
(name, loc)
16
{
17
}
18
19
StatusCode
CaloChargedFlowDecoratorAlg::initialize
() {
20
ATH_CHECK
(
m_caloClusterCollection
.initialize());
21
ATH_CHECK
(
m_neutralPFOCollection
.initialize());
22
ATH_CHECK
(
m_chargedPFOCollection
.initialize());
23
ATH_CHECK
(
m_objUsedInChargedDecorator
.initialize());
24
return
StatusCode::SUCCESS;
25
}
26
27
StatusCode
CaloChargedFlowDecoratorAlg::execute
(
28
const
EventContext& ctx)
const
29
{
30
SG::ReadHandle<IPC>
constituents(
m_caloClusterCollection
, ctx);
31
SG::ReadHandle<IPC>
neutralPFOs(
m_neutralPFOCollection
, ctx);
32
SG::ReadHandle<IPC>
chargedPFOs(
m_chargedPFOCollection
, ctx);
33
SG::WriteDecorHandle<IPC, int>
usedInChargedPFO(
34
m_objUsedInChargedDecorator
, ctx);
35
36
// Default all clusters to -1 (not linked to any PFO)
37
for
(
const
auto
* obj : *constituents) {
38
usedInChargedPFO(*obj) = -1;
39
}
40
41
// Mark clusters linked to neutral PFOs as 0
42
for
(
const
auto
* obj : *neutralPFOs) {
43
const
auto
* flow =
dynamic_cast<
const
xAOD::FlowElement
*
>
(obj);
44
if
(!flow)
continue
;
45
for
(
const
auto
* otherObject : flow->otherObjects()) {
46
if
(!otherObject) {
47
ATH_MSG_WARNING
(
"Invalid otherObject link, skipping"
);
48
continue
;
49
}
50
usedInChargedPFO(*otherObject) = 0;
51
}
52
}
53
54
// Mark clusters linked to charged PFOs as 1 (overrides neutral)
55
for
(
const
auto
* obj : *chargedPFOs) {
56
const
auto
* flow =
dynamic_cast<
const
xAOD::FlowElement
*
>
(obj);
57
if
(!flow)
continue
;
58
for
(
const
auto
* otherObject : flow->otherObjects()) {
59
if
(!otherObject) {
60
ATH_MSG_WARNING
(
"Invalid otherObject link, skipping"
);
61
continue
;
62
}
63
usedInChargedPFO(*otherObject) = 1;
64
}
65
}
66
67
return
StatusCode::SUCCESS;
68
}
69
70
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
CaloChargedFlowDecoratorAlg.h
CaloCluster.h
FlowElement.h
WriteDecorHandle.h
Handle class for adding a decoration to an object.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
FlavorTagDiscriminants::CaloChargedFlowDecoratorAlg::CaloChargedFlowDecoratorAlg
CaloChargedFlowDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CaloChargedFlowDecoratorAlg.cxx:13
FlavorTagDiscriminants::CaloChargedFlowDecoratorAlg::m_chargedPFOCollection
SG::ReadHandleKey< IPC > m_chargedPFOCollection
Definition
CaloChargedFlowDecoratorAlg.h:35
FlavorTagDiscriminants::CaloChargedFlowDecoratorAlg::initialize
virtual StatusCode initialize() override
Definition
CaloChargedFlowDecoratorAlg.cxx:19
FlavorTagDiscriminants::CaloChargedFlowDecoratorAlg::m_caloClusterCollection
SG::ReadHandleKey< IPC > m_caloClusterCollection
Definition
CaloChargedFlowDecoratorAlg.h:29
FlavorTagDiscriminants::CaloChargedFlowDecoratorAlg::m_neutralPFOCollection
SG::ReadHandleKey< IPC > m_neutralPFOCollection
Definition
CaloChargedFlowDecoratorAlg.h:32
FlavorTagDiscriminants::CaloChargedFlowDecoratorAlg::m_objUsedInChargedDecorator
SG::WriteDecorHandleKey< IPC > m_objUsedInChargedDecorator
Definition
CaloChargedFlowDecoratorAlg.h:39
FlavorTagDiscriminants::CaloChargedFlowDecoratorAlg::execute
virtual StatusCode execute(const EventContext &) const override
Definition
CaloChargedFlowDecoratorAlg.cxx:27
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
FlavorTagDiscriminants
Definition
CaloChargedFlowDecoratorAlg.h:15
xAOD::FlowElement
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition
FlowElement.h:16
Generated on
for ATLAS Offline Software by
1.17.0