ROOT: Functions & Histograms

Slides:



Advertisements
Similar presentations
/ Elementi di C++ Introduzione a ROOT , Laboratorio Informatico ROOT warm up , Laboratorio Informatico Introduzione a.
Advertisements

Exercise session # 1 Random data generation Jan Matuska November, 2006 Labor Economics.
Templated Functions. Overloading vs Templating  Overloaded functions allow multiple functions with the same name.
Joe Foster Visualizing Data with ROOT Joe Foster University of Manchester.
Must-Know ROOT Class I/O/TGraph/Tntuple/Ttree/…. 1.
Why ROOT?. ROOT ROOT: is an object_oriented frame work aimed at solving the data analysis challenges of high energy physics Object _oriented: by encapsulation,
Nursing Home Falls Control Chart Problem Statement: Assume that following data were obtained about number of falls in a Nursing Home facility. Produce.
Computing the Posterior Probability The posterior probability distribution contains the complete information concerning the parameters, but need often.
Checking the Required Conditions. Check these 3 boxes.
T T07-01 Sample Size Effect – Normal Distribution Purpose Allows the analyst to analyze the effect that sample size has on a sampling distribution.
WELCOME TO THE INTERACTIVE PHYSICS TUTORIAL… This is a presentation that works much like a slide show. To Proceed through the slides all you have to do.
Binomial PDF and CDF Section Starter Five marbles are on a table. Two of them are going to be painted with a “W” and the rest will be painted.
ROOT Graphics Release planning – June 2006 See also the Graphics Work Package Program of Work on the web.Graphics Work Package Program of Work.
Normal Distribution Introduction.
21-Apr-2005J. Adamczewski1 DVEE C++ course 2005 The ROOT framework 1: Introduction.
10/31/2015PHYS 3446 DØ Data Analysis with ROOT Venkat (for Dr.Yu)
Univariate Linear Regression Problem Model: Y=  0 +  1 X+  Test: H 0 : β 1 =0. Alternative: H 1 : β 1 >0. The distribution of Y is normal under both.
Summer Student Program 15 August 2007 Cluster visualization using parallel coordinates representation Bastien Dalla Piazza Supervisor: Olivier Couet.
Introduction to ROOT Practical Part Jan Fiete Grosse-Oetringhaus, CERN PH/ALICE Summer Student Lectures th July.
Social Science Research Design and Statistics, 2/e Alfred P. Rovai, Jason D. Baker, and Michael K. Ponton Using the Chart Editor PowerPoint Prepared by.
PATTERN RECOGNITION LAB 3 TA : Nouf Al-Harbi::
Statistics with TI-Nspire™ Technology Module E. Lesson 2: Properties Statistics with TI-Nspire™ Technology Module E.
Plotting Complex Figures Using R
Outline of Today’s Discussion 1.Displaying the Order in a Group of Numbers: 2.The Mean, Variance, Standard Deviation, & Z-Scores 3.SPSS: Data Entry, Definition,
Sample Graphing. Assign #Sample Graphing45 pts. X – Y Coordinates Shows a change of 2 or more variables X – Horizontal axis ____________________ Independent.
ROOT: Functions & Fitting Harinder Singh Bawa California State University Fresno.
Joe Foster 1 This talk extends the one I gave in 2006 called Visualizing Data with ROOT. –
V0.02 The ROOT Collection Classes. V Collection Classes Group of related objects TObjects or descendants from TObject Abstract base class TCollection.
Data Visualization The commonality between science and art is in trying to see profoundly - to develop strategies of seeing and showing Edward Tufte.
§ 1.3 Intercepts.
Data Assimilation Research Testbed Tutorial
“Teach A Level Maths” Statistics 1
Graphing Lines Using Intercepts
ROOT: Functions & Fitting
Probability & Statistics Displays of Quantitative Data
iSTEP 2016 Tsinghua University, Beijing July 10-20, 2016
Graphics GrowingKnowing.com © 2013.
Introduction to ROOT Practical Part
Tutorial on Statistics TRISEP School 27, 28 June 2016 Glen Cowan
Lecture 25: Exploring data
Standard Form I can identify intercepts from an equation.
Summary Statistics in R Commander
MATH SELF TUTOR SKILL: GRAPHS.
Templates.
Net 222: Communications and networks fundamentals (Practical Part)
GRAPHING NOTES Part 1.
Unit 7 – Excel Graphs.
Lab 2 Data Manipulation and Descriptive Stats in R
Quantitative Methods PSY302 Quiz 6 Confidence Intervals
Describing Distributions of Data
INTRODUCTION TO SGPLOT Zahir Raihan OVERVIEW  ODS Graphics  SGPLOT overview  Plot Content  High value plot statements  High value plot options 
Section 12.6 – Area and Arclength in Polar Coordinates
Frequency Polygon.
MatLab – 2D Plots 2 MATLAB has many built-in functions and commands to create various types of plots. Instructor notes: We start with an example of some.
Tutorial 2 SEG7550 Introduction to MATLAB II
GRAPHING NOTES Part 1.
Frequencies and the normal distribution
S.Linev, J. Adamczewski, M. Al-Turany, D. Bertini, H.G.Essel
Default Arguments.
Math 083 – Intermediate Algebra
Plotting Signals in MATLAB
Volume 111, Issue 2, Pages (July 2016)
Function Overloading.
Announcements P3 due today
Introduction to ROOT (2/2) Practical Part
Topic 7: Visualization Lesson 2 – Frequency Charts in Excel
GRAPHING NOTES Part 1.
Simulate Multiple Dice
Microsoft PowerPoint Tutorial Graphs BIS 101 Spring 2018.
Ungraded quiz Unit 4.
Presentation transcript:

