Hi Jason, try something that looks like this perhaps: TH1F *myhist[10]; char *histname = new char[10]; int nbins=10,nfiles=5; float xmin=0,xmax=10; for (int i=0;i<nfiles;i++) { sprintf(histname,"histo%d",i); myhist[i] = new TH1F(histname,"",nbins,xmin,xmax); for (int j=0;j<20;j++) { myhist[i]->Fill(j/10); } } On Tue, 4 Mar 2003, jrieger wrote: > Hey rooters - > > I wish to loop over many runs in a set of histograms, and for each run I > want to fill a separate histogram. However, I do not wish to have to > define each histogram separately, as I will not have prior knowledge of > the number of histograms I will need. Is there a way to make a "variable" > histogram name that changes over the loop. > > Thanks > Jason > > > -Berrie
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET