00001 /***************************************************************************** 00002 * Project: RooFit * 00003 * Package: RooFitCore * 00004 * @(#)root/roofitcore:$Id: RooAbsBinning.cxx 24247 2008-06-12 14:54:32Z wouter $ 00005 * Authors: * 00006 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu * 00007 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu * 00008 * * 00009 * Copyright (c) 2000-2005, Regents of the University of California * 00010 * and Stanford University. All rights reserved. * 00011 * * 00012 * Redistribution and use in source and binary forms, * 00013 * with or without modification, are permitted according to the terms * 00014 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) * 00015 *****************************************************************************/ 00016 00017 ////////////////////////////////////////////////////////////////////////////// 00018 // 00019 // BEGIN_HTML 00020 // RooAbsBinning is the abstract base class for RooRealVar binning definitions 00021 // This class defines the interface to retrieve bin boundaries, ranges etc. 00022 // END_HTML 00023 // 00024 // 00025 00026 #include "RooFit.h" 00027 00028 #include "RooAbsBinning.h" 00029 #include "RooAbsReal.h" 00030 #include "TClass.h" 00031 00032 #include "Riostream.h" 00033 00034 ClassImp(RooAbsBinning) 00035 ; 00036 00037 00038 //_____________________________________________________________________________ 00039 RooAbsBinning::RooAbsBinning(const char* name) : TNamed(name,name) 00040 { 00041 // Constructor 00042 } 00043 00044 00045 00046 //_____________________________________________________________________________ 00047 RooAbsBinning::~RooAbsBinning() 00048 { 00049 // Destructor 00050 } 00051 00052 00053 00054 //_____________________________________________________________________________ 00055 void RooAbsBinning::printName(ostream& os) const 00056 { 00057 // Print binning name 00058 00059 os << GetName() ; 00060 } 00061 00062 00063 00064 //_____________________________________________________________________________ 00065 void RooAbsBinning::printTitle(ostream& os) const 00066 { 00067 // Print binning title 00068 00069 os << GetTitle() ; 00070 } 00071 00072 00073 00074 //_____________________________________________________________________________ 00075 void RooAbsBinning::printClassName(ostream& os) const 00076 { 00077 // Print binning class name 00078 00079 os << IsA()->GetName() ; 00080 } 00081 00082 00083 00084 //_____________________________________________________________________________ 00085 void RooAbsBinning::printArgs(ostream& os) const 00086 { 00087 // Print binning arguments (the RooAbsReal objects represening 00088 // the variable bin boundaries for parameterized binning implementations 00089 00090 os << "[ " ; 00091 if (lowBoundFunc()) { 00092 os << "lowerBound=" << lowBoundFunc()->GetName() ; 00093 } 00094 if (highBoundFunc()) { 00095 if (lowBoundFunc()) { 00096 os << " " ; 00097 } 00098 os << "upperBound=" << highBoundFunc()->GetName() ; 00099 } 00100 os << " ]" ; 00101 } 00102 00103 00104 00105 //_____________________________________________________________________________ 00106 void RooAbsBinning::printValue(ostream &os) const 00107 { 00108 // Print binning value, i.e the bin boundary positions 00109 Int_t n = numBins() ; 00110 os << "B(" ; 00111 00112 Int_t i ; 00113 for (i=0 ; i<n ; i++) { 00114 if (i>0) { 00115 os << " : " ; 00116 } 00117 os << binLow(i) ; 00118 } 00119 os << " : " << binHigh(n-1) ; 00120 os << ")" ; 00121 00122 } 00123 00124 00125 00126 //_____________________________________________________________________________ 00127 void RooAbsBinning::Streamer(TBuffer &R__b) 00128 { 00129 // Custom streamer implementing schema evolution between V1 and V2 persistent binnings 00130 00131 UInt_t R__s, R__c; 00132 if (R__b.IsReading()) { 00133 Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { } 00134 if (R__v==1) { 00135 TObject::Streamer(R__b); 00136 } else { 00137 TNamed::Streamer(R__b); 00138 } 00139 RooPrintable::Streamer(R__b); 00140 R__b.CheckByteCount(R__s, R__c, RooAbsBinning::IsA()); 00141 } else { 00142 R__c = R__b.WriteVersion(RooAbsBinning::IsA(), kTRUE); 00143 TNamed::Streamer(R__b); 00144 RooPrintable::Streamer(R__b); 00145 R__b.SetByteCount(R__c, kTRUE); 00146 } 00147 } 00148