COMANDOS EN ROOT UTILES
Instalacion en fpmac116
ROOT no está instalado como paquete rpm, por eso no está en la base de datos de RPM. Los de root distribuyen un "tarball" que se descomprime en cierto directorio, por ejemplo "/opt". Si haces un listado de ese directorio en fpmac116 verás que hay un link simbólico para root apuntando a la versión 5.16
Definicion de las variables de entorno:
1-
Definir $ROOTSYS donde tengamos descargado el paquete root (en mi caso, dentro de fpmac116, en el directorio /opt/root):
export ROOTSYS=/opt/root
2-
Añadir ROOTSYS/bin en mi path:
export PATH=$PATH:$ROOTSYS/bin
3- Establecer las
librerias del Path:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
4- Ir al directorio local donde esta instalado ROOT (/opt/root/) y poner:
. bin/thisroot.sh
El nuevo script *thisroot.sh *ajustara correctamente ROOTSYS, LD_LIBRARY_PATH y otros paths.
NOTA: (Estas 4 primeras instrucciones hay que hacerlas cada vez que abro una ventana nueva o definirlas en un script y ejecutarlo al comienzo)
5- Finalmente para
correr ROOT, simplemente escribir:
Root
Y se abrirá una pantalla del tipo:
[iglesias@fpmac116 ~]$ root
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 5.16/00 27 June 2007 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
Compiled on 29 June 2007 for linux with thread support.
CINT/ROOT C/C++ Interpreter version 5.16.21, June 22, 2007
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0]
para salir de root:
root[ ] .q
NTUPLES
Para abrir la ntuple, si estamos situados en el mismo directorio donde se encuentra la ntuple, simplemente poner:
root [0] TFile f1("ntuple.root")
Para ver el contenido de la ntuple:
root [1] f1.ls()
TFile** ntuple.root
TFile* ntuple.root
KEY: TNtuple confucius;1 confucius
KEY: TNtuple eff;1 eff
KEY: TNtuple hit;1 hit
KEY: TNtuple track;1 track
En este caso esta formada por 4 ntuples distintas: "confucius", "eff", "hit" y "track".
Para ver el contenido de una de esas ntuples:
root [2] eff->Scan()
************************************************************************************************************
* Row * evt * pdg * p * pt * theta * phi * vtxx * vtxy *
************************************************************************************************************
* 0 * 0 * 13 * 2.0000014 * 1.8400890 * 1.9734002 * 2.8171234 * 0 * 0 *
* 1 * 0 * 13 * 2.0000014 * 1.928532 * 1.3026561 * 0.9479593 * 0 * 0 *
* 2 * 0 * 13 * 2.0000014 * 0.9553816 * 0.4980239 * 1.3556954 * 0 * 0 *
* 3 * 0 * 13 * 2.0000016 * 1.7393161 * 2.0870847 * 2.2315609 * 0 * 0 *
* 4 * 0 * -13 * 2.0000014 * 0.7537208 * 0.3864041 * -1.209654 * 0 * 0 *
* 5 * 0 * 13 * 2.0000014 * 1.0498882 * 2.5889437 * 2.3403301 * 0 * 0 *
* 6 * 0 * -13 * 2.0000014 * 1.9183646 * 1.8574986 * -1.404702 * 0 * 0 *
* 7 * 0 * -13 * 2.0000014 * 1.9324486 * 1.3101500 * -1.996732 * 0 * 0 *
* 8 * 0 * -13 * 2.0000014 * 1.9608719 * 1.3726607 * 0.0610460 * 0 * 0 *
* 9 * 0 * -13 * 2.0000014 * 0.8833087 * 0.4574414 * 1.2320897 * 0 * 0 *
* 10 * 0 * 13 * 2.0000014 * 1.2723186 * 0.6895095 * -1.434904 * 0 * 0 *
root [3] hit->Scan()
************************************************************************************************************
* Row * evt * side * layer * x * y * z * r * theta *
************************************************************************************************************
* 0 * 0 * 0 * 0 * 1.7663962 * 11.832013 * 22 * 11.963138 * 0.4980544 *
* 1 * 0 * 0 * 0 * 2.6196887 * -8.563647 * 22 * 8.9553794 * 0.3865800 *
* 2 * 0 * 0 * 1 * 3.7982239 * -14.62814 * 37.130939 * 15.113214 * 0.3865475 *
* 3 * 0 * 0 * 2 * 4.5869855 * -25.76406 * 64.490577 * 26.169204 * 0.3854820 *
* 4 * 0 * 0 * 0 * 2.0843827 * -6.676621 * 22 * 6.9944214 * 0.3078224 *
* 5 * 0 * 0 * 1 * 2.1919360 * -6.675683 * 37.130939 * 7.0263309 * 0.1870197 *
* 6 * 0 * 0 * 2 * 2.2845237 * -6.662490 * 64.490577 * 7.0432825 * 0.1087829 *
* 7 * 0 * 1 * 0 * -10.08300 * 9.0754499 * -22 * 13.565794 * 2.5890369 *
* 8 * 0 * 0 * 0 * 1.4301350 * -11.20565 * 21.998750 * 11.296547 * 0.4743959 *
* 9 * 0 * 0 * 0 * 4.2492046 * 9.9453067 * 22 * 10.815030 * 0.4568988 *
* 10 * 0 * 0 * 0 * 3.1762721 * 7.7407164 * 22 * 8.3670425 * 0.3634267 *
Para ver el total de variables que hay dentro de cada ntuple, se pone nombre_de_la_ntupla->Print():
root [7] hit->Print()
******************************************************************************
*Tree :hit : hit *
*Entries : 5366 : Total = 176851 bytes File Size = 91204 *
* : : Tree compression factor = 1.00 *
******************************************************************************
*Br 0 :evt : *
*Entries : 5366 : Total Size= 22074 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 1 :side : *
*Entries : 5366 : Total Size= 22080 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 2 :layer : *
*Entries : 5366 : Total Size= 22086 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 3 :x : *
*Entries : 5366 : Total Size= 22062 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 4 :y : *
*Entries : 5366 : Total Size= 22062 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 5 :z : *
*Entries : 5366 : Total Size= 22062 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 6 :r : *
*Entries : 5366 : Total Size= 22062 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 7 :theta : *
*Entries : 5366 : Total Size= 22086 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
Para hacer plots de las variables de las ntuples:
root [14] track.Draw("trackphi")
Para dibujar variar graficas diferentes:
root [2] TCanvas *MyC = new TCanvas ("Myc","Test Canvas",1)
root [3] MyC ->Divide(4,3)
root [4] MyC->cd(1)
root [5] eff->Draw("pdg")
root [6] MyC->cd(2)
(class TVirtualPad*)0xa32fb08
root [7] eff->Draw("p")
root [8] MyC->cd(3)
....
-- Main.iglesias - 05 Feb 2009
to top