#include #include Double_t error_in_median(TH1F* h1) { const Int_t nq = 100; 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;iGetEntries(); //Stat_t nn=h1->GetEntries(); if (nn>0) { h1->GetQuantiles(nq,yq,xq); Float_t med=yq[nq/2-1]; TH1F *herr = new TH1F("herr","herr",100,med-1,med+1); Int_t nb=h1->GetNbinsX(); Float_t xmin=h1->GetBinLowEdge(1); Float_t xmax=h1->GetBinLowEdge(nb+1); for(Int_t j=1; j<=100; j++) { TH1F *htes = new TH1F("htes","htes",nb,xmin,xmax); htes->FillRandom(h1,nn); htes->GetQuantiles(nq,yq,xq); herr->Fill(yq[nq/2-1]); htes->Delete(); } err=herr->GetRMS(); herr->Delete(); } else err=0; return err; }