ATLAS Offline Software
PhysicsAnalysis
TrackingID
InDetTrackSystematicsTools
src
TrackSystematicsAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "GaudiKernel/ServiceHandle.h"
6
7
#include "
TrackSystematicsAlg.h
"
8
9
namespace
InDet
{
10
TrackSystematicsAlg::TrackSystematicsAlg
(
const
std::string&
name
, ISvcLocator* pSvcLocator ) :
11
AthReentrantAlgorithm
(
name
, pSvcLocator ){}
12
13
StatusCode
TrackSystematicsAlg::initialize
() {
14
15
ATH_CHECK
(
m_inTrackKey
.
initialize
());
16
ATH_CHECK
(
m_outTrackKey
.
initialize
());
17
ATH_CHECK
(
m_decorDeps
.initialize(
m_inTrackKey
,
m_outTrackKey
));
18
19
// Retrieve the tools:
20
ATH_CHECK
(
m_trackFilterToolLRT
.retrieve());
21
ATH_CHECK
(
m_trackFilterToolSTD
.retrieve());
22
23
CP::SystematicSet
systSetLRT = {
24
CP::SystematicVariation
(
"TRK_EFF_LARGED0_GLOBAL"
)
25
};
26
CP::SystematicSet
systSetSTD = {
27
CP::SystematicVariation
(
"TRK_EFF_LOOSE_COMBINED"
),
28
};
29
30
ATH_CHECK
(
m_trackFilterToolLRT
->applySystematicVariation(systSetLRT));
31
ATH_CHECK
(
m_trackFilterToolSTD
->applySystematicVariation(systSetSTD));
32
33
return
StatusCode::SUCCESS;
34
}
35
36
StatusCode
TrackSystematicsAlg::execute
(
const
EventContext& ctx)
const
{
37
38
//Retrieve the tracks:
39
SG::ReadHandle<xAOD::TrackParticleContainer>
inTracks(
m_inTrackKey
, ctx);
40
41
auto
selectedTracks = std::make_unique<ConstDataVector<xAOD::TrackParticleContainer> >(
SG::VIEW_ELEMENTS
);
42
43
for
(
const
xAOD::TrackParticle
*
track
: *inTracks) {
44
45
const
std::bitset<xAOD::NumberOfTrackRecoInfo> patternReco =
track
->patternRecoInfo();
46
bool
passFilter
=
false
;
47
48
// LRT track
49
if
(patternReco.test(49)) {
50
passFilter
=
m_trackFilterToolLRT
->accept(
track
);
51
}
52
// standard track
53
else
{
54
passFilter
=
m_trackFilterToolSTD
->accept(
track
);
55
}
56
if
(
passFilter
) {
57
ATH_MSG_DEBUG
(
"Track accepted!"
);
58
selectedTracks->push_back(
track
);
59
}
60
else
{
61
ATH_MSG_DEBUG
(
"Track rejected!"
);
62
}
63
}
64
65
std::unique_ptr<const xAOD::TrackParticleContainer> outTracks(selectedTracks.release()->asDataVector());
66
SG::WriteHandle<xAOD::TrackParticleContainer>
outTrackHandle(
m_outTrackKey
, ctx);
67
68
ATH_MSG_DEBUG
(
"Initial number of tracks: "
<< inTracks->size() );
69
ATH_MSG_DEBUG
(
"Selected number of tracks: "
<< outTracks->
size
() );
70
71
if
(not outTrackHandle.
put
(std::move(outTracks))){
72
ATH_MSG_ERROR
(
"Failed to record "
<<
m_outTrackKey
.
key
() <<
" as const xAOD::TrackParticleContainer!"
);
73
return
StatusCode::FAILURE;
74
}
75
ATH_CHECK
(
m_decorDeps
.linkDecors (
m_inTrackKey
, ctx));
76
77
78
return
StatusCode::SUCCESS;
79
}
80
}
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition:
OwnershipPolicy.h:18
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:67
InDet
Primary Vertex Finder.
Definition:
VP1ErrorUtils.h:36
InDet::TrackSystematicsAlg::m_trackFilterToolLRT
ToolHandle< InDet::InclusiveTrackFilterTool > m_trackFilterToolLRT
Definition:
TrackSystematicsAlg.h:34
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition:
SystematicSet.h:31
InDet::TrackSystematicsAlg::m_decorDeps
SG::ShallowCopyDecorDeps< xAOD::TrackParticleContainer > m_decorDeps
Definition:
TrackSystematicsAlg.h:40
covarianceTool.passFilter
bool passFilter
Definition:
covarianceTool.py:604
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition:
AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
CP::SystematicVariation
Definition:
SystematicVariation.h:47
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition:
AthReentrantAlgorithm.h:74
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
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
InDet::TrackSystematicsAlg::m_trackFilterToolSTD
ToolHandle< InDet::InDetTrackTruthFilterTool > m_trackFilterToolSTD
Definition:
TrackSystematicsAlg.h:36
InDet::TrackSystematicsAlg::m_inTrackKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inTrackKey
Definition:
TrackSystematicsAlg.h:38
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:240
TrackSystematicsAlg.h
InDet::TrackSystematicsAlg::initialize
StatusCode initialize() override
Definition:
TrackSystematicsAlg.cxx:13
SG::WriteHandle
Definition:
StoreGate/StoreGate/WriteHandle.h:73
InDet::TrackSystematicsAlg::TrackSystematicsAlg
TrackSystematicsAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition:
TrackSystematicsAlg.cxx:10
xAOD::track
@ track
Definition:
TrackingPrimitives.h:513
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition:
TrackParticle_v1.h:43
SG::WriteHandle::put
const_pointer_type put(std::unique_ptr< T > data, bool returnExisting=false) const
Record an object to the store.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
InDet::TrackSystematicsAlg::m_outTrackKey
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_outTrackKey
Definition:
TrackSystematicsAlg.h:39
InDet::TrackSystematicsAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition:
TrackSystematicsAlg.cxx:36
Generated on Tue Sep 2 2025 21:23:49 for ATLAS Offline Software by
1.8.18