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
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
RawTowerDefs::CalorimeterId
caloid =
RawTowerDefs::decode_caloid
(
towerid
);
63
switch
(caloid)
64
{
65
case
RawTowerDefs::LFHCAL
:
66
os <<
"RawTowerv1: etabin: "
<<
get_bineta
() <<
", phibin: "
<<
get_binphi
() <<
", l-bin: "
<<
get_binl
()
67
<<
" energy="
<<
get_energy
() << std::endl;
68
return
;
69
default
:
70
os <<
"RawTowerv1: etabin: "
<<
get_bineta
() <<
", phibin: "
<<
get_binphi
()
71
<<
" energy="
<<
get_energy
() << std::endl;
72
return
;
73
}
74
}
75
76
void
RawTowerv1::add_ecell
(
const
CellKeyType
g4cellid,
77
const
float
ecell)
78
{
79
if
(
ecells
.find(g4cellid) ==
ecells
.end())
80
{
81
ecells
[g4cellid] = ecell;
82
}
83
else
84
{
85
ecells
[g4cellid] += ecell;
86
}
87
}
88
89
void
RawTowerv1::add_eshower
(
const
int
g4showerid,
const
float
eshower)
90
{
91
if
(
eshowers
.find(g4showerid) ==
eshowers
.end())
92
{
93
eshowers
[g4showerid] = eshower;
94
}
95
else
96
{
97
eshowers
[g4showerid] += eshower;
98
}
99
}
100
101
int
RawTowerv1::get_bineta
()
const
102
{
103
RawTowerDefs::CalorimeterId
caloid =
RawTowerDefs::decode_caloid
(
towerid
);
104
switch
(caloid)
105
{
106
case
RawTowerDefs::LFHCAL
:
107
return
RawTowerDefs::decode_index1v2
(
towerid
);
108
default
:
109
return
RawTowerDefs::decode_index1
(
towerid
);
110
}
111
return
-1;
112
}
113
114
int
RawTowerv1::get_binphi
()
const
115
{
116
RawTowerDefs::CalorimeterId
caloid =
RawTowerDefs::decode_caloid
(
towerid
);
117
switch
(caloid)
118
{
119
case
RawTowerDefs::LFHCAL
:
120
return
RawTowerDefs::decode_index2v2
(
towerid
);
121
default
:
122
return
RawTowerDefs::decode_index2
(
towerid
);
123
}
124
return
-1;
125
}
coresoftware
blob
master
offline
packages
CaloBase
RawTowerv1.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:05
using
1.8.2 with
sPHENIX GitHub integration