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("");
}
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET