ROOT1 Hands-on Sami Kama. S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/2011 2 Download root file from indico.

Slides:



Advertisements
Similar presentations
Joe Foster Visualizing Data with ROOT Joe Foster University of Manchester.
Advertisements

The Web Warrior Guide to Web Design Technologies
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Java Tutorial – Building GUIs Java with Added Swing Daniel Bryant
Hands-On Microsoft Windows Server 2003 Administration Chapter 5 Administering File Resources.
1 of 4 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
Recap, Test 1 prep, Composition and Inheritance. Dates Test 1 – 12 th of March Assignment 1 – 20 th of March.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Introduction to Client Side Scripting CS Client Side Scripting Client side means the Browser is interpreting the script Script is downloaded with.
Code reading skills LEVEL GAME.  Skeleton has error messages.  Notice the red lines on right slider. Click… you’ll go to an error.  pieces = levels.getPieces();
Classes In C++ 1. What is a class Can make a new type in C++ by declaring a class. A class is an expanded concept of a data structure: instead of holding.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Stacks.
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
Visual C++ Programming: Concepts and Projects Chapter 12B: Linked List (Tutorial)
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
PROOF and ALICE Analysis Facilities Arsen Hayrapetyan Yerevan Physics Institute, CERN.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
 2008 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Pointers and Dynamic Arrays.
PHP Form Processing * referenced from
RootMaker v1.0.0 Jordan Damgov, Shuichi Kunori. Contents Introduction Root file - structure and objects File size and CPU time Example for root file analysis.
S.Linev: Go4 - J.Adamczewski, H.G.Essel, S.Linev ROOT 2005 New development in Go4.
Gaudi Framework Tutorial, Algorithm Tools: what they are and how to use them.
Go4 Workshop J.Adamczewski-Musch, S.Linev Go4 advanced features.
Joe Foster 1 This talk extends the one I gave in 2006 called Visualizing Data with ROOT. –
Gaudi Framework Tutorial, April Histograms And N-tuples.
An AOD analysis example Esteban Fullana Torregrosa High Energy Physics Division Argonne National Laboratory.
HYDRA Framework. Setup of software environment Setup of software environment Using the documentation Using the documentation How to compile a program.
V0.02 The ROOT Collection Classes. V Collection Classes Group of related objects TObjects or descendants from TObject Abstract base class TCollection.
Chapter 8 Multiple Forms, Modules, and Menus. Introduction This chapter demonstrates how to: – Add multiple forms to a project – Create a module to hold.
Introduction to ROOT Sami Kama. S. Kama ISTAPP 2011 Dogus Univ.07/02/ Outline ● A little C++ ● Starting ROOT - CINT ● ROOT Documentation ● Histograms.
Memory Management.
AOD example analysis Argonne Jamboree January 2010
EGR 2261 Unit 13 Classes Read Malik, Chapter 10.
Appendix A Barb Ericson Georgia Institute of Technology May 2006
C++ Exceptions.
Pointers and Dynamic Arrays
Winter 2009 Tutorial #6 Arrays Part 2, Structures, Debugger
User-Written Functions
Registering and filing IRS Form 990 e-Postcard
Appendix A Barb Ericson Georgia Institute of Technology May 2006
© 2016 Pearson Education, Ltd. All rights reserved.
Separate Compilation and Namespaces
Objectives Identify the built-in data types in C++
CMSC202 Computer Science II for Majors Lecture 08 – Overloaded Constructors Dr. Katherine Gibson Based on slides by Chris Marron at UMBC.
Coding Defensively Coding Defensively
Geant4 Geometry Objects Persistency using ROOT
Specification-Based Testing and the Category-Partition Method
Creating and Modifying Text part 2
Intro to PHP & Variables
This pointer, Dynamic memory allocation, Constructors and Destructor
Array Lists Chapter 6 Section 6.1 to 6.3
Conditions and Ifs BIS1523 – Lecture 8.
Chapter 9 Classes: A Deeper Look, Part 1
Building Web Applications
CMPE 152: Compiler Design October 4 Class Meeting
Constant: value does not change
Introduction to Classes and Objects
Coding Concepts (Basics)
Array-Based Implementations
Understanding the TigerSHARC ALU pipeline
Classes and Objects.
Homework Reading Programming Assignments Finish K&R Chapter 1
Stata Basic Course Lab 2.
Data Structures & Algorithms
COP 3330 Object-oriented Programming in C++
Workshop for Programming And Systems Management Teachers
Presentation transcript:

