Difference: HiggsAnalysisAtATLASUsingRooStats (22 vs. 23)

Revision 232011-08-18 - WilliamBreadenMadden

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Changed:
<
<
-- WilliamBreadenMadden - 2011-08-16
>
>
-- WilliamBreadenMadden - 2011-08-18
 
Line: 178 to 178
 

Added:
>
>

Datasets

General description

In RooFit, data can be stored in an unbinned or binned manner. Unbinned data is stored using the RooDataSet class while binned data is stored using the RooDataHist class. The user can define how many bins there are in a variable. For the purposes of plotting using the RooPlot class, a RooDataSet is binned into a histogram.

In general, working in RooFit with binned and unbinned data is very similar, as both class RooDataSet (for unbinned data) and class RooDataHist (for binned data) inherit from a common base class, RooAbsData, which defines the interface for a generic abstract data sample. With few exceptions, all RooFit methods take abstract datasets as input arguments, allowing for the interchangeable use of binned and unbinned data.

RooDataSet (unbinned data)

Example code: generating toy Monte Carlo, storing it as unbinned data and then plotting it

} // Create a RooDataSet and fill it with generated toy Monte Carlo data: RooDataSet* myData = gauss.generate(x, 100); // Plot the dataset. RooPlot* myFrame = x.frame(); myData.plotOn()(myFrame); myFrame.Draw(); }

Plotting unbinned data is similar to plotting binned data with the exception that one can show it in some preferred binning.

Example code: plotting unbinned data (a RooDataSet) using a specified binning

RooPlot* myFrame = x.frame() ; myData.plotOn(myFrame, Binning(25)) ; myFrame->Draw()

Importing data from ROOT trees (how to populate RooDataSets from TTrees)

* Put stuff here, Will. *

RooDataHist (binned data)

Importing data from ROOT TH histogram objects (take a histogram and map it to a binned data set) (how to populate RooDataHists from histograms)

In RooFit, binned data is represented by the RooDataHist class. The contents of a ROOT histogram can be imported into a RooDataHist object. In importing a ROOT histogram, the binning of the original histogram is imported as well. A RooDataHist associates the histogram with a RooFit variable object of type RooRealVar. In this way it is always known what kind of data is stored in the histogram.

In displaying the data, RooFit, by default, shows the 68% confidence interval for Poisson statistics.

Example code: import a ROOT histogram into a RooDataHist (a RooFit binned dataset)

{ // Access the file. TFile* myFile = new TFile("myFile.root"); // Load the histogram. TH1* myHistogram = (TH1*) myFile->Get("myHistogram"); // Draw the loaded histogram. myHistogram.Draw(); // Declare an observable x. RooRealVar x("x", "x", -1, 2); // Create a binned dataset that imports the contents of TH1 and associates its contents to observable 'x'. RooDataHist myData("myData", "myData", RooArgList(x), myHistogram); // Plot the imported dataset. RooPlot* myFrame = x.frame(); myData.plotOn(myFrame) myFrame.Draw() }

Fitting

Fitting a model to data

Fitting a model to data can be done in many ways. The most common methods are the χ2 fit and the -log(L) fit. The default fitting method in ROOT is the χ2 method, while the default method in RooFit is the -log(L) method. The -log(L) method is often preferred because it is more robust for low statistics fits and because it can also be performed on unbinned data.

Fitting a PDF to unbinned data

Example code: fit a Gaussian PDF to data

// Fit gauss to unbinned data gauss.fitTo(*myData);

 

The RooFit workspace

General description

Line: 326 to 414
 

RooStats

Changed:
<
<

General description
>
>

General description

  RooStats provides tools for high-level statistics questions in ROOT. It builds on RooFit, which provides basic building blocks for statistical questions.

The main goal is to standardise the interface for major statistical procedures so that they can work on an arbitrary RooFit model and dataset and handle any parameters of interest and nuisance parameters. Another goal is to implement most accepted techniques from frequentist, Bayesian and likelihood based approaches. A further goal is to provide utilities to perform combined measurements.

Deleted:
<
<

Datasets

In RooFit, data can be stored in an unbinned or binned manner. Unbinned data is stored using the RooDataSet class while binned data is stored using the RooDataHist class. The user can define how many bins there are in a variable. For the purposes of plotting using the RooPlot class, a RooDataSet is binned into a histogram.

Example code: generating toy Monte Carlo, storing it as unbinned data and then plotting it

} // Create a RooDataSet and fill it with generated toy Monte Carlo data: RooDataSet* myData = gauss.generate(x, 100); // Plot the dataset. RooPlot* myFrame = x.frame(); myData.plotOn()(myFrame); myFrame.Draw(); }

Importing data (how to populate datasets from histograms and TTrees)

Importing data from ROOT trees

* Put stuff here, Will. *

Importing data from ROOT TH histogram objects (take a histogram and map it to a binned data set)

Example code: import a ROOT histogram into a RooDataHist (a RooFit binned dataset)

{ // Access the file. TFile* myFile = new TFile("myFile.root"); // Load the histogram. TH1* myHistogram = myFile.Get("myHistogram"); // Draw the loaded histogram. myHistogram.Draw(); // Declare an observable x. RooRealVar x("x", "x", -1, 2); // Create a binned dataset that imports the contents of TH1 and associates its contents to observable 'x'. RooDataHist myData("myData", "myData", RooArgList(x), myHistogram); // Plot the imported dataset. RooPlot* myFrame = x.frame(); myData.plotOn(myFrame) myFrame.Draw() }

Fitting

Fitting a PDF to unbinned data

Example code: fit a Gaussian PDF to data

// Fit gauss to unbinned data gauss.fitTo(*myData);

 

Example code: create a simple model using the RooFit Workspace Factory. Specify parts of the model using ModelConfig. Create a simple dataset. Complete a confidence interval test using the ProfileLikelihoodCalculator of RooStats

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback