[ROOT] TTree::Draw and "or"ed TCuts failing.

From: Brett Viren (bv@bnl.gov)
Date: Tue Mar 04 2003 - 20:56:16 MET


Hi,

I am finding that when doing a TTree::Draw() an "or"ed cut is failing
to act as I expect it should, leading to bogus results.


Our top level tree object is like:

class TTreeSR : public TObject {
public:
	...
	EventSRHeader evthdr; // contains "hdr.ntrack" holding # of tracks
	TClonesArray* trk;    // TrackSRTTree
	...
};
class TrackSRTTree : public TObject {
public:
	...
	Float_t ds;
	...
};

I am trying to plot the number of tracks (A UShort_t in
"evthdr.ntrack") for all events which either have 0 tracks or have >0
tracks but have a certain value, ds<1.0.  This "ds" is held as a
Float_t in a data member of the "TrackSRTTree" elements of the "trk"
TClonesArray.

The two commands I use are:

 1) tree->Draw("evthdr.ntrack");

 2) tree->Draw("evthdr.ntrack","evthdr.ntrack==0||trk[0].ds<1.0");

or more explicitly:

 2') tree->Draw("evthdr.ntrack","evthdr.ntrack==0||(evthdr.ntrack==1&&trk[0].ds<1.0)")

In the first case the data populates the ntrack==0 and 1 bins.  In
both of the second cases, only bin ntracks==1 is populated.


There is a test file (14.4 MB):

http://minos.phy.bnl.gov/~bviren/minos/mc/gminos/test.root

Using it, this session should reproduce the problem:

root [1] TFile f("test.root")
root [2] TTree* t = (TTree*)f.Get("reco")
root [3] t->Draw("evthdr.ntrack")
root [4] t->Draw("evthdr.ntrack","evthdr.ntrack==0||trk[0].ds<1.0")   
root [5] t->Draw("evthdr.ntrack","evthdr.ntrack==0||(evthdr.ntrack==1&&trk[0].ds<1.0)")


This is with today's CVS on x86, GCC 3.2.
-Brett.



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