ATLAS Offline Software
Reconstruction
Jet
JetEDM
Root
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
5
#include "
JetEDM/TrackVertexAssociation.h
"
6
namespace
jet
{
7
8
9
TrackVertexAssociation::TrackVertexAssociation
(
const
xAOD::TrackParticleContainer
* trkCont) :
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
19
void
TrackVertexAssociation::associate
(
const
xAOD::TrackParticle
* trk,
const
xAOD::Vertex
* vtx){
20
m_vertex
[ trk->
index
() ] = vtx;
21
}
22
23
const
xAOD::Vertex
*
TrackVertexAssociation::associatedVertex
(
const
xAOD::TrackParticle
* trk)
const
{
24
return
m_vertex
[trk->
index
()];
25
}
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
}
jet::TrackVertexAssociation::TrackVertexAssociation
TrackVertexAssociation(const xAOD::TrackParticleContainer *trkCont=0)
Definition:
TrackVertexAssociation.cxx:9
jet::TrackVertexAssociation::m_trackContainer
const xAOD::TrackParticleContainer * m_trackContainer
Definition:
TrackVertexAssociation.h:42
jet
Definition:
JetCalibTools_PlotJESFactors.cxx:23
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition:
OwnershipPolicy.h:17
DataVector::front
const T * front() const
Access the first element in the collection as an rvalue.
jet::TrackVertexAssociation::associatedTracks
std::vector< const xAOD::TrackParticle * > associatedTracks(const xAOD::Vertex *vtx) const
Definition:
TrackVertexAssociation.cxx:27
TrackVertexAssociation.h
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
jet::TrackVertexAssociation::associate
void associate(const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx)
Definition:
TrackVertexAssociation.cxx:19
DataVector< xAOD::TrackParticle_v1 >
jet::TrackVertexAssociation::associatedVertex
const xAOD::Vertex * associatedVertex(const xAOD::TrackParticle *trk) const
Definition:
TrackVertexAssociation.cxx:23
jet::TrackVertexAssociation::m_vertex
std::vector< const xAOD::Vertex * > m_vertex
Definition:
TrackVertexAssociation.h:41
xAOD::Vertex_v1
Class describing a Vertex.
Definition:
Vertex_v1.h:42
DataVector::ownPolicy
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition:
TrackParticle_v1.h:43
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
SG::AuxElement::container
const SG::AuxVectorData * container() const
Return the container holding this element.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
SG::AuxVectorData::size_v
virtual size_t size_v() const =0
Return the size of the container.
Generated on Sun Jun 30 2024 21:30:06 for ATLAS Offline Software by
1.8.18