Introduction to ROOT and data analysis What is ROOT? Widely used in the online/offline data analyses in particle and nuclear physics Developed for the LHC experiments in CERN (root.cern.ch) Based on Object Oriented programming with C++ What can ROOT do? Save data Your data (and any C++ object) can be saved in a compressed binary form in a ROOT file. Access data Data saved into one or several ROOT files can be accessed from your PC. Process data Powerful mathematical and statistical tools are provided to operate on your data. Show results Results are shown with histograms, scatter plots, fitting functions, etc. Interactive or built application You can use the CINT C++ interpreter for your interactive sessions and to write macros, or compile your program to run.
GUI windows, buttons, menus Three ways to use ROOT Root Command line CINT (c++ interpreter) Macros, applications, libraries. The ROOT file A directory structure like UNIX Items in a directory can be: subdirectory objects (canvas, histograms, etc.) root trees In this Praktikum Histograms and some results can be saved in the root file
Start ROOT Getting started with the GUI Click the ROOT icon (or from the Start Menu) Quit ROOT (just in case) Root [0]>.q Display the browser Root [0]> new TBrowser(); Open the browser Click the root file Browse the file Click the histogram Displaying a histogram Basic navigations by clicking Left click select the object drag the object resize the object Right click context menu Middle click activate t canvas
Histogram Graphical display of tabulated frequencies, very frequently used on the statistical data analysis Usually shown as bars Important parameters Histogram range Minimum Maximum Size of divisions or number of divisions: bin Coloring histograms Changing styles of histograms Error bars Lines 2D or 3D Changing division (bin size) Draw panel
Histogram fitting with Default functions Gaussian Landau Exponential Linear Quadratic Users can also define their own functions Changing conditions interactively Results shown in the terminal Fitting with Fit Panel Analysis: Step 1 Taking the maximum amplitude data from the oscilloscope and save the data on the disc Reading the saved data by using a ROOT macro, ReadData.C Root[0]>.L ReadData.C; Root[1]> ReadData( file name ); Observing the amplitude data on the screen Create histogram for the saved amplitude by using a ROOT macro, HistoData.C Root[0]>.L HistoData.C; Root[1]> HistoData( file name ); Modify the histogram by changing the histogram parameters in TH1F() Perform analysis on the histogram
Name of method, name: input data file name ReadData.C Declaring parameters double: double float char: character string: character Checking if the file exists Iterating all signal data. Store x and y information in x[] and y[] Showing x and y values on the screen HistoData.C Creating a canvas to display a histogram Definition of histograms TH1F(name,title,divisions,min,max) Filling x[] in the histogram h1 Displaying h1 on the canvas c1
Analysis: Step 2 Taking the wave form data by the oscilloscope and save the data on the disc Reading the saved data by using a ROOT macro, ReadData_Gauss.C Root[0]>.L ReadData_Gauss.C; Root[1]> ReadData_Gauss( file name ); The macro ReadData_Gauss.C also performs fitting ov the wave form by using Gaussian. Fitted parameters, amplitide, sigma and mean are saved in the other output ascii file Read the saved fitting parameters and create a histogram of the amplitude parameters by using a ROOT macro, HistoData_Gauss.C Root[0]>.L HistoData_Gauss.C; Root[1]> HistoData_Gauss( fitting_output.txt ); t t t t t ) Modify the histogram by changing the histogram parameters in TH1F() Perform analysis on the histogram ReadData_Gauss.C Getting the session name to be analyzed Getting the number of the waveform files to be analyzed Creating the list of the g names of waveform data
ReadData_Gauss.C Creating a canvas to show the signal shape and fitting Creating output file to store the fitting i results Iterating on the data files from the created list Reading signal data (600 points) and store in x[] and y[] Plotting x[] and y[] data Defining Gaussian function and fit the plot Displaying the plot and the fitting Getting fitting results Write the fitting results to the output file HistoData_Gauss.C Reading the file for the fitting results Filling the amplitude to the histogram h1
More explanation on ROOT and C++ programming Date: December 3rd Time: 10:00 AM Place: Here