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::WriteHandleKey< std::vector< float > > m_trackZ0PVKey { this, "Z0SGEntryName", "", "" }

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 31 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 33 of file TrackParametersAtPV.cxx.

34{
35 SG::WriteHandle< std::vector<float> >track_z0_PV(m_trackZ0PVKey,ctx);
36 ATH_CHECK(track_z0_PV.record(std::make_unique< std::vector<float> >()));
37
38 // Get Primary vertex
39 SG::ReadHandle<xAOD::VertexContainer> vertices(m_collVertexKey,ctx);
40 if(!vertices.isValid()) {
41 ATH_MSG_ERROR ("Couldn't retrieve VertexContainer with key: " << m_collVertexKey.key());
42 return StatusCode::FAILURE;
43 }
44
45 const xAOD::Vertex* pv(nullptr);
46 for (const xAOD::Vertex* vx : *vertices) {
47 if (vx->vertexType() == xAOD::VxType::PriVtx) {
48 pv = vx;
49 break;
50 }
51 }
52
53 // Get the track container
54 SG::ReadHandle<xAOD::TrackParticleContainer> tracks(m_collTrackKey,ctx);
55 if(!tracks.isValid()) {
56 ATH_MSG_ERROR ("Couldn't retrieve TrackParticleContainer with key: " << m_collTrackKey.key());
57 return StatusCode::FAILURE;
58 }
59
60 // Get track z0 w.r.t PV
61 for (const auto *trackIt : *tracks) {
62 if (pv) {
63 float z0wrtPV = trackIt->z0() + trackIt->vz() - pv->z();
64 track_z0_PV->push_back(z0wrtPV);
65
66 } else {
67 track_z0_PV->push_back(999.);
68 }
69 }
70
71 return StatusCode::SUCCESS;
72}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
SG::ReadHandleKey< xAOD::VertexContainer > m_collVertexKey
SG::WriteHandleKey< std::vector< float > > m_trackZ0PVKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_collTrackKey
double z0wrtPV(const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx)
Provide the trk DCA w.r.t. the PV.
@ PriVtx
Primary vertex.
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ initialize()

StatusCode DerivationFramework::TrackParametersAtPV::initialize ( )
finaloverridevirtual

Definition at line 13 of file TrackParametersAtPV.cxx.

14{
15 if (m_collTrackKey.key().empty() || m_collVertexKey.key().empty()) {
16 ATH_MSG_ERROR("No selection variables for the TrackParametersAtPV tool!");
17 return StatusCode::FAILURE;
18 }
19 ATH_CHECK( m_collTrackKey.initialize() );
20 ATH_CHECK( m_collVertexKey.initialize() );
21
22 if (m_trackZ0PVKey.key().empty()) {
23 ATH_MSG_ERROR("No Store Gate Keys for the TrackParametersAtPV tool!");
24 return StatusCode::FAILURE;
25 }
26 ATH_CHECK( m_trackZ0PVKey.initialize() );
27
28 ATH_MSG_VERBOSE("initialize() ...");
29 return StatusCode::SUCCESS;
30}
#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 44 of file TrackParametersAtPV.h.

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

◆ m_collVertexKey

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

Definition at line 46 of file TrackParametersAtPV.h.

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

◆ m_trackZ0PVKey

SG::WriteHandleKey< std::vector<float> > DerivationFramework::TrackParametersAtPV::m_trackZ0PVKey { this, "Z0SGEntryName", "", "" }
private

Definition at line 49 of file TrackParametersAtPV.h.

50{ this, "Z0SGEntryName", "", "" };

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