Hi, I have an error message I dont understand followed by a segfault in a compiled code (fragment near error and error here under). Perhaps this is relevant: The problem occur only the second time this code fragment is called. Between the first and the second call I do a lot of minuit fitting using TFitter constructor. So perhaps it could be interferance between fitting by hand with minuit and using histogram fitting. peak is a TObjectArray cout<<"gag"<<endl; TArrayD* a=(TArrayD *)(*peak)[i]; cout<<"gjkjlkd"<<endl; if (a){ cout<<i<<endl; Int_t xmin=TMath::Max(0,int(((*a)[2])-2)); Int_t xmax=TMath::Min(sky.Rows(),int(((*a)[2])+3)); Int_t ymin=TMath::Max(0,int(((*a)[3])-2)); Int_t ymax=TMath::Min(sky.Cols(),int(((*a)[3])+3)); TH2D* histo=new TH2D("forfit","forfit",xmax-xmin,xmin,xmax,ymax-ymin,ymin,ymax); Double_t scale=1E4; for (Int_t ii=xmin;ii<xmax;ii++){ for (Int_t jj=ymin;jj<ymax;jj++){ histo->Fill(ii,jj,sky(ii,jj)/scale); const Double_t rescale=30.0; histo->SetBinError(histo->FindBin(ii,jj),sigma(ii,jj)/scale*rescale); //cout<<ii<<" "<<jj<<" "<<sky(ii,jj)<<" "<<sigma(ii,jj)<<endl; } } const Int_t npar=7; cout<<"111"<<endl; TF2 *func = new TF2("fitf",fitf,xmin,xmax,ymin,ymax,npar); cout<<"222"<<endl; // Sets initial values and parameter names Double_t par[npar]; par[0]=0.0; par[1]=histo->GetMaximum();//should be 1 if scale par[2]=histo->GetMean(1); par[3]=histo->GetMean(2); par[4]=histo->GetRMS(1); par[5]=histo->GetRMS(2); par[6]=0.0; func->SetParameters(par); cout<<"333"<<endl; // func->SetParNames("Back","Const","Mean_valuex","Mean_valuey","Varx","Vary","offd"); func->SetParLimits(2,xmin,xmax); func->SetParLimits(3,ymin,ymax); cout<<"444"<<endl; histo->Fit("fitf","Q0"); running it give: gag gjkjlkd 0 111 222 333 444 Error in <TList::AddAt>: argument is a null pointer *** Break *** segmentation violation Abort Exit 134 -- Nicolas Produit INTEGRAL Science Data Center Phone: +41 22 950 91 40 16, Chemin d'Ecogia Fax: +41 22 950 91 33 CH-1290 Versoix www: http://isdc.unige.ch/
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET