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
FillCalHist.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file FillCalHist.C
1
2
// Fillcalhist.C //
4
5
// This makes a histogram that can show the raw hits.
6
7
#include "
FillCalHist.h
"
8
#include "TH1D.h"
9
#include "TH2D.h"
10
#include "TH3D.h"
11
#include "TF1.h"
12
#include "
AZigzag.h
"
13
14
#include "
groot.h
"
15
16
#include <iostream>
17
#include <cmath>
18
19
TH2D*
CalHist
=0;
20
TH1D*
CalDist
[
Nsrs
];
21
22
TH1D*
CalHistQ
=0;
23
TH1D*
CalHistT
=0;
24
TH1D*
CalHistX
=0;
25
TH1D*
CalHistY
=0;
26
27
TH1D*
CalibratedMeans
=0;
28
TH1D*
CalibratedSigmas
=0;
29
30
using namespace
std;
31
32
void
FillCalHist
()
33
{
34
35
int
nTime =
AZigzag::Raw
[0].size();
36
double
left
= -0.5;
37
double
right = (
double
)nTime - 0.5;
38
39
if
(!
CalHist
)
40
{
41
CalHist
=
new
TH2D(
"CalHist"
,
"CalHist"
,
Nsrs
, -0.5, (
float
)
Nsrs
-0.5, nTime, left, right);
42
43
CalHistQ
=
new
TH1D(
"CalHistQ"
,
"CalHistQ"
,
Nsrs
, -0.5, (
float
)
Nsrs
-0.5);
44
CalHistT
=
new
TH1D(
"CalHistT"
,
"CalHistT"
,
Nsrs
, -0.5, (
float
)
Nsrs
-0.5);
45
46
CalHistX
=
new
TH1D(
"CalHistX"
,
"CalHistX"
,
Nsrs
, -0.5, (
float
)
Nsrs
-0.5);
47
CalHistY
=
new
TH1D(
"CalHistY"
,
"CalHistY"
,
Nsrs
, -0.5, (
float
)
Nsrs
-0.5);
48
49
char
name
[500];
50
for
(
int
i
=0;
i
<
Nsrs
;
i
++)
51
{
52
sprintf(name,
"CalDist%04d"
,
i
);
53
CalDist
[
i
] =
new
TH1D(name, name, 101, -50.5, 50.5);
54
55
}
56
57
}
58
59
CalHist
->Reset();
60
CalHistQ
->Reset();
61
CalHistT
->Reset();
62
CalHistX
->Reset();
63
CalHistY
->Reset();
64
65
groot
* Tree=
groot::instance
();
66
for
(
int
i
=0;
i
<
Nsrs
;
i
++)
67
{
68
for
(
int
j
=0;
j
<
AZigzag::Cal
[
i
].size();
j
++)
69
{
70
CalHist
->SetBinContent(
i
+1,
j
+1,
AZigzag::Cal
[
i
][
j
]);
71
CalDist
[
i
]->Fill(
AZigzag::Cal
[
i
][j]);
72
}
73
if
(Tree->
theZigzags
[
i
])
74
{
75
int
ID = Tree->
theZigzags
[
i
]->MyID();
76
CalHistQ
->SetBinContent(
i
+1,Tree->
theZigzags
[
i
]->Q());
77
CalHistT
->SetBinContent(
i
+1,Tree->
theZigzags
[
i
]->T());
78
//CalHistX->SetBinContent(i+1,Tree->theZigzags[i]->XCenter());
79
//CalHistY->SetBinContent(i+1,Tree->theZigzags[i]->YCenter());
80
}
81
}
82
}
83
84
85
void
FitCalHist
()
86
{
87
if
(!
CalibratedMeans
)
88
{
89
CalibratedMeans
=
new
TH1D(
"CalibratedMeans"
,
"CalibratedMeans"
,
Nsrs
, -0.5,
Nsrs
-0.5);
90
CalibratedSigmas
=
new
TH1D(
"CalibratedSigmas"
,
"CalibratedSigmas"
,
Nsrs
, -0.5,
Nsrs
-0.5);
91
}
92
93
CalibratedMeans
->Reset();
94
CalibratedSigmas
->Reset();
95
96
for
(
int
i
=0;
i
<
Nsrs
;
i
++)
97
{
98
CalDist
[
i
]->Fit(
"gaus"
,
"Q"
);
99
CalibratedMeans
->SetBinContent(
i
,
CalDist
[
i
]->GetFunction(
"gaus"
)->
GetParameter
(1));
100
CalibratedSigmas
->SetBinContent(
i
,
CalDist
[
i
]->GetFunction(
"gaus"
)->
GetParameter
(2));
101
}
102
103
}
analysis
blob
master
TPC
groot
FillCalHist.C
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:58
using
1.8.2 with
sPHENIX GitHub integration