Re: [ROOT] NAN in NTuples

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jul 09 2003 - 22:33:48 MEST


Hi Max,

You can test for a NaN with:

Double_t r =  tt->FindLeaf("jetdata.ijet_phi")->GetValue(1431)
if (TMath::IsNaN(r)) {...

Rene Brun

On Wed, 9 
Jul 2003 mbrustke@purdue.edu wrote:

> I've read about some similar problems in the digest, but most of them seemed to 
> involve histogramming, while mine simply involves accessing the values of 
> leaves of a tree.  I setup a tree using the following syntax:
> afile = new TFile("mc.root")
> TTree *tt = afile.Get("t")
> Unfortunately, my MC files are around 60 megs each, so I can't attach one.  I 
> am working on creating a smaller file with a few good events and one or two bad 
> ones, but I'm still a novice with root.  The problem happens with different 
> instances of different variables, but the first one on which I noticed it was 
> event #1431 of a variable called jetdata.ijet_phi.  When I call
> tt->Scan("jetdata.ijet_phi")
> all values display properly, but if I call
> tt->FindLeaf("jetdata.ijet_phi")->GetValue(1431)
> I get:
> Error: Symbol nan is not defined in current scope  FILE: LINE:0
> (const Double_t)nan
> *** Interpreter error recovered ***
> I have experienced this under versions 3.03/07, 3.03/09, and 3.05/03., all 
> under various versions of Linux.  As I said, tt->Scan displays reasonable 
> looking values for the offending variables, and I can histogram them without 
> error, but accessing certain ones individually results in nan.  Even if there 
> is no way to fix this, is there some way I can detect nan entries and simply 
> skip them when I am looping over the entire dataset?
> 
> Thanks,
> Max Brustkern
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET