Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Keerthi Nakkalil
gain_measurement
Commits
99eced95
Commit
99eced95
authored
Nov 16, 2020
by
Keerthi Nakkalil
Browse files
codes for gain measurement. The fitting doesnt work properly.
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
gain_measurement.cpp
0 → 100644
View file @
99eced95
void
gain_measurement
()
{
ifstream
file_255
;
file_255
.
open
(
"255_255.dat"
);
cout
<<
"The data file 255_255 is opened..."
<<
std
::
endl
;
TCanvas
*
c1
=
new
TCanvas
();
TTree
*
tree
=
new
TTree
(
"tree"
,
"tree"
);
TH1D
*
hist_255
=
new
TH1D
(
"hist_255"
,
" Threshold gain measurement"
,
100
,
900
,
1300
);
tree
->
ReadFile
(
"255_255.dat"
,
"x/D:y/D"
);
tree
->
SetEstimate
(
-
1
);
//Set the #entries to estimate variable limits. n=-1, estimate is set to current maximum of the tree.
tree
->
Draw
(
"x>>hist_255"
,
"y"
,
"HIST"
);
hist_255
->
GetXaxis
()
->
SetTitle
(
"Threshold"
);
hist_255
->
GetYaxis
()
->
SetTitle
(
"# signals above the threshold"
);
//fitting the histogram with modified error function
TF1
*
modified_erf
=
new
TF1
(
"modified_erf"
,
"[0]*(1-TMath::Erf((x-[1])/(sqrt(2)*[2])))"
,
1000
,
1250
);
//Not sure how to give the fit range
modified_erf
->
SetParameter
(
0
,
100
);
modified_erf
->
SetParameter
(
1
,
1115
);
modified_erf
->
SetParameter
(
2
,
0
);
//Not sure how to give the initial value
modified_erf
->
SetParNames
(
"constant"
,
"mean"
,
"noise"
);
hist_255
->
Fit
(
"modified_erf"
);
hist_255
->
Draw
();
//file_255.close();
cout
<<
"Code succesfull..."
<<
std
::
endl
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment