ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkEvent
VxJetVertex
src
TwoTrackVerticesInJet.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/***************************************************************************
6
TwoTrackVerticesInJet.cxx - Description
7
-------------------
8
begin : Jan 2008
9
authors : Giacinto Piacquadio (University of Freiburg)
10
Christian Weiser (University of Freiburg)
11
e-mails: giacinto.piacquadio@physik.uni-freiburg.de)
12
christian.weiser@cern.ch
13
changes: new!
14
15
(C) Atlas Collaboration 2008
16
17
More information contained in the header file
18
19
***************************************************************************/
20
21
#include "
VxJetVertex/TwoTrackVerticesInJet.h
"
22
23
#include "
VxVertex/VxCandidate.h
"
24
25
#include "
TrkParticleBase/TrackParticleBase.h
"
26
27
namespace
Trk
28
{
29
30
TwoTrackVerticesInJet::TwoTrackVerticesInJet
() =
default
;
31
32
TwoTrackVerticesInJet::TwoTrackVerticesInJet
(std::vector<const xAOD::Vertex*> twoTrackVertices,
33
std::vector<const TrackParticleBase*> neutralTrackOfVertex)
34
:
35
m_twoTrackVertices
(
std
::move(twoTrackVertices)),
36
m_neutralTrackOfVertex
(
std
::move(neutralTrackOfVertex))
37
{}
38
39
40
41
TwoTrackVerticesInJet::~TwoTrackVerticesInJet
()
42
{
43
deleteAll
(
m_twoTrackVertices
);
44
deleteAll
(
m_neutralTrackOfVertex
);
45
}
46
47
TwoTrackVerticesInJet::TwoTrackVerticesInJet
(
const
TwoTrackVerticesInJet
& rhs)
48
{
49
50
std::vector<const xAOD::Vertex*>::const_iterator vxBegin=rhs.
m_twoTrackVertices
.begin();
51
std::vector<const xAOD::Vertex*>::const_iterator vxEnd=rhs.
m_twoTrackVertices
.end();
52
53
std::vector<const TrackParticleBase*>::const_iterator neuBegin=rhs.
m_neutralTrackOfVertex
.begin();
54
std::vector<const TrackParticleBase*>::const_iterator neuEnd=rhs.
m_neutralTrackOfVertex
.end();
55
56
57
for
(std::vector<const xAOD::Vertex*>::const_iterator vxIter=vxBegin;
58
vxIter!=vxEnd;++vxIter)
59
{
60
if
(*vxIter!=
nullptr
)
61
{
62
const
xAOD::Vertex
* thisPtr=*vxIter;
63
//const xAOD::Vertex* newVertex=thisPtr->clone();
64
const
xAOD::Vertex
* newVertex =
new
xAOD::Vertex
(*thisPtr);
65
m_twoTrackVertices
.push_back(newVertex);
66
}
67
}
68
69
for
(std::vector<const TrackParticleBase*>::const_iterator neuIter=neuBegin;
70
neuIter!=neuEnd;++neuIter)
71
{
72
if
(*neuIter!=
nullptr
)
73
{
74
m_neutralTrackOfVertex
.push_back(
new
TrackParticleBase
(**neuIter));
75
}
76
}
77
}
78
79
TwoTrackVerticesInJet
&
TwoTrackVerticesInJet::operator=
(
const
TwoTrackVerticesInJet
& rhs)
80
{
81
if
(
this
!=&rhs)
82
{
83
deleteAll
(
m_twoTrackVertices
);
84
deleteAll
(
m_neutralTrackOfVertex
);
85
86
m_twoTrackVertices
.clear();
87
m_neutralTrackOfVertex
.clear();
88
89
std::vector<const xAOD::Vertex*>::const_iterator vxBegin=rhs.
m_twoTrackVertices
.begin();
90
std::vector<const xAOD::Vertex*>::const_iterator vxEnd=rhs.
m_twoTrackVertices
.end();
91
92
std::vector<const TrackParticleBase*>::const_iterator neuBegin=rhs.
m_neutralTrackOfVertex
.begin();
93
std::vector<const TrackParticleBase*>::const_iterator neuEnd=rhs.
m_neutralTrackOfVertex
.end();
94
95
96
for
(std::vector<const xAOD::Vertex*>::const_iterator vxIter=vxBegin;
97
vxIter!=vxEnd;++vxIter)
98
{
99
if
(*vxIter!=
nullptr
)
100
{
101
const
xAOD::Vertex
* thisPtr=*vxIter;
102
//const xAOD::Vertex* newVertex=thisPtr->clone();
103
const
xAOD::Vertex
* newVertex =
new
xAOD::Vertex
(*thisPtr);
104
m_twoTrackVertices
.push_back(newVertex);
105
}
106
}
107
108
for
(std::vector<const TrackParticleBase*>::const_iterator neuIter=neuBegin;
109
neuIter!=neuEnd;++neuIter)
110
{
111
if
(*neuIter!=
nullptr
)
112
{
113
m_neutralTrackOfVertex
.push_back(
new
TrackParticleBase
(**neuIter));
114
}
115
}
116
117
}
118
119
return
*
this
;
120
}
121
122
123
void
TwoTrackVerticesInJet::setTwoTrackVertices
(std::vector<const xAOD::Vertex*> twoTrackVertices)
124
{
125
deleteAll
(
m_twoTrackVertices
);
126
m_twoTrackVertices
=std::move(twoTrackVertices);
127
}
128
129
void
TwoTrackVerticesInJet::setNeutralTrackOfVertices
(std::vector<const TrackParticleBase*> neutralTrackOfVertex)
130
{
131
deleteAll
(
m_neutralTrackOfVertex
);
132
m_neutralTrackOfVertex
=std::move(neutralTrackOfVertex);
133
}
134
135
const
std::vector<const xAOD::Vertex*> &
TwoTrackVerticesInJet::getTwoTrackVertice
()
const
{
136
return
m_twoTrackVertices
;
137
}
138
139
const
std::vector<const TrackParticleBase*> &
TwoTrackVerticesInJet::getNeutralTrackOfVertices
()
const
140
{
141
return
m_neutralTrackOfVertex
;
142
}
143
144
145
void
TwoTrackVerticesInJet::deleteAll
(std::vector<const xAOD::Vertex*> & twoTrackVertices)
noexcept
146
{
147
std::vector<const xAOD::Vertex*>::iterator vxBegin=twoTrackVertices.begin();
148
std::vector<const xAOD::Vertex*>::iterator vxEnd=twoTrackVertices.end();
149
150
for
(std::vector<const xAOD::Vertex*>::iterator vxIter=vxBegin;
151
vxIter!=vxEnd;++vxIter)
152
{
153
if
(*vxIter!=0)
154
{
155
delete
*vxIter;
156
}
157
}
158
twoTrackVertices.clear();
159
}
160
161
void
TwoTrackVerticesInJet::deleteAll
(std::vector<const TrackParticleBase*> & neutralTrackOfVertex)
noexcept
162
{
163
for
(
const
TrackParticleBase
* p : neutralTrackOfVertex)
164
{
165
delete
p;
166
}
167
neutralTrackOfVertex.clear();
168
}
169
170
171
}
//end namespace Trk
172
173
174
175
TrackParticleBase.h
TwoTrackVerticesInJet.h
VxCandidate.h
Trk::TrackParticleBase
Definition
TrackParticleBase.h:41
Trk::TwoTrackVerticesInJet::m_twoTrackVertices
std::vector< const xAOD::Vertex * > m_twoTrackVertices
Definition
TwoTrackVerticesInJet.h:110
Trk::TwoTrackVerticesInJet::operator=
TwoTrackVerticesInJet & operator=(const TwoTrackVerticesInJet &)
Definition
TwoTrackVerticesInJet.cxx:79
Trk::TwoTrackVerticesInJet::setTwoTrackVertices
void setTwoTrackVertices(std::vector< const xAOD::Vertex * > twoTrackVertices)
Set the two track vertices (takes ownership of pointers).
Definition
TwoTrackVerticesInJet.cxx:123
Trk::TwoTrackVerticesInJet::m_neutralTrackOfVertex
std::vector< const TrackParticleBase * > m_neutralTrackOfVertex
Definition
TwoTrackVerticesInJet.h:111
Trk::TwoTrackVerticesInJet::getNeutralTrackOfVertices
const std::vector< const TrackParticleBase * > & getNeutralTrackOfVertices() const
Get the neutral tracks of Vertices (please do not delete the pointers).
Definition
TwoTrackVerticesInJet.cxx:139
Trk::TwoTrackVerticesInJet::TwoTrackVerticesInJet
TwoTrackVerticesInJet()
Default constructor, if called initializes a VxVertexOnJetAxis with all data members set to 0.
Trk::TwoTrackVerticesInJet::getTwoTrackVertice
const std::vector< const xAOD::Vertex * > & getTwoTrackVertice() const
Get the two track vertices (please do not delete the pointers).
Definition
TwoTrackVerticesInJet.cxx:135
Trk::TwoTrackVerticesInJet::deleteAll
static void deleteAll(std::vector< const TrackParticleBase * > &neutralTrackOfVertex) noexcept
Definition
TwoTrackVerticesInJet.cxx:161
Trk::TwoTrackVerticesInJet::~TwoTrackVerticesInJet
~TwoTrackVerticesInJet()
Destructor.
Definition
TwoTrackVerticesInJet.cxx:41
Trk::TwoTrackVerticesInJet::setNeutralTrackOfVertices
void setNeutralTrackOfVertices(std::vector< const TrackParticleBase * > neutralTrackOfVertex)
Set the neutral tracks of Vertices (takes ownership also of TrackParticleBase pointers,...
Definition
TwoTrackVerticesInJet.cxx:129
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
std
STL namespace.
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Generated on
for ATLAS Offline Software by
1.17.0