Multiple TGraph2D - Issue when using SetPoint

Hi everyone,

I am having an issue that is literally making me go crazy as I have absolutely no idea why it is happening. Basically, I plot 3 TGraph2D on the same canvas using this simple piece of code:

TH3F *frame3d = new TH3F("frame3d","",10,-1.2,1.2,10,-1.2,1.2,10,-1,max_npe);

// draw pixels
TGraph2D *g1 = new TGraph2D("pixels","",size_vec,x_arr,y_arr,npe_arr);
g1->Draw("PCOLZ SAME");

//draw COG
TGraph2D *g2 = new TGraph2D(1);
g2->SetPoint(0, 0.5, 0.5, max_npe);
g2->Draw("P SAME");

which gives me this plot:

where TGraph2D *g1 gives me the colored points and TGraph2D *g2 gives me the cross. So far so good.

However, if I change g2->SetPoint(0, 0.5, 0.5, max_npe); to g2->SetPoint(0, -0.5, 0.5, max_npe);or basically changes any of the x or y coordinate value of my point to a negative value, the cross is not plotted anymore. How is it possible that a simple change of sign causes such issue? I do not get any error message from ROOT so I am a bit clueless now. I thought it my be a problem of defined axis limits but those are already specified in the TH3F object. Could it be due to the binning of that histogram?

Thanks in advance :slight_smile:

It would be nice if you could provide a piece of code we can run and reproducing the problem.
What you posted is incomplete.
Thanks in advance.

I have attached the routine here, let me know if you need any more information. Thanks for having a look at it.

images.C (1.1 KB)

It works for me:

    // draw COG
    TGraph2D *g2 = new TGraph2D(1);
    g2->SetPoint(0, -0.5, 0.5, max_npe);
    g2->Draw("P SAME");

Then I am completely speechless… it does not work for me at all.

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

I am using ROOT master on Mac … which root version are you using ? on which machine ?

Oops, yes, my bad!

ROOT version: ROOT 6.12/04
Platform: Ubuntu 16.04
Compiler: gcc 5 and g++ 4.8

Both ROOT 6.12/06 and 6.14/06 have this bug. You need to use ROOT 6.16/00 or newer.

Indeed, after installing a newer version of ROOT, the bug disappears. Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.