ROOT  6.06/09
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 //
19 // BEGIN_HTML
20 // RooAbsBinning is the abstract base class for RooRealVar binning definitions
21 // This class defines the interface to retrieve bin boundaries, ranges etc.
22 // END_HTML
23 //
24 //
25 
26 #include "RooFit.h"
27 
28 #include "RooAbsBinning.h"
29 #include "RooAbsReal.h"
30 #include "TClass.h"
31 
32 #include "Riostream.h"
33 
34 using namespace std;
35 
37 ;
38 
39 
40 ////////////////////////////////////////////////////////////////////////////////
41 /// Constructor
42 
43 RooAbsBinning::RooAbsBinning(const char* name) : TNamed(name,name)
44 {
45 }
46 
47 
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 /// Destructor
51 
53 {
54 }
55 
56 
57 
58 ////////////////////////////////////////////////////////////////////////////////
59 /// Print binning name
60 
61 void RooAbsBinning::printName(ostream& os) const
62 {
63  os << GetName() ;
64 }
65 
66 
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 /// Print binning title
70 
71 void RooAbsBinning::printTitle(ostream& os) const
72 {
73  os << GetTitle() ;
74 }
75 
76 
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// Print binning class name
80 
81 void RooAbsBinning::printClassName(ostream& os) const
82 {
83  os << IsA()->GetName() ;
84 }
85 
86 
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 /// Print binning arguments (the RooAbsReal objects represening
90 /// the variable bin boundaries for parameterized binning implementations
91 
92 void RooAbsBinning::printArgs(ostream& os) const
93 {
94  os << "[ " ;
95  if (lowBoundFunc()) {
96  os << "lowerBound=" << lowBoundFunc()->GetName() ;
97  }
98  if (highBoundFunc()) {
99  if (lowBoundFunc()) {
100  os << " " ;
101  }
102  os << "upperBound=" << highBoundFunc()->GetName() ;
103  }
104  os << " ]" ;
105 }
106 
107 
108 
109 ////////////////////////////////////////////////////////////////////////////////
110 /// Print binning value, i.e the bin boundary positions
111 
112 void RooAbsBinning::printValue(ostream &os) const
113 {
114  Int_t n = numBins() ;
115  os << "B(" ;
116 
117  Int_t i ;
118  for (i=0 ; i<n ; i++) {
119  if (i>0) {
120  os << " : " ;
121  }
122  os << binLow(i) ;
123  }
124  os << " : " << binHigh(n-1) ;
125  os << ")" ;
126 
127 }
128 
129 
130 
131 ////////////////////////////////////////////////////////////////////////////////
132 /// Custom streamer implementing schema evolution between V1 and V2 persistent binnings
133 
134 void RooAbsBinning::Streamer(TBuffer &R__b)
135 {
136  UInt_t R__s, R__c;
137  if (R__b.IsReading()) {
138  Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
139  if (R__v==1) {
140  TObject::Streamer(R__b);
141  } else {
142  TNamed::Streamer(R__b);
143  }
144  RooPrintable::Streamer(R__b);
145  R__b.CheckByteCount(R__s, R__c, RooAbsBinning::IsA());
146  } else {
147  R__c = R__b.WriteVersion(RooAbsBinning::IsA(), kTRUE);
148  TNamed::Streamer(R__b);
149  RooPrintable::Streamer(R__b);
150  R__b.SetByteCount(R__c, kTRUE);
151  }
152 }
153 
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
ClassImp(RooAbsBinning)
virtual Double_t binLow(Int_t bin) const =0
virtual RooAbsReal * lowBoundFunc() const
Definition: RooAbsBinning.h:83
Bool_t IsReading() const
Definition: TBuffer.h:81
short Version_t
Definition: RtypesCore.h:61
virtual RooAbsReal * highBoundFunc() const
Definition: RooAbsBinning.h:87
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
int Int_t
Definition: RtypesCore.h:41
STL namespace.
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual void printName(std::ostream &os) const
Print binning name.
virtual ~RooAbsBinning()
Destructor.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
Int_t numBins() const
Definition: RooAbsBinning.h:37
RooAbsBinning(const char *name=0)
Constructor.
virtual void printArgs(std::ostream &os) const
Print binning arguments (the RooAbsReal objects represening the variable bin boundaries for parameter...
virtual void printTitle(std::ostream &os) const
Print binning title.
TClass * IsA() const
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual void printClassName(std::ostream &os) const
Print binning class name.
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual Double_t binHigh(Int_t bin) const =0
const Bool_t kTRUE
Definition: Rtypes.h:91
const Int_t n
Definition: legend1.C:16
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual void printValue(std::ostream &os) const
Print binning value, i.e the bin boundary positions.