00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 #ifndef __CINT__
00013 #include "RooGlobalFunc.h"
00014 #endif
00015 #include "RooRealVar.h"
00016 #include "RooDataSet.h"
00017 #include "RooGaussian.h"
00018 #include "TCanvas.h"
00019 #include "TAxis.h"
00020 #include "RooPlot.h"
00021 using namespace RooFit ;
00022 
00023 
00024 void rf107_plotstyles()
00025 {
00026 
00027   
00028   
00029 
00030   
00031   RooRealVar x("x","x",-10,10) ;
00032 
00033   
00034   RooRealVar sigma("sigma","sigma",3,0.1,10) ;
00035   RooRealVar mean("mean","mean",-3,-10,10) ;
00036   RooGaussian gauss("gauss","gauss",x,mean,sigma) ;
00037 
00038   
00039   RooDataSet* data = gauss.generate(x,100) ;
00040 
00041   
00042   gauss.fitTo(*data) ;
00043 
00044 
00045 
00046   
00047   
00048 
00049   
00050   RooPlot* frame1 = x.frame(Name("xframe"),Title("Red Curve / SumW2 Histo errors"),Bins(20)) ;
00051   RooPlot* frame2 = x.frame(Name("xframe"),Title("Dashed Curve / No XError bars"),Bins(20)) ;
00052   RooPlot* frame3 = x.frame(Name("xframe"),Title("Filled Curve / Blue Histo"),Bins(20)) ;
00053   RooPlot* frame4 = x.frame(Name("xframe"),Title("Partial Range / Filled Bar chart"),Bins(20)) ;
00054 
00055 
00056 
00057   
00058   
00059 
00060   
00061   data->plotOn(frame1,DataError(RooAbsData::SumW2)) ;
00062 
00063   
00064   data->plotOn(frame2,XErrorSize(0)) ;
00065 
00066   
00067   data->plotOn(frame3,MarkerColor(kBlue),LineColor(kBlue)) ;
00068 
00069   
00070   data->plotOn(frame4,DrawOption("B"),DataError(RooAbsData::None),XErrorSize(0),FillColor(kGray)) ;
00071 
00072 
00073 
00074   
00075   
00076 
00077   
00078   gauss.plotOn(frame1,LineColor(kRed)) ;
00079 
00080   
00081   gauss.plotOn(frame2,LineStyle(kDashed)) ;
00082 
00083   
00084   gauss.plotOn(frame3,DrawOption("F"),FillColor(kOrange),MoveToBack()) ;
00085 
00086   
00087   gauss.plotOn(frame4,Range(-8,3),LineColor(kMagenta)) ;
00088 
00089 
00090 
00091   TCanvas* c = new TCanvas("rf107_plotstyles","rf107_plotstyles",800,800) ;
00092   c->Divide(2,2) ;
00093   c->cd(1) ; gPad->SetLeftMargin(0.15) ; frame1->GetYaxis()->SetTitleOffset(1.6) ; frame1->Draw() ;
00094   c->cd(2) ; gPad->SetLeftMargin(0.15) ; frame2->GetYaxis()->SetTitleOffset(1.6) ; frame2->Draw() ;
00095   c->cd(3) ; gPad->SetLeftMargin(0.15) ; frame3->GetYaxis()->SetTitleOffset(1.6) ; frame3->Draw() ;
00096   c->cd(4) ; gPad->SetLeftMargin(0.15) ; frame4->GetYaxis()->SetTitleOffset(1.6) ; frame4->Draw() ;
00097 
00098   
00099 }