ROOT TOOLKIT (Graphics, I/O, Data Structures) Técnicas Fundamentales de Simulación, Reconstrucción y Análisis de Datos en Física Experimental de Partículas.

Slides:



Advertisements
Presentaciones similares
Los Números y El Tiempo. Los Números Más de = once 12 = doce 13 = trece 14 = catorce 15 = quince 16 = dieciseis 17 = diecisiete 18 = dieciocho 19.
Advertisements

You need to improve the way you write and think in Spanish - Time This is an interactive presentation. You need your work sheet, your pencil, and your.
You need to improve the way you write and think in Spanish – At what time? This is an interactive presentation. You need your worksheet, your pencil, and.
This is an interactive presentation
Telling Time (Cómo decir la hora).
Ser vs Estar.
Las Palabras Interrogativas
Mr. Redaelli OnlineTaco.com. To Have - Tener Yo tengo – I have Tú tienes – You have (Informal) Usted tiene – You have (Formal) El tiene – He has Ella.
Goal: Factor trinomials of the form ax2 + bx + c
Los números del 0 al cero uno dos tres cuatro cinco 6 7 8
DESCRIBILICIOUS – LEVEL 3 The following presentation is designed to help you improve your understanding of descriptions in Spanish. Youll need to stay.
Telling Time Grammar Essential #8.
© 2006 XBRL International, All Rights Reservedwww.xbrl.org/Legal Ignacio Hernández-Ros Technology development XBRL International Using XQuery to process.
TEMA 2 MÚLTIPLOS Y DIVISORES
02- Plan Organización Docente v.2 Noviembre 2009 SIES – SISTEMA INTEGRADO DE EDUCACIÓN SUPERIOR.
Respuestas Buscando a Nemo.
Respuestas Los 101 Dálmatas Total= ___/60. 1.vivían 2.tuvo 3.llamó 4.anunció 5.exclamó 6.podía 7.era 8.bailaba 9.se abrió 10.estaba 11.estaba 12.tenía.
Capítulo 3 Nuevas clases, nuevos amigos PRIMER PASO
ANDRE FRANCO. Malena aprende los números Malena is learning the numbers in Spanish with objects. Lets find out how much she knows.
Telling Time in Spanish Grammar Notes
1 3 WAYS TO ASK A QUESTION 1.Add question marks to a statement. 2.Add a tag word to a statement. 3.Use a question word.
2003 HYPACK MAX Training Seminar1 Sample Case la Entrada manual de Datos de la Línea de la costa El Metodo de MANUAL –DIG Objectos –Boya (Roja)
2003 HYPACK MAX Training Seminar1 Sample Belgium Test Inputting Tag Line information into HYPACK® MAX In the old days, a Tag Line was anchored to.
Game Cluedo: How to Play 1.Your group should have the 21 cards containing 6 cards of suspects, 9 rooms and 6 weapons, a tally card for each member and.
¿Qué hora es? What time is it? (What hour is it?).
Objetivo: Los estudiantes van a usar vocabulario del desayuno para comprender un cuento. Práctica: 1. ¿Te gusta comer? 2. ¿Te gusta beber Mt. Dew.
1) Penélope Cruz es actriz mexicana ……………………………………….. 2) Nació en setiembre ………………………………………………………….. 3) Tiene 23 años …………………………………………………………… 4) Nació
8 th Grade Midterm Study Guide Complete the think-tac-toe that will help you prepare for your midterm. The tasks that you complete must create a tic- tac-toe,
Español 1 el 30 de agosto. Bell Dinger – el 30 de agosto
Telling Time Unidad 2 Etapa 2. Telling time in Spanish : Its 2:00.--Son las dos. Its 3:00.--Son las tres. Its 4:00.--Son las cuatro. Its 5:00--Son las.
Entrada: Los verbos en la historia (Entrance: Verbs in the story) Copy the date and title, and log the entry in your table of contents. Take a Realidades.
¿ Que día es hoy? Hoy es lunes ¿ Cual es la fecha de hoy? Hoy es el 26 de septiembre ¿ Cual es tu clase favorita? Mi clase favorita es… BELL RINGER.
Table of Contents Help How to Find Clip Art How to Export Clip Art How to Print Clip Art Talk About Activities UNIDAD 1 Lección 1 andar en patineta alquilar.
Capítulo 2 El Vocabulario Nuevo.
Respuestas- Cenicienta
Parte 3. Descripción del código de una función 1.
¿Qué hora es? Telling Time en Español Sra Spampinato.
9/20 A- Complete the sentences: 1. Me llam_ Pablo. 2. ¿Cómo te llam_ _? 3.¿Cómo se llam_ ? B- Contesta las preguntas (oraciones completas). 1. ¿Estudias.
Spanish Ia (Final Exam) Crossfire Initial Activity 1. Brief notes on tener... (or review if you have received them already!) Tener---formas Tener.
Los Numeros 0 – 100 en espanol.
(por favor) By emory gibson Para describir how long ago en español, presta attencion.
Ecuaciones Cuadráticas
Departamento de Ing. Electrónica Circuitos Digitales II Universidad de Antioquia Departamento de Ing. Electrónica Circuitos Digitales II Universidad.
HAZ AHORA / DO NOW Responde en frases completas: Por ejemplo: ¿Qué te gusta más, nadar o esquiar? Pues, me gusta más nadar. Pues, no me gusta ni nadar.
0 1 ¿Qué hora es? By: Craig Tillmann Revised by: Malinda Seger Coppell High School Coppell, TX.
Telling time in Spanish: Explanation Practice exercise index McCarron.
Cancela, JM. Ayán C. University Of Vigo. Throughout history the definition of learning has been conceptualized in many different ways depending on the.
La Lección del Repaso Antes de entrar en la clase de Español IV, necesita saber esta información.
¿Qué hora es?.
Articles, nouns and contractions oh my!. The POWER of the article THE 1. There are four ways to express THE in Spanish 2. The four ways are: El La Los.
 Making complete sentences How to make complete sentences in Spanish. The following presentation is designed to help you learn how to do the following:
