22TF1 *gam =
new TF1(
"gam",
"1/(1+0.1*x*0.1*x)", -100., 100.);
23TF1 *gam1 =
new TF1(
"gam",
"1/(1+0.1*x*0.1*x)", -1., .25);
24TF1 *iga =
new TF1(
"inv gam",
"1.-1/(1+0.1*x*0.1*x)", -100., 100.);
25TF1 *iga1 =
new TF1(
"inv gam",
"1.-1/(1+0.1*x*0.1*x)", -.5, 1.);
27enum class EHist101_Func {
36void hist101_TH1_autobinning(EHist101_Func function = EHist101_Func::kGaus,
unsigned nEntriesPerHisto = 1001)
38 const Int_t nbins = 50;
51 auto href = std::make_unique<TH1D>(
"myhref",
"current", nbins, 0., -1.);
53 auto href2 = std::make_unique<TH1D>(
"myhref",
"Auto P2, sequential", nbins, 0., -1.);
65 for (
int j = 0; j < 10; ++j) {
66 double xmi = 1e15, xma = -1e15;
68 const std::string hname =
"myh" + std::to_string(j);
71 auto hw =
new TH1D(hname.c_str(),
"Auto P2, merged", nbins, 0., -1.);
74 bool buffering =
true;
75 for (
UInt_t i = 0; i < nEntriesPerHisto; ++i) {
79 case EHist101_Func::kGaus: xx = rndm.Gaus(3, 1);
break;
80 case EHist101_Func::kLinear: xx = rndm.Rndm() * 100. - 50.;
break;
81 case EHist101_Func::kGamma: xx = gam->
GetRandom();
break;
82 case EHist101_Func::kGamma1: xx = gam1->
GetRandom();
break;
83 case EHist101_Func::kInvGamma: xx = iga->
GetRandom();
break;
84 case EHist101_Func::kInvGamma1: xx = iga1->
GetRandom();
break;
85 default: xx = rndm.Gaus(0, 1);
99 if (!hw->GetBuffer()) {
107 a.Fill(xw.GetMean());
120 auto h0 = std::unique_ptr<TH1D>(
static_cast<TH1D *
>(histoList.
First()));
121 histoList.
Remove(h0.get());
122 if (!h0->Merge(&histoList))
126 gStyle->SetOptStat(111110);
128 if (
gROOT->GetListOfCanvases()->FindObject(
"c3"))
129 delete gROOT->GetListOfCanvases()->FindObject(
"c3");
135 h0->DrawClone(
"HIST");
138 href2->StatOverflows();
142 href->StatOverflows();
145 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.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Double_t GetRandom(TRandom *rng=nullptr, Option_t *opt=nullptr)
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.
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Random number generator class based on M.
Statistical variable, defined by its mean and variance (RMS).