ATLAS Offline Software
Loading...
Searching...
No Matches
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
20namespace Trk {
21 // standard constructor for persistency
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
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
39 {
40 std::vector<Trk::V0Hypothesis *>::iterator i = m_v0Hyp.begin();
41 std::vector<Trk::V0Hypothesis *>::iterator ie = m_v0Hyp.end();
42 for(;i!=ie;++i)
43 {
44 if(0!=(*i)) delete (*i);
45 (*i)=0;
46 }
47 m_v0Hyp.clear();
48 }
49
51 {
52 if (this!=&rhs)
53 {
54
55//cleaning the local vector before assignement
56 std::vector<Trk::V0Hypothesis *>::iterator i = m_v0Hyp.begin();
57 std::vector<Trk::V0Hypothesis *>::iterator ie = m_v0Hyp.end();
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
75 {
76 if (this != &rhs) {
77 m_v0Hyp = std::move(rhs.m_v0Hyp);
78 }
79 return *this;
80 }
81} // end of namespace
virtual ~V0Candidate()
Destructor.
V0Candidate & operator=(const V0Candidate &rhs)
Assignement constructor.
std::vector< Trk::V0Hypothesis * > m_v0Hyp
Definition V0Candidate.h:82
V0Candidate()
Default constructor.
An extension of Trk::ExtendedVxCandidate, to be used for constrained and unconstrained V0 candidates ...
Ensure that the ATLAS eigen extensions are properly loaded.
STL namespace.