Fill multiple histograms with different functions and automatic binning.
Illustrates merging with the power-of-two autobin algorithm
OBJ: TStatistic min Mean = -0.15551 +- 0.112 RMS = 0.35408 Count = 10 Min = -0.67325 Max = 0.51068
OBJ: TStatistic max Mean = 6.0602 +- 0.08333 RMS = 0.26351 Count = 10 Min = 5.682 Max = 6.5837
OBJ: TStatistic dif Mean = 6.2157 +- 0.1505 RMS = 0.47586 Count = 10 Min = 5.2872 Max = 6.7759
OBJ: TStatistic mean Mean = 2.9833 +- 0.01201 RMS = 0.037968 Count = 10 Min = 2.9293 Max = 3.0596
OBJ: TStatistic rms Mean = 0.99564 +- 0.009295 RMS = 0.029395 Count = 10 Min = 0.93466 Max = 1.0365
ent: 10010
TH1.Print Name = myh0, Entries= 10010, Total sum= 10004
TH1.Print Name = myhref, Entries= 10010, Total sum= 10000
TF1 *
gam =
new TF1(
"gam",
"1/(1+0.1*x*0.1*x)", -100., 100.);
TF1 *
gam1 =
new TF1(
"gam",
"1/(1+0.1*x*0.1*x)", -1., .25);
TF1 *
iga =
new TF1(
"inv gam",
"1.-1/(1+0.1*x*0.1*x)", -100., 100.);
TF1 *
iga1 =
new TF1(
"inv gam",
"1.-1/(1+0.1*x*0.1*x)", -.5, 1.);
kGaus = 1,
kLinear = 2,
};
{
auto href = std::make_unique<TH1D>(
"myhref",
"current", nbins, 0., -1.);
auto href2 = std::make_unique<TH1D>(
"myhref",
"Auto P2, sequential", nbins, 0., -1.);
for (
int j = 0;
j < 10; ++
j) {
const std::string
hname =
"myh" + std::to_string(
j);
auto hw =
new TH1D(
hname.c_str(),
"Auto P2, merged", nbins, 0., -1.);
switch (function) {
case EHist101_Func::kGaus:
xx =
rndm.Gaus(3, 1);
break;
case EHist101_Func::kLinear:
xx =
rndm.Rndm() * 100. - 50.;
break;
case EHist101_Func::kGamma:
xx =
gam->GetRandom();
break;
case EHist101_Func::kGamma1:
xx =
gam1->GetRandom();
break;
case EHist101_Func::kInvGamma:
xx =
iga->GetRandom();
break;
case EHist101_Func::kInvGamma1:
xx =
iga1->GetRandom();
break;
default:
xx =
rndm.Gaus(0, 1);
}
}
}
}
}
return;
if (
gROOT->GetListOfCanvases()->FindObject(
"c3"))
delete gROOT->GetListOfCanvases()->FindObject(
"c3");
std::cout <<
" ent: " <<
h0->GetEntries() <<
"\n";
}
int Int_t
Signed integer 4 bytes (int)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
long long Long64_t
Portable signed long integer 8 bytes.
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
R__EXTERN TStyle * gStyle
1-D histogram with a double per channel (see TH1 documentation)
@ kAutoBinPTwo
different than 1.
static void SetDefaultBufferSize(Int_t bufsize=1000)
Static function to set the default buffer size for automatic histograms.
Random number generator class based on M.
Statistical variable, defined by its mean and variance (RMS).
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
- Date
- November 2017
- Author
- Gerardo Ganis
Definition in file hist101_TH1_autobinning.C.