ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
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
#include "
xAODTracking/TrackingPrimitives.h
"
9
10
namespace
InDet
{
11
TrackSystematicsAlg::TrackSystematicsAlg
(
const
std::string& name, ISvcLocator* pSvcLocator ) :
12
AthReentrantAlgorithm
( name, pSvcLocator ){}
13
14
StatusCode
TrackSystematicsAlg::initialize
() {
15
16
ATH_CHECK
(
m_inTrackKey
.initialize());
17
ATH_CHECK
(
m_outTrackKey
.initialize());
18
ATH_CHECK
(
m_decorDeps
.initialize(
m_inTrackKey
,
m_outTrackKey
));
19
20
// Retrieve the tools:
21
ATH_CHECK
(
m_trackFilterToolLRT
.retrieve());
22
ATH_CHECK
(
m_trackFilterToolSTD
.retrieve());
23
24
CP::SystematicSet
systSetLRT = {
25
CP::SystematicVariation
(
"TRK_EFF_LARGED0_GLOBAL"
)
26
};
27
CP::SystematicSet
systSetSTD = {
28
CP::SystematicVariation
(
"TRK_EFF_LOOSE_COMBINED"
),
29
};
30
31
ATH_CHECK
(
m_trackFilterToolLRT
->applySystematicVariation(systSetLRT));
32
ATH_CHECK
(
m_trackFilterToolSTD
->applySystematicVariation(systSetSTD));
33
34
return
StatusCode::SUCCESS;
35
}
36
37
StatusCode
TrackSystematicsAlg::execute
(
const
EventContext& ctx)
const
{
38
39
//Retrieve the tracks:
40
SG::ReadHandle<xAOD::TrackParticleContainer>
inTracks(
m_inTrackKey
, ctx);
41
42
auto
selectedTracks = std::make_unique<ConstDataVector<xAOD::TrackParticleContainer> >(
SG::VIEW_ELEMENTS
);
43
44
for
(
const
xAOD::TrackParticle
* track : *inTracks) {
45
46
const
std::bitset<xAOD::NumberOfTrackRecoInfo> patternReco = track->patternRecoInfo();
47
bool
passFilter =
false
;
48
49
// LRT track
50
if
(patternReco.test(
xAOD::SiSpacePointsSeedMaker_LargeD0
)) {
51
passFilter =
m_trackFilterToolLRT
->accept(track);
52
}
53
// standard track
54
else
{
55
passFilter =
m_trackFilterToolSTD
->accept(track);
56
}
57
if
(passFilter) {
58
ATH_MSG_DEBUG
(
"Track accepted!"
);
59
selectedTracks->push_back( track );
60
}
61
else
{
62
ATH_MSG_DEBUG
(
"Track rejected!"
);
63
}
64
}
65
66
std::unique_ptr<const xAOD::TrackParticleContainer> outTracks(selectedTracks.release()->asDataVector());
67
SG::WriteHandle<xAOD::TrackParticleContainer>
outTrackHandle(
m_outTrackKey
, ctx);
68
69
ATH_MSG_DEBUG
(
"Initial number of tracks: "
<< inTracks->size() );
70
ATH_MSG_DEBUG
(
"Selected number of tracks: "
<< outTracks->size() );
71
72
if
(not outTrackHandle.
put
(std::move(outTracks))){
73
ATH_MSG_ERROR
(
"Failed to record "
<<
m_outTrackKey
.key() <<
" as const xAOD::TrackParticleContainer!"
);
74
return
StatusCode::FAILURE;
75
}
76
ATH_CHECK
(
m_decorDeps
.linkDecors (
m_inTrackKey
, ctx));
77
78
79
return
StatusCode::SUCCESS;
80
}
81
}
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
TrackSystematicsAlg.h
TrackingPrimitives.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition
SystematicSet.h:31
CP::SystematicVariation
Definition
SystematicVariation.h:47
InDet::TrackSystematicsAlg::initialize
StatusCode initialize() override
Definition
TrackSystematicsAlg.cxx:14
InDet::TrackSystematicsAlg::TrackSystematicsAlg
TrackSystematicsAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TrackSystematicsAlg.cxx:11
InDet::TrackSystematicsAlg::m_outTrackKey
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_outTrackKey
Definition
TrackSystematicsAlg.h:39
InDet::TrackSystematicsAlg::m_inTrackKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inTrackKey
Definition
TrackSystematicsAlg.h:38
InDet::TrackSystematicsAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition
TrackSystematicsAlg.cxx:37
InDet::TrackSystematicsAlg::m_trackFilterToolLRT
ToolHandle< InDet::InclusiveTrackFilterTool > m_trackFilterToolLRT
Definition
TrackSystematicsAlg.h:34
InDet::TrackSystematicsAlg::m_decorDeps
SG::ShallowCopyDecorDeps< xAOD::TrackParticleContainer > m_decorDeps
Definition
TrackSystematicsAlg.h:40
InDet::TrackSystematicsAlg::m_trackFilterToolSTD
ToolHandle< InDet::InDetTrackTruthFilterTool > m_trackFilterToolSTD
Definition
TrackSystematicsAlg.h:36
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::put
const_pointer_type put(std::unique_ptr< T > data, bool returnExisting=false) const
Record an object to the store.
InDet
Primary Vertex Finder.
Definition
VP1ErrorUtils.h:36
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::SiSpacePointsSeedMaker_LargeD0
@ SiSpacePointsSeedMaker_LargeD0
Definition
TrackingPrimitives.h:184
Generated on
for ATLAS Offline Software by
1.17.0