Logo ROOT   6.08/07
Reference Guide
rf506_msgservice.C File Reference

Detailed Description

View in nbviewer Open in SWAN 'ORGANIZATION AND SIMULTANEOUS FITS' RooFit tutorial macro #506

Tuning and customizing the RooFit message logging facility

Processing /mnt/build/workspace/root-makedoc-v608/rootspi/rdoc/src/v6-08-00-patches/tutorials/roofit/rf506_msgservice.C...
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooConstVar.h"
#include "RooPolynomial.h"
#include "RooAddPdf.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
#include "RooMsgService.h"
using namespace RooFit ;
void rf506_msgservice()
{
// C r e a t e p d f
// --------------------
// Construct gauss(x,m,s)
RooRealVar x("x","x",-10,10) ;
RooRealVar m("m","m",0,-10,10) ;
RooRealVar s("s","s",1,-10,10) ;
RooGaussian gauss("g","g",x,m,s) ;
// Construct poly(x,p0)
RooRealVar p0("p0","p0",0.01,0.,1.) ;
RooPolynomial poly("p","p",x,p0) ;
// Construct model = f*gauss(x) + (1-f)*poly(x)
RooRealVar f("f","f",0.5,0.,1.) ;
RooAddPdf model("model","model",RooArgSet(gauss,poly),f) ;
RooDataSet* data = model.generate(x,10) ;
// P r i n t c o n f i g u r a t i o n o f m e s s a g e s e r v i c e
// ---------------------------------------------------------------------------
// Print streams configuration
cout << endl ;
// A d d i n g I n t e g r a t i o n t o p i c t o e x i s t i n g I N F O s t r e a m
// -----------------------------------------------------------------------------------------------
// Print streams configuration
cout << endl ;
// Add Integration topic to existing INFO stream
// Construct integral over gauss to demonstrate new message stream
RooAbsReal* igauss = gauss.createIntegral(x) ;
igauss->Print() ;
// Print streams configuration in verbose, which also shows inactive streams
cout << endl ;
cout << endl ;
// Remove stream
// E x a m p l e s o f p d f v a l u e t r a c i n g s t r e a m
// -----------------------------------------------------------------------
// Show DEBUG level message on function tracing, trace RooGaussian only
// Perform a fit to generate some tracing messages
model.fitTo(*data,Verbose(kTRUE)) ;
// Reset message service to default stream configuration
// Show DEBUG level message on function tracing on all objects, redirect output to file
// Perform a fit to generate some tracing messages
model.fitTo(*data,Verbose(kTRUE)) ;
// Reset message service to default stream configuration
// E x a m p l e o f a n o t h e r d e b u g g i n g s t r e a m
// ---------------------------------------------------------------------
// Show DEBUG level messages on client/server link state management
// Clone composite pdf g to trigger some link state management activity
RooAbsArg* gprime = gauss.cloneTree() ;
gprime->Print() ;
// Reset message service to default stream configuration
}
Author
07/2008 - Wouter Verkerke

Definition in file rf506_msgservice.C.