TCut question

I am encounting such a problem: There are events with different number of tracks. I want to use Tcut to select events with each track having a pt>0.1

For exactly two tracks, I can do:

TCut twotrks = “Ntrk==2”;
TCut ptcut = “(abs(Pt[0])>0.1) && (abs(Pt[1])>0.1)”;

If I want events with at least two tracks, and each track in a event to have a pt>0.1, what should I do?

TCut twotrks = “Ntrk>=2”;
TCut ptcut = “?”;

Thanks for your help!


Unless you maximum number of track is relatively small, there is no practical solution using string based cuts. You could do:

TCut ptcut = "(abs(Pt[0])>0.1) && (abs(Pt[1])>0.1) && Alt$(1, abs(Pt[2])>0.1)) && Alt$(1, abs(Pt[3])>0.1)) && Alt$(1, abs(Pt[4])>0.1)) && ... ");Where Alt$(1,Pt[4]>0.1) will be equal to 1 if Ntrk is less than 4 and equal to Pt[4]>0.1 if Ntrk is greater or equal to 4.

If your maximum number of track is too large you will to use a MakeProxy and MakeSelector.