ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::TrackParametersAtPV Class Reference

the code used in this implementation is kindly stolen from: atlasoff:: ISF/ISF_Core/ISF_Tools More...

#include <TrackParametersAtPV.h>

Inheritance diagram for DerivationFramework::TrackParametersAtPV:
Collaboration diagram for DerivationFramework::TrackParametersAtPV:

Public Member Functions

virtual StatusCode initialize () override final
virtual StatusCode addBranches (const EventContext &ctx) const override final
 Check that the current event passes this filter.

Private Attributes

SG::ReadHandleKey< xAOD::TrackParticleContainerm_collTrackKey { this, "TrackParticleContainerName", "InDetTrackParticles", ""}
SG::ReadHandleKey< xAOD::VertexContainerm_collVertexKey { this, "VertexContainerName", "PrimaryVertices", ""}
SG::WriteDecorHandleKey< xAOD::TrackParticleContainerm_trackZ0PVDecoKey { this, "Z0SGEntryName", m_collTrackKey, "DFCommonInDetTrackZ0AtPV"}

Detailed Description

the code used in this implementation is kindly stolen from: atlasoff:: ISF/ISF_Core/ISF_Tools

Author
James Catmore -at- cern.ch

Definition at line 32 of file TrackParametersAtPV.h.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::TrackParametersAtPV::addBranches ( const EventContext & ctx) const
finaloverridevirtual

Check that the current event passes this filter.

Definition at line 32 of file TrackParametersAtPV.cxx.

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}
#define ATH_MSG_ERROR(x)
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_trackZ0PVDecoKey
SG::ReadHandleKey< xAOD::VertexContainer > m_collVertexKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_collTrackKey
@ PriVtx
Primary vertex.
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ initialize()

StatusCode DerivationFramework::TrackParametersAtPV::initialize ( )
finaloverridevirtual

Definition at line 17 of file TrackParametersAtPV.cxx.

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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)

Member Data Documentation

◆ m_collTrackKey

SG::ReadHandleKey<xAOD::TrackParticleContainer> DerivationFramework::TrackParametersAtPV::m_collTrackKey { this, "TrackParticleContainerName", "InDetTrackParticles", ""}
private

Definition at line 45 of file TrackParametersAtPV.h.

46{ this, "TrackParticleContainerName", "InDetTrackParticles", ""};

◆ m_collVertexKey

SG::ReadHandleKey<xAOD::VertexContainer> DerivationFramework::TrackParametersAtPV::m_collVertexKey { this, "VertexContainerName", "PrimaryVertices", ""}
private

Definition at line 47 of file TrackParametersAtPV.h.

48{ this, "VertexContainerName", "PrimaryVertices", ""};

◆ m_trackZ0PVDecoKey

SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> DerivationFramework::TrackParametersAtPV::m_trackZ0PVDecoKey { this, "Z0SGEntryName", m_collTrackKey, "DFCommonInDetTrackZ0AtPV"}
private

Definition at line 50 of file TrackParametersAtPV.h.

51{ this, "Z0SGEntryName", m_collTrackKey, "DFCommonInDetTrackZ0AtPV"};

The documentation for this class was generated from the following files: