The following accessor methods are used
to obtain the named coordinate components,
as in double s = p.t();
.
The Cartesian components may also be accessed by the index syntax, using either square braces or parentheses. In either case, the meaning of the index is 0-based, with the time component last. An enum is nested in the HepLorentzVector class to help clarify this: X=0, Y=1, Z=2, T=3.
The spatial components can also be accessed in spherical coordinates:
There is a family of methods of the form set Component () which may be used to set one component in Cartesian or spherical coordinates, or the cylindrical coordinate, keeping the other components in that system constant.
The entire spatial component can be set at once, keeping the time component constant.
And there is a family of set() methods, corresponding to the constructors, that may be used to update all four of a HepLorentzVector's coordinates at once.
Assignment from a Hep3Vector is supported, as in p = v;
.
Finally, there are conversion operators to const and non-const Hep3Vector; these were present in the original CLHEP classes. They ignore the time component.