Re: Basic question on how to read an histo, an ntuple etc. from

Valery Fine (Valeri.Faine@cern.ch)
Fri, 21 Mar 1997 10:21:27 +0100


On 20 May 97 at 23:37, Luca Sfarzo wrote:

> Hello,
>
> I've a basic question:
>
> after having converted an hbook file via the h2root.exe utility I
> want to Draw the content of such file (it is made up of TH1Fs and
> TProfiles) on the screen. I've searched a bit in the tutorial but I
> still haven't understood well how to find objects in a file (how can
> I know the content of an unknown file??) and how to plot it. Is
> there something useful in the tutorial or elsewhere?

In tutorials one can find:
1. Hsimple.C - to create file "hsimple.root" with some objects
(TH1F,TPorfiles, etc)
and
2. h1draw.C - use this file to draw histogram etc
ntuple1.C

Usually one need no special READ operation to access histogram.

To understand thing it is useful to create a TFile object and
then have a play with TBrowser object. One can create Browser "by
hand" from command line like this:

TBrowser b;

or from the canvas menu.

The topic

http://root.cern.ch/root/HowtoHistogram.html

says:

" ...
Reading histograms from a file
==============================

Assume you have opened a file with, for example:

TFile f("histos.root");

you can f.ls() to see the list of objects in this file. In an
interactive session, you can read directly an histogram in memory,
just by typing its name, or name->Draw(). ROOT will automatically
create a pointer to this object in memory. The name of the pointer is
the name of the object in the file. Note that this is a ROOT extension
to C++.

... "

The advanced technology is present with

http://root.cern.ch/root/HowtoRead.html

as well

Hope this helps,

=================================================================
Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for NuclearRes Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su

Dr. Valeri Faine
------------ Phone: +41 22 767 6468
CERN FAX : +41 22 767 7910
CH-1211 Geneva, 23 mailto:fine@mail.cern.ch
Switzerland http://nicewww.cern.ch/~fine