Answers (to questions that came up on Sept. 6, 2001):
To add to an existing TEventList via a Draw command:
t->Draw(">>+ elist", "TKR_No_Tracks < 10");
Duplicate entries will NOT be added to a TEventList.
Also.. at the command line, it is not necessary to actually declare the TEventList explicitly:
t->Draw(">>elist", "TKR_No_Tracks > 0");
TEventList *elist = (TEventList*)gDirectory->Get("elist");
Note: This second line is only necessary if you want to store your TEventList in a file.
So the simple example would now look like:
root [0] TFile f("backgndavgpdr100000TUP0494.root")
root [1] TTree *t = (TTree*)f->Get("PDR/t1")
root [2] t->GetEntries()
(const Stat_t)3.44180000000000000e+004
root [3] t->Draw(">>elist", "TKR_No_Tracks > 0")
(Int_t)13485
root [5] elist->GetN()
(const Int_t)13485
root [6] t->SetEventList(elist)
root [7] t->Draw("ACD_TileCount")
root [8] t->SetEventList(0)
root [9] t->Draw("ACD_TileCount")
Tracy had posed a question as to whether it is possible to pass a user defined function to a TCut. Actually, it is not possible. However, there is another method to handle this via TTree::MakeSelector. This routine will automatically generate a skeleton class, that can be used to cut events and process the ones that pass the cut.
TFile f("myPDRntuple.root");
TTree *t = (TTree*)f.Get("PDR/t1");
t->MakeSelector("mySelector");
// This creates 2 new files mySelector.C and mySelector.h
// Then you fill MySelector.C's ProcessCuts and ProcessFill routines
t->Process("mySelector.C++");
// to run your tree through the selector and create the histograms
|