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
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
for
(
const
auto
& pair:
m_hits
)
18
{
delete
pair.second; }
19
20
m_hits.clear();
21
return
;
22
}
23
24
void
TrkrHitSetv1::identify
(std::ostream& os)
const
25
{
26
const
unsigned
int
layer
=
TrkrDefs::getLayer
(
m_hitSetKey
);
27
const
unsigned
int
trkrid =
TrkrDefs::getTrkrId
(
m_hitSetKey
);
28
os
29
<<
"TrkrHitSetv1: "
30
<<
" hitsetkey "
<<
getHitSetKey
()
31
<<
" TrkrId "
<< trkrid
32
<<
" layer "
<< layer
33
<<
" nhits: "
<<
m_hits
.size()
34
<< std::endl;
35
36
for
(
const
auto
& entry :
m_hits
)
37
{
38
std::cout <<
" hitkey "
<< entry.first << std::endl;
39
(entry.second)->
identify
(os);
40
}
41
}
42
43
void
TrkrHitSetv1::removeHit
(
TrkrDefs::hitkey
key)
44
{
45
const
auto
it
=
m_hits
.find(key);
46
if
(
it
!=
m_hits
.end())
47
{
48
delete
it
->second;
49
m_hits
.erase(
it
);
50
}
else
{
51
identify
();
52
std::cout <<
"TrkrHitSetv1::removeHit: deleting a nonexist key: "
<< key <<
" exiting now"
<< std::endl;
53
exit
(1);
54
}
55
}
56
57
TrkrHitSetv1::ConstIterator
58
TrkrHitSetv1::addHitSpecificKey
(
const
TrkrDefs::hitkey
key,
TrkrHit
* hit)
59
{
60
const
auto
ret =
m_hits
.insert(std::make_pair(key, hit));
61
if
( !ret.second )
62
{
63
std::cout <<
"TrkrHitSetv1::AddHitSpecificKey: duplicate key: "
<< key <<
" exiting now"
<< std::endl;
64
exit
(1);
65
}
else
{
66
return
ret.first;
67
}
68
}
69
70
TrkrHit
*
71
TrkrHitSetv1::getHit
(
const
TrkrDefs::hitkey
key)
const
72
{
73
TrkrHitSetv1::ConstIterator
it
=
m_hits
.find(key);
74
75
if
(it !=
m_hits
.end())
return
it->second;
76
else
return
nullptr
;
77
}
78
79
TrkrHitSetv1::ConstRange
80
TrkrHitSetv1::getHits
()
const
81
{
82
return
std::make_pair(
m_hits
.cbegin(),
m_hits
.cend());
83
}
coresoftware
blob
master
offline
packages
trackbase
TrkrHitSetv1.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:37
using
1.8.2 with
ECCE GitHub integration