TLorentzVector::EtaPhiVector()
returns a TVector2
whose X component is eta, and whose Y component is phi. Is there a function in ROOT that would allow adding these in a way that correctly treats phi?
Hi
I have not understood what do you mean a way that correctly treats phi. Can you please explain better your problem ?
Thank you
Lorenzo
Phi is an angle, so the result of an addition or subtraction should be moved into that range.
HI,
If you want to add two Lorenz vectors, you should add them and then you ask for the resulting phi. Otherwise, I don;t think there is a public special function to treat phi, but you can copy and use this from here:
Lorenzo
In detectors, we often use (pₜ, η, ϕ, E) coordinates, where ϕ is an angle. TLorentzVector lets you set these with SetPtEtaPhiE
. The (η, ϕ) vector can be extracted as a TVector2 using EtaPhiVector
. η and ϕ are the x and y component of this TVector2, so adding or subtracting TVector2s simply adds and subtracts the η and ϕ components. This can take ϕ outside the 0 - 2π (or -π to π) range it should always be in. I wanted to know if there were a convenience function that deals with this automatically, rather than having to manually add the components and call TVector2::Phi_0_2pi
or TVector2::Phi_mpi_pi
on the ϕ result.
HI,
For your use case, I would then recommend to use the the ROOT class ROOT::Math::PtEtaPhiEVector
see https://root.cern/doc/master/classROOT_1_1Math_1_1PtEtaPhiE4D.html
That would be a 4-vector. What I’m looking for is essentially a 2-vector with a ROOT::Math::CylindricalEta2D<T>
coordinate system (this coordinate system isn’t actually available).
I have no problem doing the additions manually, but I think it would be useful for EtaPhiVector
to return something that can be added and subtracted naturally.
Hi,
Yes this is not available, because normally in 2D you have always the radius. But cannot you use ROOT::Math::CylindricalEta3D with rho=1 ?
Lorenzo
I certainly could, yes. That isn’t what EtaPhiVector()
returns though.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.