Presentation is loading. Please wait.

Presentation is loading. Please wait.

ROOT What & Why? ROOT Status ROOT Application ROOT Install ROOT Example ROOT References Introduction to March 13, 2003 Dae Jung CHEP.

Similar presentations


Presentation on theme: "ROOT What & Why? ROOT Status ROOT Application ROOT Install ROOT Example ROOT References Introduction to March 13, 2003 Dae Jung CHEP."— Presentation transcript:

1 ROOT What & Why? ROOT Status ROOT Application ROOT Install ROOT Example ROOT References Introduction to March 13, 2003 Dae Jung Kong @ CHEP

2 ROOT What & Why? ROOT is a Data Analysis and DAQ or other application Tool based on C/C++ PAW(Physics Analysis Workstation) is physics analysis tool using Fortran Lang. Why not PAW? Why ROOT? Very Huge Data >> Tbyte Computing Technology Regular grammar (C++) on command line Single language (compiled and interpreted) Object Oriented (use your class in the interpreter) Advanced Interactive User Interface Well Documented code. HTML class descriptions for every class. 3-d interfaces with OpenGL and X3D.

3 ROOT Status First ROOT release version 1.0 published in 1995 and update almost monthly….. Linux Unix (HP, SGI, Compaq…) Window(NT,2000) GCC, egcs, CC, g++, VC++, …. Platform & Complier

4 ROOT Applications Almost HEP/nuclear experiments in the World Other fields Economics Medical Applied physics WHY ?

5 ROOT Install Getting the source To install ROOT from source you first have to get the tar file containing the source. prompt% ftp root.cern.ch User: anonymous Password: ftp> cd /root ftp> bin ftp> get root-.source.tar.gz ftp> bye prompt% gzip -dc root-.source.tar.gz | tar -xf - Getting ready to build You may want to compile features into ROOT, which depends on third party libraries. Make sure you meet all demands for additional features before trying to enable them (see below). If you are using some Un*x, you need to have libXpm installed. On very few systems libXpm.a is not available. In that case get the pre-built version from: ftp://root.cern.ch/root/xpmftp://root.cern.ch/root/xpm Then use either environment variable XPM or "configure" flags "--with-xpm= " to specify where you installed libXpm, if you didn't install it in some generally searched directory (see more below). ROOT Install from source. You want to install in a generic directory, depending on environment variables ROOTSYS, LD_LIBRARY_PATH, and PATH. > setenv ROOTSYS /root set ROOTSYS to the `root' directory: (csh) >./configure --help now type the build commands: all shells: >./configure [change arch appropriately] > gmake [or, make -j2 for dual CPU machines] > gmake install [when run directory is not $ROOTSYS] > setenv PATH ${ROOTSYS}/bin:${PATH} add $ROOTSYS/bin to PATH > setenv LD_LIBRARY_PATH ${ROOTSYS}/lib:${LD_LIBRARY_PATH} add $ROOTSYS/lib to LD_LIBRARY_PATH > rehash > root try running root :

6 ROOT Framework

7 What Can we do with ??  Histogramming and Fitting(Gauss, Poly, exp, Landau..)  Graphics (2D, 3D)  I/O to file : specialized for histograms, Ntuples (Trees)  Collection Classes and Run Time Type Identification User Interface  GUI: Browsers, Panels, Tree Viewer  Command Line interface: C++ interpreter CINT  Script Processor (C++ compiled  C++ interpreted)

8 GUI windows, buttons, menus Root Command line CINT (C++ interpreter) Macros, applications, libraries (C++ compiler and interpreter) Three User Interfaces

9 ROOT Example hep2:2:11pm:Root_temp_527>> root *************************************************** * W E L C O M E to R O O T * * Version 3.03/07 5 August 2002 * * * * You are welcome to visit our Web site * * http://root.cern.ch * **************************************************** FreeType Engine v1.x used to render TrueType fonts. Compiled for linuxkcc. CINT/ROOT C/C++ Interpreter version 5.15.50, July 7 2002 Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }. root [0].q root [1].x file.C root [2].! ls(linux command) root [3] b = TBrowser(); Root[4].? Or.help root [0] TFile f("filter.root") root [3] f.ls() TFile** filter.root TFile* filter.root KEY: TH1F h1;1 x distribution KEY: TNtuple ntuple;1 data from ascii file

