ATLAS Offline Software
Loading...
Searching...
No Matches
TIDAVertexBuilder.cxx
Go to the documentation of this file.
1
9
11
12
13std::vector<TIDA::Vertex> TIDAVertexBuilder::select(
14 const xAOD::VertexContainer* xAODVertices,
15 const std::vector<TIDA::Track*>* trackCollection,
16 bool useType0,
17 bool require_tracks ) {
18
19 std::vector<TIDA::Vertex> vertices;
20
21 xAOD::VertexContainer::const_iterator vtxitr = xAODVertices->begin();
22
23 for ( ; vtxitr != xAODVertices->end(); ++vtxitr ) {
24
25 if ( require_tracks && (*vtxitr)->nTrackParticles()==0 ) continue;
26
27 if ( (*vtxitr)->vertexType()!=0 || useType0 ) {
28 TIDA::Vertex vertex = selectVertex( *vtxitr );
29
30 if ( trackCollection ) {
31 std::vector< unsigned long > trackIds;
32
33 const std::vector< ElementLink< xAOD::TrackParticleContainer > >& xAODtracks = (*vtxitr)->trackParticleLinks();
34
35 for ( const auto& track : xAODtracks ) {
36 unsigned long id = 0;
37 if (track.isValid()) id = getTrackId( *track );
38 trackIds.push_back( id );
39 }
40
41 vertex.selectTracks( *trackCollection, trackIds );
42 }
43
44 vertices.push_back( vertex );
45 }
46 }
47
48 return vertices;
49}
50
51
52std::vector<TIDA::Vertex> TIDAVertexBuilder::select(
55 const std::vector<TIDA::Track*>* trackCollection,
56 bool useType0,
57 bool require_tracks ) {
58
59 std::vector<TIDA::Vertex> vertices;
60
62
63 for ( ; vtxitr!=enditr; ++vtxitr ) {
64
65 if ( require_tracks && (*vtxitr)->nTrackParticles()==0 ) continue;
66
67 if ( (*vtxitr)->vertexType()!=0 || useType0 ) {
68
69 TIDA::Vertex vertex = selectVertex( *vtxitr );
70
71 if( trackCollection ) {
72 std::vector< unsigned long > trackIds;
73
74 const std::vector< ElementLink< xAOD::TrackParticleContainer > >& xAODtracks = (*vtxitr)->trackParticleLinks();
75
76 for( const auto& track : xAODtracks ) {
77 unsigned long id = getTrackId( *track );
78 trackIds.push_back( id );
79 }
80
81 vertex.selectTracks( *trackCollection, trackIds );
82 }
83
84 vertices.push_back( vertex );
85 }
86 }
87
88 return vertices;
89}
90
91
93
94 // convert xAOD::Vertex into TIDA::Vertex
95 TIDA::Vertex tidav( v->x(),
96 v->y(),
97 v->z(),
99 v->covariancePosition()(Trk::x,Trk::x),
100 v->covariancePosition()(Trk::y,Trk::y),
101 v->covariancePosition()(Trk::z,Trk::z),
102 v->nTrackParticles(),
104 v->chiSquared(),
105 v->numberDoF() );
106
107 return tidav;
108}
109
110
112 unsigned long id = (unsigned long)track;
113 return id;
114}
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
static std::vector< TIDA::Vertex > select(const xAOD::VertexContainer *xAODVertices, const std::vector< TIDA::Track * > *trackCollection=0, bool useType0=false, bool require_tracks=true)
static TIDA::Vertex selectVertex(const xAOD::Vertex *v)
static unsigned long getTrackId(const xAOD::TrackParticle *track)
@ x
Definition ParamDefs.h:55
@ z
global position (cartesian)
Definition ParamDefs.h:57
@ y
Definition ParamDefs.h:56
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.