On Tue, 7 Aug 2001, Rene Brun wrote:
Dear Rene,
Just saw your mail to Tomasso.
> Hi Tommaso,
>
> Variables in a TNtuple are of type Float_t not Double_t.
> You have two other problems in your script
> - never use gROOT->Reset() in a named macro
Why, what could be a problem?
Thanks,
Ilia
> - the loop index starts at 0, not 1
>
> You have 3 ways (at least) to check the content of your ntuple.
> - using teh browser, double click on your variable "p"
> - use nf->Show(ki) to dump the values of entry ki
> - use nf->Scan();
>
> Rene Brun
>
> Tommaso Chiarusi wrote:
> >
> > Hello rooters,
> >
> > According to the userguide, I wrote the following:
> > Note:
> > 1. "vario.root" is the root file in which I have stored my ntuple.
> > 2. "front" is the name of my ntuple (in "vario.root" there are many
> > other ntuples!).
> > 3. "p" is the variable that I want to plot. ("p" is either the name of
> > the TLeaf inside the ntuple "front" and of the variable the histogram I
> > fill with)
> >
> > The problem I get is that I actually do NOT Get the Entry value, but
> > something like 5.30784e-315!!!!!
> >
> > Thank you very much!
> >
> > void plot()
> > {
> > gROOT->Reset();
> >
> > TFile *f = new TFile("vario.root");
> > TNtuple *nf = (TNtuple*)f->Get("front");
> >
> >
> > Int_t entries = (Int_t)nf->GetEntries();
> > cout<<"Number of Entries: "<<entries<< endl;
> >
> >
> > Double_t p=0;
> > nf->SetBranchAddress("p",&p);
> >
> > TH1F *htp = new TH1F("htp","p",100,0,10);
> >
> > for (Int_t ki=1;ki<entries;ki++)
> > {
> > nf->GetEntry(ki);
> > htp->Fill(p);
> > }
> >
> > TCanvas *c1 = new TCanvas("c1", "c1",515,210,540,376);
> > c1->Draw();
> > htp->Draw();
> >
> > //
> > }
> >
> > Tommaso
>
************************************************************************
* *
* Ilia Ravinovich *
* Department of Particle Physics PPE Division *
* Weizmann Institute of Science Bld 892, 1D-015 *
* Rehovot 76100 CERN, 1211 Geneva *
* ISRAEL Switzerland *
* *
* PHONE : 972 8 9343187 41 22 7676437 *
* FAX : 972 8 9466253 41 22 7677910 *
* E-mail: Ilia.Ravinovich@weizmann.ac.il Ilia.Ravinovich@cern.ch *
* *
************************************************************************
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:56 MET