ROOT TOOLKIT (I) Técnicas Fundamentales de Simulación, Reconstrucción y Análisis de Datos en Física Experimental de Partículas Isidro González Caballero.

Slides:



Advertisements
Similar presentations
Introduction to C++ An object-oriented language Unit - 01.
Advertisements

Tahir Nawaz Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a.
C++ Language Fundamentals. 2 Contents 1. Introduction to C++ 2. Basic syntax rules 3. Declaring and using variables.
Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Software. What Is Software? software –Also called Computer programs –Are a list of instructions –Instructions are called code –CPU performs the instructions.
CIS 101: Computer Programming and Problem Solving Lecture 8 Usman Roshan Department of Computer Science NJIT.
C# Programming: From Problem Analysis to Program Design1 2 Your First C# Program C# Programming: From Problem Analysis to Program Design 2 nd Edition.
Chapter 6. 2 Objectives You should be able to describe: Function and Parameter Declarations Returning a Single Value Pass by Reference Variable Scope.
General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.
C# Programming: From Problem Analysis to Program Design1 2 Your First C# Program.
1. 2 FUNCTION INLINE FUNCTION DIFFERENCE BETWEEN FUNCTION AND INLINE FUNCTION CONCLUSION 3.
Guide To UNIX Using Linux Third Edition
LIGO-G0200XX-00-M Interactive DMT with Root John G. Zweizig LIGO, Caltech.
C++ Functions. 2 Agenda What is a function? What is a function? Types of C++ functions: Types of C++ functions: Standard functions Standard functions.
Introduction to ROOT1 Summer Students Lecture 10 July 2007 Ren é Brun CERN/PH/SFT Introduction to ROOT
Introduction to C++ - How C++ Evolved Most popular languages currently: COBOL, Fortran, C, C++, Java (script) C was developed in 1970s at AT&T (Richie)
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Sept 11, 2003ROOT Day1, Suzanne Panacek39 ROOT An object oriented HEP analysis framework. Day 1.
ROOT An object oriented HEP analysis framework.. Computing in Physics Physics = experimental science =>Experiments (e.g. at CERN) Planning phase Physics.
Intro. to Game Programming Want to program a game?
ROOT: A Data Mining Tool from CERN Arun Tripathi and Ravi Kumar 2008 CAS Ratemaking Seminar on Ratemaking 17 March 2008 Cambridge, Massachusetts.
Computing IV Visual C Introduction with OpenCV Example Xinwen Fu.
Herramientas de simulación, reconstrucción y análisis de datos en Física de Partículas (II): ROOT Javier Fernández Menéndez Master Técnicas de Computación.
Introduction of ROOT Yao. ROOT Development In the mid 1990's, René Brun and Fons Rademakers, they had lead successful projects such as PAW, PIAF, and.
Capture and Replay Often used for regression test development –Tool used to capture interactions with the system under test. –Inputs must be captured;
CS161 Topic #21 CS161 Introduction to Computer Science Topic #2.
A First Book of C++: From Here To There, Third Edition2 Objectives You should be able to describe: Function and Parameter Declarations Returning a Single.
21-Apr-2005J. Adamczewski1 DVEE C++ course 2005 The ROOT framework 1: Introduction.
Introduction to ROOT May May Rene Brun/CERN.
Old Chapter 10: Programming Tools A Developer’s Candy Store.
Introduction to ROOT1 Summer Students Lecture 20 July 2005 ftp://root.cern.ch/root/SummerStudents2005.ppt Introduction to ROOT.
Chapter 1 Introduction to Computers and C++ Programming Goals: To introduce the fundamental hardware and software components of a computer system To introduce.
Python From the book “Think Python”
Rossella Lau Lecture 1, DCO10105, Semester B, DCO10105 Object-Oriented Programming and Design  Lecture 1: Introduction What this course is about:
9/2/ CS171 -Math & Computer Science Department at Emory University.
CINT C++ Interpreter update ROOT2001 at Fermi-Lab Masaharu Goto.
Introduction to ROOT1 Summer Students Lecture 10 July 2007 Ren é Brun CERN/PH/SFT Introduction to ROOT
THtml  THtml will generate >=1 doc.root file .html pages generated from doc.root files by April (Feb doesn't exist)  Bertrand: extract doc for online.
ROOT What & Why? ROOT Status ROOT Application ROOT Install ROOT Example ROOT References Introduction to March 13, 2003 Dae Jung CHEP.
C++ Programming Lecture 11 Functions – Part III By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
CHEP 2013, Amsterdam Reading ROOT files in a browser ROOT I/O IN JAVASCRIPT B. Bellenot, CERN, PH-SFT B. Linev, GSI, CS-EE.
ReNeW Reference Net Workshop Presenter Yao Sun. The ReNeW Features  High-level Petri Nets (Support Predicate)  Place/Transition Nets  Petri Nets with.
BOĞAZİÇİ UNIVERSITY DEPARTMENT OF MANAGEMENT INFORMATION SYSTEMS MATLAB AS A DATA MINING ENVIRONMENT.
ROOT Tutorials - Session 51 ROOT Tutorials – Session 5 Dictionary Generation, rootcint, Simple I/O, Hands-on Fons Rademakers.
9-Nov-97Tri-Ada '971 TASH An Alternative to the Windows API TRI-Ada ‘97 Terry J. Westley
Introduction to ROOT1 Summer Students Lecture 6 July 2009 Fons Rademakers (PH/SFT) Jan Fiete Grosse-Oetringhaus (PH/AIP) Introduction to ROOT
FALL 2001ICOM Lecture 01 ICOM 4015 Advanced Programming Lecture 0 Review of Programming I Reading: LNN Chapters 1-3,5-6.
Chapter 3 Functions. 2 Overview u 3.2 Using C++ functions  Passing arguments  Header files & libraries u Writing C++ functions  Prototype  Definition.
ROOT I/O in JavaScript Browsing ROOT Files on the Web For more information see: For any questions please use following address:
G.Govi CERN/IT-DB 1 September 26, 2003 POOL Integration, Testing and Release Procedure Integration  Packages structure  External dependencies  Configuration.
CSE 1341 Honors Note Set 2 1. Overview  Java vs. C++  Functions in C++  First Programming Packet  Development Environment 2.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
INFORMATION SYSTEM – SOFTWARE TOPIC: GRAPHICAL USER INTERFACE.
LCG AA Meeting 31 October 2007 The new dynamically and extensively customizable ROOT browser Bertrand Bellenot.
Sebastian Böser HepMC Visual - an interactive browser for HepMC records 1st Annual ARTEMIS Meeting 27 th September, 2007.
C++: Functions, Program Compilation, Libraries Modified from CS101 slides, which are by JPC and JWD © 2002 McGraw-Hill, Inc.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
1 G4UIRoot Isidro González ALICE ROOT /10/2002.
Go4 Workshop J.Adamczewski-Musch, S.Linev Go4 advanced features.
LCG AA Meeting 30 June 2004 Ilka Antcheva Graphics User Interface in ROOT.
FUNCTIONS (C) KHAERONI, M.SI. OBJECTIVE After this topic, students will be able to understand basic concept of user defined function in C++ to declare.
2001 ROOT Workshop The Summary. Content Most Requested Request already satisfied Build and Distribution Web Page Information and Documentation.
HYDRA Framework. Setup of software environment Setup of software environment Using the documentation Using the documentation How to compile a program.
Experience of PROOF cluster Installation and operation
CST 1101 Problem Solving Using Computers
Summer Students Lecture 21 July 2004
Summer Students Lecture 8 July 2008 Fons Rademakers CERN/PH/SFT
Getting Started: Developing Code with Cloud9
Simulation And Modeling
SPL – PS1 Introduction to C++.
Presentation transcript:

ROOT TOOLKIT (I) Técnicas Fundamentales de Simulación, Reconstrucción y Análisis de Datos en Física Experimental de Partículas Isidro González Caballero ( Universidad de Oviedo) Valencia, 07-11/05/

ROOT ( 2 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

ROOT in a Nutshell 3  The ROOT system is an Object Oriented framework for large scale data handling applications. It is written in C++.  Provides, among others,  an efficient data storage and access system designed to support structured data sets (PetaBytes)  a query system to extract data from these data sets  a C++ interpreter  advanced statistical analysis algorithms (multi dimensional histogramming, fitting, minimization and cluster finding)  scientific visualization tools with 2D and 3D graphics  an advanced Graphical User Interface  The user interacts with ROOT via a graphical user interface, the command line or scripts  The command and scripting language is C++, thanks to the embedded CINT C++ interpreter, and large scripts can be compiled and dynamically loaded.  A Python shell is also provided. Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas

The ROOT Libraries Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 4  Over 1500 classes  1,550,000 lines of code  CORE (8 Mbytes)  CINT (2 Mbytes)  Green libraries linked on demand via plug- in manager (only a subset shown)  100 shared libs

ROOT: An Open Source Project Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 5  The project was started in  The project is developed as a collaboration between:  Full time developers: 11 people full time at CERN (PH/SFT) +4 developers at Fermilab/USA, Protvino, JINR/Dubna (Russia)  Large number of part-time contributors (155 in CREDITS file)  A long list of users giving feedback, comments, bug fixes and many small contributions 2400 registered to RootForum 10,000 posts per year  An Open Source Project, source available under the LGPL license

ROOT: a Framework and a Library Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 6  User classes  User can define new classes interactively  Either using calling API or sub-classing API  These classes can inherit from ROOT classes  Dynamic linking  Interpreted code can call compiled code  Compiled code can call interpreted code  Macros can be dynamically compiled & linked This is the normal operation mode Interesting feature for GUIs & event displays Script Compiler root >.x file.C++

ROOT Application Domains 7 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas Data Storage: Local, Network Data Analysis & Visualization General Framework

Three User Interfaces  GUI windows, buttons, menus  Command line CINT (C++ interpreter)  Macros, applications, libraries (C++ compiler and interpreter) Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 8

CINT Interpreter

CINT in ROOT Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 10  CINT is used in ROOT:  As command line interpreter  As script interpreter  To generate class dictionaries  To generate function/method calling stubs  Signals/Slots with the GUI  The command line, script and programming language become the same  Large scripts can be compiled for optimal performance

Compiled versus Interpreted Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 11  Why compile?  Faster execution, CINT has limitations…  Why interpret?  Faster Edit → Run → Check result → Edit cycles ("rapid prototyping"). Scripting is sometimes just easier.  Are Makefiles dead?  No! if you build/compile a very large application  Yes! ACLiC is even platform independent!

Starting ROOT Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas Open a terminal 2. Set the ROOT environment 3. Launch ROOT through the root command.  Command parameters:  -l : Do not show splash screen  -b : Run in batch mode without graphics  -q : Exit after processing command line macro files  -n : Do not execute logon and logoff macros as specified in.rootrc $ source /opt/root/bin/thisroot.sh $ root ******************************************* * * * W E L C O M E to R O O T * * * * Version 5.32/00 2 December 2011 * * * * You are welcome to visit our Web site * * * * * ******************************************* ROOT 5.32/00 Dec , 12:42:25 on linuxx8664gcc) CINT/ROOT C/C++ Interpreter version , July 2, 2010 Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }. root [0]

Running Code Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 13 To run function mycode() in file mycode.C: root [0].x mycode.C Equivalent: load file and run function: root [1].L mycode.C root [2] mycode() All of CINT's commands (help): root [3].h

Running Code Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 14 Macro: file that is interpreted by CINT (.x ) Execute with.x mymacro1.C(42) Also unnamed macros in next slide int mymacro1(int value) { int ret = 42; ret += value; return ret; }

Unnamed Macros Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 15 No functions, just statements Execute with.x mymacro2.C No functions thus no arguments! Named macro recommended! Compiler prefers it, too… { float ret = 0.42; return sin(ret); } No need to include math header or library

Running Code – Libraries Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas 16  “library” here refers to both compiled code and actual shared libraries  CINT can call its functions, classes, …!  To build a library from a macro we use ACLiC! (Automatic Compiler of Libraries for CINT)  Option 1: Compile only if “needed” by checking modification dates.x mymacro.C+(42) Use "+" instead of writing a Makefile…  Option 2: Compile in any case.x mymacro.C++(42)  CINT will know all functions in mymacro_C.so

My first session 17 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas root [0] (const double) e+002 root [1] float x=89.7; root [2] float y=567.8; root [3] x+sqrt(y) (double) e+002 root [4] float z = x+2*sqrt(y/6); root [5] z (float) e+002 root [6].q root root [0] /*try up and down arrows*/ See file $HOME/.root_hist

