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_Temperature.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RawTower_Temperature.cc
1
#include "
RawTower_Temperature.h
"
2
3
#include <calobase/RawTowerDefs.h>
4
5
#include <iomanip>
6
#include <iostream>
7
8
using namespace
std;
9
10
RawTower_Temperature::RawTower_Temperature
()
11
:
towerid
(~0)
// initialize all bits on
12
{
13
}
14
15
RawTower_Temperature::RawTower_Temperature
(
RawTowerDefs::keytype
id
)
16
:
towerid
(id)
17
{
18
}
19
20
RawTower_Temperature::RawTower_Temperature
(
const
unsigned
int
icol,
21
const
unsigned
int
irow)
22
{
23
towerid
=
RawTowerDefs::encode_towerid
(
RawTowerDefs::NONE
, icol, irow);
24
}
25
26
void
RawTower_Temperature::Reset
()
27
{
28
eventnumbers
.clear();
29
times
.clear();
30
temperatures
.clear();
31
}
32
33
float
RawTower_Temperature::get_temperature_from_time
(
const
time_t
t
)
const
34
{
35
if
(!
isValid
())
36
return
-1;
37
38
if
(t <
get_time_from_entry
(0))
// if we ask for a time before the start time,
39
// we return the first reading
40
{
41
return
get_temperature_from_entry
(0);
42
}
43
44
int
lowest_entry = 0;
45
int
above_entry = 0;
46
47
for
(
int
i
= 0;
i
<
get_nr_entries
();
i
++)
48
{
49
if
(
get_time_from_entry
(
i
) <
t
)
50
{
51
lowest_entry =
i
;
52
}
53
else
54
{
55
if
(!above_entry)
56
above_entry =
i
;
57
}
58
}
59
60
if
(!above_entry)
// we didn't find a entry later than this
61
{
62
return
get_temperature_from_entry
(lowest_entry);
63
}
64
65
double
m
=
66
(
get_temperature_from_entry
(above_entry) -
67
get_temperature_from_entry
(lowest_entry)) /
68
(
get_time_from_entry
(above_entry) -
get_time_from_entry
(lowest_entry));
69
70
return
get_temperature_from_entry
(lowest_entry) +
71
m * (t -
get_time_from_entry
(lowest_entry));
72
}
73
void
RawTower_Temperature::identify
(std::ostream &
os
)
const
74
{
75
os <<
"RawTower_Temperature col="
<<
get_column
() <<
" row="
<<
get_row
()
76
<<
": "
<<
temperatures
.size() <<
" entries"
<< std::endl;
77
}
78
79
void
RawTower_Temperature::print
(std::ostream &
os
)
const
80
{
81
identify
(os);
82
83
cout <<
"entry event time T"
<< endl;
84
for
(
int
i
= 0;
i
<
get_nr_entries
();
i
++)
85
{
86
os << setw(4) <<
i
<<
" "
<< setw(7) <<
get_eventnumber_from_entry
(
i
)
87
<<
" "
<< setw(7) <<
get_time_from_entry
(
i
) <<
" "
<< setw(5)
88
<<
get_temperature_from_entry
(
i
) << endl;
89
}
90
}
analysis
blob
master
EMCTemplateFitting
src
RawTower_Temperature.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:51
using
1.8.2 with
sPHENIX GitHub integration