Editing Slides With Polaris Office, you can create new .ppt and .pptx presentations or edit your presentation with ease.
1 DEFINITION OF A CIRCLE and example CIRCLES PROBLEM 1a PROBLEM 2a Standard 4, 9, 17 PROBLEM 1b PROBLEM 2b PROBLEM 3 END SHOW PRESENTATION CREATED BY SIMON.
 1. Why should a person learn Spanish? Give at least 3 reasons in your explanation.  2. What Spanish experiences have you had? (None is not an option.
Please do the following: 1.Measure an arms length of yarn of the color you like and cut it. (arms length goes from finger tip of one had to fingertip of.
Negatives and Questions. Negatives Consider the following sentences: Juan estudia mucho. Marta y Antonio viven en Georgia. Rita y el chico necesitan.
Español la memoria (1): cómo trabajarla bien. Hoy vamos a… mirar escucharpensar hablar memorizar.
Derechos de Autor©2008.SUAGM.Derechos Reservados Sistema Universitario Ana G. Méndez División de Capacitación Basic Quality Tools CQIA Primer Section VII.
Quantity How much? How many?
WALT: talking about dates and saying when your birthday is WILF: To be able to write & understand months and dates in Spanish to get to a Level 2 To be.
ECOM-6030 PASOS PARA LA INSTALACIÓN DE EASYPHP Prof. Nelliud D. Torres © - Derechos Reservados.
Go to cessarsc9.wixsite.com/clasedeespanol Click in this icon to see the presentation.
EQUILIBRIUM OF A PARTICLE IN 2-D Today’s Objectives: Students will be able to : a) Draw a free body diagram (FBD), and, b) Apply equations of equilibrium.
First Grade Dual High Frequency Words
GRAPHIC MATERIALS 1. GRAPHIC MATERIALS. GRAPHIC MATERIALS 1. GRAPHIC MATERIALS.
Preparacion Hoy es jueves el 3 de diciembre
JKSimMet Software (windows & buttons) Split Engineering Chile Ltda. General Salvo #331 oficina 201 Casilla Sucursal Panorámico Providencia – Santiago,
Welcome to PowerPoint gdskcgdskfcbskjc. Designer helps you get your point across PowerPoint Designer suggests professional designs for your presentation,
TABLET INFORMATION SUBMIT A Presentation Template.
Transcripción de la presentación:

ROOT TOOLKIT (Graphics, I/O, Data Structures) Técnicas Fundamentales de Simulación, Reconstrucción y Análisis de Datos en Física Experimental de Partículas Isidro González Caballero ( Universidad de Oviedo) Valencia, 07-11/05/

Graphics & GUI Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 2

TPad: main graphics container 3 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas Hello root[0] TLine line(.1,.9,.6,.6) root[1] line.Draw() root[2] TText text(.5,.2,”Hello”) root[3] text.Draw()  The Draw() method adds the object to the list of primitives of the current pad.  If no pad exists, a pad is automatically created with a default range [0,1].  When the pad needs to be drawn or redrawn, the object Paint() function is called. Only objects deriving from TObject may be drawn in a pad Root Objects or User objects

Basic Primitives 4 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas TButton TLineTArrow TEllipse TCurvyLine TPaveLabel TPave TDiamond TPavesText TPolyLine TLatex TCrown TMarker TText TCurlyArc TBox

5 Full LateX support on screen and postscript TCurlyArc TCurlyLine TWavyLine and other building blocks for Feynmann diagrams Formula or diagrams can be edited with the mouse Feynman.C latex3.C Lots of examples in /opt/root/tutorials/graphics Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

Graphs 6 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas TGraph(n,x,y) TCutG(n,x,y) TGraphErrors(n,x,y,ex,ey) TGraphAsymmErrors(n,x,y,exl,exh,eyl,eyh) TMultiGraph $ROOTSYS/tutorials/graphs/gerrors2.C

Graphics examples Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 7

More graphics examples 8 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

More graphics examples 9 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

10

Graphics (2D-3D) 11 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas “SURF” “LEGO” TF3 TH3 TGLParametric

ASImage: Image processor Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 12

GUI (Graphical User Interface) Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 13

Canvas tool bar/menus/help 14 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas Select Toolbar to activate the primitives toolbar Click on Ev. Statusbar to activate some info at the bottom Select Toottip to activate some info when overlying objects $ROOTSYS/tutorials/fit/fit1.C

Object editor 15 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas Click on any object to show its edition options Select Editor to activate the objects edition panel You can save it as file.C to explore the C++ command to change options

GUI C++ code generator  When pressing ctrl+S on any widget it is saved as a C++ macro file thanks to the SavePrimitive methods implemented in all GUI classes. The generated macro can be edited and then executed via CINT  Executing the macro restores the complete original GUI as well as all created signal/slot connections in a global way Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 16 // transient frame TGTransientFrame *frame2 = new TGTransientFrame(gClient- >GetRoot(),760,590); // group frame TGGroupFrame *frame3 = new TGGroupFrame(frame2,"curve"); TGRadioButton *frame4 = new TGRadioButton(frame3,"gaus",10); frame3->AddFrame(frame4); root [0].x example.C

Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 17  The GUI builder provides GUI tools for developing user interfaces based on the ROOT GUI classes. It includes over 30 advanced widgets and an automatic C++ code generator. The GUI Builder

More GUI Examples 18 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas $ROOTSYS/tutorials/gui $ROOTSYS/test/RootShower $ROOTSYS/test/RootIDE

Geometry Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 19 The GEOMetry package is used to model very complex detectors (LHC). It includes -a visualization system -a navigator (where am I, distances, overlaps, etc)

OpenGL Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 20 see $ROOTSYS/tutorials/geom

Math libraries 21 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

Peak Finder + Deconvolutions Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 22 TSpectrum

Fitters Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 23 Minuit Fumili LinearFitter RobustFitter Roofit

Fit Panel 24 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

Roofit: a powerful fitting framework 25 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas see $ROOTSYS/tutorials/fit/RoofitDemo.C

