reading histogram contents

From: Lalith Perera <>
Date: Fri, 29 Apr 2005 13:10:18 -0400 (EDT)


    I am running the following script to read the contents of a histogram from a file. But it reads them always as zeros, althogh histogram is not empty. I can plot it from the script, which shows the filled histogram. Also, When I type the commad interactively (ie, like:  

root[1] bc= (Float_t)haccpt->GetBinContent(2,0); root[2] std::cout << bc << endl; )

it shows the actual value in that bin. Am I missing anything in the script?


	TFile *f = new TFile("histos4.root");

        Int_t j=0;
        Float_t bc;

        for(Int_t i=0;i<80;i++)
          bc= (Float_t)haccpt->GetBinContent(i,j);
           std::cout<< i<< " j " << j << "  " << bc << endl;


Received on Fri Apr 29 2005 - 19:11:12 MEST

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