1 / 16

Javier Fernández Menéndez Master Técnicas de Computación en Física Enero-2013

Herramientas de simulación, reconstrucción y análisis de datos en Física de Partículas (III): practica ROOT. Javier Fernández Menéndez Master Técnicas de Computación en Física Enero-2013 Javier.Fernandez@cern.ch. Descarga de ficheros para la práctica. http://www.hep.uniovi.es/jfernan/Master/

mrinal
Download Presentation

Javier Fernández Menéndez Master Técnicas de Computación en Física Enero-2013

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Herramientas de simulación, reconstrucción y análisis de datos en Física de Partículas (III): practica ROOT Javier Fernández Menéndez Master Técnicas de Computación en Física Enero-2013 Javier.Fernandez@cern.ch

  2. Descarga de ficheros para la práctica • http://www.hep.uniovi.es/jfernan/Master/ • Descargar descargar.tgz • Descomprimir: tar xzf descargar.tgz • Ejecutar root.exe (o thisroot.bat) en el directorio donde se almacenen todos los ficheros anteriores J. Fernández

  3. Instalación manual de ROOT en Linux • http://root.cern.ch/drupal/content/downloading-root • Seleccionar la última versión recomendada • Escoger la plataforma correspondiente y descargar el fichero (wget). A continuación (e.g.): • tar xvzf root_v5.34.03.Linux.slc5.gcc4.3.tar.gz • Establecer la variable ROOTSYS al directorio de instalación ( $PWD ): • sh family: • export ROOTSYS=$PWD/root • export PATH=$ROOTSYS/bin:$PATH • export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH • csh family: • setenv ROOTSYS $PWD/root • setenv PATH ${ROOTSYS}/bin:${PATH} • setenv LD_LIBRARY_PATH ${ROOTSYS}/lib:${LD_LIBRARY_PATH} • root.exe J. Fernández

  4. Instalación manual de ROOT en Windows • http://root.cern.ch/drupal/content/downloading-root • Seleccionar la última versión recomendada • Ir a la sección: Windows tar files (recomendado) • Descargar la versión denotada con: • “the bold versions are recommended” • Descomprimir el archivo en C:/ (e.g.), no valen directorios con espacios • Crear un archivo llamado “thisroot.bat” que contenga: • set ROOTSYS=C:\ROOT • C:\ROOT\bin\root.exe • o bien usar el: Windows Installer Packages (instalación completa, requiere desinstalación…) J. Fernández

  5. Practicas con funciones y clases de root J. Fernández

  6. Creating a Function Object from the Command Line • 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.http://root.cern.ch/root/html/TF1.html • You will see several constructors, one of which has four arguments. TF1 TF1(const char* name, const char* formula, Double_t xmin = 0,Double_t xmax = 1) • Create the following 1-D function and draw it with: root [] TF1 f1("f1","sin(x)/x",0,10); root [] f1.Draw(); • 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 of f1 type: root [] f1.<TAB> J. Fernández

  7. Graphs • Find the class description page for TGraph to answer the following questions: http://root.cern.ch/root/html/TGraph.html • .x $ROOTSYS/tutorials/graphs/graph.C • Copy graph.C to graph2.C and change it to:1. Center the title of the axis.2. Add two more points to the graph, one at (2.5,6 and 3,4)  • Modify the script graph2.C to draw two arrows starting from the same point at x=1, y = -5, one pointing to the point 6, the other pointing to the last point. Using the GUI • Use the context menu to change the graph line thickness, line color, marker style, and marker color. Change the background of the canvas. Zoom the graph so that it starts at 0.5 and ends at 3.5. The finished canvas should look like this: • With the GUI Editor add another arrow, this time from  x = 3, y = 0 to  x = 2, y = 5 • Pull down the File menu and select Save as canvas.ps. This creates a PostScript file of the canvas named after the canvas name (c1.ps). Print the file on the local printer. J. Fernández

  8. Fitting Graphs Fitting a Graph • Re-execute the script graph2.C. 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. • Fit the first part with a polynomial of degree 4, and the second part with a polynomial of degree 1, using the slider. In the end, use the "Add to list of function" and "same picture" options to see both fits on the graph. • How would you modify the first script graph.C adding a loop to fit the graph with polynomials of degree 2 to 7 keeping all the fits on the canvas and assigning a different color to each function?  The added statements should not produce any output in the alphanumeric window.  • To access the list of fitted functions for the graph, you can do: • root [] TList *lfits = gr->GetListOfFunctions(); • root [] lfits->ls(); • To get a pointer to the fitted function with a polynomial of degree 4, do root [] TF1 *pol4 = (TF1*)lfits->FindObject(“pol4”) Or root [] TF1 *pol4 = gr->GetFunction(“pol4”); J. Fernández

  9. Histograms Filling Histograms • This next exercise will show you how to fill histograms and take time measurements. Open the file hrandom.C. http://www.hep.uniovi.es/jfernan/Master/hrandom.C • Study how it fills 2 histograms and prints the time it takes to fill them. Execute the script. • root [] .x hrandom.C • While this is executing, study the script and notice how it is written so it can be compiled. • Copy hrandom.C to hrandom1.C and modify it to add two more histograms using TRandom2 and TRandom3 to fill them. For each case, print the CPU time spent in the random generator. Using the Compiler interface ACLiC • Start a new ROOT session and run the same script using ACLiC. You should see a considerable improvement in the CPU time: • root [] .x hrandom1.C++ • Copy the hrandom1.C script to hrandom2.C and modify it so to draw all the histograms after the script has finished. J. Fernández

  10. Práctica con ficheros de datos reales J. Fernández

  11. Práctica 1 • Abrir un TTree y examinar sus variables: • $ root.exe • root [0] new TBrowser • 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 J. Fernández

  12. 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)< 10 J. Fernández

  13. 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 .gif J. Fernández

  14. Resultado J. Fernández

  15. Ejercicios • Pintar una leyenda que describa el tipo de fondos y datos • Establecer la estadística de datos y fondos simulados • 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 J. Fernández

  16. Deberíais obtener algo así… J. Fernández

More Related