Baret Bruny <baret@lpsc.in2p3.fr> writes: > Hello rooters! > I'm trying to fill histograms named "si" (where i is an integer) with > the following piece of code but I get this message: > > "Warning in <TH1::GetBinContent>: this method must be overridden!"(times > the number of histograms) > > > "Warning in <TH1::GetBinContent>: this method must be overridden!" > (times the number of histograms) > > and it seems to enter an endless loop since it shows regularly the > warning message (even after a ctrl C).Moreover the histogram seems not > to be filled. > > > here is the piece of code: > { > float xbins[21]; > float xint=(50.-.1)/20.; > > h1= (char *) calloc(10,sizeof(char)); > h2= (char *) calloc(10,sizeof(char)); > > 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); > TH1::TH1(h1,h1,20,xbins); > } > > for(int i=1;i<7;i++){ > int id1=i; > sprintf(h2,"s%d",id1); > TH1 *h3=(TH1*)gROOT->FindObject(h2); > h3->Fill(xbins[i]); > } > > > } Hi, I guess it happens with an older version of Root as TH1 constructor has been protected lately. Use some of the classes TH1F/TH1D/TH1C instead of the abstract TH1 to instantiate a histogram. -- Jiri
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET