forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
macro5.C
31 lines (26 loc) · 1.05 KB
/
macro5.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Create, Fill and draw an Histogram which reproduces the
// counts of a scaler linked to a Geiger counter.
void macro5(){
auto cnt_r_h=new TH1F("count_rate",
"Count Rate;N_{Counts};# occurencies",
100, // Number of Bins
-0.5, // Lower X Boundary
15.5); // Upper X Boundary
auto mean_count=3.6f;
TRandom3 rndgen;
// simulate the measurements
for (int imeas=0;imeas<400;imeas++)
cnt_r_h->Fill(rndgen.Poisson(mean_count));
auto c= new TCanvas();
cnt_r_h->Draw();
auto c_norm= new TCanvas();
cnt_r_h->DrawNormalized();
// Print summary
cout << "Moments of Distribution:\n"
<< " - Mean = " << cnt_r_h->GetMean() << " +- "
<< cnt_r_h->GetMeanError() << "\n"
<< " - Std Dev = " << cnt_r_h->GetStdDev() << " +- "
<< cnt_r_h->GetStdDevError() << "\n"
<< " - Skewness = " << cnt_r_h->GetSkewness() << "\n"
<< " - Kurtosis = " << cnt_r_h->GetKurtosis() << "\n";
}