EIC Software
Reference for
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
JetMapv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file JetMapv1.cc
1
#include "
JetMapv1.h
"
2
3
#include "
Jet.h
"
4
5
#include <
phool/PHObject.h
>
// for PHObject
6
7
#include <cassert>
8
#include <cmath>
9
#include <iterator>
// for reverse_iterator
10
#include <ostream>
// for operator<<, endl, ostream, basic_ostream::operat...
11
#include <utility>
// for pair, make_pair
12
13
using namespace
std;
14
15
JetMapv1::JetMapv1
()
16
: _algo(
Jet
::
NONE
)
17
, _par(NAN)
18
, _src()
19
, _map()
20
{
21
}
22
23
JetMapv1::JetMapv1
(
const
JetMap
*jets)
24
: _algo(jets->get_algo())
25
, _par(jets->get_par())
26
, _src()
27
, _map()
28
{
29
for
(
ConstSrcIter
iter = jets->
begin_src
();
30
iter != jets->
end_src
();
31
++iter)
32
{
33
_src
.insert(*iter);
34
}
35
36
for
(
ConstIter
iter = jets->
begin
();
37
iter != jets->
end
();
38
++iter)
39
{
40
Jet
* jet =
dynamic_cast<
Jet
*
>
((iter->second)->
CloneMe
());
41
assert(jet);
42
_map
.insert(make_pair(jet->
get_id
(), jet));
43
}
44
}
45
46
JetMapv1
&
JetMapv1::operator=
(
const
JetMapv1
& jets)
47
{
48
Reset
();
49
50
_algo
= jets.
get_algo
();
51
_par
= jets.
get_par
();
52
53
for
(
ConstSrcIter
iter = jets.
begin_src
();
54
iter != jets.
end_src
();
55
++iter)
56
{
57
_src
.insert(*iter);
58
}
59
60
for
(
ConstIter
iter = jets.
begin
();
61
iter != jets.
end
();
62
++iter)
63
{
64
Jet
* jet =
dynamic_cast<
Jet
*
>
((iter->second)->
CloneMe
());
65
assert(jet);
66
_map
.insert(make_pair(jet->
get_id
(), jet));
67
}
68
69
return
*
this
;
70
}
71
72
JetMapv1::~JetMapv1
()
73
{
74
JetMapv1::Reset
();
75
}
76
77
void
JetMapv1::Reset
()
78
{
79
_algo
=
Jet::NONE
;
80
_par
= NAN;
81
_src
.clear();
82
83
while
(
_map
.begin() !=
_map
.end())
84
{
85
delete
_map
.begin()->second;
86
_map
.erase(
_map
.begin());
87
}
88
}
89
90
PHObject
*
JetMapv1::CloneMe
()
const
91
{
92
JetMap
* map =
new
JetMapv1
(*
this
);
93
return
map;
94
}
95
96
void
JetMapv1::identify
(ostream& os)
const
97
{
98
os <<
"JetMapv1: size = "
<<
_map
.size() << endl;
99
os <<
" par = "
<<
_par
<< endl;
100
os <<
" source = "
;
101
for
(
ConstSrcIter
i =
begin_src
(); i !=
end_src
(); ++i)
102
{
103
os << (*i) <<
","
;
104
}
105
os << endl;
106
107
return
;
108
}
109
110
const
Jet
*
JetMapv1::get
(
unsigned
int
id
)
const
111
{
112
ConstIter
iter =
_map
.find(
id
);
113
if
(iter ==
_map
.end())
return
nullptr
;
114
return
iter->second;
115
}
116
117
Jet
*
JetMapv1::get
(
unsigned
int
id
)
118
{
119
Iter
iter =
_map
.find(
id
);
120
if
(iter ==
_map
.end())
return
nullptr
;
121
return
iter->second;
122
}
123
124
Jet
*
JetMapv1::insert
(
Jet
* jet)
125
{
126
unsigned
int
index = 0;
127
if
(!
_map
.empty()) index =
_map
.rbegin()->first + 1;
128
_map
.insert(make_pair(index, jet));
129
_map
[index]->set_id(index);
130
return
(
_map
[index]);
131
}
fun4all_coresoftware
blob
master
simulation
g4simulation
g4jets
JetMapv1.cc
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:49
using
1.8.2 with
EIC GitHub integration