Drawing TGraphErr

Hello Rooters,

I am trying to draw a TGraphErr for my separate binning(Attached2D histogram).But I got empty canvas.Could you please help me?

Please see the snippet.

const int nxB=3, nQ2=4;

int nbins_mpipi=5.0;
int nbins_tmin_t=10;
          
TCanvas *canxBQ2_t_tmin_vs_mpipi_graphs= new TCanvas("canxBQ2_t_tmin_vs_mpipi_graphs","",12000,6000);
    canxBQ2_t_tmin_vs_mpipi_graphs->Divide(nxB,nQ2);


int z=0;
 //  Loop over Q2, xB bins
for (int iQ2=0; iQ2<nQ2; iQ2++) {
        for (int ixB=0; ixB<nxB; ixB++) {
            z++;
            canxBQ2_t_tmin_vs_mpipi_graphs->cd(z);
            //Drawing Tgraph
            double XX[nbins_mpipi], YY[nbins_tmin_t], ERR[nbins_mpipi];
            TGraphErrors *gEff = new TGraphErrors(nbins_mpipi, XX,YY,ERR);
         
                 for (int jtmin_t=0; jtmin_t<nbins_tmin_t; jtmin_t++)
                 {
                      for (int ipipi=0; ipipi<nbins_mpipi; ipipi++)
                      {
                           XX[ipipi] = h_t_tmin_vs_mpipi_ratio[iQ2][ixB]->GetBinContent(ipipi+1);
                           YY[jtmin_t] = h_t_tmin_vs_mpipi_ratio[iQ2][ixB]->GetBinContent(jtmin_t+1);
                           ERR[ipipi]= h_t_tmin_vs_mpipi_ratio[iQ2][ixB]->GetBinError(ipipi+1);
                       }
                       gEff->SetMarkerColor(jtmin_t+1);
                       gEff->Draw("ALP");
                 }
           
}

}

4.pdf (40.1 KB)

Move the line:
TGraphErrors *gEff = new TGraphErrors(nbins_mpipi, XX,YY,ERR);
to a place right before the line:
gEff->SetMarkerColor(jtmin_t+1);

Thank You, Wile_E_Coyote
This is a stupid mistake.

But still I haven’t got what I want.
Just wondering is this following part is okay???

XX[ipipi] = h_t_tmin_vs_mpipi_ratio[iQ2][ixB]->GetBinContent(ipipi+1);
 YY[jtmin_t] = h_t_tmin_vs_mpipi_ratio[iQ2][ixB]->GetBinContent(jtmin_t+1);

10.pdf (18.9 KB)

I guess you need: YY[ipipi] = ...