My second session 18 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas root [0].x session2.C for N=100000, sum= root [1] sum (double) e+004 Root [2] r.Rndm() (Double_t) e-001 root [3].q root { int N = ; TRandom r; double sum = 0; for (int i=0; i < N; i++) { sum += sin(r.Rndm()); } cout << "for N=" << N << ", sum=“ << sum << endl; } session2.C Unnamed macro  executes in global scope

My third session 19 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas root [0].x session3.C for N=100000, sum= root [1] sum Error: Symbol sum is not defined in current scope *** Interpreter error recovered *** Root [2].x session3.C(1000) for N=1000, sum= root [3].q ROOT void session3 (int N=100000) { TRandom r; double sum = 0; for (int i=0; I < N; i++) { sum += sin(r.Rndm()); } cout << "for N=" << N << ", sum=“ << sum << endl; } session3.C Named macro:  Normal C++ scope rules

My third session with ACLIC 20 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas root [0] gROOT->Time(); root [1].x session4.C( ) for N= , sum= e+006 Real time 0:00:06, CP time root [2].x session4.C+( ) for N= , sum= e+006 Real time 0:00:09, CP time root [3] session4( ) for N= , sum= e+006 Real time 0:00:01, CP time root [4].q #include "TRandom.h“ #include using namespace std; void session4 (int N) { TRandom r; double sum = 0; for (int i = 0; i < N; i++) { sum += sin(r.Rndm()); } cout << "for N=" << N << ", sum=" << sum << endl; } session4.C File session4.C Automatically compiled and linked by the native compiler. Must be C++ compliant

root [0].L session5.C root [1] session5(100); >session5.log root [2] session5b(3) sum(0) = 0 sum(1) = 1 sum(2) = 3 root [3].q Macros with more than one function 21 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas root [0].x session5.C >session5.log root [1].q session5.C.x session5.C Executes the function session5 in session5.C void session5(int N=100) { session5a(N); session5b(N); gROOT->ProcessLine(".x session4.C+(1000)"); } void session5a(int N) { for (int i = 0; i < N; i++) { cout << "sqrt(" << i << ") = " << sqrt(i) << endl; } void session5b(int N) { double sum = 0; for (int i = 0; i < N; i++) { sum += i; cout << "sum(" << i << ") = " << sum << endl; } Use gROOT->ProcessLine() to execute a macro from a macro or from compiled code

Generating a Dictionary 22 Téc. Fund. de Simulación, Reconstrucción y Análisis de datos en F. Exp. de Partículas MyClass.h MyClass.cxx rootcint –f MyDict.cxx –c MyClass.h compile and link libMyClass.so MyDict.h MyDict.cxx