Ejercicio propuesto 1  ROOT has several function classes.  The most basic is the TF1. Note that all class names in ROOT start with "T“  "F" is for function, and "1" is for one-dimensional.  Locate the class description page for TF1 on the ROOT website.  You will see several constructors, one of which has four arguments.  Create the following 1-D function and draw it with:  The constructor arguments are: the name ( f1 ), and expression ( sin(x)/x ) and a lower and upper limit (0,10).  You can use the tab key to complete the command or list the argument. For example to list all the methods accessible trhough f1 type: Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 26 root [0] TF1 f1("f1","sin(x)/x",0,10); root [1] f1.Draw(); root [2] f1. TF1::TF1(const char* name, const char* formula, Double_t xmin=0, Double_t xmax=1);

Ejercicio propuesto 2  Find the class description page for TGraph to answer the following questions:  Copy $ROOTSYS/graphs/graph.C to your directory and change it to:  Center the title of the x axis.  Add two more points to the graph at (2.5, 6) and (3,4)  Modify it to draw 2 arrows starting from (1,-5) pointing to the 6 th and last points  Use the context menu on the window to change the graph  Line thickness,  Line color  Marker style  Marker color  Change the background of the canvas.  Zoom the graph so that it starts at 0.5 and ends at 3.5.  Pull down the File menu and select “Save as” canvas.png. This creates a graphic file of the canvas named after the canvas name (c1.png) Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 27

Ejercicio propuesto 3  This next exercise will show you how to fill histograms and take time measurements.  Open the file hrandom.C  Note that it is written so it can be compiled  Study how it fills 2 histograms and prints the time it takes to fill them  Execute the script.  Copy hrandom.C to hrandom1.C and modify it to add two more fills using TRandom2 and TRandom3 to fill them. For each case, print the CPU time spent in the random generator.  Start a new ROOT session and run the same script using ACLiC. You should see a considerable improvement in the CUP time:  Copy the hrandom1.C script to hrandom2.C and modify it so to draw the first histogram and display it after the script has finished  Note problems with scope  Can you make it draw the histogram after each fill?  gPad->Update() Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 28

Input/Output Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 29

I/O 30 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas Object in Memory Streamer: No need for transient / persistent classes http sockets File on disk Net File Web File XML XML File SQL DataBase Local Buffer

Object Oriented Concepts Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 31  Members: a “has a” relationship to the class.  Inheritance: an “is a” relationship to the class.  Class: the description of a “thing” in the system  Object: instance of a class  Methods: functions for a class TObject JetsTracksEvNum Momentum Segments Charge Event IsA HasA

TFile / TDirectory Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 32  A TFile object may be divided in a hierarchy of directories, like a Unix file system.  Two I/O modes are supported  Key-mode (TKey). An object is identified by a name (key), like files in a Unix directory. OK to support up to a few thousand objects, like histograms, geometries, mag fields, etc.  TTree-mode to store event data, when the number of events may be millions, billions.

Self-describing files Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 33  Dictionary for persistent classes written to the file.  ROOT files can be read by foreign readers  Support for Backward and Forward compatibility  Files created in 2001 must be readable in 2015  Classes (data objects) for all objects in a file can be regenerated via TFile::MakeProject root[0] TFile* f = Tfile::Open("demo.root"); root[1] f.MakeProject("dir", "*", "new++");

Example of key mode 34 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas void keywrite() { TFile f("keymode.root", "new"); TH1F h("hist", "test",100,-3,3); h.FillRandom("gaus",1000); h.Write(); } void keyRead() { TFile f(“keymode.root”); TH1F *h = (TH1F*)f.Get(“hist”); h.Draw(); } (1) Open a new file (write mode) (2) Build and fill a histogram (3) Write it to the active file (1’) Open an existing file in read only mode (default) (2’) Find object by name

Browse file content 35 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas $ root $ROOTSYS/test/RootBrowser/demos.root root[0] new Tbrowser; A Root file demos.root with no directories Different objects stored and accessible by name Double click to draw graphic objects

Browse file content 36 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas $ root $ROOTSYS/test/RootBrowser/demos.root root[0] new Tbrowser; A Root file demos.root with no directories Different objects stored and accessible by name Double click to draw graphic objects

ROOT Trees Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 37

