Introduction to ROOT



Similar documents
Introduction to ROOT and data analysis

GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4GO4G

12 Trees. Why Should You Use a Tree? A Simple TTree

ROOT: A Data Analysis and Data Mining Tool from CERN

Sources: On the Web: Slides will be available on:

Parameter Passing. Standard mechanisms. Call by value-result Call by name, result

Basic Data Analysis Using ROOT

Installation and Testing of NMM (Windows)

An Incomplete C++ Primer. University of Wyoming MA 5310

ROOT Basics. Deb Mohapatra. This lecture is based on Fermilab ROOT tutorial and ROOT lecture in CERN summer school

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Use of ROOT in Geant4

Evaluation of the CMT and SCRAM Software Configuration, Build and Release Management Tools

The programming language C. sws1 1

QClaims Launch Instructions for Windows

Install Apache on windows 8 Create your own server

Code Estimation Tools Directions for a Services Engagement

ScanShell.Net Install Guide

Class 16: Function Parameters and Polymorphism

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Getting started in Excel

APNS Certificate generating and installation

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

Getting Started with the Internet Communications Engine

G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P.

RuleBender Tutorial

Hypercosm. Studio.

In this tutorial I will be uploading multiple images to my ftp folder on my ktools site, and then add them using manager.

Android: Setup Hello, World: Android Edition. due by noon ET on Wed 2/22. Ingredients.

Basics of I/O Streams and File I/O

Installation of ADS SiMKit startup script and designkit on Windows for SiMKit version 4.4

Writer Guide. Chapter 15 Using Forms in Writer

Getting Started With Delegated Administration

Comp151. Definitions & Declarations

Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions

GETTING STARTED WITH SQL SERVER

Chapter One Introduction to Programming


PIC 10A. Lecture 7: Graphics II and intro to the if statement

Xilinx ISE. <Release Version: 10.1i> Tutorial. Department of Electrical and Computer Engineering State University of New York New Paltz

How to Configure the Windows DNS Server

Qsync Install Qsync utility Login the NAS The address is :8080 bfsteelinc.info:8080

Installing S500 Power Monitor Software and LabVIEW Run-time Engine

Data Migration from Magento 1 to Magento 2 Including ParadoxLabs Authorize.Net CIM Plugin Last Updated Jan 4, 2016

SysAid Remote Discovery Tool

NovaBACKUP xsp Version 15.0 Upgrade Guide

Answers to Review Questions Chapter 7

Compiler Construction

CEFNS Web Hosting a Guide for CS212

MATH 4470/5470 EXPLORATORY DATA ANALYSIS ONLINE COURSE SYLLABUS

11 Input/Output. The Physical Layout of ROOT Files

Where Are My Primary Documents?

MS SQL Express installation and usage with PHMI projects

COMP 356 Programming Language Structures Notes for Chapter 4 of Concepts of Programming Languages Scanning and Parsing

TUTORIAL ECLIPSE CLASSIC VERSION: ON SETTING UP OPENERP 6.1 SOURCE CODE UNDER WINDOWS PLATFORM. by Pir Khurram Rashdi

Getting Started using the SQuirreL SQL Client

Umbraco Courier 2.0. Installation guide. Per Ploug Hansen 5/24/2011

Appendix K Introduction to Microsoft Visual C++ 6.0

A short simple tutorial on. SAS libname statements. for SAS for Windows

Tool - 1: Health Center

Custom Javascript In Planning

FTP, IIS, and Firewall Reference and Troubleshooting

CLAS12 Offline Software Tools. G.Gavalian (Jlab)

Instructions for Installing and Using the FOCUS DL-15 Data Transfer Software

Click the Windows. Click the Office Trial icon to write letters or create a spreadsheet

Reputation-Management Tutorial. Presented By: Brian-Angeli.com Partner With Brian

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Improve Fortran Code Quality with Static Analysis

PaperStream Connect. Setup Guide. Version Copyright Fujitsu

C++FA 5.1 PRACTICE MID-TERM EXAM

Supported platforms & compilers Required software Where to download the packages Geant4 toolkit installation (release 9.6)

The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.

1 Topic. 2 Scilab. 2.1 What is Scilab?

Using Dedicated Servers from the game

Site Administrator Guide

MOODLE Installation on Windows Platform

The C Programming Language course syllabus associate level

for both the Verbatim Gateway and Catalyst Autodialer EtherNet Options

Parallelization: Binary Tree Traversal

How To Build An Intranet In Sensesnet.Com

CS 103 Lab Linux and Virtual Machines

When you publish data to a SharePoint site, you first

SOLIDWORKS Education Edition Installation Instructions Preparation

The Answer to the 14 Most Frequently Asked Modbus Questions

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Backing up IMail Server using Altaro Backup FS

CafePilot has 3 components: the Client, Server and Service Request Monitor (or SRM for short).

TRANSFORM YOUR MEDE8ER TV WALL FROM THIS: TO THIS: LIBRARY VIEW SHOW VIEW SEASON VIEW FULL SYNOPSIS AND INFO

SQL Tables, Keys, Views, Indexes

Inteset Secure Lockdown ver. 2.0

Getting Started with the LabVIEW Mobile Module Version 2009

Visual Studio 2008 Express Editions

Basics of STATA. 1 Data les. 2 Loading data into STATA

Transcription:

Introduction to ROOT

