ATLAS Offline Software
Loading...
Searching...
No Matches
jet::TrackVertexAssociation Class Reference

Class to hold N-to-one aassociations between tracks and vertices. More...

#include <TrackVertexAssociation.h>

Collaboration diagram for jet::TrackVertexAssociation:

Public Member Functions

 TrackVertexAssociation (const xAOD::TrackParticleContainer *trkCont=0)
void associate (const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx)
const xAOD::VertexassociatedVertex (const xAOD::TrackParticle *trk) const
std::vector< const xAOD::TrackParticle * > associatedTracks (const xAOD::Vertex *vtx) const

Protected Attributes

std::vector< const xAOD::Vertex * > m_vertex
const xAOD::TrackParticleContainerm_trackContainer

Detailed Description

Class to hold N-to-one aassociations between tracks and vertices.

It is assumed the track container is the one that directly holds the tracks, i.e. is not a view container.

Definition at line 23 of file TrackVertexAssociation.h.

Constructor & Destructor Documentation

◆ TrackVertexAssociation()

jet::TrackVertexAssociation::TrackVertexAssociation ( const xAOD::TrackParticleContainer * trkCont = 0)

Definition at line 9 of file TrackVertexAssociation.cxx.

9 :
10 m_trackContainer(trkCont) {
11 // Check if this is a view container, in which case we need to use the size of the owning container.
12 size_t Ntracks = trkCont->size();
13 if(Ntracks>0 && trkCont->ownPolicy() != SG::OWN_ELEMENTS) {
14 Ntracks = trkCont->front()->container()->size_v();
15 }
16 m_vertex.resize(Ntracks, nullptr );
17 }
const T * front() const
Access the first element in the collection as an rvalue.
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
size_type size() const noexcept
Returns the number of elements in the collection.
const SG::AuxVectorData * container() const
Return the container holding this element.
virtual size_t size_v() const =0
Return the size of the container.
std::vector< const xAOD::Vertex * > m_vertex
const xAOD::TrackParticleContainer * m_trackContainer
@ OWN_ELEMENTS
this data object owns its elements

Member Function Documentation

◆ associate()

void jet::TrackVertexAssociation::associate ( const xAOD::TrackParticle * trk,
const xAOD::Vertex * vtx )

Definition at line 19 of file TrackVertexAssociation.cxx.

19 {
20 m_vertex[ trk->index() ] = vtx;
21 }
size_t index() const
Return the index of this element within its container.

◆ associatedTracks()

std::vector< const xAOD::TrackParticle * > jet::TrackVertexAssociation::associatedTracks ( const xAOD::Vertex * vtx) const

Definition at line 27 of file TrackVertexAssociation.cxx.

28 {
29 std::vector<const xAOD::TrackParticle*> tracks;
30 for (size_t iTrack = 0; iTrack < m_trackContainer->size(); ++iTrack)
31 if (associatedVertex(m_trackContainer->at(iTrack))->index() == vtx->index())
32 tracks.push_back(m_trackContainer->at(iTrack));
33
34 return tracks;
35 }
const xAOD::Vertex * associatedVertex(const xAOD::TrackParticle *trk) const

◆ associatedVertex()

const xAOD::Vertex * jet::TrackVertexAssociation::associatedVertex ( const xAOD::TrackParticle * trk) const

Definition at line 23 of file TrackVertexAssociation.cxx.

23 {
24 return m_vertex[trk->index()];
25 }

Member Data Documentation

◆ m_trackContainer

const xAOD::TrackParticleContainer* jet::TrackVertexAssociation::m_trackContainer
protected

Definition at line 42 of file TrackVertexAssociation.h.

◆ m_vertex

std::vector<const xAOD::Vertex*> jet::TrackVertexAssociation::m_vertex
protected

Definition at line 41 of file TrackVertexAssociation.h.


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