ATLAS Offline Software
Loading...
Searching...
No Matches
TrackVertexAssociation.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6namespace jet {
7
8
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 }
18
20 m_vertex[ trk->index() ] = vtx;
21 }
22
26
27 std::vector<const xAOD::TrackParticle*> TrackVertexAssociation::associatedTracks(const xAOD::Vertex* vtx) const
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 }
36
37
38}
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.
size_t index() const
Return the index of this element within its container.
const xAOD::Vertex * associatedVertex(const xAOD::TrackParticle *trk) const
TrackVertexAssociation(const xAOD::TrackParticleContainer *trkCont=0)
void associate(const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx)
std::vector< const xAOD::Vertex * > m_vertex
const xAOD::TrackParticleContainer * m_trackContainer
std::vector< const xAOD::TrackParticle * > associatedTracks(const xAOD::Vertex *vtx) const
@ OWN_ELEMENTS
this data object owns its elements
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".