ROOT: Functions & Histograms Harinder Singh Bawa California State University Fresno

Review of previous sessions: Any Question Review of previous sessions: Any Question? * Good to practice some exercises side by side in order to understand

So far in Histograms Booking TH1F(const char* name, const char* title, int nbinsx, double xlow, double xup); TH1F(const char* name, const char* title, int nbinsx, const double* xbins); Filling virtual int Fill(double x); virtual int Fill(double x, double w); Getting information virtual double GetBinContent(int bin) const; virtual double GetMaximum(double maxval = FLT_MAX) const; Drawing virtual void Draw(Option_t* option); Writing to a file (inherited from TObject) virtual int Write(const char* name = "0", int option = 0, int bufsize = 0);

Review: Histogram Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigma. https://root.cern.ch/doc/master/classTRandom.html

1-D Histograms 1-D histograms can be instantiated in various ways

1-D Histograms (2) Filling histograms, getting information in various ways { Double_t Bins[4]={0,2,5,8}; TH1F *hist=new TH1F("hist","",3,Bins); TH1F *hist1=new TH1F("hist1","",3,Bins); for(Int_t i=0;i<1000;i++) { hist->Fill(i); hist1->Fill(i,100); }//100 is weight given to histogram entries cout<<"Bin 1 of hist now have\t"<<hist->GetBinContent(1)<<"\tentries"<<endl; cout<<"Bin 1 of hist1 now have\t"<<hist1->GetBinContent(1)<<"\tentries"<<endl; hist->Print("all"); }

Many 1-Dimensional histograms (1) How to plot many histograms at once

Many 1-Dimensional histograms (2) How to plot many histograms at once, in easy way

THStack (1) How to plot many histograms at once and stack them as well

THStack (2) How to plot many histograms at once and stack them as well

TPad How to have e.g. a data/MC inset on the bottom of your plot

TPad How to have e.g. a data/MC inset on the bottom of your plot

TLegend How to draw a legend for multiple histograms

Functions

TF1 with parameters A function can have parameters (e.g. floating parameters for fits...)

Let's draw a TF1 on a TCanvas Like most objects in ROOT, functions can be drawn on a canvas a TCanvas is an object too...

TF1 Functions and Fit:

Some ROOT commands

Graphs

TGraph TGraph: two arrays of points representing x and y coordinates TGraphErrors: TGraph with symmetric errors on x and y points TGraphAsymmErrors: TgraphErrors, with asymmetric errors

Graph Drawing options

TGraph Error bar

TGraphAsymmErrors TGraph: two arrays of points representing x and y coordinates TGraphErrors: TGraph with symmetric errors on x and y points TGraphAsymmErrors: TgraphErrors, with asymmetric errors

Many TGraphs How to plot many graphs at once?

TMultigraph TMultiGraph *mg = new TMultiGraph();

Exercises (1) Create two histograms with 10 bins ranging from -5. to 5. with no title and two different names. (* Also try to use variable binning by your own) Fill the first histogram with a Gaussian distribution by using hist1->FillRandom("gaus", 500); Fill the second histogram with a second order polynomial distribution by using hist2->FillRandom("pol2", 500); Create a new TCanvas with name "c1" and title "gauss" and draw the first histogram. Create a new TCanvas with name "c2" and title "poly" and draw the second histogram. Set the line color of the first histogram to red (kRed) and the second to blue (kBlue). *Using hist->SetLineColor() Create a third canvas and draw the first histogram. Then draw the second histogram with option "same" to have both histograms in the same plot. Create a legend at position (0.16, 0.63, 0.45, 0.91) and add entries for both histograms to it. Draw the legend. Save the third canvas as a PDF file and open the PDF Save the third canvas as a ROOT file (gaussian-polynomial.root).

Exercise(2) Exercise(3) Create a one dimensional function f(x)=sin(x)/x+a in the region 0 - 10. Set the parameter a=5. Draw the function. Create a graph with symmetric errors and 5 points. Set the following points: (1.0, 2.1), (2.0, 2.9), (3.0, 4.05), (4.0, 5.2), (5.0, 5.95) Set the errors on x to 0.0 and the errors on y to 0.1. Draw the graph including the axes and error bars. Exercise(3)