not very convenient if I need to predefine separate function for evey getPhi(), getTheta(), getX(), getY(), getZ()… Then the advantage of using XYZVector rather than plain px, py, pz vanishes.
I have tried this one-liner, which I was expecting to work, but it doesn’t…
Hello Bohdan,
very annoyingly, to make it work you need return Map instead of just Map, because there is a return in the expression so RDF does not insert another one. This should work:
I agree that’s more characters than one would like to write, but at least you don’t need the extra Declare stuff. However if you do these operations over and over again you might want to just put some helper functions in a library that you load at the beginning. Write them once, use them many times.
For ROOT, we could:
have a bunch of RVec helper functions that work on RVecs of XYZVectors (or 4-vectors in general)
allow Map(vec, &XYZVector::R), to invoke a method on each element of the RVec. unfortunately C++ forces us to have that & in there