gROOT->Reset();
void bug(void)
{
// get data
TFile *f = new TFile(“data/orange_103735_02_08_04.root”);
// get tree
TTree MyTree = (TTree)f->Get(“h1”);
// create canvas
TCanvas *MyCanvas = new TCanvas();
MyCanvas->Divide(2,1);
MyCanvas->cd(1);
MyTree->Draw(“Eventnr”);
MyCanvas->cd(2);
MyTree->Draw(“Eventnr”,“etamcdstar<1”);
MyTree->Draw(">> myList",“etamcdstar<1”);
myList->Print();
}
In the first plot I see the number of entries which is 100341 - the tolal number of events. In the second plot I see for the number of entries 5579 - number of events reduced by the cut.
So far everything o.k. I create an eventlist with the same cut applied for the second plot. I expect to get 5579 entries in the list but I get 100341, so the cut does not seem to act. Unfortunately there are variables where this bug does not occur, e.g. “Mc_q2>1000”. Am I doing something wrong or is there a better way to create an eventlist?
Falcone
P.S.: I am running root version 3.03/09 under SuSE Linux. The data file is 150 MB.
The variable is actually an array. I think this causes the troubles. Anyway I don’t know how to treat array for cuts if they have different numbers of entries. The following replacement does not work either, it give the same result as above :
The TEventList keeps a list a entry number where there is one or more value that match the conditions. So for variables that have more than one value per entries (arrays, TClonesArrays, etc), the number of values drawn and the size of the list might be different. Also when re-using the event list, to reproduce the original plot, you might need to use SetReapplyCut (See some explanation at http://root.cern.ch/root/html/TTree.html#TTree:Draw))
Now you problem seems to be the reserve issue (where the list is seemingly listing more events thatn it should). I assume that when you say “in the list but I get 100341”, you meant that “myList->Print()” printed 100341 values?
(If you did not mean that but meant that when using the EventList, Draw plotted too many values, then see above). If this is the case I would need to at least see the result of
MyTree->Print();
MyTree->Scan("Eventnr:etamcdstar");
Cheers,
Philippe
************************************[/quote]
I don’t know why but there are no entries in the eventlist and therefore nothing is plotted. If one applies the opposite cut “etamcdstar<0” as posted firstly at least the plotting works with
“myList->SetReapplyCut(kTRUE);”. For this case "myList->Print(); " gives
************************************[/quote]
I don’t know why but there are no entries in the eventlist and therefore nothing is plotted. If one applies the opposite cut “etamcdstar<0” as posted firstly at least the plotting works with
“myList->SetReapplyCut(kTRUE);”. For this case "myList->Print(); " gives
what is the exact number of entries in the tree. For me it looks like the cut acts on the pointer of the array and not on the contents itself.