TEntryList clarification

I realize that I can draw to a TEntryList to store a list of entries in a TTree or TChain that passed some cut.

chain.Draw('>>'+elist_name, tcut, 'entrylist')
elist = ROOT.gDirectory.Get(elist_name)
chain.SetEntryList(elist)

I’ve been doing this to create a cut flow table by storing a list of TEntryLists for different cuts and then calling GetN() for each TEntryList to get the number of events that passed that cut. I also later use those TEntryLists to Draw some plots at certain points in the cut flow.

This seems to be working great, but I am confused about the details concerning what happens when I cut on or draw variables that are stored in a vector in the TTree. For example, my TTrees contain variables like the following.

>>> chain.Scan('TauJet_N:TauJet_E_T:TauJet_isTauMedium')
***********************************************************
*    Row   * Instance *  TauJet_N * TauJet_E_ * TauJet_is *
***********************************************************
*        0 *        0 *         2 * 29355.379 *         0 *
*        0 *        1 *         2 * 16497.300 *         0 *
*        1 *        0 *         0 *         0 *         0 *
*        2 *        0 *         2 * 40513.117 *         1 *
*        2 *        1 *         2 * 33390.223 *         1 *
*        3 *        0 *         3 * 104271.92 *         0 *
*        3 *        1 *         3 * 19092.962 *         1 *
*        3 *        2 *         3 * 11848.232 *         0 *

Where if TauJet_N is not zero, then there are TauJet_N number of instances of TauJet_E_T. So if I have a cut that cuts on TauJet_E_T and I draw with it to a TEntryList, then does every good “Row” (event) end up in the TEntryList, or does every Instance (particle) that passed end up in the TEntryList? If it is the row (event) that is stored, does only one instance (particle) have to pass the cut?

If it is the rows (events) that are stored in the TEntryList and I later use that TEntryList to Draw some plots, for example if I

tree.SetEntryList(elist)
tree.Draw('TauJet_E_T')

Do I need to specify the cuts again in the Draw command, because if I don’t, wouldn’t it will loop over the other instances of TauJet that failed the cut as long as one in that row (event) passed?

Lastly, since I’ve been talking about vectors in TTrees, could someone verify that the best way to cut on the number of instances that pass some cuts is to use Sum$ as in the following:

c = TCut('Sum$((TauJet_E_T>15000)&&(TauJet_isTauMedium==1)&&(TauJet_ElectronFlag==0)&&(TauJet_MuonFlag==0)&&((TauJet_numTrack==1)||(TauJet_numTrack==3))&&(abs(TauJet_charge)==1))==1')

Or is there a better way? Thanks for your help.

Hi,

Take a look at the TEntryList::SetReapplyCut() method. Normally, an entry list just stores event numbers, so no secondary indices inside vectors. As far as I remember, the SetReapplycut() method should tell the tree to reapply the original cut to get only the right elements of vectors (collections). Please try and let me know, if it doesn’t work, we’ll have to fix it.

Cheers
Anna