ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::AsgSelectionToolWrapper Class Reference

#include <AsgSelectionToolWrapper.h>

Inheritance diagram for DerivationFramework::AsgSelectionToolWrapper:
Collaboration diagram for DerivationFramework::AsgSelectionToolWrapper:

Public Member Functions

virtual StatusCode initialize () override final
virtual StatusCode addBranches (const EventContext &ctx) const override final

Private Attributes

PublicToolHandle< IAsgSelectionToolm_tool {this, "AsgSelectionTool", ""}
Gaudi::Property< std::string > m_cut {this, "CutType", "" }
SG::ReadHandleKey< xAOD::IParticleContainerm_containerKey {this, "ContainerName", ""}
SG::WriteDecorHandleKey< xAOD::IParticleContainerm_decorKey {this, "StoreGateEntryName", m_containerKey, ""}

Detailed Description

Definition at line 18 of file AsgSelectionToolWrapper.h.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::AsgSelectionToolWrapper::addBranches ( const EventContext & ctx) const
finaloverridevirtual

Definition at line 24 of file AsgSelectionToolWrapper.cxx.

25 {
26 // retrieve container
27
28 SG::WriteDecorHandle<xAOD::IParticleContainer, char> decorator (m_decorKey, ctx);
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 }
#define ATH_MSG_ERROR(x)
SG::ReadHandleKey< xAOD::IParticleContainer > m_containerKey
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_decorKey
PublicToolHandle< IAsgSelectionTool > m_tool

◆ initialize()

StatusCode DerivationFramework::AsgSelectionToolWrapper::initialize ( )
finaloverridevirtual

Definition at line 15 of file AsgSelectionToolWrapper.cxx.

15 {
16 ATH_CHECK(m_tool.retrieve());
17 ATH_CHECK(m_containerKey.initialize());
18 ATH_CHECK(m_decorKey.initialize());
19 return StatusCode::SUCCESS;
20 }
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_containerKey

SG::ReadHandleKey<xAOD::IParticleContainer> DerivationFramework::AsgSelectionToolWrapper::m_containerKey {this, "ContainerName", ""}
private

Definition at line 29 of file AsgSelectionToolWrapper.h.

29{this, "ContainerName", ""};

◆ m_cut

Gaudi::Property<std::string> DerivationFramework::AsgSelectionToolWrapper::m_cut {this, "CutType", "" }
private

Definition at line 28 of file AsgSelectionToolWrapper.h.

28{this, "CutType", "" };

◆ m_decorKey

SG::WriteDecorHandleKey<xAOD::IParticleContainer> DerivationFramework::AsgSelectionToolWrapper::m_decorKey {this, "StoreGateEntryName", m_containerKey, ""}
private

Definition at line 30 of file AsgSelectionToolWrapper.h.

30{this, "StoreGateEntryName", m_containerKey, ""};

◆ m_tool

PublicToolHandle<IAsgSelectionTool> DerivationFramework::AsgSelectionToolWrapper::m_tool {this, "AsgSelectionTool", ""}
private

Definition at line 27 of file AsgSelectionToolWrapper.h.

27{this, "AsgSelectionTool", ""};

The documentation for this class was generated from the following files: