Overloading Operators in TTree->Draw

Does anyone know if a method has been implemented to allow for the overloading of operators in TTree->Draw(). For instance, if I have two branches in a TTree that are TLorentzVectors V1 and V2, I would like to make an invariant mass plot of the vector sum of these as:


This call currently returns

Error in TTreeFormula::Compile: Bad numerical expression : “(V1+V2).Pt()”

And I was wondering if there is a way around (other than writing the formula by hand) or if there are plans in a near future realease to implement this?



Operator overloading is not support in TTreeFormula. To work around this, you need to script to the script based version of TTree::Draw (based on MakeProxy). TTreeFormula is planned for a facelift circa 2014 leveraging cling.


// script.h #include "TLoretnzVector.h"

// script.C double script() { return (V1+V2).M(); }