TH2F

Header Files

The following may be needed if not using CINT Shortcuts #include "TH2.h"

Description

TH2F is a 2d histogram object of floating point numbers. To create the histogram e.g.:-
 TH2F *H_ADC = new TH2F("H_ADC","RawA vs RawB",100,0.,1000.,100,0.,1000.);
Initialises the TH2F pointer H_ADC to a newly created TH2F object also named H_ADC. It has the title "RawA vs RawB" and has 100 bins and limits of 0, to 1000. in both X and Y. This constructor is rather similar to HBOOK's H2BOOK!

To fill it, e.g.:-

H_ADC->Fill(x_value,y_value);
and to draw the result:-
H_ADC->Draw();
This results in the histogram being added to the current sub-window (TPad) of the current window (TCanvas). As explained in TCanvas the actual displaying (painting) happens each time the TPad is displayed, so the histogram can be updated after receiving the Draw command, and display show the updated form.

Histograms can be manipulated on screen using the ??? menu. ROOT provides support for histogram fitting using either standard or user supplied functions.

Example Use in MINFast

The loopmacro shows how TH2F objects are created and used.

TH2F is just one example of a wide range of 1d, 2d and 3d histograms. For more information see


Go Back to the The ROOT Crib Top Page


If you have any comments about this page please send them to Nick West