TGraph2D SetPoint problems inside a non-for loop

Hello.
The second argument does not progress in the line

g2Deff->SetPoint(ifilter,igoodChan, iocData_elem, avPixCount);

The M1 (as below) is taken instead of a for-loop

         M1:
	if(igoodChan>=0 && igoodChan< size_goodChan){
          //.........

             if (igoodChan<=size_goodChan)
			goto M1;
        }
   because busyflag errors encountered at TGraph *geff = new TGraph()	if inside a for-loop
       int filter =20;
       TGraph2D *g2Deff = new TGraph2D(filter);  
	M1:
	if(igoodChan>=0 && igoodChan< size_goodChan){
		
		TGraph *geff = new TGraph();				
		geff ->SetLineColor(2);
		geff ->SetMarkerStyle(20);
		geff ->SetMarkerSize(2);
		geff ->SetMarkerColor(2);
		geff ->SetLineWidth(8);	
				
		for (int ifilter =0; ifilter<filter; ifilter++) {			
			avPixCount = avCnt[ifilter][igoodChan];			
			iocData_elem = iocVector[ifilter];			
			geff->SetPoint(ifilter, iocData_elem, avPixCount);	//igoodChan does progress here				
			g2Deff->SetPoint(ifilter,igoodChan, iocData_elem, avPixCount); //problem here, igoodChan does not progress
		}						
		c1->cd();
		geff->Draw("ALP");					
		
		c1->Modified();					
		c1->Update();	
			
		delete geff;
		igoodChan++;			
		
		if (igoodChan<=size_goodChan)
			goto M1;			
	}		
	c2->cd();
	g2Deff->Draw("surf4"); 

Errors encountered

Error in <TCanvas::Range>: illegal world coordinates range: x1=2.000000, y1=-483132.675012, x2=2.000000, y2=4361848.095056
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=2.000000, ymin=1365.420044, xmax=2.000000, ymax=3877350.000000
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::SetRange>: problem setting view
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TCanvas::Range>: illegal world coordinates range: x1=-0.000000, y1=-0.000000, x2=0.000000, y2=0.000000
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=-0.000000, ymin=-0.000000, xmax=0.000000, ymax=0.000000
root [2] Error in <TCanvas::Range>: illegal world coordinates range: x1=2.000000, y1=-483132.675012, x2=2.000000, y2=4361848.095056
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=2.000000, ymin=1365.420044, xmax=2.000000, ymax=3877350.000000
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::SetRange>: problem setting view
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TCanvas::Range>: illegal world coordinates range: x1=-0.000000, y1=-0.000000, x2=0.000000, y2=0.000000
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=-0.000000, ymin=-0.000000, xmax=0.000000, ymax=0.000000
Error in <TCanvas::Range>: illegal world coordinates range: x1=2.000000, y1=-483132.675012, x2=2.000000, y2=4361848.095056
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=2.000000, ymin=1365.420044, xmax=2.000000, ymax=3877350.000000
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::SetRange>: problem setting view
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TCanvas::Range>: illegal world coordinates range: x1=-0.000000, y1=-0.000000, x2=0.000000, y2=0.000000
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=-0.000000, ymin=-0.000000, xmax=0.000000, ymax=0.000000

Basically, I just want to build a 3D representation, g2Deff, of the all geff in the range igoodChan>=0 && igoodChan< size_goodChan. How does one solve this?
Thanks!

Try to pre-compile (and run) your macro using ACLiC … this should find the majority of any possibly existing source code problems (and you will be free of any CINT limitations that you possibly meet).
If it doesn’t help, prepare a standalone macro which one could try (i.e. a macro which reproduces your problem).

Try: [code]#include “TSystem.h”
#include “TCanvas.h”
#include “TPad.h”
#include “TRandom.h”
#include “TGraph2D.h”
#include “TPolyLine3D.h”

void trial(void) {
Int_t i, j;
Double_t x, y, z;

TCanvas *c1 = new TCanvas(“c1”);
c1 = c1; // get rid of the warning: unused variable ‘c1’

Int_t m = 100;
TGraph2D *g2 = ((TGraph2D *)0);

Int_t n = 10;
TPolyLine3D *l = ((TPolyLine3D *)0);

for (j = 0; j < 100; j++) {
// delete the “previous” TPolyLine3D
delete l; // delete “l” before deleting “g2”
// delete the “previous” TGraph2D
delete g2;

g2 = new TGraph2D(m);
g2->SetTitle("TGraph2D and TPolyLine3D");
for (i = 0; i < m; i++) {
  gRandom->Rannor(x, y);
  z = x*x + y*y;
  g2->SetPoint(i, x, y, z);
} // for (i ...

// c1->cd();
g2->Draw("surf4");
// gPad->Modified(); gPad->Update();
// gSystem->Sleep(100); // 100 ms delay

l = new TPolyLine3D(n);
for (i = 0; i < n; i++) {
  x = 2.0 * gRandom->Rndm();
  y = 2.0 * gRandom->Rndm();
  z = 2.0 * gRandom->Rndm();
  l->SetPoint(i, x, y, z);
} // for (i ...

// c1->cd();
l->Draw();
gPad->Modified(); gPad->Update();
gSystem->Sleep(100); // 100 ms delay

} // for (j …
} // void trial(void) …[/code]

Thanks Wile. I put here the essentials of my code. Basically I am building 2 canvases: one for a TGraph and another for a TGraph2D. TGraph here is a movie. TGraph works well and I fail in TGraph2D.

// reads a data file fname with nch channels and return an 1D histogram
TH1F *readDataFile(char* fname, int nch) {
  int ch;
  float fc;
  TH1F *h = new TH1F("h1","",nch,-0.5,nch-0.5);
  h->Sumw2();
  
  FILE* fp=fopen(fname,"r");
  if (fp==NULL) {
    printf("Could not open file %s\n",fname);
    return h;
  }
  for (int j=0; j<nch; j++) {  
      fscanf(fp,"%d %f",&ch,&fc);      
      h->SetBinContent(j+1,fc);
  }
  fclose(fp); 
  return h;
}

// Creates a 2D histogram from a set of files (fn is the format of the file name)
TH2F* createScan(char* fn, int mi, int ma, int step, int nch) {    
  char fname[1000];
  TH1F *hdum;
  TH2F *h2 = new TH2F("h2","",nch,-0.5,nch-0.5,((ma-mi)/step)+1,mi-(Double_t)step/2.,ma+(Double_t)step/2.);
  h2->SetStats(kFALSE); 
  for (int i=mi; i<ma+1; i=i+step) {
    sprintf(fname,fn,i);   
    hdum=readDataFile(fname, nch);
    for (int j=0; j<nch; j++)
      h2->Fill(j,i,hdum->GetBinContent(j+1));
    delete hdum;   
  }
  return h2; 
}

float pixelAveCount(TH2F *h2, int ichan) {
		float pixAveCount;
		int nsteps = h2->GetYaxis()->GetNbins();	
		float pixCount=0.;			
		for (int istep=1; istep<nsteps+1; istep++) {			
			pixCount +=h2->GetBinContent (ichan+1, istep);				
		}
		pixAveCount = pixCount/nsteps;		
		return pixAveCount;
}

//scans through bad channels
bool item_exists(int item, int *array, int arrSize) {
  for(int k=0; k < arrSize; k++) {     
     if(array[k] == item)  {
       return true;
     }
  }
  return false;
}

void storeToVector(char *fpath0, int chMin, int chMax, int sensor) {
	gStyle->SetCanvasDefH(500);
       gStyle->SetCanvasDefW(560);
	gStyle->SetPalette(1);
	
	char fname[256];
	char fn[6] = "/run_";
	char ext[5] = ".raw";
	
	int begin = 0;
	int end = 59;
	char specifier[3] = "%d";	
	float pixelAveCnts;		
	
	int filter = 20;	
	vector<float> avCnt[filter];
	int size_goodChan;	
	Double_t avPixCount;	
	vector<float> ioc;	
	
	char *fbadname ="/home/results/layer_2_2011May/badChan_AllMods.raw";		
	char line_bad[80];
	int badChan;
	vector<int> vec_bad;
	int size;	
		
	FILE *fbad = fopen(fbadname,"r");
	if(fbad==NULL) {
		printf("Could not open file %s\n", fbadname);
		return;
	}		
	while (fgets(line_bad, 256, fbad) != NULL)  {
		sscanf(line_bad, "%d",&badChan);
                vec_bad.push_back(badChan);
	}
	size=vec_bad.size(); 
	int *bad=new int[size*sizeof(int)];
  for (int ibad =0; ibad<size; ibad++) {
  	bad[ibad] = vec_bad[ibad];    
  }	
	fclose(fbad);	
		
		
	for (int ifilter = 0; ifilter<filter; ifilter++) {							
		sprintf(fname, "%s%d%s%s%s", fpath0, ifilter,fn, specifier, ext);				
		TH2F *h2 = createScan(fname, begin,end, 1,128*12*3);		
		for (int ichan=chMin; ichan<chMax+1; ichan++) {	
			if(!item_exists(ichan, bad, size)) {
				pixelAveCnts = pixelAveCount(h2, ichan);																	
				avCnt[ifilter].push_back(pixelAveCnts);								
			}else{
				;
			}			
		}		
		delete h2;				
	}
	
	
	vector<float> iocData() ;
	int igoodChan;
	char channel[]= "Good Channel";
       char chanNum[100];     
       vector<float> iocVector = iocData() ;
         float iocData_elem;   
      Double_t mypar[2], emypar[2];   
      vector<float> fitElements; 
  
  char *fitFile0 = "/home/res1/filElements.sensor0";
	char fitFile[256];
	sprintf(fitFile,"%s%d",fitFile0, sensor);
	FILE *ftfile = fopen(fitFile, "w");
	if(ftfile==NULL) {
		printf("Could not open file %s\n", fitFile);
		return;	
	}

 	size_goodChan = avCnt[0].size();
 	
 	char *hist = " Sensor";
	char histName[256];
	sprintf(histName,"%s%d", hist, sensor); 		
	
	TCanvas *c1 = new TCanvas("c1");
	//c1=c1;
	TCanvas *c2 = new TCanvas("c2");
	
   TGraph2D *g2Deff = new TGraph2D(filter);
  
	M1:
	if(igoodChan>=0 && igoodChan< size_goodChan){
		sprintf(chanNum, "%s %d", channel,igoodChan );		

		TGraph *geff = new TGraph();				
		geff ->SetLineColor(2);
		geff ->SetMarkerStyle(20);
		geff ->SetMarkerSize(2);
		geff ->SetMarkerColor(2);
		geff ->SetLineWidth(8);	
		geff ->SetTitle(chanNum);			
		for (int ifilter =0; ifilter<filter; ifilter++) {			
			avPixCount = avCnt[ifilter][igoodChan];			
			iocData_elem = iocVector[ifilter];			
			geff->SetPoint(ifilter, iocData_elem, avPixCount);
			g2Deff->SetPoint(ifilter,igoodChan, iocData_elem, avPixCount);				
		}		
		printf("g2Deff Xmin %f Ymin %f Zmin %f\n", g2Deff->GetXmin(), g2Deff->GetYmin(), g2Deff->GetZmin());
	       printf("g2Deff Xmax %f Ymax %f Zmax %f\n", g2Deff->GetXmax(), g2Deff->GetYmax(), g2Deff->GetZmax());
	  
		c1->cd();
		geff->Draw("ALP");			
				
		c1->Modified();
		usleep(500000);				
		c1->Update();	
			
		delete geff;
		igoodChan++;	
		
		if (igoodChan<=size_goodChan)
			goto M1;			
	}	
		
	c2->cd();
	g2Deff->Draw("surf4");
	
	fclose(ftfile);
	return;
}


