ATLAS Offline Software
V0Candidate.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 /***************************************************************************
6  V0Candidate.cxx - Description
7  -------------------
8  begin : 31-07-2005
9  authors : Evelina Bouhova-Thacker (Lancater University), Rob Henderson (Lancater University)
10  email : e.bouhova@cern.ch, r.henderson@lancaster.ac.uk
11  changes : 20-03-2007
12  Kirill Prokofiev <Kirill.Prokofiev@cern.ch>
13  Changing private datamembers to pointers, adding clone method, equality operator etc.
14  ***************************************************************************/
15 
18 #include <vector>
19 
20 namespace Trk {
21  // standard constructor for persistency
22  V0Candidate::V0Candidate(): m_v0Hyp() {}
23 
24  V0Candidate::V0Candidate(const std::vector<Trk::V0Hypothesis *>& v0Hyp) : m_v0Hyp(v0Hyp) {}
25 
26  V0Candidate::V0Candidate(std::vector<Trk::V0Hypothesis *>&& v0Hyp)
27  : m_v0Hyp(std::move(v0Hyp))
28  {}
29 
30  V0Candidate::V0Candidate(const V0Candidate& rhs) : m_v0Hyp(std::vector<Trk::V0Hypothesis *>())
31  {
32  std::vector<Trk::V0Hypothesis *>::const_iterator itr = rhs.m_v0Hyp.begin();
33  std::vector<Trk::V0Hypothesis *>::const_iterator itre = rhs.m_v0Hyp.end();
34  for(;itr!=itre;++itr) m_v0Hyp.push_back((*itr)->clone());
35  }
36 
37 //destructor taking care of produced pointers
38  V0Candidate::~V0Candidate()
39  {
42  for(;i!=ie;++i)
43  {
44  if(0!=(*i)) delete (*i);
45  (*i)=0;
46  }
47  m_v0Hyp.clear();
48  }
49 
50  V0Candidate & V0Candidate::operator= (const V0Candidate & rhs)
51  {
52  if (this!=&rhs)
53  {
54 
55 //cleaning the local vector before assignement
58  for(;i!=ie;++i)
59  {
60  if(0!=(*i)) delete (*i);
61  (*i)=0;
62  }
63  m_v0Hyp.clear();
64 
65 //now copying the rhs content over
66  std::vector<Trk::V0Hypothesis *>::const_iterator itr = rhs.m_v0Hyp.begin();
67  std::vector<Trk::V0Hypothesis *>::const_iterator itre = rhs.m_v0Hyp.end();
68  for(;itr!=itre;++itr) m_v0Hyp.push_back((*itr)->clone());
69  }
70  return *this;
71  }
72 
73  V0Candidate&
74  V0Candidate::operator=(V0Candidate&& rhs) noexcept
75  {
76  if (this != &rhs) {
77  m_v0Hyp = std::move(rhs.m_v0Hyp);
78  }
79  return *this;
80  }
81 } // end of namespace
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
V0Candidate.h
PlotCalibFromCool.ie
ie
Definition: PlotCalibFromCool.py:420
V0Hypothesis.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
vector
Definition: MultiHisto.h:13
Trk::V0Candidate::m_v0Hyp
std::vector< Trk::V0Hypothesis * > m_v0Hyp
Definition: V0Candidate.h:82
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::V0Candidate::V0Candidate
V0Candidate()
Default constructor.
Definition: V0Candidate.cxx:31
Trk::V0Candidate
Definition: V0Candidate.h:33