ATLAS Offline Software
Loading...
Searching...
No Matches
AsgSelectionToolWrapper.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// Author: James Catmore (james.catmore@cern.ch)
6
11
12
13namespace DerivationFramework {
14
16 ATH_CHECK(m_tool.retrieve());
17 ATH_CHECK(m_containerKey.initialize());
18 ATH_CHECK(m_decorKey.initialize());
19 return StatusCode::SUCCESS;
20 }
21
22
23
24 StatusCode AsgSelectionToolWrapper::addBranches(const EventContext& ctx) const
25 {
26 // retrieve container
27
29 if( ! decorator.isValid() ) {
30 ATH_MSG_ERROR ("Couldn't retrieve IParticles with key: " << m_containerKey.fullKey() );
31 return StatusCode::FAILURE;
32 }
33
34 // Write mask for each element and record to SG for subsequent selection
35 for ( const xAOD::IParticle* part : *decorator) {
36 auto theAccept = m_tool->accept(part); // asg::AcceptData or TAccept
37 if(m_cut.empty()){
38 decorator(*part) = true && theAccept;
39 } else{
40 decorator(*part) = true && theAccept.getCutResult(m_cut);
41 }
42 }
43
44 return StatusCode::SUCCESS;
45 }
46}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
SG::ReadHandleKey< xAOD::IParticleContainer > m_containerKey
virtual StatusCode addBranches(const EventContext &ctx) const override final
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_decorKey
PublicToolHandle< IAsgSelectionTool > m_tool
Handle class for adding a decoration to an object.
Class providing the definition of the 4-vector interface.
THE reconstruction tool.