root
DESCRIPTION
ROOT. An Object Oriented Data Analysis Framework. Day 1. The Early ROOT Team. The ROOT Web Pages. http://root.cern.ch. General Information and News Download source and binaries HowTo’s & tutorials User Guide & Reference Guide Roottalk mailing list & Forum - PowerPoint PPT PresentationTRANSCRIPT
April 22, 2023 ROOT Day1 1
ROOTAn Object Oriented Data
Analysis Framework
Day 1
April 22, 2023 ROOT Day1 2
The Early ROOT Team
April 22, 2023 ROOT Day1 3
The ROOT Web Pages
http://root.cern.ch General Information and News
Download source and binaries
HowTo’s & tutorials
User Guide & Reference Guide
Roottalk mailing list & Forum
Savannah bug reporting and [email protected]
April 22, 2023 ROOT Day1 4
Acknowledgements
Suzanne Panacek (Fermilab) Philippe Canal (Fermilab)
For their help in developing this course
April 22, 2023 ROOT Day1 6
Class Schedule - Day 1 Overview of the ROOT Framework GUI basics Command line basics Finding Information (class
reference guide)
Getting started with the exercises
April 22, 2023 ROOT Day1 7
Class Schedule - Day 2 ROOT commands and CINT Discuss exercises Functions and fitting Building ROOT Trees Reading Trees Using Trees in Analysis
April 22, 2023 ROOT Day1 8
Class Schedule - Day 3 Copying Trees Chain of trees Adding your class to ROOT
With the Interpreter With a compiler (Shared Library) With ACLiC
Rootcint ROOT I/O details Remote I/O
April 22, 2023 ROOT Day1 9
ROOT Overview What is ROOT What about PAW Concepts: Object Oriented Design,
Frameworks Services and Utilities Libraries Physical Organization
April 22, 2023 ROOT Day1 10
Prehistory In the beginning there was PAW
HBOOK ZEBRA KUIP COMIS SIGMA
Mini/Micro-DST analysis was done using Ntuples Ntuples are basically simple tables Only basic types No data structures No cross reference between Ntuples Successful because simple and efficient
Dead-end No way to grow to more complex data structures Difficult to extend Expensive to maintain Too many languages: Fortran, KUIP, SIGMA
April 22, 2023 ROOT Day1 11
Main Goals for New System
Being able to support full data analysis chain Raw data, DSTs, mini-DSTs, micro-DSTs
Being able to handle complex structures Complete objects Object hierarchies
Support at least the PAW data analysis functionality Histogramming Fitting Visualization
Only one language C++
Better maintainable Use OOP
Make the system extensible Use OO framework technology
April 22, 2023 ROOT Day1 12
ROOT in a Nutshell The ROOT system is an Object Oriented framework
for large scale data handling applications 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
April 22, 2023 ROOT Day1 13
ROOT: An Open Source Project The project is developed as a
collaboration between: Full time developers:
10 people full time at CERN 2 developers at FermiLab 1 developer in Japan (Agilent Technologies) 2 developers at MIT
Large number of part-time contributors Several thousand users giving feedback,
comments, bug fixes and many small contributions
An Open Source Project, source available under the LGPL license
April 22, 2023 ROOT Day1 14
ROOT Development Process We follow an Open Source development model
“Release early, release often” Major releases 3-4 times per year Minor releases every 2-3 weeks Daily/nightly builds + regression testing +
benchmarking (rootmarks) “Let user feedback drive the development”
Bug reporting system Roottalk mailing list Annual workshop Open cvs repository Let users become developers
April 22, 2023 ROOT Day1 15
Object Oriented Concepts
Members: a “has a” relationship to the class.
Inheritance: an “is a” relationship to the class.
Class: the description of a “thing” in the system Object: instance of a class Methods: functions for a class
TObject
Segment Track Vertex
MomentumMassSquare
MeanCharge
EventIsA
HasAHasA
HasA
HasAHasAHasA
April 22, 2023 ROOT Day1 16
A Frameworkprovides utilities and services
April 22, 2023 ROOT Day1 17
ROOT's Services and Utilities Data analysis and visualization tools Histogramming and Fitting 2D and 3D graphics, Postscript, PDF, LateX Geometrical modeller Object persistency and Trees PROOF parallel query engine Collection Classes Run Time Type Identification Online services User Interface
GUI: Browsers, Panels, Tree Viewer Command Line interface: C++ interpreter CINT Script Processor (C++ compiled C++ interpreted)
April 22, 2023 ROOT Day1 18
Calling API vs Sub-classing API
Program usingcalling API
Class
Class Amethod B
Class Yvirtual method Z
Framework
Class
ClassClass
Class newYvirtual method Z
Program usingsub-classing API
calls
inherits
April 22, 2023 ROOT Day1 19
ROOT Library Structure ROOT libraries are a layered structure The CORE classes are always required (support for RTTI,
basic I/O and interpreter) The optional libraries (you load only what you use).
Separation between data objects and the high level classes acting on these objects. Example, a batch job uses only the histogram library, no need to link histogram painter library
Shared libraries reduce the application link time Shared libraries reduce the application size ROOT shared libraries can be used with other class
libraries Shared libraries are mostly loaded via the plug-in manager
April 22, 2023 ROOT Day1 20
The ROOT Libraries Over 1000
classes
1,350,000 lines of code
CORE (12 Mbytes)
CINT (2 Mbytes) Green libraries
linked on demand via plug-in manager (only a subset shown)
April 22, 2023 ROOT Day1 21
Three User Interfaces GUI
windows, buttons, menus
Command lineCINT (C++ interpreter)
Macros, applications, libraries (C++ compiler and interpreter)
April 22, 2023 ROOT Day1 22
Differences from PAW 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. Object I/O including Schema Evolution 3-D interfaces with OpenGL and X3D.
April 22, 2023 ROOT Day1 23
PAW to ROOT File Conversion Get the example PAW file from
ftp://root.cern.ch/root/exercises.tar.gz exercises_files/day1/toyz.rz
At the system prompt type
> h2root toyz.rz toyz.root
Once you've done the conversion, you can then start
a ROOT session and open toyz.root
Also see: http://root.cern.ch/root/HowtoConvert.html
April 22, 2023 ROOT Day1 24
A Data Analysis & Visualization Tools
April 22, 2023 ROOT Day1 25
Graphics: 1,2,3-D functions
April 22, 2023 ROOT Day1 26
Histograms
April 22, 2023 ROOT Day1 27
Full LateX support
on screen and
postscript
TCurlyArcTCurlyLineTWavyLine
and other building blocks for Feynman diagrams
Formula or
diagrams can beedited
with the mouse
April 22, 2023 ROOT Day1 28
Alice 3 million nodes
April 22, 2023 ROOT Day1 29
ROOT Overview Summary Concepts: Object Oriented Design,
Frameworks Services and Utilities Libraries Physical Organization PAW Compatibility Some Visual Examples
April 22, 2023 ROOT Day1 30
GUI Basics Browsing and opening files Drawing histograms Right click, left click, middle click Draw Panel Fit Panel Adding Color and Zooming Adding text and other objects Dividing the canvas Setting the log scale
April 22, 2023 ROOT Day1 31
GUI Basics
Display the browser TBrowser b;
Start root> root
Quit root (just in case)
root[0] .q
April 22, 2023 ROOT Day1 32
Displaying a Histogram
Display a histogram The Canvas
Open the ROOT fileBrowse the file
April 22, 2023 ROOT Day1 33
Basic Navigation by Clicking
Left Click select the object drag the object resize the object
Right Click context menu class::name methods
Middle Click activate canvas pop pads freezes event status bar
April 22, 2023 ROOT Day1 34
The Editor Panel The Event Status
The Editor Panel
Adding Error barsChanging colorsStyles
April 22, 2023 ROOT Day1 35
The Editor Panel
SlidersRebining
April 22, 2023 ROOT Day1 36
Fitting, Coloring, and Zooming
Adding a gaussian fit Coloring the histogram Zooming/unzooming
April 22, 2023 ROOT Day1 37
Adding Objects to the Canvas
The Editor Adding an Arrow Adding Text
April 22, 2023 ROOT Day1 38
Adding Another Pad Add a Pad Select the new
Pad Draw a histogram Add a title for the
axis
April 22, 2023 ROOT Day1 39
Modifying the Statistics The Canvas in the
Browser Setting the (7)
statistics options default = 0001111
April 22, 2023 ROOT Day1 40
Dividing the Canvas Create a new Canvas Divide it in 2 Draw two histograms.
1. Lego plot2. LogY
April 22, 2023 ROOT Day1 41
1-D Drawing OptionsAny object in the canvasis clickable and editable
April 22, 2023 ROOT Day1 42
2-D Drawing Options
April 22, 2023 ROOT Day1 43
2-D Drawing Options
April 22, 2023 ROOT Day1 44
2-D Drawing Options
All these plots can be rotated with the mouse
April 22, 2023 ROOT Day1 45
2-D Drawing Options
Same outputon the screen and with
vector Postscript
April 22, 2023 ROOT Day1 46
THStack Examples
April 22, 2023 ROOT Day1 47
Filling with String Variables
April 22, 2023 ROOT Day1 48
Command Line Basics Use up and down arrows to
recall commands $HOME/.root_hist
Use emacs commands to navigate
April 22, 2023 ROOT Day1 49
Open a File Open a file for reading
root [] TFile f("Example.root") Look at the contents of the file
root [] f.ls()TFile** Example.root ROOT file TFile* Example.root ROOT file KEY: TTree myTree;1 Example ROOT tree KEY: TH1F totalHistogram;1 Total Distribution KEY: TH1F mainHistogram;1 Main Contributor KEY: TH1F s1Histogram;1 First Signal KEY: TH1F s2Histogram;1 Second Signal
April 22, 2023 ROOT Day1 50
Plotting a Variable Plot a variable
root [] myTree->Draw("xs1")
Where did myTree come from? ROOT executed an implicit gROOT->FindObject("myTree")
And now.. root[] f.ls() … OBJ: TTree myTree Example ROOT tree: 0 KEY: TTree myTree;1 Example ROOT tree
April 22, 2023 ROOT Day1 51
The ROOT File
A TFile is a directory structure like UNIX Object in Memory (OBJ) Object on Disk (KEY)
April 22, 2023 ROOT Day1 52
The ROOT Tree Stores large quantities of same
class objects: Optimize disk space Optimize access speed Had analysis methods (TTree::Draw())
TNtuple is a TTree limited to floating point numbers.
More details later …
April 22, 2023 ROOT Day1 53
Fitting To add a Gaussian Fit
root [] htemp->Fit("gaus")
Where did htemp come from?automatically generated
histogram by the TTree::Draw() command.
April 22, 2023 ROOT Day1 54
Color and Error Bars To add color
root [] htemp->SetFillColor(9) See pg. 134 of the Users Guide for color
index Or in any Canvas choose View:Colors
Drawing Error Barsroot[] htemp->Draw("E1,same")
Many Draw Options See the User's Guide
April 22, 2023 ROOT Day1 55
Command Line Basics Open and browse a file Drawing histograms Adding a Fit Adding Error bars Adding Color
April 22, 2023 ROOT Day1 56
Class Reference Guide Find the class in the index, for
example TH1. Class Inheritanceclass TH1 : public TNamed, public TAttLine, public
TAttFill, public TAttMarker Class Description Private members Public methods Code
April 22, 2023 ROOT Day1 57
Finding Examples The ROOT Tutorials:
http://root.cern.ch/root/Tutorials.html The ROOT How To's: http://root.cern.ch/root/
Howto.html For on-line help for a particular topic it's very
useful to use their facility to search the ROOT site. http://root.cern.ch/root
April 22, 2023 ROOT Day1 58
Summary Overview of ROOT GUI Basics Command line basics Using the Class reference
guide PAW to ROOT conversion
April 22, 2023 ROOT Day1 59
Exercise Overview Session A
Use ROOT command line Write a named and un-named script Use the GUI to create objects and change their attributes Save your canvas to a PostScript file Fit a graph
Session B Fit and rotate a histogram Use the Object Browser and the Tree Viewer Make a profile and contour graphs Build an event list from a cut Fill a histograms with random numbers Use ACLiC
April 22, 2023 ROOT Day1 60
Exercise Session C Session C:
Study an example analysis from H1 at DESY Learn about the TTree::MakeSelector() method to
automatically create a class that loops over each entry in a tree.
Save and retrieve a canvas to and from a ROOT file Compute the integral of a histogram Compute the integral of a function within a range
April 22, 2023 ROOT Day1 61
Installing ROOT Go to ROOT web page and download
the latest version of ROOT Install according to description
Set shell variablesROOTSYS, LD_LIBRARY_PATH and PATH
Make sure you can do: root root [0] .q
April 22, 2023 ROOT Day1 62
Getting Started with the Exercises
Find the exercises on line at:
ftp://root.cern.ch/root/exercises.tar.gz
Today Session A.