Fill multiple histograms with different functions and automatic binning.
Illustrates merging with the power-of-two autobin algorithm
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.);
void fillhistosauto2p(unsigned opt = 1, unsigned n = 1001)
{
auto href =
new TH1D(
"myhref",
"current", 50, 0., -1.);
href->SetBuffer(bsize);
auto href2 =
new TH1D(
"myhref",
"Auto P2, sequential", 50, 0., -1.);
href2->SetBuffer(bsize);
for (
UInt_t j = 0; j < nh; ++j) {
auto hw =
new TH1D(hname.
Data(),
"Auto P2, merged", nbins, 0., -1.);
hw->SetBuffer(bsize);
switch (opt) {
case 1: xx = rndm.
Gaus(3, 1);
break;
case 2: xx = rndm.
Rndm() * 100. - 50.;
break;
default: xx = rndm.
Gaus(0, 1);
}
if (buffering) {
if (xx > xma)
xma = xx;
if (xx < xmi)
xmi = xx;
xw.Fill(xx);
}
hw->Fill(xx);
href->Fill(xx);
href2->Fill(xx);
if (!hw->GetBuffer()) {
}
}
x.Fill(xmi);
y.Fill(xma);
d.Fill(xma - xmi);
a.Fill(xw.GetMean());
r.Fill(xw.GetRMS());
}
x.Print();
y.Print();
d.Print();
a.Print();
r.Print();
return;
if (
gROOT->GetListOfCanvases()->FindObject(
"c3"))
delete gROOT->GetListOfCanvases()->FindObject(
"c3");
href2->StatOverflows();
href->StatOverflows();
std::cout <<
" ent: " << h0->
GetEntries() <<
"\n";
href->Print();
delete hlist;
delete href;
delete href2;
delete h0;
}
- Author
- Gerardo Ganis
Definition in file fillhistosauto2p.C.