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
RawHitSetContainerv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RawHitSetContainerv1.cc
1
7
#include "
RawHitSetContainerv1.h
"
8
9
#include "
TrkrDefs.h
"
10
#include "
RawHitSetv1.h
"
11
12
#include <cstdlib>
13
14
void
RawHitSetContainerv1::Reset
()
15
{
16
for
(
const
auto
& pair:
m_hitmap
)
17
{
delete
pair.second; }
18
19
m_hitmap.clear();
20
}
21
22
void
RawHitSetContainerv1::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
RawHitSetContainerv1::ConstIterator
36
RawHitSetContainerv1::addHitSet
(
RawHitSet
* newhit)
37
{
return
addHitSetSpecifyKey
(newhit->
getHitSetKey
(), newhit); }
38
39
RawHitSetContainerv1::ConstIterator
40
RawHitSetContainerv1::addHitSetSpecifyKey
(
const
TrkrDefs::hitsetkey
key,
RawHitSet
* newhit)
41
{
42
const
auto
ret =
m_hitmap
.insert(std::make_pair(key, newhit));
43
if
( !ret.second )
44
{
45
std::cout <<
"RawHitSetContainerv1::AddHitSpecifyKey: duplicate key: "
<< key <<
" exiting now"
<< std::endl;
46
exit(1);
47
}
else
{
48
return
ret.first;
49
}
50
}
51
52
void
RawHitSetContainerv1::removeHitSet
(
TrkrDefs::hitsetkey
key)
53
{
m_hitmap
.erase(key); }
54
55
void
RawHitSetContainerv1::removeHitSet
(
RawHitSet
*hitset)
56
{
removeHitSet
( hitset->
getHitSetKey
() ); }
57
58
RawHitSetContainerv1::ConstRange
59
RawHitSetContainerv1::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
RawHitSetContainerv1::ConstRange
67
RawHitSetContainerv1::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
RawHitSetContainerv1::ConstRange
75
RawHitSetContainerv1::getHitSets
()
const
76
{
return
std::make_pair(
m_hitmap
.cbegin(),
m_hitmap
.cend()); }
77
78
RawHitSetContainerv1::Iterator
79
RawHitSetContainerv1::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
RawHitSetv1
));
85
it
->second->setHitSetKey( key );
86
}
87
return
it
;
88
}
89
90
RawHitSet
*
91
RawHitSetContainerv1::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
RawHitSetContainerv1.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:09
using
1.8.2 with
sPHENIX GitHub integration