10 hep2:2:24pm:Root_temp_527>> more filter.txt 10 6 0. 0.00001 0. 0. 0. 20 6.25 0. 0.78766 0.00919 0.00007 0. 30 6.7 0. 0.78371 0.00874 0.00006 0. 40 7 0. 0.7923 0.00974 0.00009 0. 50 7.3 0. 0.82585 0.14758 0.00032 0.00001 60 7.5 0. 0.86892 0.24537 0.00147 0.00008 70 7.6 0. 0.86069 0.22308 0.00111 0.00005 80 7.85 0. 0.10788 0. 0. 0. 90 8 0.00001 0.00654 0. 0. 0. 1008.1 0.00004 0.00546 0. 0. 0. 4910 3.74 0.99409 0.99472 0.94842 0.85311 0.76737 4920 3.73 0.99413 0.99475 0.94871 0.85389 0.76855 4930 3.73 0.99417 0.99478 0.949 0.85468 0.76973 4940 3.72 0.9942 0.99481 0.94929 0.85545 0.77089 4950 3.71 0.99424 0.99484 0.94957 0.85622 0.77205 4960 3.7 0.99428 0.99487 0.94986 0.85699 0.7732 4970 3.69 0.99431 0.9949 0.95014 0.85775 0.77434 4980 3.68 0.99435 0.99493 0.95042 0.8585 0.77548 4990 3.67 0.99438 0.99496 0.95069 0.85926 0.77661 5000 3.66 0.99442 0.99499 0.95097 0.86 0.77773 5010 3.65 0.99445 0.99501 0.95124 0.86074 0.77885 hep2:2:21pm:Root_temp_527>> more filter.C //Reading " MCP Qunatum Efficiency + Polyca_2 + Al_0.1 + Al_1 + Al_3 + Al_5 microns " and making an ntuple // to read data from an ascii file and create a root file with and an ntuple. { gROOT->Reset(); FILE *fp = fopen("./filter.txt","r"); Float_t x,q,p,al_1,al_10,al_30,al_50; Int_t ncols; Int_t nlines = 0; TFile *f = new TFile("./filter.root","RECREATE"); TH1F *h1 = new TH1F("h1","x distribution",100,-4,4); TNtuple *ntuple = new TNtuple("ntuple","data from ascii file",“ x:q:p:al_1:al_10:al_30:al_50"); while (1) { ncols = fscanf(fp,"%f %f %f %f %f %f %f", &x, &q, &p, &al_1, &al_10, &al_30, &al_50); if (ncols < 0) break; if (nlines < 500) printf("x=%8f, q=%8f, p=%8f, al_1=%8f, al_10=%8f, al_30=%8f, al_50=%8f\n",x,q,p,al_1,al_10,al_30,al_50); h1->Fill(x); ntuple->Fill(x,q,p,al_1,al_10,al_30,al_50); nlines++; } printf(" found %d points\n",nlines); fclose(fp); f->Write(); } ROOT Example Cont. 1

11 hep2:2:37pm:Root_temp_527>> more filter_selection.C { gROOT->Reset(); c1 = new TCanvas("c1","The Ntuple canvas",200,10,700,780); gBenchmark->Start("ntuple1"); f1 = new TFile("./filter.root"); // Inside this canvas, we create 4 pads pad1 = new TPad("pad1","This is pad1",0.02,0.52,0.48,0.98,18); pad2 = new TPad("pad2","This is pad2",0.52,0.52,0.98,0.98,17); pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.48,0.48,21); pad4 = new TPad("pad4","This is pad4",0.52,0.02,0.98,0.48,20); pad1->Draw();pad2->Draw(); pad3->Draw();pad4->Draw(); // pad 1 gStyle->SetStatW(0.30); gStyle->SetStatH(0.20); gStyle->SetStatColor(42); pad1->cd(); // MCP Quantum Efficiency Polycarbonate 2 micron pad1->GetFrame()->SetFillColor(38); pad1->GetFrame()->SetBorderSize(8); ntuple->SetMarkerColor(1); ntuple->Draw("q:x","x>0"); ntuple->SetMarkerColor(2); ntuple->Draw("p:x","x>0","same"); c1->Update(); // pad2 gStyle->SetStatW(0.30); gStyle->SetStatH(0.20); gStyle->SetStatColor(42); pad2->cd(); // Aluminum 0.1 micron // Aluminum 1 micron pad2->GetFrame()->SetFillColor(38); pad2->GetFrame()->SetBorderSize(8); ntuple->SetMarkerColor(1); ntuple->Draw("al_1:x","x>0"); ntuple->SetMarkerColor(2); ntuple->Draw("al_10:x","x>0","same"); c1->Update(); // pad 3 gStyle->SetStatW(0.30); gStyle->SetStatH(0.20); gStyle->SetStatColor(42); pad3->cd(); // Aluminum 3 micron // Aluminum 5 micron pad3->GetFrame()->SetFillColor(38); pad3->GetFrame()->SetBorderSize(8); ntuple->SetMarkerColor(1); ntuple->Draw("al_30:x","x>0"); ntuple->SetMarkerColor(2); ntuple->Draw("al_50:x","x>0","same"); c1->Update(); // Pad 4 gStyle->SetStatW(0.30); gStyle->SetStatH(0.20); gStyle->SetStatColor(42); // MCP Quantum Efficiency + Polycarbonate 2 micron + Aluminum 0.1 micron // MCP Quantum Efficiency + Polycarbonate 2 micron + Aluminum 1 micron // MCP Quantum Efficiency + Polycarbonate 2 micron + Aluminum 3 micron // MCP Quantum Efficiency + Polycarbonate 2 micron + Aluminum 5 micron // pad4->cd(); pad4->GetFrame()->SetFillColor(38); pad4->GetFrame()->SetBorderSize(8); ntuple->SetMarkerColor(1); ntuple->Draw("q*p*al_1:x","x>0"); ntuple->SetMarkerColor(2); ntuple->Draw("q*p*al_10:x","x>0","same"); ntuple->SetMarkerColor(3); ntuple->Draw("q*p*al_30:x","x>0","same"); ntuple->SetMarkerColor(4); ntuple->Draw("q*p*al_50:x","x>0","same"); c1->Update(); gStyle->SetStatColor(19); gBenchmark->Show("ntuple1"); } ROOT Example Cont. 2

12 Pad 1 Pad 3 Pad 2 Pad 4 ROOT Example Cont. 3

13 ROOT References http://root.cern.chhttp://root.cern.ch : ROOT Home page http://www-cpd.fnal.gov/root/http://www-cpd.fnal.gov/root/ : ROOT Fermilab


Download ppt "ROOT What & Why? ROOT Status ROOT Application ROOT Install ROOT Example ROOT References Introduction to March 13, 2003 Dae Jung CHEP."

Similar presentations


Ads by Google