I just noticed that there is a confusion between fabs and abs in certain case.
Let say I have a tree named toto and I am interested to the number of event with this criteria
(E>0 && pdg==22 && abs(x)<0.6 && abs(y)<0.6).
I open my root file and do:
toto->Draw(“E”,“E>0 && pdg==22 && abs(x)<0.6 && abs(y)<0.6”,"")
and I have N events.
In this case changing abs to fabs give : Error in TTreeFormula::Compile: Bad numerical expression : “fabs(x)”)
Now I wand to do exactly the same inside .C file.
I do this small loop
for (Int_t i=0; iGetEntries(); i++)
if(E>0 && pdg==22 && abs(x)<0.6 && abs(y)<0.6)
and it return me a different number .
But by changing abs to fabs inside the loop (if(E>0 && pdg==22 && fabs(x)<0.6 && fabs(y)<0.6)))
return me the correct value.
I think this behavior is very confusing …