70 TGraphAsymmErrors(), _nominalBinWidth(nominalBinWidth), _nSigma(nSigma), _rawEntries(-1)
89 TGraphAsymmErrors(), _nominalBinWidth(nominalBinWidth), _nSigma(nSigma), _rawEntries(-1)
105 for(
Int_t bin= 1; bin <= nbin; bin++) {
137 TGraphAsymmErrors(), _nominalBinWidth(nominalBinWidth), _nSigma(nSigma), _rawEntries(-1)
159 coutE(
InputArguments) <<
"RooHist::RooHist: histograms have different number of bins" << endl;
162 for(
Int_t bin= 1; bin <= nbin; bin++) {
165 coutW(
InputArguments) <<
"RooHist::RooHist: histograms have different centers for bin " << bin << endl;
222 coutE(
InputArguments) <<
"RooHist::RooHist input histograms have incompatible binning, combined histogram will remain empty" << endl ;
230 if (wgt1!=1.0 || wgt2 != 1.0) {
231 coutW(
InputArguments) <<
"RooHist::RooHist: WARNING: Poisson errors of weighted sum of two histograms is not well defined! " << endl
232 <<
" Summed histogram bins will rounded to nearest integer for Poisson confidence interval calculation" << endl ;
237 for(i=0 ; i<
n ; i++) {
239 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
245 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
250 addBin(x1,
roundBin(wgt1*y1+wgt2*y2),2*dx1/xErrorFrac,xErrorFrac) ;
258 for(i=0 ; i<
n ; i++) {
260 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
268 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
273 Double_t dy =
sqrt(wgt1*wgt1*dy1*dy1+wgt2*wgt2*dy2*dy2) ;
274 addBinWithError(x1,wgt1*y1+wgt2*y2,dy,dy,2*dx1/xErrorFrac,xErrorFrac) ;
308 for (
int i=0 ; i<
GetN() ; i++) {
311 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
317 if (x>=xlo && x<=xhi) {
323 coutW(
Plotting) <<
"RooHist::getFitRangeNEvt() WARNING: Number of normalization events associated to histogram is not equal to number of events in histogram" << endl
324 <<
" due cut made in RooAbsData::plotOn() call. Automatic normalization over sub-range of plot variable assumes" << endl
325 <<
" that the effect of that cut is uniform across the plot, which may be an incorrect assumption. To be sure of" << endl
326 <<
" correct normalization explicit pass normalization information to RooAbsPdf::plotOn() call using Normalization()" << endl ;
352 coutW(
Plotting) <<
fName <<
"::roundBin: rounding negative bin contents to zero: " << y << endl;
357 coutW(
Plotting) <<
fName <<
"::roundBin: rounding non-integer bin contents: " << y << endl;
372 coutW(
Plotting) <<
"RooHist::addBin(" <<
GetName() <<
") WARNING: negative entry set to zero when Poisson error bars are requested" << endl ;
387 Double_t ym1(0),yp1(0),ym2(0),yp2(0) ;
392 coutE(
Plotting) <<
"RooHist::addBin: unable to add bin with " << n <<
" events" << endl;
394 ym = ym1 + (n-n1)*(ym2-ym1) ;
395 yp = yp1 + (n-n1)*(yp2-yp1) ;
397 <<
") WARNING: non-integer bin entry " << n <<
" with Poisson errors, interpolating between Poisson errors of adjacent integer" << endl ;
401 coutE(
Plotting) <<
"RooHist::addBin: unable to add bin with " << n <<
" events" << endl;
406 SetPoint(index,binCenter,n*scale*scaleFactor);
407 SetPointError(index,dx*xErrorFrac,dx*xErrorFrac,scale*(n-ym)*scaleFactor,scale*(yp-n)*scaleFactor);
423 if(binWidth > 0 && correctForBinWidth) {
430 SetPoint(index,binCenter,n*scale*scaleFactor);
431 SetPointError(index,dx*xErrorFrac,dx*xErrorFrac,elow*scale*scaleFactor,ehigh*scale*scaleFactor);
450 SetPoint(index,binCenter,n*scaleFactor);
451 SetPointError(index,exlow,exhigh,eylow*scaleFactor,eyhigh*scaleFactor);
473 coutE(
Plotting) <<
"RooHist::addAsymmetryBin: unable to calculate binomial error for bin with " << n1 <<
"," << n2 <<
" events" << endl;
478 SetPoint(index,binCenter,a*scaleFactor);
479 SetPointError(index,dx*xErrorFrac,dx*xErrorFrac,(a-ym)*scaleFactor,(yp-a)*scaleFactor);
504 SetPoint(index,binCenter,a*scaleFactor);
505 SetPointError(index,dx*xErrorFrac,dx*xErrorFrac,(a-ym)*scaleFactor,(yp-a)*scaleFactor);
527 coutE(
Plotting) <<
"RooHist::addEfficiencyBin: unable to calculate binomial error for bin with " << n1 <<
"," << n2 <<
" events" << endl;
531 SetPoint(index,binCenter,a*scaleFactor);
532 SetPointError(index,dx*xErrorFrac,dx*xErrorFrac,(a-ym)*scaleFactor,(yp-a)*scaleFactor);
559 SetPoint(index,binCenter,a*scaleFactor);
560 SetPointError(index,dx*xErrorFrac,dx*xErrorFrac,(a-ym)*scaleFactor,(yp-a)*scaleFactor);
588 for (i=0 ; i<
GetN() ; i++) {
591 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
599 if (
fabs(x1-x2)>1e-10) {
618 TH1F h_self(
"h_self",
"h_self",
GetN(),0,1) ;
619 TH1F h_other(
"h_other",
"h_other",
GetN(),0,1) ;
623 h_self.SetBinContent(i+1,
GetY()[i]) ;
624 h_other.SetBinContent(i+1,other.
GetY()[i]) ;
627 Double_t M = h_self.KolmogorovTest(&h_other,
"M") ;
629 Double_t kprob = h_self.KolmogorovTest(&h_other) ;
630 cout <<
"RooHist::isIdentical() tolerance exceeded M=" << M <<
" (tol=" << tol <<
"), corresponding prob = " << kprob << endl ;
649 os << indent <<
"--- RooHist ---" << endl;
651 os << indent <<
" Contains " << n <<
" bins" << endl;
653 os << indent <<
" Errors calculated at" <<
_nSigma <<
"-sigma CL" << endl;
654 os << indent <<
" Bin Contents:" << endl;
655 for(
Int_t i= 0; i <
n; i++) {
656 os << indent << setw(3) << i <<
") x= " <<
fX[i];
660 os <<
" , y = " <<
fY[i] <<
" +" <<
fEYhigh[i] <<
" -" <<
fEYlow[i] << endl;
717 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
728 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
745 yy = point - curve.
average(x-exl,x+exh) ;
755 coutW(
Plotting) <<
"RooHist::makeResisHist(" <<
GetName() <<
") WARNING: point " << i <<
" has zero error, setting residual to zero" << endl ;
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Print info about this histogram to the specified output stream.
Double_t GetErrorYhigh(Int_t i) const
Get high error on Y.
virtual const char * GetTitle() const
Returns title of object.
A RooCurve is a one-dimensional graphical representation of a real-valued function.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Double_t getFitRangeBinW() const
Return (average) bin width of this RooHist.
virtual void printName(std::ostream &os) const
Print name of RooHist.
virtual void SetName(const char *name)
Change (i.e.
Double_t _nominalBinWidth
Bool_t isIdentical(const RooHist &other, Double_t tol=1e-6) const
Return kTRUE if contents of this RooHIst is identical within given relative tolerance to that of 'oth...
virtual void SetTitle(const char *title="")
Set graph title.
virtual Int_t GetNbinsX() const
Double_t GetErrorXhigh(Int_t i) const
Get high error on X.
Bool_t hasIdenticalBinning(const RooHist &other) const
Return kTRUE if binning of this RooHist is identical to that of 'other'.
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
Double_t interpolate(Double_t x, Double_t tolerance=1e-10) const
Return linearly interpolated value of curve at xvalue.
virtual Double_t GetBinWidth(Int_t bin) const
return bin width for 1D historam Better to use h1.GetXaxis().GetBinWidth(bin)
void addAsymmetryBinWithError(Axis_t binCenter, Double_t n1, Double_t n2, Double_t en1, Double_t en2, Double_t binWidth=0, Double_t xErrorFrac=1.0, Double_t scaleFactor=1.0)
Add a bin to this histogram with the value (n1-n2)/(n1+n2) using an error bar calculated with Binomia...
TGraph with assymetric error bars.
Int_t roundBin(Double_t y)
Return the nearest positive integer to the input value and print a warning if an adjustment is requir...
static const double x2[5]
A RooHist is a graphical representation of binned data based on the TGraphAsymmErrors class...
void addEfficiencyBinWithError(Axis_t binCenter, Double_t n1, Double_t n2, Double_t en1, Double_t en2, Double_t binWidth=0, Double_t xErrorFrac=1.0, Double_t scaleFactor=1.0)
Add a bin to this histogram with the value n1/(n1+n2) using an error bar calculated with Binomial sta...
virtual void printClassName(std::ostream &os) const
Print class name of RooHist.
Double_t GetErrorYlow(Int_t i) const
Get low error on Y.
double pow(double, double)
virtual void printTitle(std::ostream &os) const
Print title of RooHist.
void addAsymmetryBin(Axis_t binCenter, Int_t n1, Int_t n2, Double_t binWidth=0, Double_t xErrorFrac=1.0, Double_t scaleFactor=1.0)
Add a bin to this histogram with the value (n1-n2)/(n1+n2) using an error bar calculated with Binomia...
if on multiple lines(like in C++).**The" * configuration fragment. * * The "import myobject continue
Parses the configuration file.
void initialize()
Perform common initialization for all constructors.
RooHist()
Default constructor.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Print detailed information.
Double_t getNominalBinWidth() const
virtual Double_t GetBinCenter(Int_t bin) const
return bin center for 1D historam Better to use h1.GetXaxis().GetBinCenter(bin)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Class to manage histogram axis.
Double_t getFitRangeNEvt() const
Return the number of events of the dataset associated with this RooHist.
char * Form(const char *fmt,...)
void updateYAxisLimits(Double_t y)
static const RooHistError & instance()
Return a reference to a singleton object that is created the first time this method is called...
void addBin(Axis_t binCenter, Double_t n, Double_t binWidth=0, Double_t xErrorFrac=1.0, Double_t scaleFactor=1.0)
Add a bin to this histogram with the specified integer bin contents and using an error bar calculated...
virtual const char * GetName() const
Returns name of object.
virtual void SetMarkerStyle(Style_t mstyle=1)
static void indent(ostringstream &buf, int indent_level)
const char * getYAxisLabel() const
static const double x1[5]
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Get x and y values for point number i.
Double_t average(Double_t lo, Double_t hi) const
Return average curve value in [xFirst,xLast] by integrating curve between points and dividing by xLas...
virtual ~RooHist()
Destructor.
void addBinWithError(Axis_t binCenter, Double_t n, Double_t elow, Double_t ehigh, Double_t binWidth=0, Double_t xErrorFrac=1.0, Bool_t correctForBinWidth=kTRUE, Double_t scaleFactor=1.0)
Add a bin to this histogram with the specified bin contents and error.
TAxis * GetYaxis() const
Get y axis of the graph.
Double_t GetErrorX(Int_t bin) const
This function is called by GraphFitChisquare.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
void addBinWithXYError(Axis_t binCenter, Double_t n, Double_t exlow, Double_t exhigh, Double_t eylow, Double_t eyhigh, Double_t scaleFactor=1.0)
Add a bin to this histogram with the specified bin contents and error.
void setYAxisLabel(const char *label)
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
void addEfficiencyBin(Axis_t binCenter, Int_t n1, Int_t n2, Double_t binWidth=0, Double_t xErrorFrac=1.0, Double_t scaleFactor=1.0)
Add a bin to this histogram with the value n1/(n1+n2) using an error bar calculated with Binomial sta...
double norm(double *x, double *p)
Double_t GetErrorY(Int_t bin) const
This function is called by GraphFitChisquare.
RooHist * makeResidHist(const RooCurve &curve, bool normalize=false, bool useAverage=false) const
Create and return RooHist containing residuals w.r.t to given curve.
virtual void SetPointError(Double_t exl, Double_t exh, Double_t eyl, Double_t eyh)
Set ex and ey values for point pointed by the mouse.
Double_t GetErrorXlow(Int_t i) const
Get low error on X.