//read ioc data
vector <float> iocData() {
	vector<float> ioc;
	int nreadings =20;
	float iocReading;
	char *f_ioc = "/home/l_common/Frances/results/efficiencyMay2011/iocReadings.log";
	FILE * fioc = fopen(f_ioc, "r");
	if(fioc==NULL) {
		printf("Could not open file %s'\n", f_ioc);
		return ioc;
	}
	for(int iioc=0; iioc<nreadings; iioc++) {
		fscanf(fioc,"%f", &iocReading);	
		ioc.push_back(iocReading);
	}	
	return ioc;
}

it seems the problematic part is this one

g2Deff->SetPoint(ifilter,igoodChan, iocData_elem, avPixCount)

It outputs

printf("g2Deff Xmin %f Ymin %f Zmin %f\n", g2Deff->GetXmin(), g2Deff->GetYmin(),g2Deff->GetZmin());
printf("g2Deff Xmax %f Ymax %f Zmax %f\n", g2Deff->GetXmax(), g2Deff->GetYmax(),g2Deff->GetZmax());

//g2Deff Xmin 2.000000 Ymin 1365.420044 Zmin 1013.833313
//g2Deff Xmax 2.000000 Ymax 3877350.000000 Zmax 854429.437500

You l->SetPoint(i, x, y, z) and g2->SetPoint(i, x, y, z) in a for loop while I do if(igoodChan>=0 && igoodChan< size_goodChan){ …if (igoodChan<=size_goodChan) goto M1; } for

geff->SetPoint(ifilter, iocData_elem, avPixCount);
g2Deff->SetPoint(ifilter,igoodChan, iocData_elem, avPixCount);  

because of the issue described in

https://root-forum.cern.ch/t/calling-th1f-function-in-a-loop-segmentation-violoation/14992/1

So anyway , here are the error logs for the code above

Error in <TCanvas::Range>: illegal world coordinates range: x1=2.000000, y1=-483132.675012, x2=2.000000, y2=4361848.095056
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=2.000000, ymin=1365.420044, xmax=2.000000, ymax=3877350.000000
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::SetRange>: problem setting view
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TCanvas::Range>: illegal world coordinates range: x1=-0.000000, y1=-0.000000, x2=0.000000, y2=0.000000
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=-0.000000, ymin=-0.000000, xmax=0.000000, ymax=0.000000
root [2] Error in <TCanvas::Range>: illegal world coordinates range: x1=2.000000, y1=-483132.675012, x2=2.000000, y2=4361848.095056
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=2.000000, ymin=1365.420044, xmax=2.000000, ymax=3877350.000000
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::SetRange>: problem setting view
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TCanvas::Range>: illegal world coordinates range: x1=-0.000000, y1=-0.000000, x2=0.000000, y2=0.000000
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=-0.000000, ymin=-0.000000, xmax=0.000000, ymax=0.000000
Error in <TCanvas::Range>: illegal world coordinates range: x1=2.000000, y1=-483132.675012, x2=2.000000, y2=4361848.095056
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=2.000000, ymin=1365.420044, xmax=2.000000, ymax=3877350.000000
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::SetRange>: problem setting view
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TCanvas::Range>: illegal world coordinates range: x1=-0.000000, y1=-0.000000, x2=0.000000, y2=0.000000
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=-0.000000, ymin=-0.000000, xmax=0.000000, ymax=0.000000

