Re: [ROOT] problem with recursive filling of histograms

From: Frankland John (frankland@ganil.fr)
Date: Fri Aug 22 2003 - 12:13:27 MEST


Hi Bruny

I don't think I understand what it is you're trying to do, but this 
"corrected" version
of your script will fill the 6 histograms with the values stored in 
xbins and then
draw them in a canvas.

Hope this helps,
John


-- 

ganil logo <http://www.ganil.fr>
John D. Frankland <mailto:frankland@ganil.fr>
Beam Coordinator
GANIL
B.P. 55027
14076 CAEN Cedex 05

*tel:* +33 (0)231454628
*fax:* +33 (0)231454665





{

float xbins[21];
float xint=(50.-.1)/20.;

Char_t h1[10],h2[10];

for(int ij=0;ij<21;ij++){
  xbins[ij]=.1*pow((50./.1),(float)ij / 20.);
}

for(int i=1;i<7;i++){
  int id1=i;
  sprintf(h1,"s%d",id1);
  TH1F *h = new TH1F(h1,h1,21,-.5,20.5);
}

for(int i=1;i<7;i++){
    sprintf(h2,"s%d",i);
    TH1F *h=(TH1F*)gROOT->FindObject(h2);
	for(int j=0;j<21;j++){
    	h->Fill(j,xbins[j]);
	}
}

TCanvas *c=new TCanvas();
c->Divide(2,3);
for(int i=1;i<7;i++){
  int id1=i;
  sprintf(h1,"s%d",id1);
    TH1F *h=(TH1F*)gROOT->FindObject(h2);
	c->cd(i);
	h->Draw();
}

c->Update();
}



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET