Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

ROOT Tutorial für D. Liko. Was ist ROOT ? ● Am CERN entwickeltes Tool zur Analyse von Daten ● Funktionalität in vielen Bereichen ● Objekte.

Ähnliche Präsentationen


Präsentation zum Thema: "ROOT Tutorial für D. Liko. Was ist ROOT ? ● Am CERN entwickeltes Tool zur Analyse von Daten ● Funktionalität in vielen Bereichen ● Objekte."—  Präsentation transkript:

1 ROOT Tutorial für HEPHY@CERN D. Liko

2 Was ist ROOT ? ● Am CERN entwickeltes Tool zur Analyse von Daten ● Funktionalität in vielen Bereichen ● Objekte ● C++ ● Skriptsprachen

3 Was kann ROOT

4 Verschiedene Aspekte ● C++ as script language with interpreter CINT ● Also python and ruby ● GUI for interactive visualization(TCanvas, TBrowser,...) ● I/O and analysis of large amountof data(TFile, TTree,...) ● Histograming, plotting, fits(TH1x, TGraph, TF1,...) ● Physics and mathematics(TMatrix, TLorentzVector, TMath,..) ● Objectorganisation(TCollection, TDirectory, TFolder,...) ● Parallel analysis via network(TProof) ● Vieles mehr ● http://root.cern.ch hat alle Dokumentation http://root.cern.ch

5 Setup ROOT ● Environment Variable ● PATH ● LD_LIBRARY_PATH ● ROOTSYS

6 Hello ROOT 1 [heplx02] /scratch/liko/workbook/CMSSW_3_3_1 $ root ******************************************* * * * W E L C O M E to R O O T * * * * Version 5.22/00d 27 July 2009 * * * * You are welcome to visit our Web site * * http://root.cern.ch * * * ******************************************* ROOT 5.22/00d (branches/v5-22-00-patches@29532, Sep 25 2009, 00:59:00 on linux) CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008 Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }. root [0] cout << "Hello World" << endl; Hello World root [1] printf("Hello World\n"); Hello World

7 Hello Root 2 root [0] TCanvas *c = new TCanvas("canvas1","Hello World Canvas",600,400) root [1] c->cd() root [2] TText *t = new TText(0.5, 0.5, "Hallo Welt") root [3] t->Draw()

8 ROOT Scripte root [0].x HelloWorld.C

9 Objekt Orientiert ● Wenn man etwas in ROOT machen will, muss man Objekte benutzen ● Objekt wird durch eine Klasse definiert ● Attribute ● Methoden

10 Inheritance TFile TRFIOFileTNetFile

11 Beispiel ● TFile * input = new Tfile::Open(“http://....”) ● TFile is the main class that provides the interface ● TFile has a Factory Methode ● Actual implementation is TNetFile

12 Shared Libraries Main Root Program Extension AExtension B

13 Histogramme ● Ein Histogramm ist eine komfortable Art Daten darzustellen und zu speichern. Im Prinzip besteht es aus einer Achse, die einen minimalen und ein maximalen Wert hat. Die Achse ist in eine Anzahl von Abschnitten (Bins) aufgeteilt ist, für die es jeweils einen Zähler gibt. ● Wenn man nun einen Wert in das Histogramm einfüllt, wird der Abschnitt gesucht, in den der Wert fällt, und dessen Zähler dann um eins erhöht. Man speichert also nicht mehr die Werte an sich sondern nur die Häufigkeiten, mit denen ein Wert innerhalb eines bestimmten Abschnittes vorkommt.

14 Beispiel Histogramm TCanvas *c = new TCanvas("canvas3", "Beispiel Histogram", 600, 400); c->cd(); TH1D *hist1D = new TH1D("hist1D", "Erstsemester", 10, 15., 25.); double werte[20] = {18., 17., 18., 18., 19., 23., 19., 18., 19., 18., 20., 21., 20., 18., 19., 20., 18., 19., 18., 18.}; for(int i = 0; i < 20; i++) { hist1D->Fill(werte[i]); } hist1D->GetXaxis()->SetTitle("Alter (Jahren)"); hist1D->GetYaxis()->SetTitle("Anzahl"); hist1D->Draw();

15 2D Histogramm TCanvas *c = new TCanvas("canvas4", "Beispiel 2D Histogram", 600, 400); c->cd(); TH2D *hist2D = new TH2D("hist2D", "Erstsemester 2D", 10, 15., 25., 10, 1.60, 2.00); double alter[20] = {18., 17., 18., 18., 19., 23., 19., 18., 19., 18., 20., 21., 20., 18., 19., 20., 18., 19., 18., 18.}; double groesse[20] = {1.76, 1.68, 1.90, 1.72, 1.87, 1.64, 1.78, 1.82, 1.75, 1.70, 1.72, 1.79, 1.80, 1.75, 1.89, 1.68, 1.77, 1.77, 1.87, 1.72}; for(int i = 0; i < 20; i++) { hist2D->Fill(alter[i], groesse[i]); } hist2D->GetXaxis()->SetTitle("Alter (Jahren)"); hist2D->GetYaxis()->SetTitle("Groesse (m)"); hist2D->GetZaxis()->SetTitle("Anzahl"); hist2D->Draw("LEGO2");

16 Daten mit Fehlern double zeit[4] = {2., 4., 6., 8.}; double geschw[4] = {10., 12., 15., 19.}; double geschwFehler[4] = {1., 1.2, 1.6, 1.4}; TGraphErrors *gr = new TGraphErrors(4, zeit, geschw, 0, geschwFehler); gr->SetTitle(""); gr->SetMarkerStyle(22); gr->GetXaxis()->SetTitle("Zeit (s)"); gr->GetYaxis()->SetTitle("Geschwindigkeit (m/s)"); gr->Draw("AP");

17 Ntuple and TTree ● Ntuple ● Most simple structure to store data ● Data are Tuples ● Ttree ● Advanced data structure to store all kind of Objects ● Ntuples ● Histograms, Canvas, etc ● Event Data

18 Create and Examine Ntuple root $ROOTSYS/tutorials/hsimple.C ******************************************* * * * W E L C O M E to R O O T * * * * Version 5.22/00d 27 July 2009 * * * * You are welcome to visit our Web site * * http://root.cern.ch * * * ******************************************* ROOT 5.22/00d (branches/v5-22-00-patches@29532, Sep 25 2009, 00:59:00 on linux) CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008 Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }. root [0] Processing /afs/hephy.at/project/cms/software/slc4_ia32_gcc345/lcg/root/5.22.00d- cms//tutorials/hsimple.C... hsimple : Real Time = 65.46 seconds Cpu Time = 0.46 seconds

19

20 $ROOTSYS/tutorials/tree/ntuple1.C

21 What is python ? ● Python is an interpreted, object-oriented, high- level programming language with dynamic semantics. ● Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.

22 Python Hello World [heplx02] /scratch/liko/workbook/CMSSW_3_3_1 $ python Python 2.4.2 (#1, Mar 4 2008, 22:56:43) [GCC 3.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print "hello World" hello World >>>

23 Python and ROOT ● ROOT and Python are often used together ● Same objects ● Different syntax ● python $ROOTSYS/tutorials/pyroot/hsum.py


Herunterladen ppt "ROOT Tutorial für D. Liko. Was ist ROOT ? ● Am CERN entwickeltes Tool zur Analyse von Daten ● Funktionalität in vielen Bereichen ● Objekte."

Ähnliche Präsentationen


Google-Anzeigen