ATLAS Offline Software
Loading...
Searching...
No Matches
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"
14#include <stdexcept>
15
16namespace ftag {
17
19 const std::string& name, ISvcLocator* loc )
20 : AthReentrantAlgorithm(name, loc) {}
21
23 ATH_MSG_INFO( "Initializing " << name() << "... " );
24
25 ATH_CHECK( m_constituentKey.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
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Handle class for reading a decoration on an object.
Handle class for adding a decoration to an object.
An algorithm that can be simultaneously executed in multiple threads.
Handle class for reading a decoration on an object.
Handle class for adding a decoration to an object.
FlowSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
< Constructors
SG::ReadDecorHandleKey< IPC > m_constituentKey
virtual StatusCode execute(const EventContext &) const override
SG::WriteDecorHandleKey< IPC > m_chargedConstituentOutKey
virtual StatusCode initialize() override
SG::WriteDecorHandleKey< IPC > m_neutralConstituentOutKey
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16