Re: GetBinContent

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Apr 13 1999 - 18:25:55 MEST


Hi Luc,
You have a mismatch in your print statement. What you want to do
is probably something like:
        for(j=0;j<nbins;j++) {
          printf("bin[%d] = contenu[%d]=%g\n",j,j,h1->GetBinContent(j));
        }

Your second point about number of channels. TH1::Print("all") prints
all channels, including bin=0 (underflow bin) and bin =N+1 (overflow)

Rene Brun

On Tue, 13 Apr 1999, Perrot wrote:

> ** Electronic User Registration Form **
> 
> Name:           Perrot
> E-mail address: perrot@isn.in2p3.fr
> Institute:      ISN Grenoble
> Experiment:     Hybrids Reactors
> 
> DESCRIPTION OF APPLICATION:
> Hello,
> 
> I want write in a ASCII file, here is my very simple MACRO:
> 
> 	
> 	tree->Draw("fAmplitude>>h1","fChannel==1");
> 	h1->SetBins(4000,1,4001);
> 	tree->Draw("fAmplitude>>h1","fChannel==1");
> 	Int_t nbins = h1->GetNbinsX();
> 	Int_t j;
> 	{for(j=0;j<nbins;j++)printf("bin[%d] = contenu[%d]\n",j,h1->GetBinContent(j));};
> 
> 
> In output, i have this:
> 
> bin[1] = contenu[0]
> Error: printf parameter mismatch param[0] C i FILE:/hyb4/perrot/MANIP/run006/./test.C LINE:38
> *** Interpreter error recovered ***
> 
> If i write this:
> for(Int_t i=0;i<nbins;i++) {printf("bin[%d]\n",i);};
> the value of nbins max is 3999
> Or this:
> If i write h1->Print("all");
> the maximum of nbins write on screen is 4001.
> 
> Can you help me, please. Thamk you.
> 
> Luc Perrot
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:31 MET