Inf/NaN propagated to the pad. Check drawn objects

Hi,

I have a ntuple (NanoAOD type) of 5 M events. From that using a macro, I am creating some histograms. The macro runs without error. But when I open the histogram from the output file it shows the below error.

(TBrowser &) Name: Browser Title: ROOT Object Browser
root [1] (TFile *) 0x557617909000
Warning in <TCanvas::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects.
Warning in <TCanvas::ResizePad>: Canvas_1 height changed from 0 to 10

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

The plot is attached , how actually it looks after opening the file. I am also attaching the macro.
Also, I have noticed that when I run the macro for 10000 events it works fine. The ntuple also can be opened using bare root. Please suggest something that can solve the problem.

ZJets.C (11.2 KB)


Please read tips for efficient and successful posting and posting code

_ROOT Version: 5.34 & 6.22


Thanks & Regards,
Soumyadip

Your data file is missing:

Processing ZJets.C...
Error in <TFile::TFile>: file sample.root does not exist

I have placed the sample and the macro in my lxplus public.
This is the path : /afs/cern.ch/work/s/sobarman/public

You use “UInt_t” variables to keep the variable sizes of some arrays.
@pcanal There is / was a requirement that leaves keeping such sizes must be “Int_t” (i.e., “32 bit signed integers”).
However, it is also possible that accessing such trees via a TTreeReader based interface would be free from this “limitation” (but see also this old post).

After changing UInt_t to Int_t, I am getting this error :

Error in <TTree::SetBranchAddress>: The pointer type given "Int_t" (3) does not correspond to the type needed "UInt_t" (13) by the branch: nGenPart
Error in <TTree::SetBranchAddress>: The pointer type given "Int_t" (3) does not correspond to the type needed "UInt_t" (13) by the branch: nGenJet
Error in <TTree::SetBranchAddress>: The pointer type given "Int_t" (3) does not correspond to the type needed "UInt_t" (13) by the branch: nGenDressedLepton
No. of events processed : 1

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
    gdb.printing.register_pretty_printer(gdb.current_objfile(),
    gdb.printing.register_pretty_printer(gdb.current_objfile(),
#0  0x00007f71acc3f46c in waitpid () from /lib64/libc.so.6
#1  0x00007f71acbbcf62 in do_system () from /lib64/libc.so.6
#2  0x00007f71ad720e8c in TUnixSystem::StackTrace() () from /usr/lib64/root/libCore.so.6.22
#3  0x00007f71ad72391a in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib64/root/libCore.so.6.22
#4  <signal handler called>
#5  0x00007f71adde22b5 in ?? ()
#6  0x0000000000000000 in ?? ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum https://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern.ch/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x00007f71adde22b5 in ?? ()
#6  0x0000000000000000 in ?? ()
===========================================================


Root >

You would need to recreate your tree from scratch.

Do you mean the sample ? Then I guess it is not possible. The sample has been produced from a specific script and it automatically assigns which one will be treated as UInt_t or Int_t. If I reproduce the sample again it will be automatically assigned that particular branch as UInt_t again.

Hi,

I have modified the code to use TTreeReader but unfortunately, I am getting the same error.
The modified code is attached : ZJets_Analyzer.C (8.4 KB)

@pcanal I am not much comfortable with TTreeReader. Please suggest, if I have done anything terrible in the code or the problem is of a different source.

Try with ROOT 5 or ROOT 6:

if (!TMath::Finite(*genWeight)) {
  std::cout << "Entry = " << myReader.GetCurrentEntry() << " *genWeight = " << *genWeight << std::endl;
  continue;
}
if (!TMath::Finite(sum_pt)) {
  std::cout << "Entry = " << myReader.GetCurrentEntry() << " sum_pt = " << sum_pt << std::endl;
} else {
  h_sumpt->Fill(sum_pt, *genWeight);
}

or with ROOT 6:

#include <cmath>
// ...
if (!std::isfinite(*genWeight)) {
  std::cout << "Entry = " << myReader.GetCurrentEntry() << " *genWeight = " << *genWeight << std::endl;
  continue;
}
if (!std::isfinite(sum_pt)) {
  std::cout << "Entry = " << myReader.GetCurrentEntry() << " sum_pt = " << sum_pt << std::endl;
} else {
  h_sumpt->Fill(sum_pt, *genWeight);
}

Thanks, it solves the problem.
The problem was in the genWeight branch. It has NaN/Inf values which are causing the problem.

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