Skip to content
Snippets Groups Projects
Commit 7d84c5e4 authored by Olivier Couet's avatar Olivier Couet
Browse files

The title page was marked as "Chapter"

The markdown attribute {.unnumbered} avoid that.
parent d9ba0f0b
No related branches found
No related tags found
No related merge requests found
...@@ -24,17 +24,17 @@ these. In subsequent analysis, the statistical nature of the errors must ...@@ -24,17 +24,17 @@ these. In subsequent analysis, the statistical nature of the errors must
be handled properly. be handled properly.
As the last step, measurements are compared to models, and free model As the last step, measurements are compared to models, and free model
parameters need to be determined in this process. See Figure [2.1](#f21) for an parameters need to be determined in this process. See Figure [1.1](#f11) for an
example of a function (model) fit to data points. Several standard methods are 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 available, and a data analysis tool should provide easy access to more
than one of them. Means to quantify the level of agreement between than one of them. Means to quantify the level of agreement between
measurements and model must also be available. measurements and model must also be available.
[f21]: figures/examplefit.png "f21" [f11]: figures/examplefit.png "f11"
<a name="f21"></a> <a name="f11"></a>
![Measured data points with error bars and fitted quadratic ![Measured data points with error bars and fitted quadratic
function.\label{f21}][f21] function.\label{f11}][f11]
Quite often, the data volume to be analyzed is large - think of Quite often, the data volume to be analyzed is large - think of
fine-granular measurements accumulated with the aid of computers. A fine-granular measurements accumulated with the aid of computers. A
......
...@@ -168,14 +168,14 @@ executed one after the other. ...@@ -168,14 +168,14 @@ executed one after the other.
Fnslit->Draw(); Fnslit->Draw();
} }
``` ```
[f31]: figures/TF1_DoubleSlit.png "f31" [f21]: figures/TF1_DoubleSlit.png "f21"
<a name="f31"></a> <a name="f21"></a>
![Output of slits.C with parameters 0.2 and 2.\label{f31}][f31] ![Output of slits.C with parameters 0.2 and 2.\label{f21}][f21]
The example first asks for user input, namely the ratio of slit width The example first asks for user input, namely the ratio of slit width
over slit distance, and the number of slits. After entering this over slit distance, and the number of slits. After entering this
information, you should see the graphical output as is shown in Figure [3.1](#f31). information, you should see the graphical output as is shown in Figure [2.1](#f21).
This is a more complicated example than the ones we have seen before, so This is a more complicated example than the ones we have seen before, so
spend some time analysing it carefully, you should have understood it spend some time analysing it carefully, you should have understood it
...@@ -254,12 +254,12 @@ root [0] TGraphErrors *gr=new TGraphErrors("ExampleData.txt"); ...@@ -254,12 +254,12 @@ root [0] TGraphErrors *gr=new TGraphErrors("ExampleData.txt");
root [1] gr->Draw("AP"); root [1] gr->Draw("AP");
``` ```
You should see the output shown in Figure [3.2](#f32). You should see the output shown in Figure [2.2](#f22).
[f32]: figures/TGraphErrors_Example.png "f32" [f22]: figures/TGraphErrors_Example.png "f22"
<a name="f32"></a> <a name="f22"></a>
![Visualisation of data points with errors using the class TGraphErrors. \label{f32}][f32] ![Visualisation of data points with errors using the class TGraphErrors. \label{f22}][f22]
Make sure the file `ExampleData.txt` is available in the directory from Make sure the file `ExampleData.txt` is available in the directory from
which you started ROOT. Inspect this file now with your favourite which you started ROOT. Inspect this file now with your favourite
...@@ -302,11 +302,11 @@ in this case, and set its parameters. In Line 4 a histogram is ...@@ -302,11 +302,11 @@ in this case, and set its parameters. In Line 4 a histogram is
instantiated, with a name, a title, a certain number of bins (100 of instantiated, with a name, a title, a certain number of bins (100 of
them, equidistant, equally sized) in the range from 0 to 5. them, equidistant, equally sized) in the range from 0 to 5.
[f33]: figures/TH1F_Example.png "f33" [f23]: figures/TH1F_Example.png "f23"
<a name="f33"></a> <a name="f23"></a>
![Visualisation of a histogram filled with exponentially distributed, ![Visualisation of a histogram filled with exponentially distributed,
random numbers. \label{f33}][f33] random numbers. \label{f23}][f23]
We use yet another new feature of ROOT to fill this histogram with data, We use yet another new feature of ROOT to fill this histogram with data,
namely pseudo-random numbers generated with the method `TF1::GetRandom`, namely pseudo-random numbers generated with the method `TF1::GetRandom`,
...@@ -318,7 +318,7 @@ function. The histogram is displayed using the method `TH1F::Draw()`. ...@@ -318,7 +318,7 @@ function. The histogram is displayed using the method `TH1F::Draw()`.
You may think of this example as repeated measurements of the life time You may think of this example as repeated measurements of the life time
of a quantum mechanical state, which are entered into the histogram, of a quantum mechanical state, which are entered into the histogram,
thus giving a visual impression of the probability density distribution. thus giving a visual impression of the probability density distribution.
The plot is shown in Figure [3.3](#f33). The plot is shown in Figure [2.3](#f23).
Note that you will not obtain an identical plot when executing the above Note that you will not obtain an identical plot when executing the above
lines, depending on how the random number generator is initialised. lines, depending on how the random number generator is initialised.
...@@ -356,24 +356,24 @@ access to the members of the various classes, and you can even modify ...@@ -356,24 +356,24 @@ access to the members of the various classes, and you can even modify
them, e.g. change colour and size of the axis ticks or labels, the them, e.g. change colour and size of the axis ticks or labels, the
function lines, marker types and so on. Try it! function lines, marker types and so on. Try it!
[f34]: figures/ROOTPanel_SetParameters.png "f34" [f24]: figures/ROOTPanel_SetParameters.png "f24"
<a name="f34"></a> <a name="f24"></a>
![Interactive ROOT panel for setting function parameters.\label{f34}][f34] ![Interactive ROOT panel for setting function parameters.\label{f24}][f24]
You will probably like the following: in the output produced by the You will probably like the following: in the output produced by the
example `slits.C`, right-click on the function line and select example `slits.C`, right-click on the function line and select
"SetLineAttributes", then left-click on "Set Parameters". This gives "SetLineAttributes", then left-click on "Set Parameters". This gives
access to a panel allowing you to interactively change the parameters of access to a panel allowing you to interactively change the parameters of
the function, as shown in Figure [3.4](#f34). Change the slit width, or go from one to the function, as shown in Figure [2.4](#f24). Change the slit width, or go from one to
two and then three or more slits, just as you like. When clicking on two and then three or more slits, just as you like. When clicking on
"Apply", the function plot is updated to reflect the actual value of the "Apply", the function plot is updated to reflect the actual value of the
parameters you have set. parameters you have set.
[f35]: figures/ROOTPanel_FitPanel.png "f35" [f25]: figures/ROOTPanel_FitPanel.png "f25"
<a name="f35"></a> <a name="f25"></a>
![Fit Panel. \label{f35}][f35] ![Fit Panel. \label{f25}][f25]
Another very useful interactive tool is the `FitPanel`, available for the Another very useful interactive tool is the `FitPanel`, available for the
classes `TGraphErrors` and `TH1F`. Predefined fit functions can be selected classes `TGraphErrors` and `TH1F`. Predefined fit functions can be selected
...@@ -384,7 +384,7 @@ for functions with parameters are possible. ...@@ -384,7 +384,7 @@ for functions with parameters are possible.
After setting the initial parameters, a fit of the selected function to the After setting the initial parameters, a fit of the selected function to the
data of a graph or histogram can be performed and the result displayed on the plot. data of a graph or histogram can be performed and the result displayed on the plot.
The fit panel is shown in Figure [3.5](#f35). The fit panel has a number of control options to The fit panel is shown in Figure [2.5](#f25). The fit panel has a number of control options to
select the fit method, fix or release individual parameters in the fit, to steer select the fit method, fix or release individual parameters in the fit, to steer
the level of output printed on the console, or to extract and display additional the level of output printed on the console, or to extract and display additional
information like contour lines showing parameter correlations. As function fitting information like contour lines showing parameter correlations. As function fitting
......
...@@ -44,7 +44,7 @@ documentation of ROOT: have a look for example to the ...@@ -44,7 +44,7 @@ documentation of ROOT: have a look for example to the
The complication level of the code below is intentionally a little The complication level of the code below is intentionally a little
higher than in the previous examples. The graphical output of the macro higher than in the previous examples. The graphical output of the macro
is shown in Figure [7.1](#f71): is shown in Figure [6.1](#f61):
``` {.cpp .numberLines} ``` {.cpp .numberLines}
void format_line(TAttLine* line,int col,int sty){ void format_line(TAttLine* line,int col,int sty){
...@@ -145,12 +145,12 @@ Some step by step explanation is at this point necessary: ...@@ -145,12 +145,12 @@ Some step by step explanation is at this point necessary:
- Lines *58-end*: Plot the pseudo-data, the fitted function and the - Lines *58-end*: Plot the pseudo-data, the fitted function and the
signal and background components at the best-fit values. signal and background components at the best-fit values.
[f71]: figures/functions.png "f71" [f61]: figures/functions.png "f61"
<a name="f71"></a> <a name="f61"></a>
![Fit of pseudo data: a signal shape over a background trend. This plot ![Fit of pseudo data: a signal shape over a background trend. This plot
is another example of how making a plot "self-explanatory" can help you is another example of how making a plot "self-explanatory" can help you
better displaying your results. \label{f71}][f71] better displaying your results. \label{f61}][f61]
## Toy Monte Carlo Experiments ## ## Toy Monte Carlo Experiments ##
......
...@@ -92,7 +92,7 @@ theoretical prediction. ...@@ -92,7 +92,7 @@ theoretical prediction.
With ROOT you can profit from rather advanced plotting routines, like With ROOT you can profit from rather advanced plotting routines, like
the ones implemented in the `TPolarGraph`, a class to draw graphs in the ones implemented in the `TPolarGraph`, a class to draw graphs in
polar coordinates. It is very easy to use, as you see in the example polar coordinates. It is very easy to use, as you see in the example
macro and the resulting Figure [5.1](#f51): macro and the resulting Figure [4.1](#f41):
``` {.cpp .numberLines} ``` {.cpp .numberLines}
// Builds a polar graph in a square Canvas. // Builds a polar graph in a square Canvas.
...@@ -119,10 +119,10 @@ macro and the resulting Figure [5.1](#f51): ...@@ -119,10 +119,10 @@ macro and the resulting Figure [5.1](#f51):
A new element was added on line 4, the size of the canvas: it is A new element was added on line 4, the size of the canvas: it is
sometimes optically better to show plots in specific canvas sizes. sometimes optically better to show plots in specific canvas sizes.
[f51]: figures/polar_graph.png "f51" [f41]: figures/polar_graph.png "f41"
<a name="f51"></a> <a name="f41"></a>
![The graph of a fan obtained with ROOT.\label{f51}][f51] ![The graph of a fan obtained with ROOT.\label{f41}][f41]
## 2D Graphs ## ## 2D Graphs ##
...@@ -204,14 +204,14 @@ Let's go through the code, step by step to understand what is going on: ...@@ -204,14 +204,14 @@ Let's go through the code, step by step to understand what is going on:
- Line *32*: The *Surf1* option draws the `TF2` objects (but also - Line *32*: The *Surf1* option draws the `TF2` objects (but also
bi-dimensional histograms) as coloured surfaces with a wire-frame on bi-dimensional histograms) as coloured surfaces with a wire-frame on
three-dimensional canvases. See Figure [5.2](#f52). three-dimensional canvases. See Figure [4.2](#f42).
- Line *37-41*: Here you learn how to create a canvas, partition it in - Line *37-41*: Here you learn how to create a canvas, partition it in
two sub-pads and access them. It is very handy to show multiple two sub-pads and access them. It is very handy to show multiple
plots in the same window or image. plots in the same window or image.
[f52]: figures/fitted2dFunction.png "f52" [f42]: figures/fitted2dFunction.png "f42"
<a name="f52"></a> <a name="f42"></a>
![A dataset fitted with a bidimensional function visualised as a colored ![A dataset fitted with a bidimensional function visualised as a colored
surface.\label{f52}][f52] surface.\label{f42}][f42]
...@@ -49,14 +49,14 @@ can fill and draw a histogram with the following example macro. ...@@ -49,14 +49,14 @@ can fill and draw a histogram with the following example macro.
} }
``` ```
Which gives you the following plot (Figure [6.1](#f61)): Which gives you the following plot (Figure [5.1](#f51)):
[f61]: figures/poisson.png "f61" [f51]: figures/poisson.png "f51"
<a name="f61"></a> <a name="f51"></a>
![The result of a counting (pseudo) experiment. Only bins corresponding ![The result of a counting (pseudo) experiment. Only bins corresponding
to integer values are filled given the discrete nature of the poissonian to integer values are filled given the discrete nature of the poissonian
distribution. \label{f61}][f61] distribution. \label{f51}][f51]
Using histograms is rather simple. The main differences with respect to Using histograms is rather simple. The main differences with respect to
graphs that emerge from the example are: graphs that emerge from the example are:
...@@ -146,17 +146,17 @@ will learn how to manage these procedures within ROOT. ...@@ -146,17 +146,17 @@ will learn how to manage these procedures within ROOT.
} }
``` ```
The plots that you will obtain are shown in Figures [6.2](#f62) and [6.3](#f63). The plots that you will obtain are shown in Figures [5.2](#f52) and [5.3](#f53).
[f62]: figures/histo_sum.png "f62" [f52]: figures/histo_sum.png "f52"
<a name="f62"></a> <a name="f52"></a>
![The sum of two histograms.\label{f62}][f62] ![The sum of two histograms.\label{f52}][f52]
[f63]: figures/histo_ratio.png "f63" [f53]: figures/histo_ratio.png "f53"
<a name="f63"></a> <a name="f53"></a>
![The ratio of two histograms.\label{f63}][f63] ![The ratio of two histograms.\label{f53}][f53]
Some lines now need a bit of clarification: Some lines now need a bit of clarification:
...@@ -228,27 +228,27 @@ void macro7(){ ...@@ -228,27 +228,27 @@ void macro7(){
``` ```
Two kinds of plots are provided within the code, the first one Two kinds of plots are provided within the code, the first one
containing three-dimensional representations (Figure [6.4](#f64)) and the second one containing three-dimensional representations (Figure [5.4](#f54)) and the second one
projections and profiles (Figure [6.5](#f65)) of the bi-dimensional histogram. projections and profiles (Figure [5.5](#f55)) of the bi-dimensional histogram.
[f64]: figures/th2f.png "f64" [f54]: figures/th2f.png "f54"
<a name="f64"></a> <a name="f54"></a>
![Different ways of representing bi-dimensional ![Different ways of representing bi-dimensional
histograms.\label{f64}][f64] histograms.\label{f54}][f54]
[f65]: figures/proj_and_prof.png "f65" [f55]: figures/proj_and_prof.png "f55"
<a name="f65"></a> <a name="f55"></a>
![The projections and profiles of bi-dimensional ![The projections and profiles of bi-dimensional
histograms.\label{f65}][f65] histograms.\label{f55}][f55]
When a projection is performed along the x (y) direction, for every bin When a projection is performed along the x (y) direction, for every bin
along the x (y) axis, all bin contents along the y (x) axis are summed along the x (y) axis, all bin contents along the y (x) axis are summed
up (upper the plots of Figure [6.5](#f65)). When a profile is performed along the x (y) up (upper the plots of Figure [5.5](#f55)). When a profile is performed along the x (y)
direction, for every bin along the x (y) axis, the average of all the direction, for every bin along the x (y) axis, the average of all the
bin contents along the y (x) is calculated together with their RMS and bin contents along the y (x) is calculated together with their RMS and
displayed as a symbol with error bar (lower two plots of Figure [6.5](#f65)). displayed as a symbol with error bar (lower two plots of Figure [5.5](#f55)).
Correlations between the variables are quantified by the methods Correlations between the variables are quantified by the methods
`Double_t GetCovariance()` and `Double_t GetCorrelationFactor()`. `Double_t GetCovariance()` and `Double_t GetCorrelationFactor()`.
......
# A ROOT Guide For Beginners # # A ROOT Guide For Beginners {.unnumbered}
"Diving Into ROOT" "Diving Into ROOT"
......
...@@ -237,17 +237,17 @@ Let's comment it in detail: ...@@ -237,17 +237,17 @@ Let's comment it in detail:
- Line *63*: save the canvas as image. The format is automatically - Line *63*: save the canvas as image. The format is automatically
inferred from the file extension (it could have been eps, gif, ...). inferred from the file extension (it could have been eps, gif, ...).
Let's give a look to the obtained plot in Figure [4.1](#f41). Beautiful Let's give a look to the obtained plot in Figure [3.1](#f31). Beautiful
outcome for such a small bunch of lines, isn't it ? outcome for such a small bunch of lines, isn't it ?
[f41]: figures/graf_with_law.png "f41" [f31]: figures/graf_with_law.png "f31"
<a name="f41"></a> <a name="f31"></a>
![Your first plot with data points, a fit of an analytical function, a ![Your first plot with data points, a fit of an analytical function, a
legend and some additional information in the form of graphics legend and some additional information in the form of graphics
primitives and text. A well formatted plot, clear for the reader is primitives and text. A well formatted plot, clear for the reader is
crucial to communicate the relevance of your results to the crucial to communicate the relevance of your results to the
reader.\label{f41}][f41] reader.\label{f31}][f31]
## Summary of Visual effects ## Summary of Visual effects
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment