Home
ROOT
Contents
1. fPx lt 0 root tree gt Draw fPx abs fPdgCode 211 El Tree contiene TParticles Trees 9 Conectar una clase con un rbol root TParticle particle 0 root tree gt SetBranchAddress Particles amp particle Leer una entrada root tree gt GetEntry 0 root particle gt Print Ze M root tree gt GetEntry 1 root particle gt Print Estos comandos puede usarse en un lazo root 5 particle Printi l IParticle piu p Browser H ROOT Object Browser E ol x nodo olle aj om sj Contents of ROOT Files hist2 raat 0 El TBrowser puede usarse Abrir ficheros root B Navegar por ellos Earnaor sessions C afsicern ch user Aigrosseo sum Mirar a los T Trees Ee t am st2 roo Iniciar un T Browser root TBrowser t Abrir el fichero Navegar por el fichero Groot SA EnerevO M EO J GetFirstDaughter PROOF Sessions ZS GetFirstMother A GetLastDaughter GetNDaughtersQ i afsicern chiuser Mgrosseo sum 3h GetSecondMother A IsPrimary Bro Pintar un histograma prin Jamo ro Oe GAlhista root 3s Rho Mo Bp TAtt3D amp SA Kinematics root E J TAL Line TObject Theta B Evento E A A A d Ste 3 fCalc Mass fDaughter 2 rm ree 1 Cambiar el estilo GO joo Ye o Ch a Are dh fStatusCode E m ZS Height Acceder a un Tree Diferencia entre punteros y v
2. 1 L L L 800 1000 true multiplicity BER File Edit View Options Tools Help ql i NC us i il e p il Wo D 2 i L M A ti lj deg goe d e Ch i qi E he a i dl ES I Nota histogramas de ejemplo esta en hist2 root 32 Ficheros La clase TFile permite guardar cualquier objeto ROOT en el disco Crear un histograma como antes root h new TH1F hist my hist Bins Entries 10 O 10 Abrir un fichero para escribir iis aes EDU root file TFile Open file root RECREATE Escribir un objeto en el fichero root h gt Write Cerrar el fichero root h gt Close http root cern ch root html TFile html 33 Ficheros 2 Abrir el fichero para leer root file TFile Open file root Leer un objeto del fichero root hist gt Draw Leer el objeto en una macro TH1F h 0 file gt GetObjet hist h Qu mas hay en fichero root Je Abrir un fichero al iniciar root root hist root Acceder al fichero usando fileO Ficheros 3 Entrar en root y abrir todos los ficheros del directorio para leer root root root 0 Attaching file chain rootas _file0 Attaching file hist root as _file1 Attaching file hist2 root as _file2 Attaching file tree root as _file3 Attaching file tree2 root as _file4 Cambiar un fichero en particular root file1 gt cd Qu hay en el fichero root Je 36 Estructuras
3. TF1 f new TF1 f sin x x 0 10 f Draw TF1 g g new TF1 g x 0 10 g Draw C mo nos afecta esto en ROOT I e A la hora de c crear un objeto de forma r pida TCanvas cl new TCanvas canvas temporal de nombre cl cl gt SetLineColor kRed delete cl TCanvas micanvas crea un canvas con nombre micanvas micanvas SetLineColor kRed Se crea con el constructor parametros por defecto TBrowser t1 new TBrowser borrarlo antes de salir delete t1 YBevoevwsen C2 t2 new TBrowser TBrowser 0x426e6c0 TBrowser p as no habr a que borrarlo p Delete borrarlo cerrarlo en este caso TBrowser m amp p Truco Utiliza el tabulador para completar el comando o averiguar la lista de sus m todos y argumentos del mismo Ejemplo o IS Herencia en C ROOT MyClass h class MyClass public MyClass MyClass int x Inheritance for YourClass h include MyClass h class YourClass public MyClass public MyClass char text YourClass int GetX virtual void Draw protected SetX int x private int X There are two major advantages of inheritance Common implementation It is easy to extend a class to add some functionality without touching or copying the code of the base class You need not to replicate the code of the base class A lot of ROOT classes inherit from TNamed Object
4. Breve introducci n a Linux GNU Linux Es un sistema operativo de fuente libre y gratuito En el entorno cientifico y en particular la fisica de particulas Linux es mayoritario Scientific Linux CERN SLC http linux web cern ch linux scientific5 Existen aplicaciones que permiten ejecutar Linux dentro de Windows Sin necesidad de crear particiones de disco VMWare emulaci n completa de Linux http www vwmare com Cygwin entorno de aplicaciones Linux exportadas a windows http www cygwin com Portable Ubuntu corre Ubuntu desde Windows y es facilmente portable Linux Usuarios Usuarios Linux es un sistema multi usuario Cada usuario posee unos permisos concretos lectura escritura ejecuci n El usuario root puede hacer casi todo usuario alumno pwd alumnos 2012 Grupos Cada usuario pertenece al menos a un grupo Los permisos se pueden regular a nivel usuario Linux Usuarios Terminolog a Ficheros archivos documentos Directorios carpetas Cada usuario posee unos permisos concretos lectura escritura ejecuci n Todos los ficheros pertenecen a algun usuario que controla su visibilidad para el resto de usuarios grupos Directorios especiales Directorio actual ipru bame gt Directorio superior Directorio ra z Directorio de usuario home alumno Subdirectorios El camino hasta un directorio se construye encandenando los directorios intermedios separa
5. OOT Tutorial Contenido Introducci n pr ctica a ROOT Iniciando ROOT Funciones Macros Histogramas Ficheros Trees TBrowser Crear clases de ROOT Debugging Nomeclatura Azul lo que tecleas Rojo lo que obtienes 23 primeros pasos en ROOT Iniciando ROOT root I La consola de ROOT root 2 3 root int i 42 root log 5 root printf 9o din i Historia Con las flechas de direcci n Buscar con CTRL R Ayuda en linea root new TF1 lt TAB gt TF1 TF1 TF1 TF1 const char name const char formula Double t xmin 0 Double t x max 1 24 primeros pasos en ROOT 2 Comandos multi l nea root l Comandos multil nea root for 120 i 3 i printf 9o dn i O root for i20 i lt 3 i end with abort gt printf Yd n i end with H abort gt Cuando algo sale mal root printf d n i end with Y abort gt O Bert ge CL Macros Combina l neas de c digo en macros Macro sin nombre sin par metros macro1 C d for Int t iz0 i 3 i printf din i Ejecutando macros root x macro1 C root I macro1 C root I b macro1 C sin entorno gr fico root I q macro1 C salir despu s de ejecutar Macros 2 Macro con nombre puede tener par metros macro2 C void macro2 Int t max 10 i for Int t i20 i lt max i Ejecutando macros root x ma
6. WesChus cttr d MC acttew ia fr s b 20g Toit Ut o ETLE A Eat ral A nto 1 Vestam Cor teeter Mm ated ware ge Reemi er aTr Os recomiendo encarecidamente hacer este tutorial http nadron physics fsu edu skpark docu ment ROOT root beginers Crear clases Cualquier clase de c puede usarse en root Las clases derivadas de T Objects pueden usarse directamente con muchas otras clases de root TList TObjArray include lt TObject h gt include lt TString h gt class TAlumnos public TObject private TString fFirstName Int_t fAge public const TString GetFirstName const return fFirstName Int t GetAge const return fAge TAlumnos const char firstname Int t age ClassDef TAlumnos 1 4 fFirstName firstname fAge age 0 Crear clases 2 Incluir la clase en ROOT root L TAlumnos C Usala root s new TAlumnos Pepe 23 root s gt GetFirstName El objeto puede escribirse en un fichero Puedes mostrar el contenido de cualquier clase de ROOT root s gt Dump Hecursos P gina principal de ROOT http root cern ch e Gu a de referencia de clases http root cern ch root html e Tutorial C http www cplusplus com doc tutorial http www root fnal gov root CPlusPlus index html e Tutorial http root cern ch drupal content tutorials and courses e Gu a del usuario http root cern ch drupal content users
7. ap0 has no effect on its actual parameters 5 6 the function swap1 changes the value of a and b 7 8 the function swap2 is called with the addresses of a and b it does not change its arguments the addresses but it changes the values of a and b Comments C passes arguments by value To change the objects passed to a function they must be passed by reference or by pointer 5 6 7 8 Passing large objects by values 3 4 introduces performance problems because large objects have to be created as local variables Passing arguments as reference or pointer does not introduce this performance penalty En macros ficheros externos oi vamos a pasar argumentos o tenemos muchos objetos es mejor hacerlo como punteros o referencias no como variables reales by value puede no hacer lo que queremos Implica crear variables locales en la funcion m todo ROOT trabaja mejor con punteros objetos temporales pues permiten gestionar la memoria ya que podemos borrarlos limpiar memoria C mo nos afecta esto en ROOT I ROOT tiene muchas clases para representar objetos Ejemplo TF 1 todas las funciones en ROOT empiezan con T Hay un constructor entre otros que toma cuatro argumentos TEL TEL comer i name Const e ox formula Doi xmin 0 De le t xmax 1 Comolos llamo uso Objeto variable real TF1 f t Sin x 7x 0 10 f Draw TF1 g g TFI gt x 0710 g Draw Puntero
8. ariables l Una variable es una asociaci n entre un nombre y un objeto int A objeto permanente se borra al final del bloque programa funci n loop if else autom ticamente Un puntero es un objeto que se refiere apunta a otro objeto Tienen la direcci n f sica de memoria a la que apunta int D puntero es un objeto temporal hay que borrarlo cuando no lo necesitemos Una referencia es un alias de un objeto pA SA Diferencia entre punteros y variables Il Si necesitamos el objeto al cual se refiere el puntero usamos el operador pA nos d el valor del objeto al que apunta A en este caso Si necesitamos la direcci n f sica de memoria de un objeto por ejemplo para inicializar un puntero usamos el operador amp pA 8A amp objeto nos da la direccion de objeto Si en vez de int es un objeto de tipo clase con m todos usamos cuando es un objeto real variable usamos cuando es un puntero Los punteros se pueden borrar comando delete equivale a limpiar memoria pero no estamos borrando el objeto al que apuntan El puntero es temporal gH eso si se crea sin el comando new hay que referenciarlo a un objeto real variable En ROOT ONT linea de comandos se puede usar indistintamente gt pues CINT el int rprete no es extricto x otra ventaja m s pero C c digo en macros requiere object member objectpointer gt member Ejemplo 1 root 0 T Dati
9. cro2 C 12 Cargando macros root L macro2 C root macro2 12 Macros o modo en linea Utiliza la consola para probar lineas sueltas mientras escribes tu c digo Pon el c digo que vayas a re utilizar en macros Funciones La clase TF1 permite pintar funciones root f new TF1 func sin x O 10 func es un nombre nico sin x es la f rmula 0 10 es el rango x de la funci n root f gt Draw El estilo de la funci n puede cambiarse en la l nea de comando con el men root f gt SetLineColor kRed La clase TF2 3 es para gr cas de 2 y 3 dimensiones http root cern ch root html TF1 html Histogramas Contiene datos bineados probablemente la clase m s utilizada en ROOT por los f sicos Crear un TH1F uni dimensional precision float root h new TH1F hist my hist Bins Entries 10 O 10 hist es un nombre unico my hist Bins Entries son el titulo y las etiquetas del eje x y 10 es el n mero de bines 0 10 es el rango x de la funci n acl File Edit View Options Inspect Classes Llenar el histograma root h gt Fill 3 5 root h gt Fill 5 5 Pintar el histograma root h gt Draw 29 Histogramas Interactividad e Ir al menu View gt Editor ER gt e Pinchar en el histograma Podemos modificar un mont n de par metros g Eile Edit View Options Tools e File Edit RM Options Tools Editor Toolbar Event Sta
10. de datos en ROOT TTrees e Los TTree s han sido disenados para soportar colecciones muy largas de objetos e Permiten acceso directo y aleatorio a cualquier entrada del rbol aunque el acceso secuencial va mejor e Los TTree s tienen ramas branches y hojas leaves Se puede leer un subconjunto de las ramas e Hay m todos de alto nivel como TTree Draw que iteran sobre las entradas con expresiones de selecci n 44 e Se pueden ver los TTree s usando e TBrowser e Se pueden analizar los TTree s usando TTreeViewer Trees La clase I Tree es el principal contenedor para guardar datos Puede guardar cualquier clase o tipo b sico Cuando lees un rbol algunas ramas pueden desactivarse para agilizar el an lisis http root cern ch root html T Tree html 1 Event Branches File Events 35 Estructura de un T Tree e Cada fichero de datos es una colecci n de N SUCesos e Cada suceso tiene estructura de rbol con varias ramas Cada rama puede contener un valor ej N mero de SUCeSOS O una colecci n de valores momento transverso de los jets e La estructura de cada suceso puede ser muy compleja RECO PAT o plana Flat Trees Trees 2 Acceder a un rbol que contiene clases Los miembros son accesibles sin la librer a apropiada Ejemplo tree root con magnitudes cinem ticas de ALICE root tree root root tree gt Draw fPx root tree gt Draw fPx
11. dos por e el camino a mi directorio Linux Comandos Los comandos se ejecutan tecleando su nombre y pulsando la tecla enter Los comandos aceptan opciones y argumentos gt gt comando opcion ipru bame gt gt comando o gt gt comando opci n bla gt gt comando o bla gt gt man comando gt gt comando help Linux Directorios Crear un directorio gt gt mkdir nombrecarpeta Borrar un directorio vac o gt gt rmdir nombrecarpeta Moverse a un directorio gt gt cd nombrecarpeta Averiguar cual es mi directorio actual gt gt pwd N Linux Ficheros Obtener la lista de ficheros en el directorio actual gt gt ls directorio fichero Opciones gt gt Is l Con detalles gt gt Is a Todos incluido ocultos gt gt Is t Ordenar por fecha de modificacion gt gt Is r Ordenar inversa gt gt Is rhrt combinando Borrar un fichero directorio gt gt rm r fichero Renombrar Mover un fichero gt gt mv ficherooriginal ficherofinal Copiar un directorio fichero gt gt cp r fichero directorio Linux Permisos Al hacer un listado largo de un fichero Is l o directorio Is Id obtenemos rw r r 1 userl group 0 2009 10 23 17 51 fichero txt 2009 10 23 17 52 Fecha y hora de la ultima modificaci n ni XI X r x usuario u i otros o gt fichero X ejecuci n Tamano del fichero en bytes Triadas de p
12. edan motos coches camiones etc Las caracter sticas comunes s lo de definen una vez Luego en las clases m s especializadas se a aden atributos particulares En los camiones por ejemplo capacidad de carga tipo de mercanc a etc C Tipos fundamentales Nombre char short int int long int float double long double bool Qu representa Un car cter Un entero corto Un entero Un entero con mayor rango de validez Un real Un real de doble precisi n Un real de doble precisi n y mayor cierto true o falso false Entero real l gico Entero Entero Entero Entero Real Real Real L gico C Operadores Aritm ticos Operador Il Il Funcion asignacion multiplicacion division modulo resto suma resta incremento opera y asigna Uso int i 7 double r 3 5 i double t r 1 2 i 21 6 i 3 double rt r t r rt t int i O int j i j 0 int k i k 0 r 2 6 r r 2 6 y tm 2 6 Jz r 2 6 C Operadores L gicos Operador Funci n Uso lt menor que i lt 5 Ss menor o igual r lt 5 gt mayor que gt 5 gt mayor o igual i gt 5 igualdad i 5 i desigualdad i 5 NOT l gico true false amp amp Y l gico i lt 5 amp j gt 4 O l gico Toce BD E C if if condici n 1 printf Se cumple la condici n 1 n else if condici
13. ermisos d directorio W escritura usar 1s E EK link enlace x lectura formatos m s legibles gt gt chmod ulglola rw x fichero C ROOT C Es un lenguaje de programaci n dise ado a mediados de los a os 80 Es una extensi n o un superconjunto del lenguaje C Incluye mecanismos que permiten la manipulaci n de objetos Por tanto C es un lenguaje h brido por su capacidad de hacer programaci n estructurada al igual que C y programaci n orientada a los objetos Object Oriented Programming Programaci n Orientada a Objetos Clase y Objeto Objeto Un objeto es algo de lo que hablamos y podemos manipular Por ejemplo mi coche rojo Yo puedo pintarlo de amarillo cambiarle las ruedas etc Clase Una clase describe los objetos de un mismo tipo Esto incluye las propiedades y el comportamiento de los objetos Todos los objetos son instancias de una clase En el ejemplo tenemos el objeto mi coche rojo y la clase coches Los coches tienen varios atributos entre ellos el color la potencia el peso etc Mi coche es de color amarillo tiene 100 CV y pesa 1 200 kg Programaci n Orientada a Objetos Herencia La herencia es una relaci n caracter stica de la OOP Puede expresar tanto especializaci n como generalizaci n Evita definir m ltiples veces caracter sticas comunes a varias clases Ejemplo veh culos de transporte por carretera Todos tienen ruedas motor asientos Clases que her
14. guide 42
15. me now root 1 TDatime o root 2 p amp now root 3 p gt Print es el mismo objeto Date Time Thu Mar 06 17 13 42 2013 root 4 p Print igual que now Print Date Time Thu Mar 06 17 13 42 2013 root 5 delete p Ejemplo 2 void swapO Double t x Double t y Explanation Double t temp x swap0 x y x is a Double_t initialized with the value of the first actual argument y temp y is a Double tinitialized with the value of the second actual argument the values of x and y are swapped void swap1 Double t amp x Double t amp y swap Double t temp x x is an alias for the first actual argument a y is an alias for the second actual argument y temp the values of x and y are swapped void swap2 Double t x Double t y swap2 Double t temp x y y y temp root 0 L swap C root 1 Double ta 1 root 2 Double t b 2 root 3 swapO a b root 4 cout lt lt a2 lt lt a lt lt b lt a 1 b 2 root 5 swap1 a b root 6 cout lt lt a lt lt a lt lt b lt a 2 b 1 root 7 swap2 amp a amp b bn E 9d lt lt az lt lt a lt lt b lt lt b lt lt endl a x is a pointer to Double_t initialized with the value of the first actual argument y is a pointer to Double_t initialized with the value of the second actual argument the values of the Double_t objects x and y are pointing to are swapped 3 4 the function sw
16. n 2 printf Se cumple la condici n 21n else printf No se cumple ninguna condici nin C for for int i20 i lt 5 i printf d n i El lazo for declara int i e inicializa un contador i 0 pone un final i lt 10 y nos indica el tamano de cada paso i En el ejemplo tendremos 0 4 ROOT http root cern ch ROOT es un entorno Orientado a Objetos programado en C para el desarrollo de aplicaciones que manejen grandes vol menes de datos Proporciona entre otras cosas Un int rprete de C CINT Algoritmos de an lisis estad stico avanzados Herramientas de visualizaci n cient fica con gr ficos 2D y 3D Un avanzado interfaz de usuario gr fico En nuestro caso particular PCs de las pr cticas cargamos el entorno ROOT con el comando linux source opt root bin thisroot sh ROOT Compilar o Interpretar ROOT permite ambas opciones Compilar Pros ejecuci n m s r pida soporta todo C Cons compilar lleva tiempo y es m s estricto con el lenguaje Interpretar Pros ideal para pruebas r pidas Cons ejecuci n m s lenta sobre todo en programas grandes 20 ROOT Ejecutando c digo root mycode C root l root 0 x mycode C root l root 0 L mycode C root 1 mycode root mycode C root root 0 x mycode C root root 0 L mycode C o formas equivalentes ROOT interpretado ROOT compilado 3 formas equivalentes R
17. s of all of these classes can have names and titles http root cern ch root html TNamed html which inherits from TObject http root cern ch root html TObject html YourClass int x int y int GetY virtual void Draw private int y IE e Common behavior Inheritance creates a is a or better is usable as relationship Objects of the derived class can be used everywhere where objects of the base class can be used One can write functions with base class objects as arguments Caution this way of using inheritance works only if used via reference or pointer Shape shape new Shape n erect new Triangle shape 1 new Rectangle for int i 0 i lt n i shapeli gt Draw TOdject Tite st Torbay Th repo Mende e ten had y 00T TRreach Pray Clan IST WaRoere rm sa hin 1007 7 m d ada Seneca fain ote Bead aD werni Vos aes Qatar fond bot dy P sis Booch mioctery feecean ed erg Ten Te The sc Life Gio d as fetter Dio dhep fr s b Ce ng eri abun y E osi elegy Ca do La ios Cebt tes Bet pa Cou gem fr Cats perry Festa Osteen Liar din des O rr Con tert Leda frei das Otat L pp in rar t EI ILI E s3t Ter BC mp hc ee rer LEDET derby stet fr i s a step ary freih aC och ed rary os Da au de es e o Les Se ected PEA dag dos seek WR esCEus cba AI ps do oblate O
18. tros mostrados en l nea de comandos ee en el canvas D Su taa na LY ly C A Ra Linea de comando root h gt Fit gaus Otras funciones pre definidas polN expo landau Ajustes e Los par metros del ajuste salen en el texto Con el bot n derecho sobre el resum n del histograma se pueden anadir tambi n ah SetOptFit Media 1 0 Sigma 2 0 Podemos ajustar solo en NN un intervalo Eile Edit View Options Tools Histograma from Chi square N p Linear fit A ga FT Add ts mpty bins weights 1 M Use Graig Draw Options SAME No drawing Do not store draw Fit Panel x F DataSet TH1F h S it Function pe Predef 1D gaus peration Nop C Add Cony gaus Selected gaus General Minimizatio Fit Settings Method WH LIB Minuit N NO NAME 1 constar MIGRAD pen AL UE 2 Mean 3 igm L a jx n AAA h 10001 Entries Mean 1 012 RMS 2 001 x Indf 59 34 70 Constant 397 9 4 9 Mean 1 011 0 020 Sigma 1 995 0 014 Fit Reset Close ll RGE F n Z CES T Histogramas 2D root h gt Draw root h gt Draw LEGO root h2 gt Draw COLZ ge ken o m amp KA 2 o o o La eS ici x File Edit View Options Tools Help Entries 1 824904e 07
19. tusbar Style Binning e Pinchar en el eje e Renombrarlo mm n e m Fill 7 Histogram Plot 62D C 3 D Error No Errors Style no Line y Simple Drawing Show markers Draw bar chart F Bar option Marker B 35 Histogramas 2 Rebinear root h gt Rebin 2 Cambiar los rangos Con el rat n Con el men contextual Con la l nea de comando root h gt GetXaxis gt SetRangeUser 2 5 En escala logar tmica bot n derecho en el rea blanca en el lado del canvas y selecionar SetLogx linea de comandos root gPad SetLogy Nota histograma de ejemplo est en hist root http root cern ch root html TH bim 30 Histogramas Ejercicio e Hacer una macro que llene un histograma con una distribuci n aleatoria de forma gaussiana Media 1 Varianza 2 Entries 10000 220 RMS 1879 Intervalo 5 5 200 180 Ayuda Wo hay que crear una funcion 140 gaussiana de variable x 120 gaussiana en TF1 es gaus 100 y hay que meter parametros 80 con SetParameter usamos la funcion para generar igs valores con a esa distribucion 40 llenar un THIF en el intervalo 20 con el metodo FillRandom 0 Ajuste de Histogramas Interactivo E Bot n derecho y elegir fit panel Et Seleccionar la funci n y click en fit Ajustar par me
Download Pdf Manuals
Related Search
ROOT root insurance roots root beer root beer float rootstech 2025 rootsmagic rooted rooted synonym rooter hero root 123 root financial rootkit root mean square root car insurance root vegetables root insurance reviews rootstock root sports root insurance company root words roots picnic 2025 roots of pacha root android root sports stream roots natural kitchen
Related Contents
Radio Shack TRC-239 User's Manual MANGA170 取扱説明書 Instruction Manual for the USB Car Data Recorder Steps to Follow Samsung Galaxy Note 2 manual de utilizador All Terrain Vehicle Service Manual Kidde 0910UK User's Manual Copyright © All rights reserved.
Failed to retrieve file