[PDF] Exercise 0: Introduction to root





Previous PDF Next PDF



Exercise 0: Introduction to root

14.10.2012 Exercise 0: Introduction to root. N. Berger (nberger@physi.uni-heidelberg.de). 15. 10. 2012. This tutorial should provide you with a very ...



An Introduction to ROOT

20.07.2012 Introduction. ROOT is a Package for Data Analysis. ROOT Provides: ? Several C++ Libraries. – Store data in histograms.



An Introduction to ROOT

28.07.2011 Introduction. ROOT is a Package for Data Analysis. ROOT Provides: ? Several C++ Libraries. – To store data in histograms.



An Introduction to ROOT

01.08.2007 Introduction. ROOT is a Package for Data Analysis. ROOT Provides: Several C++ Libraries. ¡ To store data in histograms.



Introduction to ROOT

26.07.2018 Also a data format tailored to particle physics needs. Steven Schramm (Université de Gen`eve). Introduction to ROOT. July 26 2018.



An Introduction to ROOT

01.08.2007 Introduction. ROOT is a Package for Data Analysis. ROOT Provides: ? Several C++ Libraries. – To store data in histograms.



indecomposable representations for real roots of a wild quiver

independent of the characteristic of the field. introduction. A fundamental result in the representation theory of quivers is the discovery of the relation.



ROOT SYSTEMS 1. Introduction A root system is a configuration of

Introduction. A root system is a configuration of vectors in some Euclidean space that satisfy nice properties concerning reflections [Wik17].



Introduction to a Virtual Issue on root traits

physiologically distinct from woody fine roots of higher root order. 89. 90. Root economics spectrum. 91. Analysis of root traits logically starts 



Introduction to ROOT

21.07.2004 Separation between data objects and the high level classes acting on these objects. Example a batch job uses only the histogram library



[PDF] Introduction à Root

•Root est un programme spécialement concu pour l'analyse de données en physique des •user guide (guide en pdf par themes avec des exemples etc



[PDF] Intro à ROOT

16 avr 2012 · En physique des particules on fait tout avec ROOT – Lire et écrire des données sur des fichiers – Faire et manipuler des histogrammes – 



[PDF] Introduction à ROOT

1 Introduction ROOT est une bibliothèque de classes disponible gratuitement et facile à installer sur la plupart des machines Les classes de ROOT offrent 



[PDF] A ROOT Guide For Beginners “Diving Into ROOT” - CERN

This introductory guide illustrates the main features of ROOT which are relevant for the typical problems of data analysis: input and plotting of data from 



[PDF] An Introduction to ROOT - DESY

28 juil 2011 · ROOT uses some unusual coding conventions just get used to them ? Class names start with capital T: TH1F TVector ? Names of non-class 



[PDF] An Introduction to ROOT - DESY

1 août 2007 · Introduction ROOT is a Package for Data Analysis ROOT Provides: Several C++ Libraries ¡ To store data in histograms



[PDF] Introduction to ROOT

This introduction: http://ihplx ethz ch/CompMethPP/lectureNotes/exercises/rootintro pdf (or simpler to type: http://tinyurl com/rootintro) ? ROOT 



[PDF] Introduction to ROOT

25 jan 2022 · ROOT is an object-oriented framework for large-scale data handling analysis ? It is originally developed for high energy physics



[PDF] Root Learn to Play

Introduction Root is a fast-paced game of adventure and war You will play as one of four factions vying to show that you are the most legitimate ruler of 

:
Statistical Methods in Particle Physics WS 2012/2013

Exercise 0: Introduction toroot

N. Berger (nberger@physi.uni-heidelberg.de)

15. 10. 2012

This tutorial should provide you with a very basic introduction to theroot data analysis framework. It comes in two dierent avours, namely in the native C++ interpreter way and in Python; maybe you already have a preference, if not give both a try and see what works best for you. First, make sure you have your environment set up correctly, see /statistics/documentation.php. Also create a separate folder for your exer- cises in this course and change to that folder.

1 Native root (C++)

Open arootsession in a shell by typing

> root (where the>symbol stands for your prompt. This should startroot. If not, check your environment again... You now have therootC++ interpreter run- ning, so you can enter almost any valid C++ code. Or just userootas a calculator root[0] 1 + log(2) The object inrootwe will use most is the histogram, so lets create one: root[1] TH1F myhisto("myhisto","My most fabulous histogram",10,0,100) This creates a histogram (of type TH1F), to which root will refer by its name ("myhisto") and which will be displayed with the title given. It has ten bins, the lowest value is 0 and the highest 100. Now we can ll some values into the histogram (rootwill return the corresponding bin number, if you do not like this, terminate the statements with a semicolon): root[2] myhisto.Fill(42) root[3] myhisto.Fill(3.141592) root[4] myhisto.Fill(66) root[5] myhisto.Fill(99) root[6] myhisto.Fill(69) root[7] myhisto.Fill(17.7) Now let us draw the histogram:S. Masciocchi, N. Berger 1 statistics/statistics.php Statistical Methods in Particle Physics WS 2012/2013 root[8] myhisto.Draw() This opens acanvas, the surfacerootdraws on, per default, the canvas will be named c1. In the canvas window, you can open theEditorfrom the view menu. It allows you to change the style of various objects on the canvas (which you can also move around with the mouse); be aware though that there is no undo function. All the things that can be set from Editor, can also be set from the command line, e.g. root[9] myhisto.SetLineColor(2) for the change to become visible, you have to draw the histo again root[9] myhisto.Draw() if you want the histogram to be drawn with error bars, try root[9] myhisto.Draw("E1") If you do not want to rewrite all the code every time you start root, you can use macro les. They end in .C and can be executed directly from root. Make it a habit to start them with a comment stating the exercise they are for and your name and email. Create a le exercise0.C in your exercise directory and ll it similar to the following: /* exercise0.C:

Example macro file for the root tutorial

in Statistical Methods in particle physics

Written by Niklaus Berger, 14.10.2012

void fillHistogram(unsigned int nentries){ TH1F * histo = new TH1F("histo","Another histogram",10,0,100); for(unsigned int i=0; i < nentries; i++){ histo->Fill(fmod(i*777,100)); Note that we create the histogram on the heap usingnew, to make sure it does not go out of scope when the function returns. Inroot, we can now load the macro le using root[10] .L exercise0.C (allrootcomments start with the.). Now we can call the function like any other: root[11] fillHistogram(100) let's now draw the new histogram root[12] histo->Draw()S. Masciocchi, N. Berger 2 statistics/statistics.php Statistical Methods in Particle Physics WS 2012/2013 and we could also draw the old histogram on the same canvas root[13] myhisto.Draw("same") be aware that therootinterpreter does not really dierentiate between the. and->member access. Compiled C++ of course does, so better do it right from the start. Now let us save the histograms to a le root[14] TFile* file = new TFile("exercise0.root","RECREATE") and now we can write the histograms and close the le root[15] myhisto.Write() root[16] histo->Write() root[17] file->Close() root[18] delete file

Now try to read the histograms back in:

root[19] TFile* fileagain = new TFile("exercise0.root","READ") root[20] TH1F * histoagain = (TH1F*)fileagain->Get("histo"); You retrieve objects fromrootles using their name (usually the rst parameter in the constructor) with theGet()function, which will always return a pointer to aTObject, the base class of everything in root. You have to manually cast to the type you are expecting (here a TH1F pointer). This is not particularly safe or nice... Draw your re-loaded histogram root[21] histoagain->Draw() and then call it a day, you can quit root with root[22] .q

2 And the same again using Python

Start a Python session using

> python then import therootmodule. There are several ways of doing this, probably the cleanest is >>> import ROOT which imports everything fromroot, but leaves it in its own namespace, ROOT.

Python can of course also serve a s a calculator:

>>> import math >>> 77-math.sqrt(17)

Now let us create aroothistogram

>>> myhisto = ROOT.TH1F("myhisto","My phytonesque histogram",10,0,100) lling then works just as in the plainrootcaseS. Masciocchi, N. Berger 3 statistics/statistics.php Statistical Methods in Particle Physics WS 2012/2013 >>> myhisto.Fill(42) >>> myhisto.Fill(42) >>> myhisto.Fill(17) >>> myhisto.Fill(7) then we can draw it >>> myhisto.Draw() Note that on the CIP pool machines, PyROOT uses a slightly older version of root with lots of ugly default settings. So use the editor of the canvas (in the view menu) to get rid of the grey backgrounds and the red frame. Of course you can again also do this from the command line: >>> myhisto.SetLineColor(2) >>> myhisto.Draw("E1") where we have also switched on the error bars. Of course you can also write Python code into les (ending in .py), try something like the following in a le called exercise0.py: # exercise0.py: Example python program for the root tutorial # Niklaus Berger, 4.10.2010 import ROOT histo = ROOT.TH1F("histo","My faboulous histogram",10,0,100) def histofill(entries): for x in range(entries) histo.Fill(x)

You can now load that le as you would any module

>>> import exercise0 which puts everything from the le into the exercise0 namespace. Thus >>> exercise0.histofill(1000) >>> exercise0.histo.Draw() will ll and draw the histogram. Of course, drawing the old histogram on top will also work >>> myhisto.Draw("SAME")

Now we can safe the histograms to arootle:

>>> f = ROOT.TFile("exercise0_python.root","RECREATE") >>> myhisto.Write() >>> exercise0.histo.Write() >>> f.Close() >>> del fS. Masciocchi, N. Berger 4 statistics/statistics.php Statistical Methods in Particle Physics WS 2012/2013 Reading back in is now syntactically much more elegant than in the plainroot case: >>> fagain = ROOT.TFile("exercise0_python.root","READ") >>> histoagain = fagain.histo >>> histoagain.Draw() You can quit the python interpreter by pressingCTRL + D. This should have given you a rst glance atrootand PyROOT, you should be able to use those skills in the rst exercise. More material can be found on the course website.S. Masciocchi, N. Berger 5 statistics/statistics.phpquotesdbs_dbs10.pdfusesText_16
[PDF] INTRO aux sombres heros de l`amer

[PDF] Intro Caractéristiques du bateau - Festival

[PDF] Intro de 32 comptes - 2 Tags *TRIPLE STEP RIGHT, BACK ROCK

[PDF] Intro Dieu d`éternité Créateur de la terre Roi d`Eternité L`adoration t

[PDF] intro e roditori.indd

[PDF] Intro Höhepunkte Reiseroute - Conception

[PDF] intro mistral gagnant - Club Guitare de Lannilis

[PDF] Intro Points forts - France

[PDF] Intro Points forts Itinéraire

[PDF] Intro PROTECT A. (FR)

[PDF] Intro Tech Masques TECHNOLOGIE MASQUE

[PDF] Intro. Medumba Language

[PDF] introducción - sinat - Mexique Et Amérique Centrale

[PDF] introducing broker membership agreement - Compte Bancaire

[PDF] Introducing Heinz PlantBottleTM Pack - Conception