ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
DerivationFramework::InDetTrackSelectionToolWrapper Class Reference

#include <InDetTrackSelectionToolWrapper.h>

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

Public Member Functions

 InDetTrackSelectionToolWrapper (const std::string &t, const std::string &n, const IInterface *p)
 
StatusCode initialize ()
 
StatusCode finalize ()
 
virtual StatusCode addBranches () const
 

Private Attributes

ToolHandle< InDet::IInDetTrackSelectionToolm_tool {this,"TrackSelectionTool","InDet::InDetTrackSelectionTool/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 22 of file InDetTrackSelectionToolWrapper.h.

Constructor & Destructor Documentation

◆ InDetTrackSelectionToolWrapper()

DerivationFramework::InDetTrackSelectionToolWrapper::InDetTrackSelectionToolWrapper ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 19 of file InDetTrackSelectionToolWrapper.cxx.

21  :
22  base_class(t,n,p)
23  {
24  }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::InDetTrackSelectionToolWrapper::addBranches ( ) const
virtual

Definition at line 54 of file InDetTrackSelectionToolWrapper.cxx.

55  {
56 
57  // Get current context
58  const EventContext& ctx = Gaudi::Hive::currentContext();
59 
60  // retrieve track container
62  if (!tracks.isValid()) {
63  //if( ! tracks ) {
64  ATH_MSG_ERROR ("Couldn't retrieve TrackParticles with key: " << tracks.key() );
65  return StatusCode::FAILURE;
66  }
67  // Run tool for each element and decorate with the decision
69  for (const auto *trItr : *tracks) {
70  accept( *trItr ) = m_tool->accept(trItr).getCutResult(0);
71  } // end of loop over tracks
72 
73  return StatusCode::SUCCESS;
74  }

◆ finalize()

StatusCode DerivationFramework::InDetTrackSelectionToolWrapper::finalize ( )

Definition at line 49 of file InDetTrackSelectionToolWrapper.cxx.

50  {
51  return StatusCode::SUCCESS;
52  }

◆ initialize()

StatusCode DerivationFramework::InDetTrackSelectionToolWrapper::initialize ( )

Definition at line 26 of file InDetTrackSelectionToolWrapper.cxx.

27  {
28  if (m_decorationKey.empty()) {
29  ATH_MSG_ERROR("No decoration prefix name provided for the output of InDetTrackSelectionToolWrapper!");
30  return StatusCode::FAILURE;
31  }
32 
34  std::string::size_type pos = m_tracksKey.key().find('+');
35  pos = (pos != std::string::npos) ? pos+1 : 0;
36  std::string_view container_name( &(m_tracksKey.key()[pos]), m_tracksKey.key().size() - pos);
37  std::string_view decor_name(m_decorationKey.key());
38  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)) {
39  m_decorationKey = std::string(container_name) + "." + m_decorationKey.key();
40  }
41  std::cout << "DEBUG " << name() << " InDetTrackSelectionToolWrapper::initialize container key " << m_tracksKey.key() << " -> " << container_name << " decor=" << m_decorationKey.key() << std::endl;
43  ATH_MSG_INFO("Using " << m_tracksKey << "as the source collection for inner detector track particles");
44  ATH_CHECK(m_tool.retrieve());
45  ATH_MSG_INFO(" InDetTrackSelectionToolWrapper::initialize i: " << inputHandles().size() << " o:" << outputHandles().size() );
46  return StatusCode::SUCCESS;
47  }

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 37 of file InDetTrackSelectionToolWrapper.h.

◆ m_tool

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

Definition at line 31 of file InDetTrackSelectionToolWrapper.h.

◆ m_tracksKey

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

Definition at line 34 of file InDetTrackSelectionToolWrapper.h.


The documentation for this class was generated from the following files:
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::InDetTrackSelectionToolWrapper::m_tool
ToolHandle< InDet::IInDetTrackSelectionTool > m_tool
Definition: InDetTrackSelectionToolWrapper.h:32
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework::InDetTrackSelectionToolWrapper::m_tracksKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_tracksKey
Definition: InDetTrackSelectionToolWrapper.h:35
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
DerivationFramework::InDetTrackSelectionToolWrapper::m_decorationKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_decorationKey
Definition: InDetTrackSelectionToolWrapper.h:38