Logo ROOT  
Reference Guide
RooAbsBinning.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/**
18\file RooAbsBinning.cxx
19\class RooAbsBinning
20\ingroup Roofitcore
21
22RooAbsBinning is the abstract base class for RooRealVar binning definitions.
23This class defines the interface to retrieve bin boundaries, ranges etc.
24**/
25
26#include "RooAbsBinning.h"
27
28#include "RooAbsReal.h"
29#include "TBuffer.h"
30#include "TClass.h"
31
32#include "Riostream.h"
33
34using namespace std;
35
37
38
39
40////////////////////////////////////////////////////////////////////////////////
41/// Print binning name
42
43void RooAbsBinning::printName(ostream& os) const
44{
45 os << GetName() ;
46}
47
48
49
50////////////////////////////////////////////////////////////////////////////////
51/// Print binning title
52
53void RooAbsBinning::printTitle(ostream& os) const
54{
55 os << GetTitle() ;
56}
57
58
59
60////////////////////////////////////////////////////////////////////////////////
61/// Print binning class name
62
63void RooAbsBinning::printClassName(ostream& os) const
64{
65 os << ClassName() ;
66}
67
68
69
70////////////////////////////////////////////////////////////////////////////////
71/// Print binning arguments (the RooAbsReal objects represening
72/// the variable bin boundaries for parameterized binning implementations
73
74void RooAbsBinning::printArgs(ostream& os) const
75{
76 os << "[ " ;
77 if (lowBoundFunc()) {
78 os << "lowerBound=" << lowBoundFunc()->GetName() ;
79 }
80 if (highBoundFunc()) {
81 if (lowBoundFunc()) {
82 os << " " ;
83 }
84 os << "upperBound=" << highBoundFunc()->GetName() ;
85 }
86 os << " ]" ;
87}
88
89
90
91////////////////////////////////////////////////////////////////////////////////
92/// Print binning value, i.e the bin boundary positions
93
94void RooAbsBinning::printValue(ostream &os) const
95{
96 Int_t n = numBins() ;
97 os << "B(" ;
98
99 Int_t i ;
100 for (i=0 ; i<n ; i++) {
101 if (i>0) {
102 os << " : " ;
103 }
104 os << binLow(i) ;
105 }
106 os << " : " << binHigh(n-1) ;
107 os << ")" ;
108
109}
110
111
112
113////////////////////////////////////////////////////////////////////////////////
114/// Custom streamer implementing schema evolution between V1 and V2 persistent binnings
115
117{
118 UInt_t R__s, R__c;
119 if (R__b.IsReading()) {
120 Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
121 if (R__v==1) {
122 TObject::Streamer(R__b);
123 } else {
124 TNamed::Streamer(R__b);
125 }
127 R__b.CheckByteCount(R__s, R__c, RooAbsBinning::IsA());
128 } else {
129 R__c = R__b.WriteVersion(RooAbsBinning::IsA(), true);
130 TNamed::Streamer(R__b);
132 R__b.SetByteCount(R__c, true);
133 }
134}
135
short Version_t
Definition: RtypesCore.h:65
#define ClassImp(name)
Definition: Rtypes.h:375
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
Definition: RooAbsBinning.h:25
void printTitle(std::ostream &os) const override
Print binning title.
Int_t numBins() const
Return number of bins.
Definition: RooAbsBinning.h:36
void Streamer(TBuffer &) override
Custom streamer implementing schema evolution between V1 and V2 persistent binnings.
virtual double binLow(Int_t bin) const =0
virtual RooAbsReal * highBoundFunc() const
Return pointer to RooAbsReal parameterized upper bound, if any.
virtual double binHigh(Int_t bin) const =0
void printArgs(std::ostream &os) const override
Print binning arguments (the RooAbsReal objects represening the variable bin boundaries for parameter...
virtual RooAbsReal * lowBoundFunc() const
Return pointer to RooAbsReal parameterized lower bound, if any.
void printClassName(std::ostream &os) const override
Print binning class name.
void printName(std::ostream &os) const override
Print binning name.
TClass * IsA() const override
void printValue(std::ostream &os) const override
Print binning value, i.e the bin boundary positions.
virtual void Streamer(TBuffer &)
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Bool_t IsReading() const
Definition: TBuffer.h:86
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
void Streamer(TBuffer &) override
Stream an object of class TObject.
const char * GetTitle() const override
Returns title of object.
Definition: TNamed.h:48
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
Definition: TObject.cxx:806
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:130
const Int_t n
Definition: legend1.C:16