Dear all,
I tried to create a TH2F histogram with a variable binning on the x-axis. Afterwards I simply plotted it in a canvas. In the root shell up to now it work, but when quitting root, root crashes completely with the error message:
*** glibc detected *** /opt/root_v5-26-00b/bin/root.exe: double free or corruption (!prev): 0x095633d8 ***
and then a huge list of backtraces.
I tried to create the histogram with the following code:
Float_t ptcalcbinning1[4] = {0.5 ,1 ,2 ,5};
Float_t ptcalcbinning2[4] = {14,40,100,200};
Float_t ptcalcbinning3[5] = {1,15,28,43,53};
Double_t ptbinning[52];
ptbinning[0] = 0;
for ( int j = 0; j < 4 ; j ++ ){
for ( int i = ptcalcbinning3[j]; i<ptcalcbinning3[j+1]; i++){
ptbinning[i] = ptbinning[i-1] + ptcalcbinning1[j];
}
}
TH2F *Resolution_E_dPt_Ptrebin = new TH2F("Resolution_E_dPt_Ptrebin", "Electron Resolution dPt vs Pt ", 51, ptbinning , 200, -5., 5.) ;
TCanvas * c1_2 = new TCanvas("c1_2","",10,10,500,500); // gives the page size
c1_2->cd();
Resolution_E_dPt_Ptrebin->Draw();
c1_2->Update();
I am not sure whether I did something wrong. And actually I don’t have any clue where this error might come from. But I really need this variable binning. Therefore would anybody be so kind so send me an example. Or tell me were my code went wrong. Because if I try to plot it with the same code in a macro, what I would need, it crashes immediately. Can it be that it because the histogram is empty? The root version I am using is root v5-26-00b.
Thanks,
Friederike