Warning in <TPad::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects

Hello everybody.

I’m having problems with a macro I did, I need plot 3 superimposed histograms in one pad and a ratio of histograms in an other pad. When I run the code on root, it return message error below

Warning in <TPad::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects.
Warning in <TPad::ResizePad>: Canvas_D_IPCHI2_OWNPV_1 height changed from 0 to 10

Warning in <TPad::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects.
Warning in <TPad::ResizePad>: Canvas_D_IPCHI2_OWNPV_2 height changed from 0 to 10

root [1] Warning in <TPad::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects.
Warning in <TPad::ResizePad>: Canvas_D_IPCHI2_OWNPV_1 height changed from 0 to 10

Warning in <TPad::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects.
Warning in <TPad::ResizePad>: Canvas_D_IPCHI2_OWNPV_2 height changed from 0 to 10

Warning in <TPad::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects.
Warning in <TPad::ResizePad>: Canvas_D_IPCHI2_OWNPV_1 height changed from 0 to 10

Warning in <TPad::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects.
Warning in <TPad::ResizePad>: Canvas_D_IPCHI2_OWNPV_2 height changed from 0 to 10

The TCanvas this way

Here is my macro teste.C (3.6 KB)

It is difficult to try your macro. Running it we get:

Processing teste.C...
Error in <TFile::TFile>: file mc_weighted.root does not exist
Error in <TFile::TFile>: file NtupleWithSweights.root does not exist

Reading your post it seems also that you might be interested by this class: https://root.cern/doc/master/classTRatioPlot.html

I don’t know why, but my “Histo_Dados_D_IPCHI2_OWNPV” is empty after fill

Dados_Tree->Draw("D_IPCHI2_OWNPV>>Histo_Dados_D_IPCHI2_OWNPV","((D_IPCHI2_OWNPV>0)&&(D_IPCHI2_OWNPV<12))*(signalweight)");
 MC_Tree->Draw("D_IPCHI2_OWNPV>>Histo_MC_D_IPCHI2_OWNPV","((D_IPCHI2_OWNPV>0)&&(D_IPCHI2_OWNPV<12))*(D_PIDEff)*(wdata)*(wnTracks)");
 MC_Tree->Draw("D_IPCHI2_OWNPV>>Histo_MC_CIN_D_IPCHI2_OWNPV","((D_IPCHI2_OWNPV>0)&&(D_IPCHI2_OWNPV<12))*(D_PIDEff)*(wdata)*(wnTracks)*(weight)");

if a draw it again there is no event

Do you get also an empty plot if you do:

Dados_Tree->Draw("D_IPCHI2_OWNPV","((D_IPCHI2_OWNPV>0)&&(D_IPCHI2_OWNPV<12))*(signalweight)");

?

Thank you, I didn’t know this class, it is very helpfull

No, when it fill the histogram the pad have events, but after fill MC histograms, Data histogram get empty

? … it is just the same command you typed … without the histogram filling.

May be the histogram you try to fill does not have the right range. That’s why I asked you to Draw without the histogram to see if there is some events passing the cut you defined.