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
TrkrHitSetContainerv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TrkrHitSetContainerv1.cc
1
7
#include "
TrkrHitSetContainerv1.h
"
8
9
#include "
TrkrDefs.h
"
10
#include "
TrkrHitSetv1.h
"
11
12
#include <cstdlib>
13
14
void
TrkrHitSetContainerv1::Reset
()
15
{
16
for
(
const
auto
& pair:
m_hitmap
)
17
{
delete
pair.second; }
18
19
m_hitmap.clear();
20
}
21
22
void
TrkrHitSetContainerv1::identify
(std::ostream& os)
const
23
{
24
ConstIterator
iter;
25
os <<
"Number of hits: "
<<
size
() << std::endl;
26
for
(
const
auto
& pair:
m_hitmap
)
27
{
28
int
layer
=
TrkrDefs::getLayer
(pair.first);
29
os <<
"hitsetkey "
<< pair.first <<
" layer "
<<layer << std::endl;
30
pair.second->identify();
31
}
32
return
;
33
}
34
35
TrkrHitSetContainerv1::ConstIterator
36
TrkrHitSetContainerv1::addHitSet
(
TrkrHitSet
* newhit)
37
{
return
addHitSetSpecifyKey
(newhit->
getHitSetKey
(), newhit); }
38
39
TrkrHitSetContainerv1::ConstIterator
40
TrkrHitSetContainerv1::addHitSetSpecifyKey
(
const
TrkrDefs::hitsetkey
key,
TrkrHitSet
* newhit)
41
{
42
const
auto
ret =
m_hitmap
.insert(std::make_pair(key, newhit));
43
if
( !ret.second )
44
{
45
std::cout <<
"TrkrHitSetContainerv1::AddHitSpecifyKey: duplicate key: "
<< key <<
" exiting now"
<< std::endl;
46
exit
(1);
47
}
else
{
48
return
ret.first;
49
}
50
}
51
52
void
TrkrHitSetContainerv1::removeHitSet
(
TrkrDefs::hitsetkey
key)
53
{
m_hitmap
.erase(key); }
54
55
void
TrkrHitSetContainerv1::removeHitSet
(
TrkrHitSet
*hitset)
56
{
removeHitSet
( hitset->
getHitSetKey
() ); }
57
58
TrkrHitSetContainerv1::ConstRange
59
TrkrHitSetContainerv1::getHitSets
(
const
TrkrDefs::TrkrId
trackerid)
const
60
{
61
const
TrkrDefs::hitsetkey
keylo =
TrkrDefs::getHitSetKeyLo
(trackerid);
62
const
TrkrDefs::hitsetkey
keyhi =
TrkrDefs::getHitSetKeyHi
(trackerid);
63
return
std::make_pair(
m_hitmap
.lower_bound(keylo),
m_hitmap
.upper_bound(keyhi) );
64
}
65
66
TrkrHitSetContainerv1::ConstRange
67
TrkrHitSetContainerv1::getHitSets
(
const
TrkrDefs::TrkrId
trackerid,
const
uint8_t
layer
)
const
68
{
69
TrkrDefs::hitsetkey
keylo =
TrkrDefs::getHitSetKeyLo
(trackerid, layer);
70
TrkrDefs::hitsetkey
keyhi =
TrkrDefs::getHitSetKeyHi
(trackerid, layer);
71
return
std::make_pair(
m_hitmap
.lower_bound(keylo),
m_hitmap
.upper_bound(keyhi) );
72
}
73
74
TrkrHitSetContainerv1::ConstRange
75
TrkrHitSetContainerv1::getHitSets
()
const
76
{
return
std::make_pair(
m_hitmap
.cbegin(),
m_hitmap
.cend()); }
77
78
TrkrHitSetContainerv1::Iterator
79
TrkrHitSetContainerv1::findOrAddHitSet
(
TrkrDefs::hitsetkey
key)
80
{
81
auto
it
=
m_hitmap
.lower_bound( key );
82
if
(
it
==
m_hitmap
.end() || (key <
it
->first ) )
83
{
84
it
=
m_hitmap
.insert(
it
, std::make_pair(key,
new
TrkrHitSetv1
));
85
it
->second->setHitSetKey( key );
86
}
87
return
it
;
88
}
89
90
TrkrHitSet
*
91
TrkrHitSetContainerv1::findHitSet
(
TrkrDefs::hitsetkey
key)
92
{
93
auto
it
=
m_hitmap
.find(key);
94
if
(
it
!=
m_hitmap
.end())
95
{
96
return
it
->second;
97
}
else
{
98
return
nullptr
;
99
}
100
}
coresoftware
blob
master
offline
packages
trackbase
TrkrHitSetContainerv1.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:37
using
1.8.2 with
ECCE GitHub integration