Problem with TCuts


I’m using TCuts for my analysis - my intention is to plot the MissingEt for like-sign same-flavour lepton pairs.
The histogram with cut e3 has less entries than the same with cut c3.
Is there a mistake in the code ?

TCut c1 = "Mu_N==2";
TCut c2 = "(Mu_charge[0]==Mu_charge[1])";
TCut c3 = (c1 && c2);

TCut d1 = "El_N==2";
TCut d2 = "(El_charge[0]==El_charge[1])";
TCut d3 = (d1 && d2);

TCut e3 = c3 || d3;

mychain->Draw("MissingEt", e3);

Thank you,

Could you post a short (but running) script and a small data file reproducing the problem?
I am suspecting a problem with your cuts of style “a==b”.
If a and b are floating point variables, you should make the test including some numerical precision.


These are the files (thanks again):
analyse_roottalk.c (459 Bytes)
5200_Truth_isol_500.AAN.root (1.94 MB)

I can reproduce the problem. We are investigating.



What you see is the (unfortunate) expected behavior. With the current code, if one of the element of the expression can not be evaluated (For example if El_N[0] does not exist because El_n.size()==0), the whole expression is invalidated. We have not yet found a good way (aka performant and clear enough) to prevent this.

However you have a simple work-around:

where you use the TTree::Draw special function Alt$ to express what should be the value of the expression in the case the values are missing).



Independently, I noticed that with your file the value of El_N and the size of the corresponding vectors (like El_charge) are not consistent. For example, see the result of:mychain->Scan("El_N:El_charge@.size()");
Is this intentional?


Thank you very much for your help!