'BASIC FUNCTIONALITY' RooFit tutorial macro #102
Importing data from ROOT TTrees and THx histograms
Processing /mnt/build/workspace/root-makedoc-v610/rootspi/rdoc/src/v6-10-00-patches/tutorials/roofit/rf102_dataimport.C...
TTree* makeTTree() ;
void rf102_dataimport()
{
RooPlot* frame = x.frame(
Title(
"Imported TH1 with Poisson error bars")) ;
dh.plotOn(frame) ;
gauss.fitTo(dh) ;
gauss.plotOn(frame) ;
RooPlot* frame2 = x.frame(
Title(
"Imported TH1 with internal errors")) ;
gauss.plotOn(frame2) ;
TTree* tree = makeTTree() ;
ds.Print() ;
RooPlot* frame3 = y.frame(
Title(
"Unbinned data shown in default frame binning")) ;
ds.plotOn(frame3) ;
RooPlot* frame4 = y.frame(
Title(
"Unbinned data shown with custom binning")) ;
TCanvas* c =
new TCanvas(
"rf102_dataimport",
"rf102_dataimport",800,800) ;
}
{
TH1D* hh =
new TH1D(
"hh",
"hh",25,-10,10) ;
for (int i=0 ; i<100 ; i++) {
hh->
Fill(gRandom->Gaus(0,3)) ;
}
return hh ;
}
TTree* makeTTree()
{
TTree* tree = new TTree("tree","tree") ;
tree->Branch("x",px,"x/D") ;
tree->Branch("y",py,"y/D") ;
for (int i=0 ; i<100 ; i++) {
*px = gRandom->Gaus(0,3) ;
*py = gRandom->Uniform()*30 - 15 ;
tree->Fill() ;
}
}
- Author
- 07/2008 - Wouter Verkerke
Definition in file rf102_dataimport.C.