Why Trees ? Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 38  Trees have been designed to support very large collections of objects. The overhead in memory is in general less than 4 bytes per entry.  Trees allow direct and random access to any entry (sequential access is the best)  Trees have branches and leaves. One can read a subset of all branches.  High level functions like TTree::Draw loop on all entries with selection expressions.  Trees can be browsed via TBrowser  Trees can be analyzed via TTreeViewer

Memory Tree Each Node is a branch in the Tree 39 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas tr T.Fill() T.GetEntry(6) T Memory

Inspecting a tree 40 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas root [0] TFile* f = TFile::Open("/opt/root/tutorials/mlp/mlpHiggs.root") root [1] f->ls() TFile**/opt/root/tutorials/mlp/mlpHiggs.root TFile*/opt/root/tutorials/mlp/mlpHiggs.root KEY: TTreebg_filtered;1Filtered background (WW) events KEY: TTreesig_filtered;1Filtered signal events root [2] bg_filtered->Print() ****************************************************************************** *Tree :bg_filtered: Filtered background (WW) events * *Entries : 1350 : Total = bytes File Size = * * : : Tree compression factor = 1.00 * ****************************************************************************** *Br 0 :acolin : acolin/F * *Entries : 1350 : Total Size= bytes One basket in memory * *Baskets : 0 : Basket Size= bytes Compression= 1.00 * * * *Br 1 :acopl : acopl/F * *Entries : 1350 : Total Size= bytes One basket in memory * *Baskets : 0 : Basket Size= bytes Compression= 1.00 * ………… root [3] bg_filtered->StartViewer() File name : /opt/root/tutorials/mlp/mlpHiggs.root

Inspecting a tree (TreeViewer) 41 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas Double click on branch to draw a histogram from its values Drag and drop branches to X and Y, then click here and draw 2D histos More functionality available: Cuts, Draw options, scanning, saving session,… Check here Use this to add a cut We can also use just TBrowser