and if i

myFilename.C++                    //ACLiC 

my issues are

In file included from /tmp/rootcint_YrT848.h:3,
                 from /tmp/W3YpNL_cint.cxx:1:
/home/l_common/Frances/macros/efficiencyMay2011/./effMay2011.C:9:17: error: array: No such file or directory
Error: external preprocessing failed. :0:
!!!Removing /home/l_common/Frances/macros/efficiencyMay2011/./file0CwgbU.cxx /home/l_common/Frances/macros/efficiencyMay2011/./file0CwgbU.h !!!
Error: /users/root_v5.20/bin/rootcint: error loading headers...
Error in <ACLiC>: Dictionary generation failed!
Info in <ACLiC>: Invoking compiler to check macro's validity
/home/l_common/Frances/macros/efficiencyMay2011/./effMay2011.C:9:17: error: array: No such file or directory
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/sstream.tcc: In member function ‘virtual typename std::basic_stringbuf<_CharT, _Traits, _Alloc>::int_type std::basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(typename _Traits::int_type)’:
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/sstream.tcc:112: error: expected unqualified-id before ‘(’ token
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/sstream.tcc:114: error: expected unqualified-id before ‘(’ token

In my .bashrc I have

export ROOTSYS=/users/root_v5.20
export PATH=$ROOTSYS/bin
export LD_LIBRARY_PATH=$ROOTSYS/lib

and

 gcc -v

Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)

With the attached “myFilename.C” file, try:
root [0] .L myFilename.C++

Try also: [code]#include “TSystem.h”
#include “TCanvas.h”
#include “TPad.h”
#include “TRandom.h”
#include “TGraph2D.h”
#include “TH2.h”
#include “TPolyLine3D.h”

void trial(void) {
Int_t i, j;
Double_t x, y, z;

TCanvas *c1 = new TCanvas(“c1”);
c1 = c1; // get rid of the warning: unused variable ‘c1’

Int_t m = 100;
TGraph2D *g2 = new TGraph2D(m);
g2->SetTitle(“TGraph2D and TPolyLine3D”);

// c1->cd();
g2->Draw(“surf4”);
// gPad->Modified(); gPad->Update();

Int_t n = 2;
TPolyLine3D *l = ((TPolyLine3D *)0);

for (j = 0; j < 100; j++) {
#if 0 /* 0 or 1 /
delete l; // delete the “previous” one
#endif /
0 or 1 */

g2->GetHistogram()->Reset("M"); // full reset of the Delaunay histogram
for (i = 0; i < m; i++) {
  gRandom->Rannor(x, y);
  z = x*x + y*y;
  g2->SetPoint(i, x, y, z);
} // for (i ...

l = new TPolyLine3D(n);
for (i = 0; i < n; i++) {
  x = 2.0 * gRandom->Rndm();
  y = 2.0 * gRandom->Rndm();
  z = 2.0 * gRandom->Rndm();
  l->SetPoint(i, x, y, z);
} // for (i ...

// c1->cd();
l->Draw();
gPad->Modified(); gPad->Update();

gSystem->Sleep(100); // 100 ms delay

} // for (j …
} // void trial(void) …[/code]
myFilename.C (5.85 KB)

Hi Wile. The output…

root [0] .L myFilename.C++
Info in <TUnixSystem::ACLiC>: creating shared library /home/fclopez/Desktop/./myFilename_C.so
** $Id: TGQt.cxx 24531 2008-06-25 05:45:47Z brun $ this=0x92206c8

Try another ROOT version (I tried 5.18, 5.28, 5.34) and/or another operating system.

BTW. I don’t really understand why you complain about “igoodChan”. You have: for (int ifilter =0; ifilter<filter; ifilter++) { // ... g2Deff->SetPoint(ifilter,igoodChan, iocData_elem, avPixCount); } which explicitly sets exactly the same “igoodChan” value (apparently the last one used = 2) for ALL “g2Deff” points (ifilter = 0, …, filter - 1). No wonder you get Xmin = Xmax (= 2).

Hi Wile,
Ok, I tried running the code on another root version : root_v5.30.06.Linux-slc5-gcc4.3 (binaries). Same problem.
I encountered a different problem with the installation, on the same OS

https://root-forum.cern.ch/t/root-v5-30-06-installation-problems-with-xrdsec-error-2/15422/1

but anyway its a separate issue.

I was wrong when I said the problem was in

g2Deff->SetPoint(ifilter,igoodChan, iocData_elem, avPixCount);

but it is actually at

g2Deff->Draw("surf4");

Not asking g2Deff->Draw(“surf4”) presents no problems. Am I missing some lines before g2Deff->Draw(“surf4”)?
Thanks.
F.

Take any of the two “trials”, that I gave you in my previous posts in this thread, modify the line:
g2->SetPoint(i, x, y, z);
into:
g2->SetPoint(i, 1., y, z); // enforce the same “x” for all points
and then try to run it.

Doing

g2->SetPoint(i, 1., y, z); // enforce the same "x" for all points

[quote=“Wile E. Coyote”]Take any of the two “trials”, that I gave you in my previous posts in this thread, modify the line:
g2->SetPoint(i, x, y, z);
into:
g2->SetPoint(i, 1., y, z); // enforce the same “x” for all points
and then try to run it.[/quote]

gives

root [1] trial()   
Error in <TCanvas::Range>: illegal world coordinates range: x1=1.000000, y1=-2.563888, x2=1.000000, y2=2.451524
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=1.000000, ymin=-2.062346, xmax=1.000000, ymax=1.949983
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::SetRange>: problem setting view
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TCanvas::Range>: illegal world coordinates range: x1=-0.000000, y1=-0.000000, x2=0.000000, y2=0.000000
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=-0.000000, ymin=-0.000000, xmax=0.000000, ymax=0.000000
Error in <TCanvas::Range>: illegal world coordinates range: x1=1.000000, y1=-3.630274, x2=1.000000, y2=2.923019
Error in <TCanvas::RangeAxis>: illegal axis coordinates range: xmin=1.000000, ymin=-2.974944, xmax=1.000000, ymax=2.267690
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::SetRange>: problem setting view
Error in <TView3D::ResetView>: Error in min-max scope

 *** Break *** segmentation violation
Attaching to program: /proc/4923/exe, process 4923

warning: .dynamic section for "/lib/libdl.so.2" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libstdc++.so.6" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/lib/libm.so.6" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/lib/libgcc_s.so.1" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/lib/libpthread.so.0" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libXrender.so.1" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libXinerama.so.1" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libXext.so.6" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libXau.so.6" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libXdmcp.so.6" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libXcursor.so.1" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libXfixes.so.3" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libjpeg.so.62" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libungif.so.4" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations

warning: .dynamic section for "/usr/lib/libpng12.so.0" is not at the expected address

warning: difference appears to be caused by prelink, adjusting expectations
[Thread debugging using libthread_db enabled]
0x00bb2402 in __kernel_vsyscall ()
#1  0x041e7cb3 in __waitpid_nocancel () from /lib/libc.so.6
#2  0x0418c62b in do_system () from /lib/libc.so.6
#3  0x0026af3d in system () from /lib/libpthread.so.0
#4  0x006d0477 in TUnixSystem::Exec(char const*) () from /users/root_v5.20/lib/libCore.so
#5  0x006d5f01 in TUnixSystem::StackTrace() () from /users/root_v5.20/lib/libCore.so
#6  0x006d2b46 in TUnixSystem::DispatchSignals(ESignals) () from /users/root_v5.20/lib/libCore.so
#7  0x006d2bd4 in SigHandler(ESignals) () from /users/root_v5.20/lib/libCore.so
#8  0x006d1e19 in sighandler(int) () from /users/root_v5.20/lib/libCore.so
#9  <signal handler called>
#10 0x046f17ce in TPainter3dAlgorithms::FillPolygon(int, double*, double*) () from /users/root_v5.20/lib/libHistPainter.so
#11 0x046f1958 in TPainter3dAlgorithms::DrawFaceMode2(int*, double*, int, int*, double*) () from /users/root_v5.20/lib/libHistPainter.so
#12 0x046f7e61 in TPainter3dAlgorithms::SurfaceCartesian(double, int, int, char const*) () from /users/root_v5.20/lib/libHistPainter.so
#13 0x046e1192 in THistPainter::PaintSurface(char const*) () from /users/root_v5.20/lib/libHistPainter.so
#14 0x046e25b2 in THistPainter::PaintTable(char const*) () from /users/root_v5.20/lib/libHistPainter.so
#15 0x046d001d in THistPainter::Paint(char const*) () from /users/root_v5.20/lib/libHistPainter.so
#16 0x0392b94b in TH1::Paint(char const*) () from /users/root_v5.20/lib/libHist.so
#17 0x03918d66 in TGraph2D::Paint(char const*) () from /users/root_v5.20/lib/libHist.so
#18 0x0041af13 in TPad::PaintModified() () from /users/root_v5.20/lib/libGpad.so
#19 0x00400ce3 in TCanvas::Update() () from /users/root_v5.20/lib/libGpad.so
#20 0x00731af0 in G__G__Base1_142_0_157(G__value*, char const*, G__param*, int) () from /users/root_v5.20/lib/libCore.so
#21 0x00bef2e3 in Cint::G__ExceptionWrapper(int (*)(G__value*, char const*, G__param*, int), G__value*, char*, G__param*, int) ()
   from /users/root_v5.20/lib/libCint.so
#22 0x00c017a2 in G__exec_asm () from /users/root_v5.20/lib/libCint.so
#23 0x00cb96f1 in G__exec_loop () from /users/root_v5.20/lib/libCint.so
#24 0x00cb8a3b in G__exec_statement () from /users/root_v5.20/lib/libCint.so
#25 0x00c66a8b in G__interpret_func () from /users/root_v5.20/lib/libCint.so
#26 0x00c53966 in G__getfunction () from /users/root_v5.20/lib/libCint.so
#27 0x00c37e70 in G__getitem () from /users/root_v5.20/lib/libCint.so
#28 0x00c3aabb in G__getexpr () from /users/root_v5.20/lib/libCint.so
#29 0x00caf4a8 in G__exec_statement () from /users/root_v5.20/lib/libCint.so
#30 0x00c25c68 in G__exec_tempfile_core () from /users/root_v5.20/lib/libCint.so
#31 0x00c26fa3 in G__exec_tempfile_fp () from /users/root_v5.20/lib/libCint.so
#32 0x00cbeb2c in G__process_cmd () from /users/root_v5.20/lib/libCint.so
#33 0x006bf8db in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /users/root_v5.20/lib/libCore.so
#34 0x00604a16 in TApplication::ProcessLine(char const*, bool, int*) () from /users/root_v5.20/lib/libCore.so
#35 0x0011ce9a in TRint::HandleTermInput() () from /users/root_v5.20/lib/libRint.so
#36 0x0011b4f0 in TTermInputHandler::Notify() () from /users/root_v5.20/lib/libRint.so
#37 0x0011d78e in TTermInputHandler::ReadNotify() () from /users/root_v5.20/lib/libRint.so
#38 0x006cee02 in TUnixSystem::CheckDescriptors() () from /users/root_v5.20/lib/libCore.so
#39 0x006d3024 in TUnixSystem::DispatchOneEvent(bool) () from /users/root_v5.20/lib/libCore.so
#40 0x0065c8bc in TSystem::InnerLoop() () from /users/root_v5.20/lib/libCore.so
#41 0x0065c683 in TSystem::Run() () from /users/root_v5.20/lib/libCore.so
#42 0x00604b02 in TApplication::Run(bool) () from /users/root_v5.20/lib/libCore.so
#43 0x0011bc6e in TRint::Run(bool) () from /users/root_v5.20/lib/libRint.so
#44 0x08048d83 in main ()
A debugging session is active.

        Inferior 1 [process 4923] will be detached.

Quit anyway? (y or n) [answered Y; input not from terminal]
Detaching from program: /proc/4923/exe, process 4923
Root > Function trial() busy flag cleared

Don’t these error messages look familiar to you? :mrgreen:
A small hint … if you move to a [d|r]ecent ROOT version, they will be gone. :wink:

[quote=“Wile E. Coyote”]Don’t these error messages look familiar to you? :mrgreen:
A small hint … if you move to a [d|r]ecent ROOT version, they will be gone. :wink:[/quote]

[-X even the latest root version (5_34) does not permit

g2->SetPoint(i, 1., y, z); // enforce the same "x" for all points 

even enforcing “y” for all points, for z, yes…any more suggestions to attack this problem, I just would like to make a 3D surf plot without taking TH2 (histogram) path.
This point on I am using version 5_34_patches

Try:
g2Deff->SetPoint(ifilter, (igoodChan + gRandom->Rndm() - 0.5), iocData_elem, avPixCount);

Now it plots something because of this

gRandom->Rndm() 

I can’t have it tho… Anymore way to work around with this?

3D view needs “[XYZ]min != [XYZ]max”.
Well, you could also try (just some cheating):
g2Deff->SetPoint(ifilter, (igoodChan + 1.e-3 * gRandom->Rndm()), iocData_elem, avPixCount);

Maybe Olivier can help, though …

Or maybe better, try:
g2Deff->SetPoint(ifilter, (igoodChan + 1.e-3 * ifilter / filter), iocData_elem, avPixCount);

if structured this way,more on loops

TCanvas *c1 = new TCanvas("c1");
//TCanvas *c2 = new TCanvas("c2"); 
	
TGraph2D *g2Deff = ((TGraph2D *)0);	
for (int ifilter = 0; ifilter<filter; ifilter++) {							
	sprintf(fname, "%s%d%s%s%s", fpath0, ifilter,fn, specifier, ext);				
	TH2F *h2 = createScan(fname, begin,end, 1,128*12*3);	
	
	for (int ichan=chMin; ichan<chMax+1; ichan++) {
	   delete g2Deff;			
	   TGraph2D *g2Deff = new TGraph2D(filter);	
	 			
	   if(!item_exists(ichan, bad, size)) {
	     pixelAveCnts = pixelAveCount(h2, ichan);			
           }else{
                pixelAveCnts =0;		      								
           }
      	int N = ichan-chMin; 
	float offset0 = 1.e-3 * gRandom->Rndm();
	float offset1 = 1.e-2 * gRandom->Rndm();
	float IC = iocVector[ifilter] + offset1;
	g2Deff->SetPoint(N,(Double_t) ichan + offset0, IC , pixelAveCnts);				
	}				
	delete h2;			
	}	
	c1->cd();
	g2Deff->Draw("surf4")

it behaves as if the second and third arguments were forced to some value in spite of the little cheating with offset0 and offset1, recalling

g2->SetPoint(i, 1., y, z); // enforce the same "x" for all points .

my loop’s output is like the following

Point 0 ichan+offset0 (x-axis) 1026.001000       IC (y-axis) 3877350.000000      pixelAveCnts(z-axis) 726327.187500
Point 1 ichan+offset0 (x-axis) 1027.000283       IC (y-axis) 3877350.000000      pixelAveCnts(z-axis) 782543.125000
Point 2 ichan+offset0 (x-axis) 1028.000232       IC (y-axis) 3877350.000000      pixelAveCnts(z-axis) 800976.000000

Point 0 ichan+offset0 (x-axis) 1026.000957       IC (y-axis) 3403141.500000      pixelAveCnts(z-axis) 749884.812500
Point 1 ichan+offset0 (x-axis) 1027.000540       IC (y-axis) 3403141.500000      pixelAveCnts(z-axis) 806969.375000
Point 2 ichan+offset0 (x-axis) 1028.000760       IC (y-axis) 3403141.500000      pixelAveCnts(z-axis) 823416.625000

Point 0 ichan+offset0 (x-axis) 1026.000316       IC (y-axis) 2999584.750000      pixelAveCnts(z-axis) 768565.562500
Point 1 ichan+offset0 (x-axis) 1027.000520       IC (y-axis) 2999584.750000      pixelAveCnts(z-axis) 823932.687500
Point 2 ichan+offset0 (x-axis) 1028.000476       IC (y-axis) 2999584.750000      pixelAveCnts(z-axis) 837727.875000

Point 0 ichan+offset0 (x-axis) 1026.000222       IC (y-axis) 2649344.250000      pixelAveCnts(z-axis) 781124.625000
Point 1 ichan+offset0 (x-axis) 1027.000030       IC (y-axis) 2649344.250000      pixelAveCnts(z-axis) 832278.000000
Point 2 ichan+offset0 (x-axis) 1028.000194       IC (y-axis) 2649344.250000      pixelAveCnts(z-axis) 843588.687500

Point 0 ichan+offset0 (x-axis) 1026.000580       IC (y-axis) 2345484.500000      pixelAveCnts(z-axis) 786648.312500
Point 1 ichan+offset0 (x-axis) 1027.000666       IC (y-axis) 2345484.500000      pixelAveCnts(z-axis) 832526.937500
Point 2 ichan+offset0 (x-axis) 1028.000561       IC (y-axis) 2345484.500000      pixelAveCnts(z-axis) 841336.000000

Point 0 ichan+offset0 (x-axis) 1026.000297       IC (y-axis) 2057663.125000      pixelAveCnts(z-axis) 786443.125000
Point 1 ichan+offset0 (x-axis) 1027.000063       IC (y-axis) 2057663.125000      pixelAveCnts(z-axis) 824578.875000
Point 2 ichan+offset0 (x-axis) 1028.000725       IC (y-axis) 2057663.125000      pixelAveCnts(z-axis) 829617.875000

Point 0 ichan+offset0 (x-axis) 1026.000714       IC (y-axis) 1814055.250000      pixelAveCnts(z-axis) 778243.812500
Point 1 ichan+offset0 (x-axis) 1027.000699       IC (y-axis) 1814055.250000      pixelAveCnts(z-axis) 808682.062500
Point 2 ichan+offset0 (x-axis) 1028.000129       IC (y-axis) 1814055.250000      pixelAveCnts(z-axis) 810370.812500

Point 0 ichan+offset0 (x-axis) 1026.000208       IC (y-axis) 1586485.500000      pixelAveCnts(z-axis) 762981.000000
Point 1 ichan+offset0 (x-axis) 1027.000083       IC (y-axis) 1586485.500000      pixelAveCnts(z-axis) 784953.750000
Point 2 ichan+offset0 (x-axis) 1028.000547       IC (y-axis) 1586485.500000      pixelAveCnts(z-axis) 783189.687500

Point 0 ichan+offset0 (x-axis) 1026.000292       IC (y-axis) 1345911.875000      pixelAveCnts(z-axis) 734710.500000
Point 1 ichan+offset0 (x-axis) 1027.000227       IC (y-axis) 1345911.875000      pixelAveCnts(z-axis) 746398.125000
Point 2 ichan+offset0 (x-axis) 1028.000141       IC (y-axis) 1345911.875000      pixelAveCnts(z-axis) 740621.687500

Point 0 ichan+offset0 (x-axis) 1026.000687       IC (y-axis) 1037717.625000      pixelAveCnts(z-axis) 673068.687500
Point 1 ichan+offset0 (x-axis) 1027.000441       IC (y-axis) 1037717.625000      pixelAveCnts(z-axis) 670594.937500
Point 2 ichan+offset0 (x-axis) 1028.000311       IC (y-axis) 1037717.625000      pixelAveCnts(z-axis) 660639.437500

Point 0 ichan+offset0 (x-axis) 1026.000182       IC (y-axis) 801912.125000       pixelAveCnts(z-axis) 599670.312500
Point 1 ichan+offset0 (x-axis) 1027.000741       IC (y-axis) 801912.125000       pixelAveCnts(z-axis) 586121.812500
Point 2 ichan+offset0 (x-axis) 1028.000161       IC (y-axis) 801912.125000       pixelAveCnts(z-axis) 574874.500000

Point 0 ichan+offset0 (x-axis) 1026.000628       IC (y-axis) 624191.062500       pixelAveCnts(z-axis) 520277.093750
Point 1 ichan+offset0 (x-axis) 1027.000698       IC (y-axis) 624191.062500       pixelAveCnts(z-axis) 500762.093750
Point 2 ichan+offset0 (x-axis) 1028.000090       IC (y-axis) 624191.062500       pixelAveCnts(z-axis) 487496.937500

Point 0 ichan+offset0 (x-axis) 1026.000095       IC (y-axis) 490250.062500       pixelAveCnts(z-axis) 444437.187500
Point 1 ichan+offset0 (x-axis) 1027.000475       IC (y-axis) 490250.062500       pixelAveCnts(z-axis) 420759.593750
Point 2 ichan+offset0 (x-axis) 1028.000778       IC (y-axis) 490250.062500       pixelAveCnts(z-axis) 408362.937500

Point 0 ichan+offset0 (x-axis) 1026.000980       IC (y-axis) 292589.562500       pixelAveCnts(z-axis) 297836.906250
Point 1 ichan+offset0 (x-axis) 1027.000831       IC (y-axis) 292589.562500       pixelAveCnts(z-axis) 275715.968750
Point 2 ichan+offset0 (x-axis) 1028.000744       IC (y-axis) 292589.562500       pixelAveCnts(z-axis) 266067.156250

Point 0 ichan+offset0 (x-axis) 1026.000391       IC (y-axis) 166971.093750       pixelAveCnts(z-axis) 180757.031250
Point 1 ichan+offset0 (x-axis) 1027.000347       IC (y-axis) 166971.093750       pixelAveCnts(z-axis) 165529.750000
Point 2 ichan+offset0 (x-axis) 1028.000613       IC (y-axis) 166971.093750       pixelAveCnts(z-axis) 158580.328125

Why is that?

At least “TGraph2D *” should be removed from “TGraph2D *g2Deff = new TGraph2D(filter);”.

Again, try to pre-compile (and run) your macro using ACLiC … this should find the majority of any possibly existing source code problems (and you will be free of any CINT limitations that you possibly meet).

Reading this thread now… need some time to catch up…

Is there anywhere in this long thread a running example I can try ?
I did:

root [0] .L myFilename.C++

It gives me (with 5.34 on mac):

Info in <TUnixSystem::ACLiC>: creating shared library /Users/couet/Downloads/./myFilename_C.so
In file included from /Users/couet/Downloads/myFilename_C_ACLiC_dict.cxx:17:
In file included from /Users/couet/Downloads/myFilename_C_ACLiC_dict.h:34:
/Users/couet/Downloads/./myFilename.C:83:23: error: variable length array of
      non-POD element type 'vector<float>'
   vector<float> avCnt[filter];
                      ^
/Users/couet/Downloads/./myFilename.C:126:25: warning: empty parentheses
      interpreted as a function declaration [-Wvexing-parse]
   vector<float> iocData() ;
                        ^~
/Users/couet/Downloads/./myFilename.C:126:25: note: remove parentheses to
      declare a variable
   vector<float> iocData() ;
                        ^~
1 warning and 1 error generated.
clang: error: no such file or directory: '/Users/couet/Downloads/myFilename_C_ACLiC_dict.o'
Error in <ACLiC>: Compilation failed!