Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
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
1
#include "
TrackSeedContainer_v1.h
"
2
3
#include "
TrackSeed.h
"
4
5
#include <
phool/PHObject.h
>
6
7
#include <vector>
8
#include <iostream>
9
10
TrackSeedContainer_v1::TrackSeedContainer_v1
() :
11
m_seeds() {}
12
13
TrackSeedContainer_v1::TrackSeedContainer_v1
(
const
TrackSeedContainer_v1
& seeds) : m_seeds()
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
22
TrackSeedContainer_v1
&
TrackSeedContainer_v1::operator=
(
const
TrackSeedContainer_v1
& seedContainer)
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
34
void
TrackSeedContainer_v1::Reset
()
35
{
36
for
(
const
TrackSeed
*
seed
:
m_seeds
)
37
{
38
delete
seed
;
39
}
40
41
m_seeds.clear();
42
}
43
44
// cppcheck-suppress virtualCallInConstructor
45
TrackSeedContainer_v1::~TrackSeedContainer_v1
()
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
68
TrackSeed
*
TrackSeedContainer_v1::insert
(
const
TrackSeed
*
seed
)
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
81
std::size_t
TrackSeedContainer_v1::find
(
const
TrackSeed
*
seed
)
82
{
83
auto
it
= std::find(
m_seeds
.begin(),
m_seeds
.end(),
seed
);
84
return
std::distance
(
m_seeds
.begin(),
it
);
85
}
coresoftware
blob
master
offline
packages
trackbase_historic
TrackSeedContainer_v1.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:09
using
1.8.2 with
sPHENIX GitHub integration