Documentation ¶
Overview ¶
Package fmom provides types and functions to operate with Lorentz 4-vectors.
Example ¶
package main import ( "fmt" "math" "go-hep.org/x/hep/fmom" "gonum.org/v1/gonum/spatial/r3" ) func main() { p1 := fmom.NewPxPyPzE(10, 20, 30, 40) p2 := fmom.NewPtEtaPhiM(10, 2, math.Pi/2, 40) fmt.Printf("p1 = %v (m=%g)\n", p1, p1.M()) fmt.Printf("p2 = %v\n", p2) p3 := fmom.Add(&p1, &p2) fmt.Printf("p3 = p1+p2 = %v\n", p3) p4 := fmom.Boost(&p1, r3.Vec{X: 0, Y: 0, Z: 0.99}) fmt.Printf( "p4 = boost(p1, (0,0,0.99)) = fmom.P4{Px: %8.3f, Py: %8.3f, Pz: %8.3f, E: %8.3f}\n", p4.Px(), p4.Py(), p4.Pz(), p4.E(), ) p5 := fmom.Boost(&p1, r3.Scale(-1, fmom.BoostOf(&p1))) fmt.Printf( "p5 = rest-frame(p1) = fmom.P4{Px: %8.3f, Py: %8.3f, Pz: %8.3f, E: %8.3f}\n", p5.Px(), p5.Py(), p5.Pz(), p5.E(), ) }
Output: p1 = fmom.P4{Px:10, Py:20, Pz:30, E:40} (m=14.142135623730951) p2 = fmom.P4{Pt:10, Eta:2, Phi:1.5707963267948966, M:40} p3 = p1+p2 = fmom.P4{Px:10, Py:30, Pz:66.26860407847019, E:94.91276392425375} p4 = boost(p1, (0,0,0.99)) = fmom.P4{Px: 10.000, Py: 20.000, Pz: 493.381, E: 494.090} p5 = rest-frame(p1) = fmom.P4{Px: 0.000, Py: 0.000, Pz: 0.000, E: 14.142}
Index ¶
- func BoostOf(p P4) r3.Vec
- func CosTheta(p1, p2 P4) float64
- func DeltaEta(p1, p2 P4) float64
- func DeltaPhi(p1, p2 P4) float64
- func DeltaR(p1, p2 P4) float64
- func Dot(p1, p2 P4) float64
- func Equal(p1, p2 P4) bool
- func InvMass(p1, p2 P4) float64
- func VecOf(p P4) r3.Vec
- type EEtaPhiM
- func (p4 *EEtaPhiM) Clone() P4
- func (p4 *EEtaPhiM) CosPhi() float64
- func (p4 *EEtaPhiM) CosTh() float64
- func (p4 *EEtaPhiM) CotTh() float64
- func (p4 *EEtaPhiM) E() float64
- func (p4 *EEtaPhiM) Et() float64
- func (p4 *EEtaPhiM) Eta() float64
- func (p4 *EEtaPhiM) IPt() float64
- func (p4 *EEtaPhiM) M() float64
- func (p4 *EEtaPhiM) M2() float64
- func (p4 *EEtaPhiM) P() float64
- func (p4 *EEtaPhiM) P2() float64
- func (p4 *EEtaPhiM) Phi() float64
- func (p4 *EEtaPhiM) Pt() float64
- func (p4 *EEtaPhiM) Px() float64
- func (p4 *EEtaPhiM) Py() float64
- func (p4 *EEtaPhiM) Pz() float64
- func (p4 *EEtaPhiM) Rapidity() float64
- func (p4 *EEtaPhiM) Set(p P4)
- func (p4 *EEtaPhiM) SinPhi() float64
- func (p4 *EEtaPhiM) SinTh() float64
- func (p4 EEtaPhiM) String() string
- func (p4 *EEtaPhiM) TanTh() float64
- type EtEtaPhiM
- func (p4 *EtEtaPhiM) Clone() P4
- func (p4 *EtEtaPhiM) CosPhi() float64
- func (p4 *EtEtaPhiM) CosTh() float64
- func (p4 *EtEtaPhiM) CotTh() float64
- func (p4 *EtEtaPhiM) E() float64
- func (p4 *EtEtaPhiM) Et() float64
- func (p4 *EtEtaPhiM) Eta() float64
- func (p4 *EtEtaPhiM) IPt() float64
- func (p4 *EtEtaPhiM) M() float64
- func (p4 *EtEtaPhiM) M2() float64
- func (p4 *EtEtaPhiM) P() float64
- func (p4 *EtEtaPhiM) P2() float64
- func (p4 *EtEtaPhiM) Phi() float64
- func (p4 *EtEtaPhiM) Pt() float64
- func (p4 *EtEtaPhiM) Px() float64
- func (p4 *EtEtaPhiM) Py() float64
- func (p4 *EtEtaPhiM) Pz() float64
- func (p4 *EtEtaPhiM) Rapidity() float64
- func (p4 *EtEtaPhiM) Set(p P4)
- func (p4 *EtEtaPhiM) SinPhi() float64
- func (p4 *EtEtaPhiM) SinTh() float64
- func (p4 EtEtaPhiM) String() string
- func (p4 *EtEtaPhiM) TanTh() float64
- type IPtCotThPhiM
- func (p4 *IPtCotThPhiM) Clone() P4
- func (p4 *IPtCotThPhiM) CosPhi() float64
- func (p4 *IPtCotThPhiM) CosTh() float64
- func (p4 *IPtCotThPhiM) CotTh() float64
- func (p4 *IPtCotThPhiM) E() float64
- func (p4 *IPtCotThPhiM) Et() float64
- func (p4 *IPtCotThPhiM) Eta() float64
- func (p4 *IPtCotThPhiM) IPt() float64
- func (p4 *IPtCotThPhiM) M() float64
- func (p4 *IPtCotThPhiM) M2() float64
- func (p4 *IPtCotThPhiM) P() float64
- func (p4 *IPtCotThPhiM) P2() float64
- func (p4 *IPtCotThPhiM) Phi() float64
- func (p4 *IPtCotThPhiM) Pt() float64
- func (p4 *IPtCotThPhiM) Px() float64
- func (p4 *IPtCotThPhiM) Py() float64
- func (p4 *IPtCotThPhiM) Pz() float64
- func (p4 *IPtCotThPhiM) Rapidity() float64
- func (p4 *IPtCotThPhiM) Set(p P4)
- func (p4 *IPtCotThPhiM) SinPhi() float64
- func (p4 *IPtCotThPhiM) SinTh() float64
- func (p4 IPtCotThPhiM) String() string
- func (p4 *IPtCotThPhiM) TanTh() float64
- type P4
- type PtEtaPhiM
- func (p4 *PtEtaPhiM) Clone() P4
- func (p4 *PtEtaPhiM) CosPhi() float64
- func (p4 *PtEtaPhiM) CosTh() float64
- func (p4 *PtEtaPhiM) CotTh() float64
- func (p4 *PtEtaPhiM) E() float64
- func (p4 *PtEtaPhiM) Et() float64
- func (p4 *PtEtaPhiM) Eta() float64
- func (p4 *PtEtaPhiM) IPt() float64
- func (p4 *PtEtaPhiM) M() float64
- func (p4 *PtEtaPhiM) M2() float64
- func (p4 *PtEtaPhiM) P() float64
- func (p4 *PtEtaPhiM) P2() float64
- func (p4 *PtEtaPhiM) Phi() float64
- func (p4 *PtEtaPhiM) Pt() float64
- func (p4 *PtEtaPhiM) Px() float64
- func (p4 *PtEtaPhiM) Py() float64
- func (p4 *PtEtaPhiM) Pz() float64
- func (p4 *PtEtaPhiM) Rapidity() float64
- func (p4 *PtEtaPhiM) Set(p P4)
- func (p4 *PtEtaPhiM) SinPhi() float64
- func (p4 *PtEtaPhiM) SinTh() float64
- func (p4 PtEtaPhiM) String() string
- func (p4 *PtEtaPhiM) TanTh() float64
- type PxPyPzE
- func (p4 *PxPyPzE) Clone() P4
- func (p4 *PxPyPzE) CosPhi() float64
- func (p4 *PxPyPzE) CosTh() float64
- func (p4 *PxPyPzE) CotTh() float64
- func (p4 *PxPyPzE) E() float64
- func (p4 *PxPyPzE) Et() float64
- func (p4 *PxPyPzE) Eta() float64
- func (p4 *PxPyPzE) IPt() float64
- func (p4 *PxPyPzE) M() float64
- func (p4 *PxPyPzE) M2() float64
- func (p4 *PxPyPzE) P() float64
- func (p4 *PxPyPzE) P2() float64
- func (p4 *PxPyPzE) Phi() float64
- func (p4 *PxPyPzE) Pt() float64
- func (p4 *PxPyPzE) Px() float64
- func (p4 *PxPyPzE) Py() float64
- func (p4 *PxPyPzE) Pz() float64
- func (p4 *PxPyPzE) Rapidity() float64
- func (p4 *PxPyPzE) Set(p P4)
- func (p4 *PxPyPzE) SetPtEtaPhiE(pt, eta, phi, e float64)
- func (p4 *PxPyPzE) SetPtEtaPhiM(pt, eta, phi, m float64)
- func (p4 *PxPyPzE) SinPhi() float64
- func (p4 *PxPyPzE) SinTh() float64
- func (p4 PxPyPzE) String() string
- func (p4 *PxPyPzE) T() float64
- func (p4 *PxPyPzE) TanTh() float64
- func (p4 *PxPyPzE) X() float64
- func (p4 *PxPyPzE) Y() float64
- func (p4 *PxPyPzE) Z() float64
- type Vec4
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoostOf ¶ added in v0.25.0
BoostOf returns the 3d boost vector of the provided four-vector p. It panics if p has zero energy and a non-zero |p|^2. It panics if p isn't a timelike four-vector.
Types ¶
type IPtCotThPhiM ¶
type IPtCotThPhiM struct {
P4 Vec4
}
func NewIPtCotThPhiM ¶
func NewIPtCotThPhiM(pt, eta, phi, m float64) IPtCotThPhiM
func (*IPtCotThPhiM) Clone ¶
func (p4 *IPtCotThPhiM) Clone() P4
func (*IPtCotThPhiM) CosPhi ¶
func (p4 *IPtCotThPhiM) CosPhi() float64
func (*IPtCotThPhiM) CosTh ¶
func (p4 *IPtCotThPhiM) CosTh() float64
func (*IPtCotThPhiM) CotTh ¶
func (p4 *IPtCotThPhiM) CotTh() float64
func (*IPtCotThPhiM) E ¶
func (p4 *IPtCotThPhiM) E() float64
func (*IPtCotThPhiM) Et ¶
func (p4 *IPtCotThPhiM) Et() float64
func (*IPtCotThPhiM) Eta ¶
func (p4 *IPtCotThPhiM) Eta() float64
func (*IPtCotThPhiM) IPt ¶
func (p4 *IPtCotThPhiM) IPt() float64
func (*IPtCotThPhiM) M ¶
func (p4 *IPtCotThPhiM) M() float64
func (*IPtCotThPhiM) M2 ¶
func (p4 *IPtCotThPhiM) M2() float64
func (*IPtCotThPhiM) P ¶
func (p4 *IPtCotThPhiM) P() float64
func (*IPtCotThPhiM) P2 ¶
func (p4 *IPtCotThPhiM) P2() float64
func (*IPtCotThPhiM) Phi ¶
func (p4 *IPtCotThPhiM) Phi() float64
func (*IPtCotThPhiM) Pt ¶
func (p4 *IPtCotThPhiM) Pt() float64
func (*IPtCotThPhiM) Px ¶
func (p4 *IPtCotThPhiM) Px() float64
func (*IPtCotThPhiM) Py ¶
func (p4 *IPtCotThPhiM) Py() float64
func (*IPtCotThPhiM) Pz ¶
func (p4 *IPtCotThPhiM) Pz() float64
func (*IPtCotThPhiM) Rapidity ¶
func (p4 *IPtCotThPhiM) Rapidity() float64
func (*IPtCotThPhiM) Set ¶
func (p4 *IPtCotThPhiM) Set(p P4)
func (*IPtCotThPhiM) SinPhi ¶
func (p4 *IPtCotThPhiM) SinPhi() float64
func (*IPtCotThPhiM) SinTh ¶
func (p4 *IPtCotThPhiM) SinTh() float64
func (IPtCotThPhiM) String ¶ added in v0.25.0
func (p4 IPtCotThPhiM) String() string
func (*IPtCotThPhiM) TanTh ¶
func (p4 *IPtCotThPhiM) TanTh() float64
type P4 ¶
type P4 interface { Px() float64 // x component of 4-momentum Py() float64 // y component of 4-momentum Pz() float64 // z component of 4-momentum M() float64 // mass M2() float64 // mass squared P() float64 // momentum magnitude P2() float64 // square of momentum magnitude Eta() float64 // pseudo-rapidity Rapidity() float64 // rapidity Phi() float64 // azimuthal angle in [-pi,pi) E() float64 // energy of 4-momentum Et() float64 // transverse energy defined to be E*sin(Theta) Pt() float64 // transverse momentum IPt() float64 // inverse of transverse momentum CosPhi() float64 // cosine(Phi) SinPhi() float64 // sine(Phi) CosTh() float64 // cosine(Theta) SinTh() float64 // sine(Theta) CotTh() float64 // cottan(Theta) TanTh() float64 // tan(Theta) Set(p4 P4) Clone() P4 }
P4 models a Lorentz 4-vector.
type PxPyPzE ¶
type PxPyPzE struct {
P4 Vec4
}
func NewPxPyPzE ¶
func (*PxPyPzE) SetPtEtaPhiE ¶ added in v0.28.4
func (*PxPyPzE) SetPtEtaPhiM ¶ added in v0.28.4
Click to show internal directories.
Click to hide internal directories.