Writing/Reading a Tree 42 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas class Event : public Something { Header fHeader; std::list fVertices; std::vector fTracks; TOF fTOF; Calor *fCalor; } int WriteTree() { Event *event = 0; TFile f("demo.root", "recreate"); int split = 99; //maximnum split TTree *T = new TTree("T", "demo Tree"); T->Branch("event", "Event",&event,split); for (int ev=0;ev<1000;ev++) { event = new Event(…); T->Fill(); delete event; } t->AutoSave(); } int ReadTree() { Event *event = 0; TFile f(“demo.root”); TTree *T = (TTree*)f.Get”T”); T->SetBranchAddress(“event”,&event); Long64_t N = T->GetEntries(); for (Long64_t ev=0;ev<N;ev++) { T->GetEntry(ev); // do something with event event->… } Event.h

TTree Selection Syntax Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 43 Prints the first 8 variables of the tree. Prints all the variables of the tree. Specific variables of the tree can be explicit selected by list them in column separated list: Prints the values of var1, var2 and var3. A selection can be applied in the second argument: Prints the values of var1, var2 and var3 for the entries where var1 is exactly 0. MyTree->Scan(); MyTree->Scan("*"); MyTree->Scan("var1:var2:var3"); MyTree->Scan("var1:var2:var3", "var1==0");

Drawing tree variables  Draw a given variable:  Draw a given variable applying a cut  Draw a 2D histogram from 2 variables with a cut  Draw and store in a histogram (myh2d):  One can also select the number of entries to process and the starting event to read Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 44 MyTree->Draw("var1:var2 >> myh2d", "", "surf2"); MyTree->Draw("var1:var2", "var3==0"); MyTree->Draw("var1", "var2>10"); MyTree->Draw("var1");

Data Volume & Organisation Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas MB1GB10GB1TB100GB100TB1PB10TB TTree TChain A TChain is a collection of TTrees or/and TChains A TFile typically contains 1 TTree A TChain is typically the result of a query to the file catalogue

Chains of Trees Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 46  A TChain is a collection of Trees.  Same semantics for TChains and TTrees { //creates a TChain to be used by the h1analysis.C class //the symbol H1 must point to a directory where the H1 data sets //have been installed TChain chain("h42"); chain.Add("$H1/dstarmb.root"); chain.Add("$H1/dstarp1a.root"); chain.Add("$H1/dstarp1b.root"); chain.Add("$H1/dstarp2.root"); }

Fitting Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 47

Fit techniques in ROOT  Two ways of fitting a o fit a histogram, graph,…  Fit Panel on a visible histogram via the context menu Good for prototyping Object needs to be drawn in a pad before the Fit Panel is invoked  Fit method in TH* and TGraph classes More powerful and is used in scripts and programs. Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 48

Fit method void Fit(const char *fname, Option_t *option, Option_t *goption, Axis_t xxmin, Axis_t xxmax)  fname : Name of the fitted function.  It may be one of ROOT pre-defined function names or a user-defined function  Some predefined functions are: "gaus“: gaussian function with 3 parameters: f(x) = p0*exp(-0.5*((x-p1)/p2)^2)) "expo“: Exponential with 2 parameters: f(x) = exp(p0+p1*x) "polN“: polynomial of degree N: f(x) = p0 + p1*x + p2*x "landau“: Landau function with mean and sigma  option : Many possible values. Read documentation  goption: Draw options. Same as in Draw  xxmin, xxmax : Fit interval  Also possible to fit to function objects (ex. TF1) or user defined functions. Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 49

Fit panel 50 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas Fitting function Function name Set initial values of parameters Do not overwrite previous fits Select fit range

RooFit  The RooFit library provides a toolkit for modeling the expected distribution of events in a physics analysis.  Models can be used to perform unbinned maximum likelihood fits  Produce plots  And generate "toy Monte Carlo" samples for various studies.  It is primarily designed as a particle physics data analysis tool…  …but its general nature and open architecture make it useful for other types of data analysis also  Originally developed by BaBar it is now part of ROOT distribution  Detailed documentation in Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 51

Exercise: fitting Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 52  Get your script graph2.C from previous exercises.  We would like to add a fit for each section of the graph.  Look at the TGraph::Fit method on the TGraph class description page.  At first fit the graph with the GUI 1. Select the graph with the mouse 2. Right-click to bring up the context menu. 3. Select FitPanel.  Use the slider to fit the first part with a polynomial of degree 4…  …and the second part with a polynomial of degree 1  Use the "Add to list" and “SAME" drawing option to see both fits on the graph  Now try to do the same within the script by using the Fit method  You can access the list of fitted functions for the graph with: TList *lfits = gr->GetListOfFunctions(); lfits->ls();  To get each of the functions fitted and to print the parameter values you can do TF1* f1 = (TH1F*) lfits->At(0); f1->Print();  See $ROOTSYS/tutorials/fit/multifit.C for an example on how to fit histograms in multiple sub ranges  Can you fit the last bit of the histogram?

Práctica 1  Descargarse el fichero  y descomprimirlo  Abrir un TTree y examinar sus variables:  Buscar y abrir uno de los ficheros root  Explorar el arbol “h1000”  Dividir el canvas en 2 mitades  Pintar la variables It4tag y Pcomb en escala logaritmica 53 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

Práctica 2  Crear un puntero al TTree del archivo abierto: mytree = (TTree *) gROOT->FindObject("h1000");  Pintar la componente 5 de la variable vector Pcomb  Establecer escala logarítmica  Superponer en la misma grafica la componente 4 de la variable vector Pcomb  Cambiar a color rojo la ultima grafica superpuesta  Pintar la variable Xsum4c4 si abs(Xdiff4c4)< Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

Práctica 3  Usando la clase Xmass, pintar con la macro ejemplo.C las distribuciones de suma de masas de dijet con menor diferencia de masas iguales, para datos y fondos QCD, WW+ZZ, a distintos niveles de corte de la variable pcomb[5] : 0, 0.1, 0.5 y 2 root [0].L Xmass.C root [1].x ejemplo.C  Guardar la grafica en formato.C,.eps y.png 55 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

56 Resultado 56 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

Ejercicios  Pintar una leyenda que describa el tipo de fondos y datos  Dibujar la estadística de datos y fondos  Resolver el problema del “memory leak”  La evaluación de esta parte de la asignatura se hará en base a la presentación de estos ejercicios 57 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

58 Deberíais obtener algo así… 58 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas