TCut in event loop

Hello,

I’d like to use a TCut inside an event loop but it looks there is no easy/simple way. Few info below:

  • I can’t use a fChain->Draw(“>>eventlist”,aCut) because I need all events and then do different things if an event pass or not the cut
  • I found a suggestion in a very old thread (more than 20 years ago) here [0] and it’s ok but the execution time increase a lot and I wonder if it depends on the complexity of the cut or it’s just not an efficient solution.
  • I know RDataFrame could be an option but it looks to me that because I need to calculate many quantities and, depending on the success or not of the cut, do so many things, is not really a good option.

So I wonder if there is a different approach because I don’t want to implement 20 or more if in my loop and it would be great if there is a more simple and above all efficient way to just check if an event pass a cut or not.

Thanks for helping

Attilio

[0] TCut objects as arguments

Just to give you some number… if I use the solution given in [0] above, for 200K loops it takes 180s while if I copy & paste the TCut expression taken from the GetTitle method (it’s a string longer than 400 characters), it takes less than 1 sec… so the solution given in [0] is definitely not useful. So back to the original question: is there any other method?

Attilio

Hi,

do you mind elaborating a bit on what exactly you are trying to achieve? I take it you have a TTree (or a TChain) and you want to select its entries that satisfy a TCut expression? And what do you mean exactly by

I can’t use a fChain->Draw(">>eventlist",aCut) because I need all events

? What “all events”?