Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackSeedContainer_v1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackSeedContainer_v1.cc
2 
3 #include "TrackSeed.h"
4 
5 #include <phool/PHObject.h>
6 
7 #include <vector>
8 #include <iostream>
9 
11  m_seeds() {}
12 
14 {
15  for(const TrackSeed* seed : seeds)
16  {
17  TrackSeed* newseed = dynamic_cast<TrackSeed*>(seed->CloneMe());
18  m_seeds.push_back(newseed);
19  }
20 }
21 
23 {
24  Reset();
25  for(const TrackSeed* seed : seedContainer)
26  {
27  TrackSeed* newseed = dynamic_cast<TrackSeed*>(seed->CloneMe());
28  m_seeds.push_back(newseed);
29  }
30 
31  return *this;
32 }
33 
35 {
36  for(const TrackSeed* seed : m_seeds)
37  {
38  delete seed;
39  }
40 
41  m_seeds.clear();
42 }
43 
44 // cppcheck-suppress virtualCallInConstructor
46 {
47  Reset();
48 }
49 
50 void TrackSeedContainer_v1::identify(std::ostream& os) const
51 {
52  os << "TrackSeedContainer_v1 size is " << m_seeds.size()
53  << std::endl;
54 }
55 
56 const TrackSeed* TrackSeedContainer_v1::get(const std::size_t key) const
57 {
58  if(key > m_seeds.size()) { return nullptr; }
59  return m_seeds.at(key);
60 }
61 
62 TrackSeed* TrackSeedContainer_v1::get(const std::size_t key)
63 {
64  if(key > m_seeds.size()) { return nullptr; }
65  return m_seeds.at(key);
66 }
67 
69 {
70  m_seeds.push_back(dynamic_cast<TrackSeed*>(seed->CloneMe()));
71  Iter iter = m_seeds.end() - 1;
72  return *iter;
73 }
74 
75 std::size_t TrackSeedContainer_v1::find(const TrackSeed* seed) const
76 {
77  auto it = std::find(m_seeds.begin(), m_seeds.end(), seed);
78  return std::distance(m_seeds.begin(), it);
79 }
80 
82 {
83  auto it = std::find(m_seeds.begin(), m_seeds.end(), seed);
84  return std::distance(m_seeds.begin(), it);
85 }