RE: Error in drawing a histogram from ntuple file

From: Raghunath Sahoo <raghu_at_iopb.res.in>
Date: Sun, 13 Nov 2005 16:10:52 +0530 (IST)


Dear Rene & Philippe,

 Thanks a lot.
It is working now, after the modifications.

Regards,
Raghunath.

On Sun, 13 Nov 2005, Philippe Canal wrote:

> Replace
> Int_t Nentries = ntuple -> GetEntries();
> with
> Long64_t Nentries = ntuple -> GetEntries();
> Cheers,
> Philippe
> -----Original Message-----
> From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch]
> On Behalf Of Raghunath Sahoo
> Sent: Sunday, November 13, 2005 1:40 AM
> To: roottalk_at_pcroot.cern.ch
> Subject: [ROOT] Error in drawing a histogram from ntuple file
>
>
> Dear All,
>
> I have a macro which reads a .root file which contains a ntuple.
> While plotting, it draws a canvas but doesn't plot the desired
> observable. The error message is:
>
> root [0] .x test.C
> Warning: conversion from 64bit to 32bit integer FILE:test.C LINE:13
> Nentries = 169
> : Real Time = 1.01 seconds Cpu Time = 0.96 seconds
> root [1] .q
>
> In line: 13, I have,
>
> Int_t Nentries = ntuple -> GetEntries();
>
> I am using root version 4.04/02 in Redhat linux 7.2 gcc: 2.96
>
> I could plot the branches in the ntuple thru TBrowser().
> And also, I could plot in root giving command lines.
>
> Any help is highly appreciated.
>
> Regards,
> Raghunath.
>
> NB: The macro is the following:
>
>
> void test()
> {
>
> gROOT->Reset();
> gStyle->SetOptStat(0);
> gBenchmark->Start("");
> Float_t Et_had, Et_ptGT;
>
> TFile *f = new TFile("correctionFactors_20154.root");
> TNtuple *ntuple = (TNtuple*)f -> Get("ntuple");
> TH1F *EtT_had = new TH1F("Et_had","Total hadronic
> Et",250,0.,500.);
>
> Int_t Nentries = ntuple -> GetEntries();
> cout << " Nentries = " << Nentries << endl;
>
> ntuple -> SetBranchAddress("Et_had",&Et_had);
> ntuple -> SetBranchAddress("Et_ptGT",&Et_ptGT);
> for (Int_t i=0; i< Nentries; i++)
> {
> ntuple -> GetEntry(i);
> // cout <<Et_had <<endl;
> EtT_had -> Fill(Et_had);
> }
> TCanvas *test = new TCanvas("test","",2);
>
> EtT_had -> Draw();
> f->Close();
> gBenchmark->Show("");
>
> }
>
>
> ********************************************************************
> * Raghunath Sahoo * Phone: +91-0674-2301172 *
> * Doctoral Scholar * 2301058 *
> * Institute Of Physics * Lab:- 230,H-303,359(Extn) *
> * Sachivalaya Marg * Fax: +91-0674-2300142 *
> * Bhubaneswar * URL: http://www.iopb.res.in/~raghu *
> * Orissa (India)-751005 * email: raghu_at_iopb.res.in *
> ********************************************************************
> * raghu_at_bnl.gov * raghu_at_mail.cern.ch *
> ********************************************************************
>
>


Received on Sun Nov 13 2005 - 11:29:40 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET