TEventList and TCut

Hi all,

I am running following program:

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 :

MyTree->Draw(“Eventnr”,“etamcdstar[ ]<1”);
MyTree->Draw(">> myList",“etamcdstar[ ]<1”);

Falcone

Hi,

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

Hi Phillippe,

I changed the code a bit to make the problem even more visible (the cut is changed) :

gROOT->Reset();
void bug(void)
{
TFile *f = new TFile("data/orange_103735_02_08_04.root");
TTree *MyTree = (TTree*)f->Get("h1");
TCanvas *MyCanvas = new TCanvas();
MyCanvas->Divide(2,2);
MyCanvas->cd(1);
MyTree->Draw("Eventnr"); // --> 100341 entries
MyCanvas->cd(2);
MyTree->Draw("etamcdstar","etamcdstar>0"); // --> 3474 entries
MyTree->Draw(">> myList","etamcdstar>0");
myList->SetReapplyCut(kTRUE);
MyTree->SetEventList(myList);
MyCanvas->cd(3);
MyTree->Draw("Eventnr"); // pad is empty !!!
myList->Print(); 
MyTree->Print(); 
MyTree->Scan("Eventnr:etamcdstar");
}

I give you the output of myList->Print();

Here are a few lines from MyTree->Print();

[quote]******************************************************************************
*Tree :h1 : ORANGE *
*Entries : 100341 : Total = 314730566 bytes File Size = 153702248 *

  •    :          : Tree compression factor =   2.03                       *
    

*Br 0 :Cal_px : Cal_px/F *
*Entries : 100341 : Total Size= 417112 bytes File Size = 373075 *
*Baskets : 50 : Basket Size= 8000 bytes Compression= 1.07 *



*Br 92 :nmcdstar : nmcdstar/I *
*Entries : 100341 : Total Size= 425290 bytes File Size = 20421 *
*Baskets : 50 : Basket Size= 8000 bytes Compression= 19.58 *

*Br 93 :imcdstar : imcdstar[nmcdstar]/I *
*Entries : 100341 : Total Size= 451310 bytes File Size = 35532 *
*Baskets : 104 : Basket Size= 8000 bytes Compression= 12.24 *

*Br 94 :ptmcdstar : ptmcdstar[nmcdstar]/F *
*Entries : 100341 : Total Size= 451427 bytes File Size = 59709 *
*Baskets : 104 : Basket Size= 8000 bytes Compression= 7.29 *

*Br 95 :etamcdstar : etamcdstar[nmcdstar]/F *
*Entries : 100341 : Total Size= 455767 bytes File Size = 60551 *
*Baskets : 104 : Basket Size= 8000 bytes Compression= 7.19 *

*Br 96 :phimcdstar : phimcdstar[nmcdstar]/F *
*Entries : 100341 : Total Size= 451537 bytes File Size = 60764 *
*Baskets : 104 : Basket Size= 8000 bytes Compression= 7.16 *

…[/quote]
and here a all lines from MyTree->Scan("Eventnr:etamcdstar");

[quote]************************************

  • Row * Eventnr * etamcdsta *

************************************[/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.

Thanks for your help.

Falcone

[quote=“falcone”]Hi Phillippe,

I changed the code a bit to make the problem even more visible (the cut is changed) :

gROOT->Reset();
void bug(void)
{
TFile *f = new TFile("data/orange_103735_02_08_04.root");
TTree *MyTree = (TTree*)f->Get("h1");
TCanvas *MyCanvas = new TCanvas();
MyCanvas->Divide(2,2);
MyCanvas->cd(1);
MyTree->Draw("Eventnr"); // --> 100341 entries
MyCanvas->cd(2);
MyTree->Draw("etamcdstar","etamcdstar>0"); // --> 3474 entries
MyTree->Draw(">> myList","etamcdstar>0");
myList->SetReapplyCut(kTRUE);
MyTree->SetEventList(myList);
MyCanvas->cd(3);
MyTree->Draw("Eventnr"); // pad is empty !!!
myList->Print(); 
MyTree->Print(); 
MyTree->Scan("Eventnr:etamcdstar");
}

I give you the output of myList->Print();

Here are a few lines from MyTree->Print();

[quote]******************************************************************************
*Tree :h1 : ORANGE *
*Entries : 100341 : Total = 314730566 bytes File Size = 153702248 *

  •    :          : Tree compression factor =   2.03                       *
    

*Br 0 :Cal_px : Cal_px/F *
*Entries : 100341 : Total Size= 417112 bytes File Size = 373075 *
*Baskets : 50 : Basket Size= 8000 bytes Compression= 1.07 *



*Br 92 :nmcdstar : nmcdstar/I *
*Entries : 100341 : Total Size= 425290 bytes File Size = 20421 *
*Baskets : 50 : Basket Size= 8000 bytes Compression= 19.58 *

*Br 93 :imcdstar : imcdstar[nmcdstar]/I *
*Entries : 100341 : Total Size= 451310 bytes File Size = 35532 *
*Baskets : 104 : Basket Size= 8000 bytes Compression= 12.24 *

*Br 94 :ptmcdstar : ptmcdstar[nmcdstar]/F *
*Entries : 100341 : Total Size= 451427 bytes File Size = 59709 *
*Baskets : 104 : Basket Size= 8000 bytes Compression= 7.29 *

*Br 95 :etamcdstar : etamcdstar[nmcdstar]/F *
*Entries : 100341 : Total Size= 455767 bytes File Size = 60551 *
*Baskets : 104 : Basket Size= 8000 bytes Compression= 7.19 *

*Br 96 :phimcdstar : phimcdstar[nmcdstar]/F *
*Entries : 100341 : Total Size= 451537 bytes File Size = 60764 *
*Baskets : 104 : Basket Size= 8000 bytes Compression= 7.16 *

…[/quote]
and here a all lines from MyTree->Scan("Eventnr:etamcdstar");

[quote]************************************

  • Row * Eventnr * etamcdsta *

************************************[/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.

Thanks for your help.

Falcone[/quote]

Hi,

I still do not have enough information to resolve this issue.
Please make the file available somewhere on the web so that I can look at the data.

Cheers,
Philippe.

Hi Phillippe!

I installed a link “ROOT data file for Phillippe” on the web site :

www-zeus.desy.de/~falcone/

Cheers,

Falcone

Hi,

In ROOT 3.03/09, generating an event list when the selection criterium is an array was not functional.
This was fixed in ROOT 3.10/02

Cheers,
Philippe

Thanks for your help.

Falcone