ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkInDet
src
TrackParametersAtPV.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Author: Tomoe Kishimoto (Tomoe.Kishimoto@cern.ch)
6
// Wrapper around the passSelection() method of xAOD egamma
7
// Writes result to SG for later selection by string parser
8
9
#include "
DerivationFrameworkInDet/TrackParametersAtPV.h
"
10
11
#include <
StoreGate/ReadHandle.h
>
12
#include <
StoreGate/WriteDecorHandle.h
>
13
14
#include <string>
15
16
// Athena initialize and finalize
17
StatusCode
DerivationFramework::TrackParametersAtPV::initialize
()
18
{
19
if
(
m_collTrackKey
.key().empty() ||
m_collVertexKey
.key().empty()) {
20
ATH_MSG_ERROR
(
"No selection variables for the TrackParametersAtPV tool!"
);
21
return
StatusCode::FAILURE;
22
}
23
ATH_CHECK
(
m_collTrackKey
.initialize() );
24
ATH_CHECK
(
m_collVertexKey
.initialize() );
25
ATH_CHECK
(
m_trackZ0PVDecoKey
.initialize() );
26
27
ATH_MSG_VERBOSE
(
"initialize() ..."
);
28
return
StatusCode::SUCCESS;
29
}
30
31
// Augmentation
32
StatusCode
DerivationFramework::TrackParametersAtPV::addBranches
(
const
EventContext& ctx)
const
33
{
34
SG::WriteDecorHandle<xAOD::TrackParticleContainer, float>
track_z0_PV(
m_trackZ0PVDecoKey
, ctx);
35
36
// Get Primary vertex
37
SG::ReadHandle<xAOD::VertexContainer>
vertices(
m_collVertexKey
,ctx);
38
if
(!vertices.
isValid
()) {
39
ATH_MSG_ERROR
(
"Couldn't retrieve VertexContainer with key: "
<<
m_collVertexKey
.key());
40
return
StatusCode::FAILURE;
41
}
42
43
const
xAOD::Vertex
* pv(
nullptr
);
44
for
(
const
xAOD::Vertex
* vx : *vertices) {
45
if
(vx->vertexType() ==
xAOD::VxType::PriVtx
) {
46
pv = vx;
47
break
;
48
}
49
}
50
51
// Get the track container
52
SG::ReadHandle<xAOD::TrackParticleContainer>
tracks(
m_collTrackKey
,ctx);
53
if
(!tracks.
isValid
()) {
54
ATH_MSG_ERROR
(
"Couldn't retrieve TrackParticleContainer with key: "
<<
m_collTrackKey
.key());
55
return
StatusCode::FAILURE;
56
}
57
58
// Get track z0 w.r.t PV
59
for
(
const
auto
*trackIt : *tracks) {
60
track_z0_PV(*trackIt) = pv ? trackIt->z0() + trackIt->vz() - pv->z() : 999.;
61
}
62
63
return
StatusCode::SUCCESS;
64
}
65
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_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
TrackParametersAtPV.h
DerivationFramework::TrackParametersAtPV::m_trackZ0PVDecoKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_trackZ0PVDecoKey
Definition
TrackParametersAtPV.h:51
DerivationFramework::TrackParametersAtPV::m_collVertexKey
SG::ReadHandleKey< xAOD::VertexContainer > m_collVertexKey
Definition
TrackParametersAtPV.h:48
DerivationFramework::TrackParametersAtPV::initialize
virtual StatusCode initialize() override final
Definition
TrackParametersAtPV.cxx:17
DerivationFramework::TrackParametersAtPV::m_collTrackKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_collTrackKey
Definition
TrackParametersAtPV.h:46
DerivationFramework::TrackParametersAtPV::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Check that the current event passes this filter.
Definition
TrackParametersAtPV.cxx:32
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition
TrackingPrimitives.h:590
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Generated on
for ATLAS Offline Software by
1.17.0