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

#include <InDetTrackSelectionToolWrapper.h>

Inheritance diagram for DerivationFramework::InDetTrackSelectionToolWrapper:
Collaboration diagram for DerivationFramework::InDetTrackSelectionToolWrapper:

Public Member Functions

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

Private Attributes

ToolHandle< InDet::IInDetTrackSelectionToolm_tool {this,"TrackSelectionTool",""}
SG::ReadHandleKey< xAOD::TrackParticleContainerm_tracksKey {this, "ContainerName", "InDetTrackParticles", "The input TrackParticleCollection"}
SG::WriteDecorHandleKey< xAOD::TrackParticleContainerm_decorationKey {this, "DecorationName", "","Name of the decoration which provides the track selection result."}

Detailed Description

Definition at line 23 of file InDetTrackSelectionToolWrapper.h.

Member Function Documentation

◆ addBranches()

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

Definition at line 43 of file InDetTrackSelectionToolWrapper.cxx.

44 {
45
46 // retrieve track container
47 SG::ReadHandle<xAOD::TrackParticleContainer> tracks(m_tracksKey, ctx);
48 if (!tracks.isValid()) {
49 //if( ! tracks ) {
50 ATH_MSG_ERROR ("Couldn't retrieve TrackParticles with key: " << tracks.key() );
51 return StatusCode::FAILURE;
52 }
53 // Run tool for each element and decorate with the decision
54 SG::WriteDecorHandle<xAOD::TrackParticleContainer,bool > accept(m_decorationKey, ctx);
55 for (const auto *trItr : *tracks) {
56 accept( *trItr ) = m_tool->accept(trItr).getCutResult(0);
57 } // end of loop over tracks
58
59 return StatusCode::SUCCESS;
60 }
#define ATH_MSG_ERROR(x)
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_tracksKey
ToolHandle< InDet::IInDetTrackSelectionTool > m_tool
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_decorationKey
StatusCode accept(const xAOD::Muon *mu)

◆ initialize()

StatusCode DerivationFramework::InDetTrackSelectionToolWrapper::initialize ( )
finaloverridevirtual

Definition at line 19 of file InDetTrackSelectionToolWrapper.cxx.

20 {
21 if (m_decorationKey.empty()) {
22 ATH_MSG_ERROR("No decoration prefix name provided for the output of InDetTrackSelectionToolWrapper!");
23 return StatusCode::FAILURE;
24 }
25
26 ATH_CHECK( m_tracksKey.initialize() );
27 std::string::size_type pos = m_tracksKey.key().find('+');
28 pos = (pos != std::string::npos) ? pos+1 : 0;
29 std::string_view container_name( &(m_tracksKey.key()[pos]), m_tracksKey.key().size() - pos);
30 std::string_view decor_name(m_decorationKey.key());
31 if (!(decor_name.compare(0,m_tracksKey.key().size(),std::string_view(m_tracksKey.key()))==0 && decor_name.compare(0,container_name.size(),container_name)==0)) {
32 m_decorationKey = std::string(container_name) + "." + m_decorationKey.key();
33 }
34 std::cout << "DEBUG " << name() << " InDetTrackSelectionToolWrapper::initialize container key " << m_tracksKey.key() << " -> " << container_name << " decor=" << m_decorationKey.key() << std::endl;
35 ATH_CHECK(m_decorationKey.initialize());
36 ATH_MSG_INFO("Using " << m_tracksKey << "as the source collection for inner detector track particles");
37 ATH_CHECK(m_tool.retrieve());
38 ATH_MSG_INFO(" InDetTrackSelectionToolWrapper::initialize i: " << inputHandles().size() << " o:" << outputHandles().size() );
39 return StatusCode::SUCCESS;
40 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)

Member Data Documentation

◆ m_decorationKey

SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> DerivationFramework::InDetTrackSelectionToolWrapper::m_decorationKey {this, "DecorationName", "","Name of the decoration which provides the track selection result."}
private

Definition at line 38 of file InDetTrackSelectionToolWrapper.h.

39{this, "DecorationName", "","Name of the decoration which provides the track selection result."};

◆ m_tool

ToolHandle< InDet::IInDetTrackSelectionTool > DerivationFramework::InDetTrackSelectionToolWrapper::m_tool {this,"TrackSelectionTool",""}
private

Definition at line 32 of file InDetTrackSelectionToolWrapper.h.

33{this,"TrackSelectionTool",""};

◆ m_tracksKey

SG::ReadHandleKey<xAOD::TrackParticleContainer> DerivationFramework::InDetTrackSelectionToolWrapper::m_tracksKey {this, "ContainerName", "InDetTrackParticles", "The input TrackParticleCollection"}
private

Definition at line 35 of file InDetTrackSelectionToolWrapper.h.

36{this, "ContainerName", "InDetTrackParticles", "The input TrackParticleCollection"};

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