ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
eflowRec
src
PFTrackPreselAlg.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
#include "
PFTrackPreselAlg.h
"
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/WriteHandle.h
"
8
#include "
StoreGate/WriteDecorHandle.h
"
9
#include "
AthContainers/ConstDataVector.h
"
10
#include <memory>
11
12
PFTrackPreselAlg::PFTrackPreselAlg
(
const
std::string& name, ISvcLocator* pSvcLocator)
13
:
AthReentrantAlgorithm
(name, pSvcLocator)
14
{
15
}
16
17
PFTrackPreselAlg::~PFTrackPreselAlg
() =
default
;
18
19
StatusCode
PFTrackPreselAlg::initialize
()
20
{
21
ATH_CHECK
(
m_inputTracksKey
.initialize() );
22
ATH_CHECK
(
m_outputTracksKey
.initialize() );
23
24
ATH_CHECK
(
m_outputDecorKey
.initialize() );
25
26
ATH_CHECK
(
m_trackSelTool
.retrieve() );
27
28
return
StatusCode::SUCCESS;
29
}
30
31
StatusCode
PFTrackPreselAlg::execute
(
const
EventContext &ctx)
const
32
{
33
auto
input =
SG::makeHandle
(
m_inputTracksKey
, ctx);
34
if
(!input.isValid())
35
{
36
ATH_MSG_ERROR
(
"Failed to retrieve "
<<
m_inputTracksKey
);
37
return
StatusCode::FAILURE;
38
}
39
40
SG::WriteDecorHandle<xAOD::TrackParticleContainer, char>
decPass(
m_outputDecorKey
, ctx);
41
42
auto
output = std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(
SG::VIEW_ELEMENTS
);
43
for
(
const
xAOD::TrackParticle
* itrk : *input)
44
{
45
if
(itrk->pt() >
m_upperPtCut
|| !
m_trackSelTool
->accept(*itrk))
46
{
47
decPass(*itrk) =
false
;
48
continue
;
49
}
50
decPass(*itrk) =
true
;
51
output->push_back(itrk);
52
}
53
auto
outputHandle =
SG::makeHandle
(
m_outputTracksKey
, ctx);
54
ATH_CHECK
(outputHandle.put(std::move(output)) !=
nullptr
);
55
56
return
StatusCode::SUCCESS;
57
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
PFTrackPreselAlg.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
WriteHandle.h
Handle class for recording to StoreGate.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
PFTrackPreselAlg::m_upperPtCut
Gaudi::Property< float > m_upperPtCut
Definition
PFTrackPreselAlg.h:39
PFTrackPreselAlg::m_trackSelTool
ToolHandle< InDet::IInDetTrackSelectionTool > m_trackSelTool
Definition
PFTrackPreselAlg.h:37
PFTrackPreselAlg::m_inputTracksKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inputTracksKey
Definition
PFTrackPreselAlg.h:31
PFTrackPreselAlg::~PFTrackPreselAlg
~PFTrackPreselAlg()
PFTrackPreselAlg::m_outputDecorKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_outputDecorKey
Definition
PFTrackPreselAlg.h:35
PFTrackPreselAlg::m_outputTracksKey
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_outputTracksKey
Definition
PFTrackPreselAlg.h:33
PFTrackPreselAlg::PFTrackPreselAlg
PFTrackPreselAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
PFTrackPreselAlg.cxx:12
PFTrackPreselAlg::initialize
virtual StatusCode initialize() override
Definition
PFTrackPreselAlg.cxx:19
PFTrackPreselAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
PFTrackPreselAlg.cxx:31
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
Generated on
for ATLAS Offline Software by
1.17.0