ATLAS Offline Software
Reconstruction
eflowRec
src
PFTrackPreselAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
PFTrackPreselAlg.h
"
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/WriteHandle.h
"
8
#include "
AthContainers/ConstDataVector.h
"
9
#include <memory>
10
11
namespace
{
12
const
SG::AuxElement::Decorator<char>
decPass(
"passPFTrackPresel"
);
13
}
14
15
PFTrackPreselAlg::PFTrackPreselAlg
(
const
std::string&
name
, ISvcLocator* pSvcLocator)
16
:
AthReentrantAlgorithm
(
name
, pSvcLocator)
17
{
18
}
19
20
PFTrackPreselAlg::~PFTrackPreselAlg
() =
default
;
21
22
StatusCode
PFTrackPreselAlg::initialize
()
23
{
24
ATH_CHECK
(
m_inputTracksKey
.
initialize
() );
25
ATH_CHECK
(
m_outputTracksKey
.
initialize
() );
26
ATH_CHECK
(
m_trackSelTool
.retrieve() );
27
return
StatusCode::SUCCESS;
28
}
29
30
StatusCode
PFTrackPreselAlg::execute
(
const
EventContext &ctx)
const
31
{
32
auto
input
=
SG::makeHandle
(
m_inputTracksKey
, ctx);
33
if
(!
input
.isValid())
34
{
35
ATH_MSG_ERROR
(
"Failed to retrieve "
<<
m_inputTracksKey
);
36
return
StatusCode::FAILURE;
37
}
38
auto
output
= std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(
SG::VIEW_ELEMENTS
);
39
for
(
const
xAOD::TrackParticle
* itrk : *
input
)
40
{
41
if
(itrk->pt() >
m_upperPtCut
|| !
m_trackSelTool
->accept(*itrk))
42
{
43
decPass(*itrk) =
false
;
44
continue
;
45
}
46
decPass(*itrk) =
true
;
47
output
->push_back(itrk);
48
}
49
auto
outputHandle =
SG::makeHandle
(
m_outputTracksKey
, ctx);
50
ATH_CHECK
(outputHandle.put(std::move(
output
)) !=
nullptr
);
51
return
StatusCode::SUCCESS;
52
}
PFTrackPreselAlg::initialize
virtual StatusCode initialize() override
Definition:
PFTrackPreselAlg.cxx:22
PFTrackPreselAlg::m_inputTracksKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inputTracksKey
Definition:
PFTrackPreselAlg.h:30
PFTrackPreselAlg::m_outputTracksKey
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_outputTracksKey
Definition:
PFTrackPreselAlg.h:32
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition:
OwnershipPolicy.h:18
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
PFTrackPreselAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition:
PFTrackPreselAlg.cxx:30
PFTrackPreselAlg::PFTrackPreselAlg
PFTrackPreselAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition:
PFTrackPreselAlg.cxx:15
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition:
AthReentrantAlgorithm.h:83
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition:
ReadCondHandle.h:270
WriteHandle.h
Handle class for recording to StoreGate.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition:
Decorator.h:59
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PlotPulseshapeFromCool.input
input
Definition:
PlotPulseshapeFromCool.py:106
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
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
merge.output
output
Definition:
merge.py:17
PFTrackPreselAlg::~PFTrackPreselAlg
~PFTrackPreselAlg()
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
PFTrackPreselAlg.h
PFTrackPreselAlg::m_trackSelTool
ToolHandle< InDet::IInDetTrackSelectionTool > m_trackSelTool
Definition:
PFTrackPreselAlg.h:34
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition:
TrackParticle_v1.h:43
ReadHandle.h
Handle class for reading from StoreGate.
PFTrackPreselAlg::m_upperPtCut
Gaudi::Property< float > m_upperPtCut
Definition:
PFTrackPreselAlg.h:36
Generated on Sun Dec 22 2024 21:16:09 for ATLAS Offline Software by
1.8.18