ATLAS Offline Software
VxJetFitterVertexInfo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /****************************************
6 
7  VxSecVertexInfo.h - Description
8  -------------------
9 
10  begin: January 2008
11  author: Giacinto Piacquadio (University of Freiburg)
12  e-mail: giacinto.piacquadio@physik.uni-freiburg.de
13  changes: new!
14 
15  April 2014: Trk::VxCandidate is replaced by xAOD::Vertex
16 
17 ********************************************/
18 
23 #include "VxVertex/VxCandidate.h"
24 
25 namespace Trk {
26 
28  VxSecVertexInfo(),
29  m_twoTrackVerticesInJet(nullptr),
30  m_selectedTracksInJet(nullptr) {}
31 
32  VxJetFitterVertexInfo::VxJetFitterVertexInfo(const std::vector<Trk::VxJetCandidate*> & vertices,
33  const Trk::TwoTrackVerticesInJet * twoTrackVertices,
34  const Trk::SelectedTracksInJet* selectedTracksInJet) :
35  VxSecVertexInfo(),
36  m_twoTrackVerticesInJet(twoTrackVertices),
37  m_selectedTracksInJet(selectedTracksInJet),
38  m_verticesJF(vertices)
39  {}
40 
41 
43  VxSecVertexInfo(rhs),
44  m_twoTrackVerticesInJet(rhs.m_twoTrackVerticesInJet?new Trk::TwoTrackVerticesInJet(*rhs.m_twoTrackVerticesInJet):nullptr),
45  m_selectedTracksInJet(rhs.m_selectedTracksInJet?new Trk::SelectedTracksInJet(*rhs.m_selectedTracksInJet):nullptr)
46  {
47  std::vector<Trk::VxJetCandidate*>::const_iterator verticesBegin=rhs.m_verticesJF.begin();
48  std::vector<Trk::VxJetCandidate*>::const_iterator verticesEnd=rhs.m_verticesJF.end();
49 
50  for (std::vector<Trk::VxJetCandidate*>::const_iterator verticesIter=verticesBegin;
51  verticesIter!=verticesEnd;++verticesIter) {
52  Trk::VxJetCandidate* myCandidate=*verticesIter;
53  if (myCandidate!=nullptr) {
54  m_verticesJF.push_back(new Trk::VxJetCandidate(*myCandidate));
55  } else {
56  std::cout << " Warning in VxSecVertexInfo: tried in copy constructor to copy over a zero pointer Vertex " << std::endl;
57  }
58  }
59  m_SVOwnership=true;
60  }
61 
62 
63  VxJetFitterVertexInfo & VxJetFitterVertexInfo::operator= (const VxJetFitterVertexInfo & rhs) {
64  if (this!=&rhs) {
65 
66  m_verticesJF.clear();
68  delete m_selectedTracksInJet;
69  this->operator=(rhs);
70  std::vector<Trk::VxJetCandidate*>::const_iterator verticesBegin=rhs.m_verticesJF.begin();
71  std::vector<Trk::VxJetCandidate*>::const_iterator verticesEnd=rhs.m_verticesJF.end();
72 
73  for (std::vector<Trk::VxJetCandidate*>::const_iterator verticesIter=verticesBegin;
74  verticesIter!=verticesEnd;++verticesIter) {
75  Trk::VxJetCandidate* myCandidate=*verticesIter;
76  if (myCandidate!=nullptr) {
77  m_verticesJF.push_back(new Trk::VxJetCandidate(*myCandidate));
78  } else {
79  std::cout << " Warning in VxSecVertexInfo: tried in copy constructor to copy over a zero pointer Vertex " << std::endl;
80  }
81  }
82  m_twoTrackVerticesInJet=rhs.m_twoTrackVerticesInJet?new Trk::TwoTrackVerticesInJet(*rhs.m_twoTrackVerticesInJet):nullptr;
83  m_selectedTracksInJet=rhs.m_selectedTracksInJet?new Trk::SelectedTracksInJet(*rhs.m_selectedTracksInJet):nullptr;
84  m_SVOwnership=true;
85  }
86  return *this;
87  }
88 
90  if(m_SVOwnership){ // Delete vertices only if ownership is set explicitly
92  delete m_selectedTracksInJet;
93  std::vector<Trk::VxJetCandidate*>::const_iterator verticesBegin=m_verticesJF.begin();
94  std::vector<Trk::VxJetCandidate*>::const_iterator verticesEnd=m_verticesJF.end();
95  for (std::vector<Trk::VxJetCandidate*>::const_iterator verticesIter=verticesBegin;
96  verticesIter!=verticesEnd;++verticesIter) {
97  Trk::VxJetCandidate* myCandidate=*verticesIter;
98  if (myCandidate!=nullptr) {
99  delete myCandidate;
100  } else {
101  std::cout << " Warning in VxSecVertexInfo: tried to delete a zero pointer --> Inconsistency found. " << std::endl;
102  }
103  }
104  }
105  }
106 
107 }//end namespace
Trk::VxJetFitterVertexInfo::m_selectedTracksInJet
const Trk::SelectedTracksInJet * m_selectedTracksInJet
Definition: VxJetFitterVertexInfo.h:94
Trk::SelectedTracksInJet
Definition: SelectedTracksInJet.h:62
Trk::VxJetFitterVertexInfo::~VxJetFitterVertexInfo
virtual ~VxJetFitterVertexInfo()
Definition: VxJetFitterVertexInfo.cxx:101
Trk::VxJetFitterVertexInfo::m_verticesJF
std::vector< Trk::VxJetCandidate * > m_verticesJF
Definition: VxJetFitterVertexInfo.h:95
Trk::VxJetFitterVertexInfo::operator=
VxJetFitterVertexInfo & operator=(const VxJetFitterVertexInfo &)
Definition: VxJetFitterVertexInfo.cxx:75
Trk::VxSecVertexInfo::m_SVOwnership
bool m_SVOwnership
Definition: VxSecVertexInfo.h:126
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
VxJetCandidate.h
SelectedTracksInJet.h
Trk::TwoTrackVerticesInJet
Definition: TwoTrackVerticesInJet.h:45
Trk::VxJetFitterVertexInfo::m_twoTrackVerticesInJet
const Trk::TwoTrackVerticesInJet * m_twoTrackVerticesInJet
Definition: VxJetFitterVertexInfo.h:93
Trk::VxJetFitterVertexInfo
Definition: VxJetFitterVertexInfo.h:58
VxCandidate.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::VxSecVertexInfo
Definition: VxSecVertexInfo.h:63
Trk::VxJetCandidate
Definition: VxJetCandidate.h:72
TwoTrackVerticesInJet.h
Trk::VxJetFitterVertexInfo::VxJetFitterVertexInfo
VxJetFitterVertexInfo()
Definition: VxJetFitterVertexInfo.cxx:39
VxJetFitterVertexInfo.h