610 likes | 851 Views
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
E N D
ROOT An Object Oriented Data Analysis Framework Day 1 ROOT Day1
The Early ROOT Team ROOT Day1
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 rootdev@root.cern.ch ROOT Day1
Acknowledgements • Suzanne Panacek (Fermilab) • Philippe Canal (Fermilab) • For their help in developing this course ROOT Day1
Class Schedule - Day 1 • Overview of the ROOT Framework • GUI basics • Command line basics • Finding Information (class reference guide) • Getting started with the exercises ROOT Day1
Class Schedule - Day 2 • ROOT commands and CINT • Discuss exercises • Functions and fitting • Building ROOT Trees • Reading Trees • Using Trees in Analysis ROOT Day1
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 ROOT Day1
ROOT Overview • What is ROOT • What about PAW • Concepts: Object Oriented Design, Frameworks • Services and Utilities • Libraries • Physical Organization ROOT Day1
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 ROOT Day1
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 ROOT Day1
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 ROOT Day1
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 ROOT Day1
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 ROOT Day1
Object Oriented Concepts • Class: the description of a “thing” in the system • Object: instance of a class • Methods: functions for a class • Members: a “has a” relationship to the class. • Inheritance: an “is a” relationship to the class. TObject IsA Event HasA HasA HasA Segment Track Vertex HasA HasA HasA Momentum MeanCharge MassSquare ROOT Day1
A Framework provides utilities and services ROOT Day1
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) ROOT Day1
Class Class Class Calling API vs Sub-classing API Class Program using calling API Class A Class Y calls method B virtual method Z inherits Class newY Framework virtual method Z Program using sub-classing API ROOT Day1
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 ROOT Day1
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) ROOT Day1
Three User Interfaces • GUIwindows, buttons, menus • Command lineCINT (C++ interpreter) • Macros, applications, libraries (C++ compiler and interpreter) ROOT Day1
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. ROOT Day1
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 ROOT Day1
A Data Analysis & Visualization Tools ROOT Day1
Graphics: 1,2,3-D functions ROOT Day1
Histograms ROOT Day1
Full LateXsupport on screen and postscript Formula or diagrams can be edited with the mouse TCurlyArc TCurlyLine TWavyLine and other building blocks for Feynman diagrams ROOT Day1
3 million nodes Alice ROOT Day1
ROOT Overview Summary • Concepts: Object Oriented Design, Frameworks • Services and Utilities • Libraries • Physical Organization • PAW Compatibility • Some Visual Examples ROOT Day1
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 ROOT Day1
GUI Basics • Display the browser • TBrowser b; • Start root • > root • Quit root (just in case) • root[0] .q ROOT Day1
Displaying a Histogram • Display a histogram The Canvas Open the ROOT file Browse the file ROOT Day1
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 ROOT Day1
The Editor Panel • The Event Status The Editor Panel Adding Error bars Changing colors Styles ROOT Day1
The Editor Panel Sliders Rebining ROOT Day1
Fitting, Coloring, and Zooming • Adding a gaussian fit • Coloring the histogram • Zooming/unzooming ROOT Day1
Adding Objects to the Canvas • The Editor • Adding an Arrow • Adding Text ROOT Day1
Adding Another Pad • Add a Pad • Select the new Pad • Draw a histogram • Add a title for the axis ROOT Day1
Modifying the Statistics • The Canvas in the Browser • Setting the (7) statistics options • default = 0001111 ROOT Day1
Dividing the Canvas • Create a new Canvas • Divide it in 2 • Draw two histograms. 1. Lego plot 2. LogY ROOT Day1
1-D Drawing Options Any object in the canvas is clickable and editable ROOT Day1
2-D Drawing Options ROOT Day1
2-D Drawing Options ROOT Day1
2-D Drawing Options All these plots can be rotated with the mouse ROOT Day1
2-D Drawing Options Same output on the screen and with vector Postscript ROOT Day1
THStack Examples ROOT Day1
Filling with String Variables ROOT Day1
Command Line Basics • Use up and down arrows to recall commands • $HOME/.root_hist • Use emacs commands to navigate ROOT Day1
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 ROOT Day1
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 ROOT Day1
The ROOT File • A TFile is a directory structure like UNIX • Object in Memory (OBJ) Object on Disk (KEY) ROOT Day1