void quantiles() { // demo for quantiles // Author; Rene Brun const Int_t nq = 100; const Int_t nshots = 10; Double_t xq[nq]; // position where to compute the quantiles in [0,1] Double_t yq[nq]; // array to contain the quantiles for (Int_t i=0;iFillRandom("gaus",50); h->GetQuantiles(nq,yq,xq); gr70->SetPoint(shot,shot+1,yq[70]); gr90->SetPoint(shot,shot+1,yq[90]); gr98->SetPoint(shot,shot+1,yq[98]); } //show the original histogram in the top pad TCanvas *c1 = new TCanvas("c1","demo quantiles",10,10,600,900); c1->SetFillColor(41); c1->Divide(1,3); c1->cd(1); h->SetFillColor(38); h->Draw(); // show the final quantiles in the middle pad c1->cd(2); gPad->SetFrameFillColor(33); gPad->SetGrid(); TGraph *gr1 = new TGraph(nq,xq,yq); gr1->SetTitle("final quantiles"); gr1->SetMarkerStyle(21); gr1->SetMarkerColor(kRed); gr1->SetMarkerSize(0.3); gr1->Draw("ap"); // FIT interval [0, 1]!!! Double_t par0, par1; TF1 *f1 = new TF1("f1", "pol1", 0, 1); gr1->Fit("f1", "RQ"); par0 = f1->GetParameter(0); par1 = f1->GetParameter(1); cout << "------ interval [0, 1] ------" << endl; cout << "par0_f1 = " << par0 << endl; cout << "par1_f1 = " << par1 << endl; // show the final quantiles in the middle pad c1->cd(3); gPad->SetFrameFillColor(33); gPad->SetGrid(); TGraph *gr2 = new TGraph(nq,xq,yq); gr2->SetTitle("final quantiles"); gr2->SetMarkerStyle(21); gr2->SetMarkerColor(kRed); gr2->SetMarkerSize(0.3); gr2->Draw("ap"); // FIT interval [0.3, 0.7]!!! TF1 *f2 = new TF1("f2", "pol1", 0.3, 0.7); gr2->Fit("f2", "RQ"); par0 = f2->GetParameter(0); par1 = f2->GetParameter(1); cout << "------ interval [0.3, 0.7] ------" << endl; cout << "par0_f2 = " << par0 << endl; cout << "par1_f2 = " << par1 << endl; }