Last time and today Last time we took a quick look at LATEX Today we will start the second half of the course ROOT A basic introduction. We start with really using ROOT next time when we talk about histograms.

What is ROOT? ROOT is a data analysis package It contains many useful tools Data analysis Histograms Fitting Plotting Mathematical libraries Data storage Data formats

ROOT and C++ ROOT is written in C++ It uses fully object oriented code. ROOT can be though of as a collection of libraries in C++ These can be used in your C++ code to do analysis tasks. ROOT input is in C++ It uses a C++ interpreter call CINT

Long long ago in a Before ROOT there came PAW This is part of CernLib This did a similar job Data Analysis Data Formats Data Storage It was written in FORTRAN Root is the extension of PAW into the object orientated ed world and is much more powerful. The writers knew PAWs strengths and weaknesses.

Documentation As with everything in this course there is good documentation on the WEB. In the case of ROOT there is one specific place. http://root.cern.ch This is the place to download d root from should you need it. There is lots of documentation and examples. I recommend you work through the tutorials that cover the material covered in these lectures.

Example root files. For this section of the course I have prepared some sample root files. These can be found in.. There are the following files. atlas_z0.root Z 0 events in ATLAS. sno_16n.root A calibration run from SNO.

Starting with root You need to have the environment variable ROOTSYS set to the root install directory. This will typically y be /usr/local/root But you (or your experiment) may have your own version of root installed. You will need to set ROOTSYS accordingly. You may also need to use LD_LIBRARY_PATH This tells programs where to look for libraries For vanilla root you shouldn t need to use this For expanded d version as with many experiment extra libraries may need to be specified It does depend on the build.

Launching and Quiting Root. To launch root just type: $ROOTSYS/bin/root You may want to add $ROOTSYS/bin to your path. You should see a splash screen appear, and then root start t up in your terminal. To quit use:.q

Loading a file To load a file you type. TFile f ( my_root_tree.root tree.root ) This creates a TFile object called f. The object f is attached to the file my_root_tree.root fi is a real object and dtherefore you can use all of fthe TFile member functions. f->close() close the file. f->ls() list the objects in a file.

Browsing a file. To easily browse a file we use TBrowser. TBrowser b This makes a TBroswer object called b Lets now take a quick look at TBrowser in Lets now take a quick look at TBrowser in action.

CINT and Macros CINT is somewhat loose in it s C++syntax. You can use either f.close() or f->close(). You ll be better off if you use the correct structure anyway. When typing in root you don t need the ; A macro is set of CINT instructions enclosed in { } at. These are at the start and end of the file. You now need ; Run a macro by.x my_macro.c Precompile the macro :.x my_macro.c+

.rootlogon.c The file.rootlogon.c in your home directory can be used to configure root to your liking. This can be used to set the system to what ever defaults you want. We can return to these when we know what a few of these things are. It works just like any other root macro and uses the same syntax.

Data Storage in ROOT There are a number of ways to store and present data in ROOT: Graphs A bit like EXCEL: plot x vs y Hisograms Binned data Ntuples Tables Trees Extensions of ntuples

Ntuples Trees Ntuples were the standard d way of storing data in PAW Each entry was an event Each event was a collection of variables In paw all floating point. The same variables for each event. Not generalizable. In root you can use a TNtuple class. A tree is a generalization of an ntuple. Ntuples are now special root trees.

Trees, Branches and Leaves A Tree is a collection of branches. Each branch corresponds to a variables, or collection of variables. Generally independent variables on different branches. Like variables (eg position x,y,z) on the same branch. Using a object such as a TVector3. The data on the branches are called Leaves These can be floating point, integer Or any object (with it s own member functions) you care to define.

Accessing my data inside a Tree. You need to know how to access the data inside your tree. Generally you will loop through the tree in a macro. We will talk about this in a basic way today and get more complex in later lectures.

Loading the root tree First you need to load the file. You then setup a pointer to the tree in the file and attach it to the tree you want. This gives you a TTree object. TFile f ( mytree.root ); Load the file into object f TTree *intree = (TTree*)f.Get( MyTree ); ( ); Create a pointer to a TTree object. Name of the Tree

Getting to the data. Say the data is in a variable energy and it s double precision. You need to define that variable, and then point it to the variable in the tree. Define the variable Double_t energy; The address of my variable. intree->setbranchaddress( energy energy,&energy); Point it to my variable in the tree. The name in the tree.

Looping through the Tree. You can now loop through the Tree. Loop index Use TTree member function GetEntries() to get loop limit for (Int _ t indx=0;indx<intree->getentries();indx++){ ){ intree->getentry(indx); cout << energy << endl; Load the current event. } You can now access your variable.

TTree::Print and TTree::Scan You can use the Print method to print out the variables in a tree. Tree->Print(); This will show each branch and how much data is stored there. The scan method will show the value of the specified variables for each event. Tree->Scan( var1:var2:var3 ); Useful if you want to see what s going on event by event.

TTree::Draw( () Once you have a pointer to your tree you can also directly plot variables. intree->draw( var1 ); intree->draw( var1:var2 ); intree->draw( var1, var2>10 ); intree->draw( var1, var2>10,options); The options are as for histograms and we ll cover these next time.

Exercises Make sure you can run root. Load it and quit. Take a look at the standard root files for the course with TBrowser to see what type of data we have. Try and plot some variables using TTree::Draw()