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
RawTowerv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RawTowerv1.cc
1
#include "
RawTowerv1.h
"
2
3
#include <cmath>
4
#include <iostream>
5
6
using namespace
std;
7
8
RawTowerv1::RawTowerv1
(
const
RawTower
& tower)
9
{
10
towerid = (tower.
get_id
());
11
energy
= (tower.
get_energy
());
12
time
= (tower.
get_time
());
13
14
CellConstRange
cell_range = tower.
get_g4cells
();
15
16
for
(
CellConstIterator
cell_iter = cell_range.first;
17
cell_iter != cell_range.second; ++cell_iter)
18
{
19
add_ecell(cell_iter->first, cell_iter->second);
20
}
21
22
ShowerConstRange
shower_range = tower.
get_g4showers
();
23
24
for
(
ShowerConstIterator
shower_iter = shower_range.first;
25
shower_iter != shower_range.second; ++shower_iter)
26
{
27
add_eshower(shower_iter->first, shower_iter->second);
28
}
29
}
30
31
RawTowerv1::RawTowerv1
(
RawTowerDefs::keytype
id
)
32
: towerid(id)
33
{
34
}
35
36
RawTowerv1::RawTowerv1
(
const
unsigned
int
ieta,
const
unsigned
int
iphi)
37
{
38
towerid
=
RawTowerDefs::encode_towerid
(
RawTowerDefs::NONE
, ieta, iphi);
39
}
40
41
RawTowerv1::RawTowerv1
(
const
RawTowerDefs::CalorimeterId
caloid,
42
const
unsigned
int
ieta,
const
unsigned
int
iphi)
43
{
44
towerid
=
RawTowerDefs::encode_towerid
(caloid, ieta, iphi);
45
}
46
47
void
RawTowerv1::Reset
()
48
{
49
energy
= 0;
50
time
= NAN;
51
ecells
.clear();
52
eshowers
.clear();
53
}
54
55
int
RawTowerv1::isValid
()
const
56
{
57
return
get_energy
() != 0;
58
}
59
60
void
RawTowerv1::identify
(std::ostream& os)
const
61
{
62
63
RawTowerDefs::CalorimeterId
caloid =
RawTowerDefs::decode_caloid
(
towerid
);
64
switch
(caloid)
65
{
66
case
RawTowerDefs::LFHCAL
:
67
os <<
"RawTowerv1: etabin: "
<<
get_bineta
() <<
", phibin: "
<<
get_binphi
() <<
", l-bin: "
<<
get_binl
()
68
<<
" energy="
<<
get_energy
() << std::endl;
69
return
;
70
default
:
71
os <<
"RawTowerv1: etabin: "
<<
get_bineta
() <<
", phibin: "
<<
get_binphi
()
72
<<
" energy="
<<
get_energy
() << std::endl;
73
return
;
74
}
75
76
77
}
78
79
void
RawTowerv1::add_ecell
(
const
CellKeyType
g4cellid,
80
const
float
ecell)
81
{
82
if
(
ecells
.find(g4cellid) ==
ecells
.end())
83
{
84
ecells
[g4cellid] = ecell;
85
}
86
else
87
{
88
ecells
[g4cellid] += ecell;
89
}
90
}
91
92
void
RawTowerv1::add_eshower
(
const
int
g4showerid,
const
float
eshower)
93
{
94
if
(
eshowers
.find(g4showerid) ==
eshowers
.end())
95
{
96
eshowers
[g4showerid] = eshower;
97
}
98
else
99
{
100
eshowers
[g4showerid] += eshower;
101
}
102
}
103
104
int
RawTowerv1::get_bineta
()
const
105
{
106
RawTowerDefs::CalorimeterId
caloid =
RawTowerDefs::decode_caloid
(
towerid
);
107
switch
(caloid)
108
{
109
case
RawTowerDefs::LFHCAL
:
110
return
RawTowerDefs::decode_index1v2
(
towerid
);
111
default
:
112
return
RawTowerDefs::decode_index1
(
towerid
);
113
}
114
return
-1;
115
}
116
117
int
RawTowerv1::get_binphi
()
const
118
{
119
RawTowerDefs::CalorimeterId
caloid =
RawTowerDefs::decode_caloid
(
towerid
);
120
switch
(caloid)
121
{
122
case
RawTowerDefs::LFHCAL
:
123
return
RawTowerDefs::decode_index2v2
(
towerid
);
124
default
:
125
return
RawTowerDefs::decode_index2
(
towerid
);
126
}
127
return
-1;
128
}
coresoftware
blob
master
offline
packages
CaloBase
RawTowerv1.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:34
using
1.8.2 with
ECCE GitHub integration