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
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
(
auto
&& [key, hitset] :
m_hitmap
)
17
{
delete
hitset;}
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
{
54
auto
iter =
m_hitmap
.find( key );
55
if
(iter !=
m_hitmap
.end())
56
{
57
TrkrHitSet
* hitset = iter->second;
58
delete
hitset;
59
m_hitmap
.erase(iter);
60
}
61
}
62
63
void
TrkrHitSetContainerv1::removeHitSet
(
TrkrHitSet
*hitset)
64
{
removeHitSet
( hitset->
getHitSetKey
() ); }
65
66
TrkrHitSetContainerv1::ConstRange
67
TrkrHitSetContainerv1::getHitSets
(
const
TrkrDefs::TrkrId
trackerid)
const
68
{
69
const
TrkrDefs::hitsetkey
keylo =
TrkrDefs::getHitSetKeyLo
(trackerid);
70
const
TrkrDefs::hitsetkey
keyhi =
TrkrDefs::getHitSetKeyHi
(trackerid);
71
return
std::make_pair(
m_hitmap
.lower_bound(keylo),
m_hitmap
.upper_bound(keyhi) );
72
}
73
74
TrkrHitSetContainerv1::ConstRange
75
TrkrHitSetContainerv1::getHitSets
(
const
TrkrDefs::TrkrId
trackerid,
const
uint8_t
layer
)
const
76
{
77
TrkrDefs::hitsetkey
keylo =
TrkrDefs::getHitSetKeyLo
(trackerid, layer);
78
TrkrDefs::hitsetkey
keyhi =
TrkrDefs::getHitSetKeyHi
(trackerid, layer);
79
return
std::make_pair(
m_hitmap
.lower_bound(keylo),
m_hitmap
.upper_bound(keyhi) );
80
}
81
82
TrkrHitSetContainerv1::ConstRange
83
TrkrHitSetContainerv1::getHitSets
()
const
84
{
return
std::make_pair(
m_hitmap
.cbegin(),
m_hitmap
.cend()); }
85
86
TrkrHitSetContainerv1::Iterator
87
TrkrHitSetContainerv1::findOrAddHitSet
(
TrkrDefs::hitsetkey
key)
88
{
89
auto
it
=
m_hitmap
.lower_bound( key );
90
if
(
it
==
m_hitmap
.end() || (key <
it
->first ) )
91
{
92
it
=
m_hitmap
.insert(
it
, std::make_pair(key,
new
TrkrHitSetv1
));
93
it
->second->setHitSetKey( key );
94
}
95
return
it
;
96
}
97
98
TrkrHitSet
*
99
TrkrHitSetContainerv1::findHitSet
(
TrkrDefs::hitsetkey
key)
100
{
101
auto
it
=
m_hitmap
.find(key);
102
if
(
it
!=
m_hitmap
.end())
103
{
104
return
it
->second;
105
}
else
{
106
return
nullptr
;
107
}
108
}
coresoftware
blob
master
offline
packages
trackbase
TrkrHitSetContainerv1.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:09
using
1.8.2 with
sPHENIX GitHub integration