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
TrkrHitSetv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TrkrHitSetv1.cc
1
7
#include "
TrkrHitSetv1.h
"
8
#include "
TrkrHit.h
"
9
10
#include <cstdlib>
// for exit
11
#include <iostream>
12
#include <type_traits>
// for __decay_and_strip<>::__type
13
14
void
TrkrHitSetv1::Reset
()
15
{
16
m_hitSetKey
= TrkrDefs::HITSETKEYMAX;
17
18
for
(
auto
&& [key, hit] :
m_hits
)
19
{
delete
hit; }
20
21
m_hits.clear();
22
23
}
24
25
void
TrkrHitSetv1::identify
(std::ostream&
os
)
const
26
{
27
const
unsigned
int
layer
=
TrkrDefs::getLayer
(
m_hitSetKey
);
28
const
unsigned
int
trkrid =
TrkrDefs::getTrkrId
(
m_hitSetKey
);
29
os
30
<<
"TrkrHitSetv1: "
31
<<
" hitsetkey "
<<
getHitSetKey
()
32
<<
" TrkrId "
<< trkrid
33
<<
" layer "
<< layer
34
<<
" nhits: "
<<
m_hits
.size()
35
<< std::endl;
36
37
for
(
const
auto
&
entry
:
m_hits
)
38
{
39
std::cout <<
" hitkey "
<<
entry
.first << std::endl;
40
(
entry
.second)->
identify
(os);
41
}
42
}
43
44
void
TrkrHitSetv1::removeHit
(
TrkrDefs::hitkey
key)
45
{
46
const
auto
it
=
m_hits
.find(key);
47
if
(
it
!=
m_hits
.end())
48
{
49
delete
it
->second;
50
m_hits
.erase(
it
);
51
}
else
{
52
identify
();
53
std::cout <<
"TrkrHitSetv1::removeHit: deleting a nonexist key: "
<< key <<
" exiting now"
<< std::endl;
54
exit(1);
55
}
56
}
57
58
TrkrHitSetv1::ConstIterator
59
TrkrHitSetv1::addHitSpecificKey
(
const
TrkrDefs::hitkey
key,
TrkrHit
* hit)
60
{
61
const
auto
ret =
m_hits
.insert(std::make_pair(key, hit));
62
if
( !ret.second )
63
{
64
std::cout <<
"TrkrHitSetv1::AddHitSpecificKey: duplicate key: "
<< key <<
" exiting now"
<< std::endl;
65
exit(1);
66
}
else
{
67
return
ret.first;
68
}
69
}
70
71
TrkrHit
*
72
TrkrHitSetv1::getHit
(
const
TrkrDefs::hitkey
key)
const
73
{
74
TrkrHitSetv1::ConstIterator
it
=
m_hits
.find(key);
75
76
if
(it !=
m_hits
.end())
return
it->second;
77
else
return
nullptr
;
78
}
79
80
TrkrHitSetv1::ConstRange
81
TrkrHitSetv1::getHits
()
const
82
{
83
return
std::make_pair(
m_hits
.cbegin(),
m_hits
.cend());
84
}
coresoftware
blob
master
offline
packages
trackbase
TrkrHitSetv1.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:09
using
1.8.2 with
sPHENIX GitHub integration