没有合适的资源?快使用搜索试试~ 我知道了~
ROOTPrimer.pdf
资源推荐
资源详情
资源评论
Contents
A ROOT Guide For Beginners 3
1 Motivation and Introduction 5
1.1 Welcome to ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 ROOT Basics 9
2.1 ROOT as calculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 ROOT as Function Plotter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Controlling ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4 Plotting Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5 Histograms in ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.6 Interactive ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.7 ROOT Beginners’ FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.7.1 ROOT type declarations for basic data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.7.2 Configure ROOT at start-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.7.3 ROOT command history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.7.4 ROOT Global Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3 ROOT Macros 19
3.1 General Remarks on ROOT macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2 A more complete example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.3 Summary of Visual effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3.1 Colours and Graph Markers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3.2 Arrows and Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.3.3 Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.4 Interpretation and Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.4.1 Compile a Macro with ACLiC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.4.2 Compile a Macro with the Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4 Graphs 25
4.1 Read Graph Points from File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2 Polar Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.3 2D Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1
2 CONTENTS
5 Histograms 31
5.1 Your First Histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.2 Add and Divide Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.3 Two-dimensional Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6 Functions and Parameter Estimation 39
6.1 Fitting Functions to Pseudo Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.2 Toy Monte Carlo Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7 File I/O and Parallel Analysis 45
7.1 Storing ROOT Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.2 N-tuples in ROOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
7.2.1 Storing simple N-tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
7.2.2 Reading N-tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
7.2.3 Storing Arbitrary N-tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
7.2.4 Processing N-tuples Spanning over Several Files . . . . . . . . . . . . . . . . . . . . . . . . . . 49
7.2.5 For the advanced user: Processing trees with a selector script . . . . . . . . . . . . . . . . . . . 49
7.2.6 For power-users: Multi-core processing with PROOF lite . . . . . . . . . . . . . . . . . . . . . 53
7.2.7 Optimisation Regarding N-tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
7.3 Concluding Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
8 References 55
A ROOT Guide For Beginners
“Diving Into ROOT”
Abstact:
ROOT is a software framework for data analysis, a powerful tool to cope with the demanding tasks typical of state
of the art scientific data analysis. Among its prominent features are an advanced graphical user interface, ideal for
interactive analysis, an interpreter for the C++ programming language, for rapid and efficient prototyping and a
persistency mechanism for C++ objects, used also to write every year petabytes of data recorded by the Large Hadron
Collider experiments. This introductory guide illustrates the main features of ROOT, relevant for the typical problems
of data analysis: input and plotting of data from measurements and fitting of analytical functions.
3
4 CONTENTS
Chapter 1
Motivation and Introduction
Welcome to data analysis!
1
Comparison of measurements to theoretical models is one of the standard tasks in experimental physics. In the most
simple case, a “model” is just a function providing predictions of measured data. Very often, the model depends on
parameters. Such a model may simply state “the current I is proportional to the voltage U ”, and the task of the
experimentalist consists of determining the resistance, R, from a set of measurements.
As a first step, a visualisation of the data is needed. Next, some manipulations typically have to be applied,
e.g. corrections or parameter transformations. Quite often, these manipulations are complex ones, and a powerful
library of mathematical functions and procedures should be provided - think for example of an integral or peak-search
or a Fourier transformation applied to an input spectrum to obtain the actual measurement described by the model.
One specialty of experimental physics are the inevitable errors affecting each measurement, and visualisation tools have
to include these. In subsequent analysis, the statistical nature of the errors must be handled properly.
As the last step, measurements are compared to models, and free model parameters need to be determined in this
process. See Figure 1.1 for an example of a function (model) fit to data points. Several standard methods are available,
and a data analysis tool should provide easy access to more than one of them. Means to quantify the level of agreement
between measurements and model must also be available.
Quite often, the data volume to be analyzed is large - think of fine-granular measurements accumulated with the aid of
computers. A usable tool therefore must contain easy-to-use and efficient methods for data handling.
In Quantum mechanics, models typically only predict the probability density function (“pdf”) of measurements
depending on a number of parameters, and the aim of the experimental analysis is to extract the parameters from the
observed distribution of frequencies at which certain values of the measurement are observed. Measurements of this
kind require means to generate and visualize frequency distributions, so-called histograms, and stringent statistical
treatment to extract the model parameters from purely statistical distributions.
Simulation of expected data is another important aspect in data analysis. By repeated generation of “pseudo-data”,
which are analysed in the same manner as intended for the real data, analysis procedures can be validated or compared.
In many cases, the distribution of the measurement errors is not precisely known, and simulation offers the possibility
to test the effects of different assumptions.
1.1 Welcome to ROOT
A powerful software framework addressing all of the above requirements is ROOT (Brun, René and Rademakers, Fons
1997), an open source project coordinated by the European Organisation for Nuclear Research, CERN in Geneva.
ROOT is very flexible and provides both a programming interface to use in own applications and a graphical user
interface for interactive data analysis. The purpose of this document is to serve as a beginners guide and provides
extendable examples for your own use cases, based on typical problems addressed in student labs. This guide will
hopefully lay the ground for more complex applications in your future scientific work building on a modern, state-of
the art tool for data analysis.
This guide in form of a tutorial is intended to introduce you to the ROOT package in about 30 pages. This goal will
be accomplished using concrete examples, according to the “learning by doing” principle. Also because of this reason,
this guide cannot cover the complexity of the ROOT package. Nevertheless, once you feel confident with the concepts
1
This guide was prepared for the ROOT IRMM Tutorial adapting “A ROOT Guide for Students” http://www-ekp.physik.uni-karlsruhe.
de/~quast, a document by D. Piparo, G. Quast and M. Zeise.
5
剩余54页未读,继续阅读
资源评论
爬天梯的蜗牛
- 粉丝: 3
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功