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
RawTower_Prototype2.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RawTower_Prototype2.cc
1
#include "
RawTower_Prototype2.h
"
2
3
#include "
PROTOTYPE2_FEM.h
"
4
5
#include <calobase/RawTower.h>
// for RawTower
6
#include <calobase/RawTowerDefs.h>
7
8
#include <algorithm>
9
#include <cassert>
10
#include <cmath>
11
#include <iostream>
12
#include <vector>
// for vector
13
14
using namespace
std;
15
16
RawTower_Prototype2::RawTower_Prototype2
()
17
:
towerid
(~0)
18
,
// initialize all bits on
19
energy
(0)
20
,
time
(NAN)
21
, HBD_channel(-1)
22
{
23
fill_n(
signal_samples
,
NSAMPLES
, -9999);
24
}
25
26
RawTower_Prototype2::RawTower_Prototype2
(
const
RawTower
&
tower
)
27
{
28
towerid
= (tower.
get_id
());
29
energy
= (tower.
get_energy
());
30
time
= (tower.
get_time
());
31
HBD_channel
= -1;
32
fill_n(
signal_samples
,
NSAMPLES
, -9999);
33
}
34
35
RawTower_Prototype2::RawTower_Prototype2
(
RawTowerDefs::keytype
id
)
36
:
towerid
(id)
37
,
energy
(0)
38
,
time
(NAN)
39
, HBD_channel(-1)
40
{
41
fill_n(
signal_samples
,
NSAMPLES
, -9999);
42
}
43
44
RawTower_Prototype2::RawTower_Prototype2
(
const
unsigned
int
icol,
45
const
unsigned
int
irow)
46
:
towerid
(0)
47
,
energy
(0)
48
,
time
(NAN)
49
, HBD_channel(-1)
50
{
51
towerid
=
RawTowerDefs::encode_towerid
(
RawTowerDefs::NONE
, icol, irow);
52
fill_n(
signal_samples
,
NSAMPLES
, -9999);
53
}
54
55
RawTower_Prototype2::RawTower_Prototype2
(
56
const
RawTowerDefs::CalorimeterId
caloid,
const
unsigned
int
ieta,
57
const
unsigned
int
iphi)
58
:
towerid
(0)
59
,
energy
(0)
60
,
time
(NAN)
61
, HBD_channel(-1)
62
{
63
towerid
=
RawTowerDefs::encode_towerid
(caloid, ieta, iphi);
64
fill_n(
signal_samples
,
NSAMPLES
, -9999);
65
}
66
67
void
RawTower_Prototype2::Reset
()
68
{
69
energy
= 0;
70
time
= NAN;
71
fill_n(
signal_samples
,
NSAMPLES
, -9999);
72
}
73
74
int
RawTower_Prototype2::isValid
()
const
{
return
get_energy
() != 0; }
75
76
void
RawTower_Prototype2::identify
(std::ostream &
os
)
const
77
{
78
os <<
"RawTower_Prototype2: etabin: "
<<
get_bineta
()
79
<<
", phibin: "
<<
get_binphi
() <<
" energy="
<<
get_energy
() << std::endl;
80
}
81
82
void
RawTower_Prototype2::set_signal_samples
(
83
int
i
,
RawTower_Prototype2::signal_type
sig)
84
{
85
assert
(i >= 0);
86
assert
(i <
NSAMPLES
);
87
signal_samples
[
i
] = sig;
88
}
89
90
RawTower_Prototype2::signal_type
91
RawTower_Prototype2::get_signal_samples
(
int
i
)
const
92
{
93
assert
(i >= 0);
94
assert
(i <
NSAMPLES
);
95
return
signal_samples
[
i
];
96
}
97
98
double
RawTower_Prototype2::get_energy_power_law_exp
(
int
verbosity
)
99
{
100
double
peak = NAN;
101
double
peak_sample = NAN;
102
double
pedstal = NAN;
103
104
vector<double> vec_signal_samples;
105
for
(
int
i
= 0;
i
<
NSAMPLES
;
i
++)
106
{
107
vec_signal_samples.push_back(
signal_samples
[
i
]);
108
}
109
110
PROTOTYPE2_FEM::SampleFit_PowerLawExp
(vec_signal_samples, peak, peak_sample,
111
pedstal, verbosity);
112
113
return
peak;
114
}
prototype
blob
master
offline
packages
Prototype2
RawTower_Prototype2.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:29
using
1.8.2 with
sPHENIX GitHub integration