ROOT1 Hands-on Sami Kama

S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ Download root file from indico. Click on directory icon on ROOT1 session and download ttSmall.root file

S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ Open the file you dowloaded Default download location is ${HOME}/Desktop/. cd to where your file is. Start ROOT with file name. This will open the file and assign its memory address to _file0 variable You can access the TFile object itself with ->. This line will list the contents of the file. Notice _ (underscore) infront of the file0. This line says that, create a new variable of type TTree* called myTest and initialize it to value which is the result of the _file0- >Get('test') call treated as a TTree*. If you type-in the name of a variable in CINT, it will print its value. This line tells that myTest is a TTree* which is pointing to the memory address 0x8a4dbb8. It would be 0x0 if line [2] would have failed. We are calling MakeClass() method of TTree class for our object myTest. This line will create two files MyTestTreeReaderClass.h and MyTestTreeReaderClass.C which will contain skeleton code for us to read the ROOT tree pointed by myTree and implement our analysis.

S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ MyTestTreeReaderClass.h Header file created by MakeClass() method. All necessary variables are automatically defined. Main implementation goes in.C file. In order to keep memory consumption minimum ROOT assigns the maximum encountered number of ntracks to the length of the arrays. You need to increase this numbers if you are going to use chains and there is a probability of having more ntracks for some entries.

S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ MyTestTreeReaderClass Constructor Automatically generated minimum list of methods. You can add more methods or variables for your analyses. For example you can add pointers to your histograms as member variables and createHistograms() and saveHistograms() methods to initialize histograms before analysis and save them after it. Class constructor takes a pointer to TTree object. You can pass a TTree* that you initialized elsewhere. Or you can leave it empty, in which case ROOT will try to open the file you used in MakeClass() process and the tree it is created from.

S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ MyTestReaderClass.C Implementation class automatically includes the header file TCanvas, TStyle, and TH2 for you. Comments tell you how you can use the class in CINT and leave out unwanted branches. Loop() method is the main method that you should implement your analysis in unless you think of using PROOF. It will loop over all entries in a tree.

S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ Loop() method. Default skeleton of Loop() method just loops over all entries in the tree without doing any work. You can implement your analysis after the // if(Cut(ientry)<0)continue; line. Get the number of entries in the tree. Loop over all entries Reset the values of tree variables to the values of the jentry'th entry. Select the jentry'th entry

S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ A basic analysis implementation Declare a 2D histogram to book px and py of the selected particle Loop over all tracks in the event. ntrack will set to number of tracks in current event at every call to GetEntry(). Don't forget ntrack is specific to this example. It will be different for different trees and there may be more than one loop variable. The header file tells you which variables contain the number of entries in which arrays. Check if the zv (z vertex) of the current particle is far away from interaction vertex. Skip particles that are further than 105. mm. Fill the px and py of the selected particles in momDist histogram. Don't forget that this is a mock-up tree. You will write analysis for meaningful trees later in the data analysis lectures. Draw the final histogram

S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ Running the analysis cd to where the class and root file is and start ROOT. Load your class with.L MyTestTreeReaderClass.C. Then ROOT will know your class and you can instantiate it like any other class. Unless you pass a TTree* it constructor, your class will try to open the file you used in its creation. If you get an error message, make sure that the MyTestTreeReaderClass.C and ttSmall.root file are in the current directory or pass a pointer to „test“ tree to constructor. (lines [1] and [2] in page 3) Then call your Loop method. It will execute the analysis code that you wrote. Since we call Draw function at the end, Loop() method will draw momDist histogram. You can create multiple histograms in your analyses and save them into a file by opening a new file before histogram declaration and then calling Write() method of opened file at the end.

S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ Take a Look at ● At least Histograms, Graphs and Trees chapters of the ROOT users manual. ● ROOT reference manual of the classes that we used here. ● tutorials and tests directories in ROOT sources.

S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ Thank You