ATLAS Offline Software
FlowSelectorAlg.cxx
Go to the documentation of this file.
1 /************************************************************
2  * @file FlowSelectorAlg.cxx
3  * @brief Make a collection of constituents that aren't charged
4  * **********************************************************/
5 
6 #include "FlowSelectorAlg.h"
11 
12 namespace ftag {
13 
15  const std::string& name, ISvcLocator* loc )
16  : AthReentrantAlgorithm(name, loc) {}
17 
19  ATH_MSG_INFO( "Inizializing " << name() << "... " );
20 
21  ATH_CHECK( m_constituentKey.initialize() );
22  ATH_CHECK( m_neutralConstituentOutKey.initialize() );
23  ATH_CHECK( m_chargedConstituentOutKey.initialize() );
24 
25  return StatusCode::SUCCESS;
26  }
27 
28  StatusCode FlowSelectorAlg::execute(const EventContext& ctx) const {
29  ATH_MSG_DEBUG( "Executing " << name() << "... " );
30 
31  using IPLV = std::vector<ElementLink<xAOD::IParticleContainer>>;
32 
36 
37 
38  for (const auto* obj: *constituents) {
39  IPLV neutral_flows;
40  IPLV charged_flows;
41  for (const auto& link: constituents(*obj)) {
42  if (!link.isValid()) throw std::runtime_error(
43  "invalid constituent link");
44  const auto* flow = dynamic_cast<const xAOD::FlowElement*>(*link);
45  if (!flow) throw std::runtime_error("constituent isn't flow object");
46  if (!flow->isCharged()) neutral_flows.push_back(link);
47  else charged_flows.push_back(link);
48  }
49  neutralConstituentsOut(*obj) = neutral_flows;
50  chargedConstituentsOut(*obj) = charged_flows;
51  }
52 
53  return StatusCode::SUCCESS;
54  }
55 
56 } // end namespace ftag
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ftag::FlowSelectorAlg::m_neutralConstituentOutKey
SG::WriteDecorHandleKey< IPC > m_neutralConstituentOutKey
Definition: FlowSelectorAlg.h:35
ftag::FlowSelectorAlg::initialize
virtual StatusCode initialize() override
Definition: FlowSelectorAlg.cxx:21
ftag::FlowSelectorAlg::execute
virtual StatusCode execute(const EventContext &) const override
Definition: FlowSelectorAlg.cxx:31
ftag::FlowSelectorAlg::m_chargedConstituentOutKey
SG::WriteDecorHandleKey< IPC > m_chargedConstituentOutKey
Definition: FlowSelectorAlg.h:39
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
FlowElement.h
HepMC::flow
int flow(const T &a, int i)
Definition: Flow.h:51
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
IParticleContainer.h
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ftag::FlowSelectorAlg::m_constituentKey
SG::ReadDecorHandleKey< IPC > m_constituentKey
Definition: FlowSelectorAlg.h:31
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
FlowSelectorAlg.h
ftag::FlowSelectorAlg::FlowSelectorAlg
FlowSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
< Constructors
Definition: FlowSelectorAlg.cxx:17
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ftag
Definition: FlowSelectorAlg.cxx:12
python.PyAthena.obj
obj
Definition: PyAthena.py:132
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition: FlowElement_v1.h:25