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