Presentation is loading. Please wait.

Presentation is loading. Please wait.

Durham1 Collection of algorithms in ROOT Advanced Multivariate & Statistical Techniques FermiLab Workshop May 31, 2002 Ren é Brun CERN.

Similar presentations


Presentation on theme: "Durham1 Collection of algorithms in ROOT Advanced Multivariate & Statistical Techniques FermiLab Workshop May 31, 2002 Ren é Brun CERN."— Presentation transcript:

1 Durham1 Collection of algorithms in ROOT Advanced Multivariate & Statistical Techniques FermiLab Workshop May 31, 2002 Ren é Brun CERN

2 Rene BrunCollection of algorithms in ROOT2 Follow-on of ACAT2000 at FermiLab At ACAT2000, many interesting algorithms were presented. Many of us agreed that it would be nice to collect these algorithms in a coherent framework. Many people have the know-how to develop very clever algorithms, but not the opportunity to make the source/doc available to a large community. I proposed to gradually collect such algorithms in the ROOT suite. Your workshop is an opportunity to make some progress. ACAT2002 in Moscow could be another step.

3 Rene BrunCollection of algorithms in ROOT3 Which ingredients Statistical methods for Data Analysis Systematics Confidence Limits Signal significance Unfolding techniques Artificial Intelligence Neural nets Pattern recognition techniques Genetic algorithms Wavelet Analysis other algorithms Multi-dim integration, etc

4 Rene BrunCollection of algorithms in ROOT4 Already in Root Random Number generators standard distributions: flat, gaus, landau, Poisson, from a function 1-d, 2-d, 3-d from histograms 1-d, 2-d, 3-d Principal components Analysis Multidimensional parametrisation and Fitting Histogram peak finders Feldman Cousins Fitting MC fractions to data histogram

5 Rene BrunCollection of algorithms in ROOT5 FeldmanCousins example void FeldmanCousins() { // Example macro of using the TFeldmanCousins class in root. // Author : Adrian John Bevan // // get a FeldmanCousins calculation object with the default limits // of calculating a 90% CL with the minimum signal value scanned // = 0.0 and the maximum signal value scanned of 50.0 TFeldmanCousins f; // calculate either the upper or lower limit for 10 observerd // events with an estimated background of 3. The calculation of // either upper or lower limit will return that limit and fill // data memebers with both the upper and lower limit for you. Double_t Nobserved = 10.0; Double_t Nbackground = 3.0; Double_t ul = f.CalculateUpperLimit(Nobserved, Nbackground); Double_t ll = f.GetLowerLimit(); cout << "For " << Nobserved << " data observed with and estimated background"<

6 Rene BrunCollection of algorithms in ROOT6 Generators, Fitting // Quadratic background function Double_t background(Double_t *x, Double_t *par) { return par[0] + par[1]*x[0] + par[2]*x[0]*x[0]; } // Lorenzian Peak function Double_t lorentzianPeak(Double_t *x, Double_t *par) { return (0.5*par[0]*par[1]/TMath::Pi()) / TMath::Max( 1.e-10,(x[0]-par[2])*(x[0]-par[2]) +.25*par[1]*par[1]); } // Sum of background and peak function Double_t myFunction(Double_t *x, Double_t *par) { return background(x,par) + lorentzianPeak(x,&par[3]); } void getrandom() { TCanvas *c1 = new TCanvas("c1","Fitting Demo",10,10,700,900); c1->Divide(1,2); // create a source function with 6 parameters c1->cd(1); TF1 *source = new TF1("source",myFunction,0,3,6); source->SetParameters(-0.86,45.8,-13.3,13.8,0.172,0.987); source->SetNpx(200); source->DrawCopy(); // fill histogram with numbers sampled from the source function c1->cd(2); TH1F *histo = new TH1F("histo","Lorentzian Peak on Quadratic Background",60,0,3); for (Int_t i=0;i<10000;i++) { Double_t sval = source->GetRandom(); histo->Fill(sval); } //fit histogram with original function gStyle->SetOptFit(); histo->Fit(source); }

7 Rene BrunCollection of algorithms in ROOT7 MonteCarlo Fractions Fitter TFractionFitter: Fits MC fractions to data histogram (see R. Barlow and C. Beeston, Comp. Phys. Comm. 77 (1993) ) The virtue of this fit is that it takes into account both data and Monte Carlo statistical uncertainties. The way in which this is done is through a standard likelihood fit using Poisson statistics; however, the template (MC) predictions are also varied within statistics, leading to additional contributions to the overall likelihood. This leads to many more fit parameters (one per bin per template), but the minimisation with respect to these additional parameters is done analytically rather than introducing them as formal fit parameters.

8 Rene BrunCollection of algorithms in ROOT8 TFractionFitter example { TH1F *data; //data histogram TH1F *mc0; // first MC histogram TH1F *mc1; // second MC histogram TH1F *mc2; // third MC histogram TObjArray *mc = new TObjArray(3); mc->Add(mc0); // MC histograms are put in this array mc->Add(mc1); mc->Add(mc2); TFractionFitter* fit = new TFractionFitter(data, mc); fit->Constrain(1,0.0,1.0); // fraction 1 to be between 0 and 1 fit->SetRangeX(1,15); // use only the first 15 bins in the fit fit->Fit(); // perform the fit TH1F* prediction = (TH1F*) fit->GetPlot(); data->Draw("Ep"); prediction->Draw("same"); }

9 Rene BrunCollection of algorithms in ROOT9 Procedure We can give help to create a class in a portable way. Author is responsible for the doc and support We generate the html pages at each release We compile and distribute binaries + source for most machines and compilers. Examples:


Download ppt "Durham1 Collection of algorithms in ROOT Advanced Multivariate & Statistical Techniques FermiLab Workshop May 31, 2002 Ren é Brun CERN."

Similar presentations


Ads by Google