slide1 n.
Skip this Video
Download Presentation
Javier Fernández Menéndez Master Técnicas de Computación en Física Enero-2013

Loading in 2 Seconds...

play fullscreen
1 / 16

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

  • Uploaded on

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 Descarga de ficheros para la práctica.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

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

Download Now 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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

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


descarga de ficheros para la pr ctica
Descarga de ficheros para la práctica
  • 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

instalaci n manual de root en linux
Instalación manual de ROOT en Linux
  • 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
    • csh family:
      • setenv ROOTSYS $PWD/root
      • setenv PATH ${ROOTSYS}/bin:${PATH}
  • root.exe

J. Fernández

instalaci n manual de root en windows
Instalación manual de ROOT en Windows
  • 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

creating a function object from the command line
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.
  • 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

  • Find the class description page for TGraph to answer the following questions:
  • .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 This creates a PostScript file of the canvas named after the canvas name ( Print the file on the local printer.

J. Fernández

fitting graphs
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”)


root [] TF1 *pol4 = gr->GetFunction(“pol4”);

J. Fernández


Filling Histograms

  • This next exercise will show you how to fill histograms and take time measurements. Open the file 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

pr ctica 1
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

pr ctica 2
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

pr ctica 3
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


J. Fernández

  • 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