Hi, > is there some way I can detect nan You can use TMath::IsNan ... but that's not really you problem. > tt->FindLeaf("jetdata.ijet_phi")->GetValue(1431) Is resquesting the 1431th value of the variable in jetdata.ijet_phi in the CURRENT event (which is unlikely to be #1431). This should only be used for variable that are arrays (which an event). To access a single value of jetdata.ijet_phi in the event #1431, you do something more like: tt->GetEntry(1431); tt->FindLeaf("jetdata.ijet_phi")->GetValue(0); [The code could actually be sped-up by just reading one branch but that's another story]. I recommend (re)reading the chapter on TTree in the User's Guide. Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of mbrustke@purdue.edu Sent: Wednesday, July 09, 2003 3:24 PM To: roottalk@pcroot.cern.ch Subject: [ROOT] NAN in NTuples 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