ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
TrkrClusterContainerv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TrkrClusterContainerv1.cc
1
7
#include "
TrkrClusterContainerv1.h
"
8
#include "
TrkrCluster.h
"
9
#include "
TrkrClusterv2.h
"
10
11
#include <cstdlib>
12
13
void
TrkrClusterContainerv1::Reset
()
14
{
15
while
(
m_clusmap
.begin() !=
m_clusmap
.end())
16
{
17
delete
m_clusmap
.begin()->second;
18
m_clusmap
.erase(
m_clusmap
.begin());
19
}
20
return
;
21
}
22
23
void
TrkrClusterContainerv1::identify
(std::ostream& os)
const
24
{
25
os <<
"-----TrkrClusterContainerv1-----"
<< std::endl;
26
ConstIterator
iter;
27
os <<
"Number of clusters: "
<<
size
() << std::endl;
28
for
(iter =
m_clusmap
.begin(); iter !=
m_clusmap
.end(); ++iter)
29
{
30
int
layer
=
TrkrDefs::getLayer
(iter->first);
31
os <<
"clus key "
<< iter->first <<
" layer "
<< layer << std::endl;
32
(iter->second)->
identify
();
33
}
34
os <<
"------------------------------"
<< std::endl;
35
return
;
36
}
37
38
TrkrClusterContainerv1::ConstIterator
39
TrkrClusterContainerv1::addCluster
(
TrkrCluster
* newclus)
40
{
41
return
addClusterSpecifyKey
(newclus->
getClusKey
(), newclus);
42
}
43
44
TrkrClusterContainerv1::ConstIterator
45
TrkrClusterContainerv1::addClusterSpecifyKey
(
const
TrkrDefs::cluskey
key,
TrkrCluster
* newclus)
46
{
47
auto
ret =
m_clusmap
.insert(std::make_pair(key, newclus));
48
if
( !ret.second )
49
{
50
std::cout <<
"TrkrClusterContainerv1::AddClusterSpecifyKey: duplicate key: "
<< key <<
" exiting now"
<< std::endl;
51
exit
(1);
52
}
53
else
54
{
55
return
ret.first;
56
}
57
}
58
59
void
TrkrClusterContainerv1::removeCluster
(
TrkrDefs::cluskey
key)
60
{
m_clusmap
.erase(key); }
61
62
void
TrkrClusterContainerv1::removeCluster
(
TrkrCluster
*clus)
63
{
removeCluster
( clus->
getClusKey
() ); }
64
65
TrkrClusterContainerv1::Iterator
66
TrkrClusterContainerv1::findOrAddCluster
(
TrkrDefs::cluskey
key)
67
{
68
auto
it
=
m_clusmap
.lower_bound( key );
69
if
(
it
==
m_clusmap
.end()|| (key <
it
->first ))
70
{
71
// add new cluster and set its key
72
it
=
m_clusmap
.insert(
it
, std::make_pair(key,
new
TrkrClusterv2
()));
73
it
->second->setClusKey(key);
74
}
75
return
it
;
76
}
77
78
TrkrClusterContainer::ConstRange
79
TrkrClusterContainerv1::getClusters
()
const
80
{
return
std::make_pair(
m_clusmap
.cbegin(),
m_clusmap
.cend()); }
81
82
TrkrCluster
*
83
TrkrClusterContainerv1::findCluster
(
TrkrDefs::cluskey
key)
const
84
{
85
auto
it
=
m_clusmap
.find(key);
86
return
it
==
m_clusmap
.end() ?
nullptr
:
it
->second;
87
}
88
89
unsigned
int
TrkrClusterContainerv1::size
()
const
90
{
91
return
m_clusmap
.size();
92
}
coresoftware
blob
master
offline
packages
trackbase
TrkrClusterContainerv1.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:37
using
1.8.2 with
ECCE GitHub integration