ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
JetTagging
JetTagDerivationUtils
src
FlowSelectorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
/************************************************************
5
* @file FlowSelectorAlg.cxx
6
* @brief Make a collection of constituents that aren't charged
7
* **********************************************************/
8
9
#include "
FlowSelectorAlg.h
"
10
#include "
xAODBase/IParticleContainer.h
"
11
#include "
xAODPFlow/FlowElement.h
"
12
#include "
StoreGate/WriteDecorHandle.h
"
13
#include "
StoreGate/ReadDecorHandle.h
"
14
#include <stdexcept>
15
16
namespace
ftag
{
17
18
FlowSelectorAlg::FlowSelectorAlg
(
19
const
std::string& name, ISvcLocator* loc )
20
:
AthReentrantAlgorithm
(name, loc) {}
21
22
StatusCode
FlowSelectorAlg::initialize
() {
23
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"... "
);
24
25
ATH_CHECK
(
m_constituentKey
.initialize() );
26
ATH_CHECK
(
m_neutralConstituentOutKey
.initialize() );
27
ATH_CHECK
(
m_chargedConstituentOutKey
.initialize() );
28
29
return
StatusCode::SUCCESS;
30
}
31
32
StatusCode
FlowSelectorAlg::execute
(
const
EventContext& ctx)
const
{
33
ATH_MSG_DEBUG
(
"Executing "
<< name() <<
"... "
);
34
35
using
IPLV = std::vector<ElementLink<xAOD::IParticleContainer>>;
36
37
SG::ReadDecorHandle<IPC, IPLV>
constituents(
m_constituentKey
, ctx);
38
SG::WriteDecorHandle<IPC, IPLV>
neutralConstituentsOut(
m_neutralConstituentOutKey
, ctx);
39
SG::WriteDecorHandle<IPC, IPLV>
chargedConstituentsOut(
m_chargedConstituentOutKey
, ctx);
40
41
42
for
(
const
auto
* obj: *constituents) {
43
IPLV neutral_flows;
44
IPLV charged_flows;
45
for
(
const
auto
& link: constituents(*obj)) {
46
if
(!link.isValid())
throw
std::runtime_error(
47
"invalid constituent link"
);
48
const
auto
* flow =
dynamic_cast<
const
xAOD::FlowElement
*
>
(*link);
49
if
(!flow)
throw
std::runtime_error(
"constituent isn't flow object"
);
50
if
(!flow->isCharged()) neutral_flows.push_back(link);
51
else
charged_flows.push_back(link);
52
}
53
neutralConstituentsOut(*obj) = std::move(neutral_flows);
54
chargedConstituentsOut(*obj) = std::move(charged_flows);
55
}
56
57
return
StatusCode::SUCCESS;
58
}
59
60
}
// end namespace ftag
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
FlowElement.h
FlowSelectorAlg.h
ReadDecorHandle.h
Handle class for reading a decoration on an object.
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
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition
StoreGate/StoreGate/ReadDecorHandle.h:94
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
ftag::FlowSelectorAlg::FlowSelectorAlg
FlowSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
< Constructors
Definition
FlowSelectorAlg.cxx:18
ftag::FlowSelectorAlg::m_constituentKey
SG::ReadDecorHandleKey< IPC > m_constituentKey
Definition
FlowSelectorAlg.h:31
ftag::FlowSelectorAlg::execute
virtual StatusCode execute(const EventContext &) const override
Definition
FlowSelectorAlg.cxx:32
ftag::FlowSelectorAlg::m_chargedConstituentOutKey
SG::WriteDecorHandleKey< IPC > m_chargedConstituentOutKey
Definition
FlowSelectorAlg.h:39
ftag::FlowSelectorAlg::initialize
virtual StatusCode initialize() override
Definition
FlowSelectorAlg.cxx:22
ftag::FlowSelectorAlg::m_neutralConstituentOutKey
SG::WriteDecorHandleKey< IPC > m_neutralConstituentOutKey
Definition
FlowSelectorAlg.h:35
ftag
Definition
FlowSelectorAlg.cxx:16
xAOD::FlowElement
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition
FlowElement.h:16
IParticleContainer.h
Generated on
for ATLAS Offline Software by
1.17.0