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
CMFlashClusterContainerv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file CMFlashClusterContainerv1.cc
1
7
#include "
CMFlashClusterContainerv1.h
"
8
#include "
CMFlashCluster.h
"
9
#include "
CMFlashClusterv1.h
"
10
11
#include <cstdlib>
12
13
void
CMFlashClusterContainerv1::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
CMFlashClusterContainerv1::identify
(std::ostream& os)
const
24
{
25
os <<
"-----CMFlashClusterContainerv1-----"
<< 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
os <<
"clus key "
<< iter->first << std::endl;
31
(iter->second)->
identify
();
32
}
33
os <<
"------------------------------"
<< std::endl;
34
return
;
35
}
36
37
CMFlashClusterContainerv1::ConstIterator
38
CMFlashClusterContainerv1::addCluster
(
CMFlashCluster
* newclus)
39
{
40
return
addClusterSpecifyKey
(newclus->
getClusKey
(), newclus);
41
}
42
43
CMFlashClusterContainerv1::ConstIterator
44
CMFlashClusterContainerv1::addClusterSpecifyKey
(
const
unsigned
int
key,
CMFlashCluster
* newclus)
45
{
46
auto
ret =
m_clusmap
.insert(std::make_pair(key, newclus));
47
if
( !ret.second )
48
{
49
std::cout <<
"CMFlashClusterContainerv1::AddClusterSpecifyKey: duplicate key: "
<< key <<
" exiting now"
<< std::endl;
50
exit
(1);
51
}
52
else
53
{
54
return
ret.first;
55
}
56
}
57
58
void
CMFlashClusterContainerv1::removeCluster
(
unsigned
int
key)
59
{
m_clusmap
.erase(key); }
60
61
void
CMFlashClusterContainerv1::removeCluster
(
CMFlashCluster
*clus)
62
{
removeCluster
( clus->
getClusKey
() ); }
63
64
CMFlashClusterContainerv1::Iterator
65
CMFlashClusterContainerv1::findOrAddCluster
(
unsigned
int
key)
66
{
67
auto
it
=
m_clusmap
.lower_bound( key );
68
if
(
it
==
m_clusmap
.end()|| (key <
it
->first ))
69
{
70
// add new cluster and set its key
71
it
=
m_clusmap
.insert(
it
, std::make_pair(key,
new
CMFlashClusterv1
()));
72
it
->second->setClusKey(key);
73
}
74
return
it
;
75
}
76
77
CMFlashClusterContainer::ConstRange
78
CMFlashClusterContainerv1::getClusters
()
const
79
{
return
std::make_pair(
m_clusmap
.cbegin(),
m_clusmap
.cend()); }
80
81
CMFlashCluster
*
82
CMFlashClusterContainerv1::findCluster
(
unsigned
int
key)
const
83
{
84
auto
it
=
m_clusmap
.find(key);
85
return
it
==
m_clusmap
.end() ?
nullptr
:
it
->second;
86
}
87
88
unsigned
int
CMFlashClusterContainerv1::size
()
const
89
{
90
return
m_clusmap
.size();
91
}
coresoftware
blob
master
offline
packages
trackbase
CMFlashClusterContainerv1.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:37
using
1.8.2 with
ECCE GitHub integration