Error in <TGaxis::PaintAxis>: wmin (0.000000) == wmax (0.000

Hello!
I get these errors when trying to run my script. I’m taking the log of positive numbers, so I don’t know, where the NaN comes from. I must be overseeing something!

Thanks for any help!

Warning in TCanvas::ResizePad: Inf/NaN propagated to the pad. Check drawn objects.
Warning in TCanvas::ResizePad: can width changed from 0 to 10

Warning in TCanvas::ResizePad: can height changed from 0 to 10

Error in TGaxis::PaintAxis: wmin (0.000000) == wmax (0.000000)
root [4] Warning in TCanvas::ResizePad: Inf/NaN propagated to the pad. Check drawn objects.
Warning in TCanvas::ResizePad: can width changed from 0 to 10

Warning in TCanvas::ResizePad: can height changed from 0 to 10

Warning in TCanvas::ResizePad: Inf/NaN propagated to the pad. Check drawn objects.
Warning in TCanvas::ResizePad: can width changed from 0 to 10

Warning in TCanvas::ResizePad: can height changed from 0 to 10
ecLDirCPr.C (2.09 KB)

One problem is that … “pMinen”, “pMaxen”, “nMinen” and “nMaxen” should be “initialized” BEFORE they are used for the first time in the “for” loops (in which you search for “Min” and “Max”). You could try to add in these “for” loops something like (right after the corresponding “inChain->GetEntry([i|j])” lines):
if (!i) pMinen = pMaxen = pen;
if (!j) nMinen = nMaxen = nen;

BTW. Looking at your “ecLDirCPr.C” file, the calculated “Min” and “Max” values are printed on the screen but you didn’t show them in your post (make sure that all these values are > 0).

P.S. Try to add a “protection” in your code:
if ((pen > 0) && (nen > 0)) histoenergyn->Fill(TMath::Log10(pen), TMath::Log10(nen));

Thank you :slight_smile: