I just disovered another awesome feature of my favorite function TTree::Draw(), namely that it can interpret calls to TMath functions!
I can’t find any TMath::DeltaPhi(phi1,phi2) TMath::DeltaR(…) functions though, which would be very useful to me in this context. Maybe these functions exist some place else though such that they can be interpreted as part of a TTree::Draw() selection?
Note that TTree::Draw can not only interpret calls to TMath function but it can also interprets calls to any free standing functions taking and returning numerical arguments. I.e. adding this functionality in your case is as simple as loading (via ACLiC for performance ) this script:
// Script MyMath.C
namespace MyMath {
double DeltaPhi(double phi1, double phi2) { .... return ...; }
}and after root [] .L MyMath.C+you can call ‘MyMath::DeltaPhi(phi1,phi2)’ from TTree::Draw.
just to let you know that the GenVector package provides the template functions DeltaPhi(v1,v2) and DeltaR(v1,v2) valid for any vector classes implementing Phi() and Eta()