Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
macro5.C
Go to the documentation of this file.
1// Create, Fill and draw an Histogram which reproduces the
2// counts of a scaler linked to a Geiger counter.
3
4void macro5(){
5 auto cnt_r_h=new TH1F("count_rate",
6 "Count Rate;N_{Counts};# occurencies",
7 100, // Number of Bins
8 -0.5, // Lower X Boundary
9 15.5); // Upper X Boundary
10
11 auto mean_count=3.6f;
12 TRandom3 rndgen;
13 // simulate the measurements
14 for (int imeas=0;imeas<400;imeas++)
15 cnt_r_h->Fill(rndgen.Poisson(mean_count));
16
17 auto c= new TCanvas();
18 cnt_r_h->Draw();
19
20 auto c_norm= new TCanvas();
21 cnt_r_h->DrawNormalized();
22
23 // Print summary
24 cout << "Moments of Distribution:\n"
25 << " - Mean = " << cnt_r_h->GetMean() << " +- "
26 << cnt_r_h->GetMeanError() << "\n"
27 << " - Std Dev = " << cnt_r_h->GetStdDev() << " +- "
28 << cnt_r_h->GetStdDevError() << "\n"
29 << " - Skewness = " << cnt_r_h->GetSkewness() << "\n"
30 << " - Kurtosis = " << cnt_r_h->GetKurtosis() << "\n";
31}
#define c(i)
Definition RSha256.hxx:101
The Canvas class.
Definition TCanvas.h:23
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:878
Random number generator class based on M.
Definition TRandom3.h:27
virtual ULong64_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
Definition TRandom.cxx:403
void macro5()
Definition macro5.C:4