Dear all,
I’m running intro trouble when trying to save objects of type “PtEtaPhiEVector” to a TTree, and when performing operations (assignments, sums) on those objects.
What I’m doing:
import ROOT as R
out_tree = R.TTree("t", "t")
vec = R.PtEtaPhiEVector()
out_tree.Branch("vec", vec)
/* // 1) This works like a charm
vec.SetCoordinates(50, 0, 0, 50)
*/
// 2) This doesn't work:
v1 = R.PtEtaPhiEVector(25, 0, 0, 25)
v2 = R.PtEtaPhiEVector(25, 0, 0, 25)
vec = v1 + v2
out_tree.Fill()
out_tree.Write("test.root")
In the first case, I fill the vector by calling a method, and it works fine: the output tree is filled with the correct values.
In the second case, I call the assignment operator: in the output tree, the coordinates for “vec” are nonsensical…
Is there a workaround in PyROOT? One solution is to create a temporary vector “temp = v1 + v2”, then assign its coordinates to “vec”, but that’s not quite practical…
Yours,
Sébastien