// RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and
// printing methods. Each RooPlotable implementation must define methods that
// print the objects name, class name, title, value, arguments and extras
// to a provided stream. The definition of value is class dependent. The definition
// of arguments is also class dependent, but should always be interpreted as
// the names (and properties) of any (RooAbsArg) external inputs of a given object.
// The extras method can be used to print any properties that does not fit in any
// of the other classes. Each object an also override the definitions made
// in defaultPrintStyle and defaultPrintContents to determine what is printed
// (in terms of contents) and how it is printed (inline,single-line or multiline)
// given a Print() option string.
// END_HTML
#include "RooFit.h"
#include "RooPrintable.h"
#include "Riostream.h"
#include <iomanip>
#include "TNamed.h"
#include "TClass.h"
ClassImp(RooPrintable)
;
Int_t RooPrintable::_nameLength(0) ;
namespace RooFit {
ostream& operator<<(ostream& os, const RooPrintable& rp) {
rp.printStream(os,rp.defaultPrintContents("I"),RooPrintable::kInline) ; return os ;
}
}
void RooPrintable::nameFieldLength(Int_t newLen)
{
_nameLength = newLen>0 ? newLen : 0 ;
}
void RooPrintable::printStream(ostream& os, Int_t contents, StyleOption style, TString indent) const
{
if (style==kVerbose||style==kStandard) {
printMultiline(os,contents,style==kVerbose,indent) ;
return ;
} else if (style==kTreeStructure) {
printTree(os,indent) ;
return ;
}
if (style!=kInline) os << indent ;
if (contents&kAddress) {
printAddress(os) ;
if (contents!=kAddress) {
os << " " ;
}
}
if (contents&kClassName) {
printClassName(os) ;
if (contents!=kClassName) {
os << "::" ;
}
}
if (contents&kName) {
if (_nameLength>0) {
os << setw(_nameLength) ;
}
printName(os) ;
}
if (contents&kArgs) {
printArgs(os) ;
}
if (contents&kValue) {
if (contents&kName) {
os << " = " ;
}
printValue(os) ;
}
if (contents&kExtras) {
if (contents!=kExtras) {
os << " " ;
}
printExtras(os) ;
}
if (contents&kTitle) {
if (contents==kTitle) {
printTitle(os) ;
} else {
os << " \"" ;
printTitle(os) ;
os << "\"" ;
}
}
if (style!=kInline) os << endl ;
}
void RooPrintable::printValue(ostream& ) const
{
}
void RooPrintable::printExtras(ostream& ) const
{
}
void RooPrintable::printMultiline(ostream& , Int_t , Bool_t , TString ) const
{
}
void RooPrintable::printTree(ostream& , TString ) const
{
cout << "Tree structure printing not implement for class " << IsA()->GetName() << endl ;
}
void RooPrintable::printArgs(ostream& ) const
{
}
void RooPrintable::printName(ostream& ) const
{
}
void RooPrintable::printTitle(ostream& ) const
{
}
void RooPrintable::printClassName(ostream& ) const
{
}
void RooPrintable::printAddress(ostream& os) const
{
os << this ;
}
Int_t RooPrintable::defaultPrintContents(Option_t* ) const
{
return kName|kValue ;
}
RooPrintable::StyleOption RooPrintable::defaultPrintStyle(Option_t* opt) const
{
if (!opt) {
return kSingleLine ;
}
TString o(opt) ;
o.ToLower() ;
if (o.Contains("v")) {
return kVerbose ;
} else if (o.Contains("s")) {
return kStandard ;
} else if (o.Contains("i")) {
return kInline ;
} else if (o.Contains("t")) {
return kTreeStructure ;
}
return kSingleLine ;
}
ostream &RooPrintable::defaultPrintStream(ostream *os)
{
static ostream *_defaultPrintStream = &cout;
ostream& _oldDefault= *_defaultPrintStream;
if(0 != os) _defaultPrintStream= os;
return _oldDefault;
}
Last change: Mon Aug 25 11:36:45 2008
Last generated: 2008-08-25 11:36
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.