Upload
daniel-rey-rey
View
286
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Root Users Guide a 4
Citation preview
ROOT Users Guide
May 2013
2
Contents
Preface 21
1 Introduction 23
1.1 The ROOT Mailing Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.2 Contact Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.3 Conventions Used in This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.4 The Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.4.1 What Is a Framework? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.4.2 Why Object-Oriented? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.5 Installing ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.6 The Organization of the ROOT Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.6.1 $ROOTSYS/bin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.6.2 $ROOTSYS/lib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.6.3 $ROOTSYS/tutorials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.6.4 $ROOTSYS/test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.6.5 $ROOTSYS/include . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.6.6 $ROOTSYS/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.7 How to Find More Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.7.1 Class Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2 Getting Started 35
2.1 Setting the Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.2 Start and Quit a ROOT Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.3 Using the GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.3.1 Main Menus and Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.3.2 The Editor Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.3.3 Classes, Methods and Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.3.4 User Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.3.5 Building a Multi-pad Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.3.6 Saving the Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.3.7 Printing the Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.4 The ROOT Command Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.4.1 Multi-line Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.4.2 CINT Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.4.3 Helpful Hints for Command Line Typing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3
4 CONTENTS
2.4.4 Regular Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.5 Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.5.1 Coding Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.5.2 Machine Independent Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.5.3 TObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.6 Global Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.6.1 gROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.6.2 gFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.6.3 gDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.6.4 gPad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.6.5 gRandom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.6.6 gEnv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.7 Environment Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.7.1 Logon and Logoff Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.7.2 History File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.7.3 Tracking Memory Leaks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.7.4 Memory Checker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.8 Converting from PAW to ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
2.8.1 Converting HBOOK/PAW Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3 Histograms 55
3.1 The Histogram Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.2 Creating Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.2.1 Constant or Variable Bin Width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.3 Bin Numbering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.3.1 Convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.3.2 Re-binning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.4 Filling Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.4.1 Automatic Re-binning Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.5 Random Numbers and Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.6 Adding, Dividing, and Multiplying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.7 Projections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.8 Drawing Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.8.1 Setting the Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.8.2 Draw Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.8.3 Drawing a Sub-range of a 2-D Histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
3.8.4 Superimposing Histograms with Different Scales . . . . . . . . . . . . . . . . . . . . . . . . . . 77
3.8.5 Statistics Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.8.6 Setting Line, Fill, Marker, and Text Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.8.7 Setting Tick Marks on the Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
3.8.8 Giving Titles to the X, Y and Z Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
3.9 Making a Copy of an Histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
3.10 Normalizing Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
CONTENTS 5
3.11 Saving/Reading Histograms to/from a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
3.12 Miscellaneous Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
3.13 Alphanumeric Bin Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
3.13.1 Option 1: SetBinLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
3.13.2 Option 2: Fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.13.3 Option 3: TTree::Draw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.13.4 Sort Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.14 Histogram Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
3.15 TH2Poly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.16 Profile Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.16.1 Build Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
3.16.2 Drawing a Profile without Error Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
3.16.3 Create a Profile from a 2D Histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
3.16.4 Create a Histogram from a Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
3.16.5 Generating a Profile from a TTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
3.16.6 2D Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
3.17 Iso Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
3.18 3D Implicit Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
3.19 TPie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
3.20 The User Interface for Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.20.1 TH1Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.20.2 TH2Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4 Graphs 99
4.1 TGraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.1.1 Graph Draw Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.2 Superimposing Two Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
4.3 Graphs with Error Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
4.4 Graphs with Asymmetric Error Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.5 Graphs with Asymmetric Bent Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
4.6 TGraphPolar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.7 TGraph Exclusion Zone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
4.8 TGraphQQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4.8.1 Two Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4.8.2 One Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
4.9 TMultiGraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
4.10 TGraph2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
4.11 TGraph2DErrors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
4.12 Fitting a Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
4.13 Setting the Graphs Axis Title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
4.14 Zooming a Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
4.15 The User Interface for Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
6 CONTENTS
5 Fitting Histograms 119
5.1 The Fit Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
5.2 Fit with a Predefined Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
5.3 Fit with a User-Defined Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
5.3.1 Creating a TF1 with a Formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
5.3.2 Creating a TF1 with Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
5.3.3 Creating a TF1 with a User Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.4 Fixing and Setting Parameters Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
5.5 Fitting Sub Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
5.6 The Fit Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
5.6.1 Function Choice and Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
5.6.2 Fitter Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
5.6.3 Draw Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5.6.4 Print Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5.6.5 Command Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5.7 Fitting Multiple Sub Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5.8 Adding Functions to the List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5.9 Combining Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5.10 Associated Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
5.11 Access to the Fit Parameters and Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
5.12 Associated Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
5.13 Fit Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
5.14 The Minimization Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
5.14.1 Basic Concepts of Minuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
5.14.2 The Transformation of Limited Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
5.14.3 How to Get the Right Answer from Minuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
5.14.4 Reliability of Minuit Error Estimates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
5.15 FUMILI Minimization Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
5.16 Neural Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5.16.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5.16.2 The MLP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
5.16.3 Learning Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
5.16.4 Using the Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
5.16.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
6 A Little C++ 139
6.1 Classes, Methods and Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
6.2 Inheritance and Data Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
6.2.1 Method Overriding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
6.2.2 Data Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
6.3 Creating Objects on the Stack and Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
CONTENTS 7
7 CINT the C++ Interpreter 145
7.1 What is CINT? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.2 The ROOT Command Line Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
7.3 The ROOT Script Processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.3.1 Un-named Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.3.2 Named Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.3.3 Executing a Script from a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
7.4 Resetting the Interpreter Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
7.5 A Script Containing a Class Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.6 Debugging Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.7 Inspecting Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
7.8 ROOT/CINT Extensions to C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
7.9 ACLiC - The Automatic Compiler of Libraries for CINT . . . . . . . . . . . . . . . . . . . . . . . . . . 155
7.9.1 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
7.9.2 Setting the Include Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.9.3 Dictionary Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.9.4 Intermediate Steps and Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.9.5 Moving between Interpreter and Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.10 Reflex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
7.10.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
7.10.2 Selecting Types And Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
7.10.3 Genreflex and Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
7.10.4 GCCXML Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
7.10.5 Reflex API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
7.10.6 Cintex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
8 Object Ownership 165
8.1 Ownership by Current Directory (gDirectory) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
8.2 Ownership by the Master TROOT Object (gROOT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
8.2.1 The Collection of Specials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
8.2.2 Access to the Collection Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
8.3 Ownership by Other Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
8.4 Ownership by the User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
8.4.1 The kCanDelete Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
8.4.2 The kMustCleanup Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
9 Graphics and the Graphical User Interface 169
9.1 Drawing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
9.2 Interacting with Graphical Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
9.2.1 Moving, Resizing and Modifying Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
9.2.2 Selecting Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
9.2.3 Context Menus: the Right Mouse Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
9.2.4 Executing Events when a Cursor Passes on Top of an Object . . . . . . . . . . . . . . . . . . . 173
8 CONTENTS
9.3 Graphical Containers: Canvas and Pad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
9.3.1 The Global Pad: gPad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
9.3.2 The Coordinate Systems of a Pad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
9.3.3 Converting between Coordinate Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
9.3.4 Dividing a Pad into Sub-pads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
9.3.5 Updating the Pad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
9.3.6 Making a Pad Transparent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
9.3.7 Setting the Log Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
9.3.8 WaitPrimitive method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
9.3.9 Locking the Pad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
9.4 Graphical Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
9.4.1 Lines, Arrows and Polylines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
9.4.2 Circles and Ellipses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
9.4.3 Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
9.4.4 Markers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
9.4.5 Curly and Wavy Lines for Feynman Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
9.4.6 Text and Latex Mathematical Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
9.4.7 Greek Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
9.4.8 Mathematical Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
9.4.9 Text in a Pad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
9.4.10 The TeX Processor TMathText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
9.5 Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
9.5.1 Axis Title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
9.5.2 Axis Options and Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
9.5.3 Setting the Number of Divisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
9.5.4 Zooming the Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
9.5.5 Drawing Axis Independently of Graphs or Histograms . . . . . . . . . . . . . . . . . . . . . . . 197
9.5.6 Orientation of Tick Marks on Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
9.5.7 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
9.5.8 Axis with Time Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
9.5.9 Axis Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
9.6 Graphical Objects Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
9.6.1 Text Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
9.6.2 Line Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
9.6.3 Fill Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
9.6.4 Color and Color Palettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
9.7 The Graphics Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
9.7.1 TAxisEditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
9.7.2 TPadEditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
9.8 Copy and Paste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
9.8.1 Using the GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
9.8.2 Programmatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
9.9 Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
CONTENTS 9
9.10 The PostScript Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
9.10.1 Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
9.10.2 Writing Several Canvases to the Same PostScript File . . . . . . . . . . . . . . . . . . . . . . . 222
9.10.3 The Color Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
9.11 The PDF Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
9.12 Create or Modify a Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
9.13 3D Viewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
9.13.1 Invoking a 3D viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
9.13.2 The GL Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
9.13.3 The X3D Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
9.13.4 Common 3D Viewer Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
10 Folders and Tasks 243
10.1 Folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
10.2 Why Use Folders? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
10.3 How to Use Folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
10.3.1 Creating a Folder Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
10.3.2 Posting Data to a Folder (Producer) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
10.3.3 Reading Data from a Folder (Consumer) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
10.4 Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
10.5 Execute and Debug Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
11 Input/Output 251
11.1 The Physical Layout of ROOT Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
11.1.1 The File Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
11.1.2 The Top Directory Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
11.1.3 The Histogram Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
11.1.4 The Class Description List (StreamerInfo List) . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
11.1.5 The List of Keys and the List of Free Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
11.1.6 File Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
11.2 The Logical ROOT File: TFile and TKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
11.2.1 Viewing the Logical File Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
11.2.2 The Current Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
11.2.3 Objects in Memory and Objects on Disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
11.2.4 Saving Histograms to Disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
11.2.5 Histograms and the Current Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
11.2.6 Saving Objects to Disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
11.2.7 Saving Collections to Disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
11.2.8 A TFile Object Going Out of Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
11.2.9 Retrieving Objects from Disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
11.2.10Subdirectories and Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
11.3 Streamers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
11.3.1 Automatically Generated Streamers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
10 CONTENTS
11.3.2 Transient Data Members (//!) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
11.3.3 The Pointer to Objects (//->) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
11.3.4 Variable Length Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
11.3.5 Double32_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
11.3.6 Prevent Splitting (//|| ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
11.3.7 Streamers with Special Additions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
11.3.8 Writing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
11.3.9 Ignore Object Streamers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
11.3.10Streaming a TClonesArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
11.4 Pointers and References in Persistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
11.4.1 Streaming C++ Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
11.4.2 Motivation for the TRef Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
11.4.3 Using TRef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
11.4.4 How Does It Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
11.4.5 Action on Demand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
11.4.6 Array of TRef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
11.5 Schema Evolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
11.5.1 The TStreamerInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
11.5.2 The TStreamerElement Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
11.5.3 Example: TH1 StreamerInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
11.5.4 Optimized StreamerInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
11.5.5 Automatic Schema Evolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
11.5.6 Manual Schema Evolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
11.5.7 Building Class Definitions with the StreamerInfo . . . . . . . . . . . . . . . . . . . . . . . . . . 279
11.5.8 Example: MakeProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
11.6 Migrating to ROOT 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
11.7 Compression and Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
11.8 Remotely Access to ROOT Files via a rootd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
11.8.1 TNetFile URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
11.8.2 Remote Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
11.8.3 A Simple Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
11.8.4 The rootd Daemon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
11.8.5 Starting rootd via inetd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
11.8.6 Command Line Arguments for rootd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
11.9 Reading ROOT Files via Apache Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
11.9.1 Using the General Open Function of TFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
11.10XML Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
CONTENTS 11
12 Trees 287
12.1 Why Should You Use a Tree? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
12.2 A Simple TTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
12.3 Show an Entry with TTree::Show . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
12.4 Print the Tree Structure with TTree::Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
12.5 Scan a Variable the Tree with TTree::Scan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
12.6 The Tree Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
12.7 Creating and Saving Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
12.7.1 Creating a Tree from a Folder Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
12.7.2 Tree and TRef Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
12.7.3 Autosave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
12.7.4 Trees with Circular Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
12.7.5 Size of TTree in the File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
12.7.6 User Info Attached to a TTree Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
12.7.7 Indexing a Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
12.8 Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
12.9 Adding a Branch to Hold a List of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
12.10Adding a TBranch to Hold an Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
12.10.1Setting the Split-level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
12.10.2Exempt a Data Member from Splitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
12.10.3Adding a Branch to Hold a TClonesArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
12.10.4 Identical Branch Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
12.11Adding a Branch with a Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
12.12Adding a Branch with a Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
12.13Examples for Writing and Reading Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
12.14Example 1: A Tree with Simple Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
12.14.1Writing the Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
12.14.2Viewing the Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
12.14.3Reading the Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
12.15Example 2: A Tree with a C Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
12.15.1Writing the Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
12.15.2Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
12.16Example 3: Adding Friends to Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
12.16.1Adding a Branch to an Existing Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
12.16.2TTree::AddFriend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
12.17Example 4: A Tree with an Event Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
12.17.1The Event Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
12.17.2The EventHeader Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
12.17.3The Track Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
12.17.4Writing the Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
12.17.5Reading the Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
12.18Example 5: Import an ASCII File into a TTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
12.19Trees in Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
12 CONTENTS
12.20Simple Analysis Using TTree::Draw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
12.20.1Using Selection with TTree:Draw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
12.20.2Using TCut Objects in TTree::Draw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
12.20.3Accessing the Histogram in Batch Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
12.20.4Using Draw Options in TTree::Draw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
12.20.5Superimposing Two Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
12.20.6Setting the Range in TTree::Draw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
12.20.7TTree::Draw Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
12.20.8Multiple variables visualisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
12.20.9Using TTree::Scan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
12.20.10TEventList and TEntryList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
12.20.11Filling a Histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
12.21Using TTree::MakeClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
12.21.1Creating a Class with MakeClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
12.21.2MyClass.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
12.21.3MyClass.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
12.21.4Modifying MyClass::Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
12.21.5Loading MyClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
12.22Using TTree::MakeSelector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
12.22.1Performance Benchmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
12.23Impact of Compression on I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
12.24Chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
12.24.1TChain::AddFriend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
13 Math Libraries in ROOT 349
13.1 TMath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
13.2 Random Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
13.2.1 TRandom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
13.2.2 TRandom1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
13.2.3 TRandom2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
13.2.4 TRandom3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
13.2.5 Seeding the Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
13.2.6 Examples of Using the Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
13.2.7 Random Number Distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
13.2.8 UNURAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
13.2.9 Performances of Random Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
13.3 MathCore Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
13.4 Generic Vectors for 2, 3 and 4 Dimensions (GenVector) . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
13.4.1 Main Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
13.4.2 Example: 3D Vector Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
13.4.3 Example: 3D Point Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
13.4.4 Example: LorentzVector Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
13.4.5 Example: Vector Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
CONTENTS 13
13.4.6 Example with External Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
13.5 MathMore Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
13.6 Mathematical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
13.6.1 Special Functions in MathCore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
13.6.2 Special Functions in MathMore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
13.6.3 Probability Density Functions (PDF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
13.6.4 Cumulative Distribution Functions (CDF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
13.7 Linear Algebra: SMatrix Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
13.7.1 Example: Vector Class (SVector) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
13.7.2 Example: Matrix Class (SMatrix) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
13.7.3 Example: Matrix and Vector Functions and Operators . . . . . . . . . . . . . . . . . . . . . . . 374
13.7.4 Matrix and Vector Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
13.8 Minuit2 Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
13.9 ROOT Statistics Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
13.9.1 Classes for Computing Limits and Confidence Levels . . . . . . . . . . . . . . . . . . . . . . . . 376
13.9.2 Specialized Classes for Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
13.9.3 Multi-variate Analysis Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
14 Linear Algebra in ROOT 379
14.1 Overview of Matrix Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
14.2 Matrix Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
14.2.1 Accessing Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
14.2.2 Setting Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
14.3 Creating and Filling a Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
14.4 Matrix Operators and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
14.4.1 Arithmetic Operations between Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
14.4.2 Arithmetic Operations between Matrices and Real Numbers . . . . . . . . . . . . . . . . . . . . 384
14.4.3 Comparisons and Boolean Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
14.4.4 Matrix Norms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
14.4.5 Miscellaneous Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
14.5 Matrix Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
14.5.1 View Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
14.5.2 View Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
14.6 Matrix Decompositions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
14.6.1 Tolerances and Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
14.6.2 Condition number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
14.6.3 LU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
14.6.4 Bunch-Kaufman . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
14.6.5 Cholesky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
14.6.6 QRH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
14.6.7 SVD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
14.7 Matrix Eigen Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
14.8 Speed Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
14 CONTENTS
15 Adding a Class 395
15.1 The Role of TObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
15.1.1 Introspection, Reflection and Run Time Type Identification . . . . . . . . . . . . . . . . . . . . 395
15.1.2 Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
15.1.3 Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
15.1.4 Paint/Draw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
15.1.5 Clone/DrawClone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
15.1.6 Browse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
15.1.7 SavePrimitive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
15.1.8 GetObjectInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
15.1.9 IsFolder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
15.1.10Bit Masks and Unique ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
15.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
15.2.1 Template Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
15.3 The Default Constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
15.4 rootcint: The CINT Dictionary Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
15.4.1 Dictionaries for STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
15.5 Adding a Class with a Shared Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
15.5.1 The LinkDef.h File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
15.6 Adding a Class with ACLiC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
16 Collection Classes 411
16.1 Understanding Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
16.1.1 General Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
16.1.2 Determining the Class of Contained Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
16.1.3 Types of Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
16.1.4 Ordered Collections (Sequences) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
16.2 Iterators: Processing a Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
16.3 Foundation Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
16.4 A Collectable Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
16.5 The TIter Generic Iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
16.6 The TList Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
16.6.1 Iterating Over a TList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
16.7 The TObjArray Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
16.8 TClonesArray An Array of Identical Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
16.8.1 The Idea Behind TClonesArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
16.9 Template Containers and STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
CONTENTS 15
17 Physics Vectors 421
17.1 The Physics Vector Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
17.2 TVector3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
17.2.1 Declaration / Access to the Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
17.2.2 Other Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
17.2.3 Arithmetic / Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
17.2.4 Related Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
17.2.5 Scalar and Vector Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
17.2.6 Angle between Two Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
17.2.7 Rotation around Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
17.2.8 Rotation around a Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
17.2.9 Rotation by TRotation Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
17.2.10Transformation from Rotated Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
17.3 TRotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
17.3.1 Declaration, Access, Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
17.3.2 Rotation around Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
17.3.3 Rotation around Arbitrary Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
17.3.4 Rotation of Local Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
17.3.5 Inverse Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
17.3.6 Compound Rotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
17.3.7 Rotation of TVector3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
17.4 TLorentzVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
17.4.1 Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
17.4.2 Access to Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
17.4.3 Vector Components in Non-Cartesian Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . 427
17.4.4 Arithmetic and Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
17.4.5 Magnitude/Invariant mass, beta, gamma, scalar product . . . . . . . . . . . . . . . . . . . . . . 427
17.4.6 Lorentz Boost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
17.4.7 Rotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
17.4.8 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
17.5 TLorentzRotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
17.5.1 Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
17.5.2 Access to the Matrix Components/Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . 429
17.5.3 Transformations of a Lorentz Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
17.5.4 Transformation of a TLorentzVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
17.5.5 Physics Vector Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
18 The Geometry Package 431
18.1 Quick Start: Creating the world . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
18.1.1 Example 1: Creating the World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
18.1.2 Example 2: A Geometrical Hierarchy Look and Feel . . . . . . . . . . . . . . . . . . . . . . . . 432
18.2 Materials and Tracking Media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
18.2.1 Elements, Materials and Mixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
16 CONTENTS
18.2.2 Radionuclides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
18.2.3 Tracking Media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
18.2.4 User Interface for Handling Materials and Media . . . . . . . . . . . . . . . . . . . . . . . . . . 439
18.3 Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
18.3.1 Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
18.3.2 Primitive Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
18.3.3 Composite Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
18.3.4 Navigation Methods Performed By Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
18.3.5 Creating Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
18.3.6 Dividing Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
18.3.7 Parametric Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
18.4 Geometry Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
18.4.1 The Volume Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
18.4.2 Creating and Positioning Volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
18.4.3 Geometrical Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
18.4.4 Ownership of Geometry Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
18.5 Navigation and Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
18.5.1 TGeoNavigator Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
18.5.2 Initializing the Starting Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
18.5.3 Initializing the Direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
18.5.4 Initializing the State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
18.5.5 Checking the Current State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
18.5.6 Saving and Restoring the Current State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
18.5.7 Navigation Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
18.5.8 Creating and Visualizing Tracks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
18.6 Checking the Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
18.6.1 The Overlap Checker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
18.6.2 Graphical Checking Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
18.7 The Drawing Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
18.7.1 Drawing Volumes and Hierarchies of Volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
18.7.2 Visualization Settings and Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
18.7.3 Ray Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
18.8 Representing Misalignments of the Ideal Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
18.8.1 Physical Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
18.9 Geometry I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
18.9.1 GDML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
18.10Navigation Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
18.10.1Finding the State Corresponding to a Location (x,y,z) . . . . . . . . . . . . . . . . . . . . . . . 491
18.10.2Finding the Distance to Next Crossed Boundary . . . . . . . . . . . . . . . . . . . . . . . . . . 492
18.11Geometry Graphical User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
18.11.1Editing a Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
18.11.2The Geometry Manager Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
18.11.3Editing Existing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
CONTENTS 17
18.11.4Creation of New Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503
18.11.5Editing Volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503
18.11.6How to Create a Valid Geometry with Geometry Editors . . . . . . . . . . . . . . . . . . . . . 507
19 Python and Ruby Interfaces 509
19.1 PyROOT Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
19.1.1 Glue-ing Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
19.1.2 Access to ROOT from Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
19.1.3 Access to Python from ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
19.1.4 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
19.1.5 Using PyROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
19.1.6 Memory Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
19.1.7 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
19.1.8 Use of Python Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
19.1.9 Working with Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
19.1.10Using Your Own Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
19.2 How to Use ROOT with Ruby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
19.2.1 Building and Installing the Ruby Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
20 The Tutorials and Tests 523
20.1 $ROOTSYS/tutorials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
20.2 $ROOTSYS/test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
20.2.1 Event - An Example of a ROOT Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
20.2.2 stress - Test and Benchmark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
20.2.3 guitest - A Graphical User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
21 Example Analysis 533
21.1 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
21.2 Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
22 Networking 541
22.1 Setting-up a Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
22.2 Sending Objects over the Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
22.3 Closing the Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
22.4 A Server with Multiple Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
23 Threads 545
23.1 Threads and Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
23.1.1 Process Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
23.1.2 Thread Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
23.1.3 The Initial Thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
23.2 Implementation of Threads in ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
23.2.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
23.2.2 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
23.2.3 TThread for Pedestrians . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
18 CONTENTS
23.2.4 TThread in More Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
23.3 Advanced TThread: Launching a Method in a Thread . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
23.3.1 Known Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
23.4 The Signals of ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
23.5 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
24 PROOF: Parallel Processing 555
25 Writing a Graphical User Interface 557
25.1 The ROOT GUI Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
25.2 Widgets and Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
25.3 TVirtualX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
25.4 A Simple Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
25.4.1 A Standalone Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
25.5 Widgets Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
25.5.1 TGObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
25.5.2 TGWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
25.5.3 TGWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
25.5.4 Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
25.6 Layout Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
25.7 Event Processing: Signals and Slots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
25.8 Widgets in Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
25.8.1 Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
25.8.2 Text Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
25.8.3 Number Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
25.8.4 Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
25.8.5 Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582
25.8.6 List Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584
25.8.7 Combo Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
25.8.8 Sliders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586
25.8.9 Triple Slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
25.8.10Progress Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
25.8.11Static Widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
25.8.12Status Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
25.8.13Splitters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
25.8.14TGCanvas, ViewPort and Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
25.8.15Embedded Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
25.9 The ROOT Graphics Editor (GED) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592
25.9.1 Object Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592
25.9.2 Editor Design Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
25.10Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594
25.10.1Drag and Drop Data Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
25.10.2Handling Drag and Drop Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
CONTENTS 19
26 ROOT/Qt Integration Interfaces 597
26.1 Qt-ROOT Implementation of TVirtualX Interface (BNL) . . . . . . . . . . . . . . . . . . . . . . . . . 597
26.1.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
26.1.2 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
26.1.3 TQtWidget Class, Qt Signals / Slots and TCanvas Interface . . . . . . . . . . . . . . . . . . . . 605
26.2 GSI QtROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
26.2.1 Create a New Project in the Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
26.2.2 main() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
27 Automatic HTML Documentation 611
27.1 Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
27.1.1 Product and Module Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
27.2 Converting Sources (and Other Files) to HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
27.3 Special Documentation Elements: Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
27.3.1 Latex Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
27.3.2 Macro Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
27.4 Customizing HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
27.4.1 Referencing Documentation for other Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
27.4.2 Search Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
27.4.3 ViewCVS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
27.4.4 Wiki Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
27.5 Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
28 Appendix A: Install and Build ROOT 615
28.1 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
28.2 Installing ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
28.3 Choosing a Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
28.4 Installing Precompiled Binaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
28.5 Installing the Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616
28.5.1 Installing and Building the Source from a Compressed File . . . . . . . . . . . . . . . . . . . . 616
28.5.2 More Build Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616
28.6 File system.rootrc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617
28.6.1 TCanvas Specific Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
28.6.2 THtml Specific Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620
28.6.3 GUI Specific Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
28.6.4 TBrowser Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
28.6.5 TRint Specific Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
28.6.6 ACLiC Specific Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
28.6.7 PROOF Related Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
28.7 Documentation to Download . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627
20 CONTENTS
Preface
Draft, November 2000 - version 0.6.2In late 1994, we decided to learn and investigate Object Oriented programmingand C++ to better judge the suitability of these relatively new techniques for scientific programming. We knew thatthere is no better way to learn a new programming environment than to use it to write a program that can solve a realproblem. After a few weeks, we had our first histogramming package in C++. A few weeks later we had a rewrite ofthe same package using the, at that time, very new template features of C++. Again, a few weeks later we had anotherrewrite of the package without templates since we could only compile the version with templates on one single platformusing a specific compiler. Finally, after about four months we had a histogramming package that was faster and moreefficient than the well-known FORTRAN based HBOOK histogramming package. This gave us enough confidence inthe new technologies to decide to continue the development. Thus was born ROOT. Since its first public release at theend of 1995, ROOT has enjoyed an ever-increasing popularity. Currently it is being used in all major High Energyand Nuclear Physics laboratories around the world to monitor, to store and to analyse data. In the other sciences aswell as the medical and financial industries, many people are using ROOT. We estimate the current user base to bearound several thousand people. In 1997, Eric Raymond analysed in his paper The Cathedral and the Bazaar thedevelopment method that makes Linux such a success. The essence of that method is: release early, release oftenand listen to your customers. This is precisely how ROOT is being developed. Over the last five years, many of ourcustomers became co-developers. Here we would like to thank our main co-developers and contributors:
Masaharu Goto wrote the CINT C++ interpreter that became an essential part of ROOT. Despite being 8 timezones ahead of us, we have the feeling he has been sitting in the room next door since 1995.
Andrei and Mihaela Gheata (Alice collaboration) are co-authors of the ROOT geometry classes and VirtualMonte-Carlo. They have been working with the ROOT team since 2000.
Olivier Couet, who after a successful development and maintenance of PAW, has joined the ROOT team in 2000 andhas been working on the graphics sub-system.
Ilka Antcheva has been working on the Graphical User Interface classes. She is also responsible for this latest editionof the Users Guide with a better style, improved index and several new chapters (since 2002).
Bertrand Bellenot has been developing and maintaining the Win32GDK version of ROOT. Bertrand has also manyother contributions like the nice RootShower example (since 2001).
Valeriy Onoutchin has been working on several ROOT packages, in particular the graphics sub-system for Windowsand the GUI Builder (since 2000).
Gerri Ganis has been working on the authentication procedures to be used by the root daemons and the PROOFsystem (since 2002).
Maarten Ballintijn (MIT) is one of the main developers of the PROOF sub-system (since 1995).
Valeri Fine (now at BNL) ported ROOT to Windows and contributed largely to the 3-D graphics. He is currentlyworking on the Qt layer of ROOT (since 1995).
Victor Perevoztchikov (BNL) worked on key elements of the I/O system, in particular the improved support forSTL collections (1997-2001).
Nenad Buncic developed the HTML documentation generation system and integrated the X3D viewer inside ROOT(1995-1997).
Suzanne Panacek was the author of the first version of this Users Guide and very active in preparing tutorials andgiving lectures about ROOT (1999-2002).
Axel Naumann has been developing further the HTML Reference Guide and helps in porting ROOT under Windows(cygwin/gcc implementation) (since 2000).
Anna Kreshuk has developed the Linear Fitter and Robust Fitter classes as well as many functions in TMath, TF1,TGraph (since 2005).
Richard Maunder has contributed to the GL viewer classes (since 2004).
21
22 CONTENTS
Timur Pocheptsov has contributed to the GL viewer classes and GL in pad classes (since 2004).
Sergei Linev has developed the XML driver and the TSQLFile classes (since 2003).
Stefan Roiser has been contributing to the reflex and cintex packages (since 2005).
Lorenzo Moneta has been contributing the MathCore, MathMore, Smatrix & Minuit2 packages (since 2005).
Wim Lavrijsen is the author of the PyRoot package (since 2004).
Further we would like to thank all the people mentioned in the $ROOTSYS/README/CREDITS file for their contributions,and finally, everybody who gave comments, reported bugs and provided fixes.
Happy ROOTing!
Rene Brun & Fons Rademakers
Geneva, July 2007
Chapter 1
Introduction
In the mid 1990s, Ren Brun and Fons Rademakers had many years of experience developing interactive tools andsimulation packages. They had lead successful projects such as PAW, PIAF, and GEANT, and they knew PAW thetwenty-year-old FORTRAN libraries had reached their limits. Although still very popular, these tools could not scaleup to the challenges offered by the Large Hadron Collider, where the data is a few orders of magnitude larger thananything seen before.
At the same time, computer science had made leaps of progress especially in the area of Object Oriented Design, andRen and Fons were ready to take advantage of it.
ROOT was developed in the context of the NA49 experiment at CERN. NA49 has generated an impressive amount ofdata, around 10 Terabytes per run. This rate provided the ideal environment to develop and test the next generationdata analysis.
One cannot mention ROOT without mentioning CINT, its C++ interpreter. CINT was created by Masa Goto inJapan. It is an independent product, which ROOT is using for the command line and script processor.
ROOT was, and still is, developed in the Bazaar style, a term from the book The Cathedral and the Bazaar byEric S. Raymond. It means a liberal, informal development style that heavily relies on the diverse and deep talent ofthe user community. The result is that physicists developed ROOT for themselves; this made it specific, appropriate,useful, and over time refined and very powerful. The development of ROOT is a continuous conversation between usersand developers with the line between the two blurring at times and the users becoming co-developers.
When it comes to storing and mining large amount of data, physics plows the way with its Terabytes, but other fieldsand industry follow close behind as they acquiring more and more data over time. They are ready to use the true andtested technologies physics has invented. In this way, other fields and industries have found ROOT useful and theyhave started to use it also.
In the bazaar view, software is released early and frequently to expose it to thousands of eager co-developers to poundon, report bugs, and contribute possible fixes. More users find more bugs, because they stress the program in differentways. By now, after ten years, the age of ROOT is quite mature. Most likely, you will find the features you are lookingfor, and if you have found a hole, you are encouraged to participate in the dialog and post your suggestion or evenimplementation on roottalk, the ROOT mailing list.
1.1 The ROOT Mailing Lists
The roottalk was the very first active ROOT mailing list. mailing list People can subscribe to it by registering at theROOT web site: http://root.cern.ch/root/Registration.phtml. The RootTalk Forum http://root.cern.ch/phpBB3/ hasbeen gradually replaced this mailing list since September 2003. The RootTalk Forum is a web-based news group withabout 10 discussion sub-units.
If you have a question, it is likely that it has been asked, answered, and stored in the roottalk or RootTalk Forumarchives. Please use the search engine to see if your question has already been answered before sending a mail to theroottalk list or post a topic in the Forum.
You can browse the roottalk archives at: http://root.cern.ch/root/roottalk/AboutRootTalk.html. You can send yourquestion without subscribing to: [email protected]
23
24 CHAPTER 1. INTRODUCTION
1.2 Contact Information
Several authors wrote this book and you may see a change of voice from one chapter to the next. We felt we couldaccept this in order to have the expert explain what they know best. If you would like to contribute a chapter oradd to a section, please contact [email protected]. We count on you to send us suggestions on additi