fmom

package
v0.28.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2020 License: BSD-3-Clause Imports: 3 Imported by: 6

README

fmom

GoDoc

fmom provides facilities to create and manipulate Lorentz 4-vectors.

Installation

Is done with go get:

$ go get go-hep.org/x/hep/fmom

Documentation

Is provided via godoc:

https://godoc.org/go-hep.org/x/hep/fmom

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)) = %v\n", p4)

	p5 := fmom.Boost(&p1, fmom.BoostOf(&p1).Scale(-1))
	fmt.Printf("p5 = rest-frame(p1) = %v\n", p5)

}
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, Py:20, Pz:493.3813186858014, E:494.0901998908098}
p5 = rest-frame(p1) = fmom.P4{Px:0, Py:0, Pz:0, E:14.14213562373095}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoostOf added in v0.25.0

func BoostOf(p P4) r3.Vec

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.

func CosTheta

func CosTheta(p1, p2 P4) float64

CosTheta returns the cosine of the angle between the momentum of two 4-vectors.

func DeltaEta

func DeltaEta(p1, p2 P4) float64

DeltaEta returns the delta Eta between two P4

func DeltaPhi

func DeltaPhi(p1, p2 P4) float64

DeltaPhi returns the delta Phi in range [-pi,pi[ from two P4

func DeltaR

func DeltaR(p1, p2 P4) float64

DeltaR returns the delta R between two P4

func Dot added in v0.25.0

func Dot(p1, p2 P4) float64

Dot returns the dot product p1·p2.

func Equal

func Equal(p1, p2 P4) bool

Equal returns true if p1==p2

func InvMass

func InvMass(p1, p2 P4) float64

InvMass computes the invariant mass of two incoming 4-vectors p1 and p2.

func VecOf added in v0.28.4

func VecOf(p P4) r3.Vec

VecOf returns the 3-vector of fhe four-momentum

Types

type EEtaPhiM

type EEtaPhiM struct {
	P4 Vec4
}

func NewEEtaPhiM

func NewEEtaPhiM(e, eta, phi, m float64) EEtaPhiM

func (*EEtaPhiM) Clone

func (p4 *EEtaPhiM) Clone() P4

func (*EEtaPhiM) CosPhi

func (p4 *EEtaPhiM) CosPhi() float64

func (*EEtaPhiM) CosTh

func (p4 *EEtaPhiM) CosTh() float64

func (*EEtaPhiM) CotTh

func (p4 *EEtaPhiM) CotTh() float64

func (*EEtaPhiM) E

func (p4 *EEtaPhiM) E() float64

func (*EEtaPhiM) Et

func (p4 *EEtaPhiM) Et() float64

func (*EEtaPhiM) Eta

func (p4 *EEtaPhiM) Eta() float64

func (*EEtaPhiM) IPt

func (p4 *EEtaPhiM) IPt() float64

func (*EEtaPhiM) M

func (p4 *EEtaPhiM) M() float64

func (*EEtaPhiM) M2

func (p4 *EEtaPhiM) M2() float64

func (*EEtaPhiM) P

func (p4 *EEtaPhiM) P() float64

func (*EEtaPhiM) P2

func (p4 *EEtaPhiM) P2() float64

func (*EEtaPhiM) Phi

func (p4 *EEtaPhiM) Phi() float64

func (*EEtaPhiM) Pt

func (p4 *EEtaPhiM) Pt() float64

func (*EEtaPhiM) Px

func (p4 *EEtaPhiM) Px() float64

func (*EEtaPhiM) Py

func (p4 *EEtaPhiM) Py() float64

func (*EEtaPhiM) Pz

func (p4 *EEtaPhiM) Pz() float64

func (*EEtaPhiM) Rapidity

func (p4 *EEtaPhiM) Rapidity() float64

func (*EEtaPhiM) Set

func (p4 *EEtaPhiM) Set(p P4)

func (*EEtaPhiM) SinPhi

func (p4 *EEtaPhiM) SinPhi() float64

func (*EEtaPhiM) SinTh

func (p4 *EEtaPhiM) SinTh() float64

func (EEtaPhiM) String added in v0.25.0

func (p4 EEtaPhiM) String() string

func (*EEtaPhiM) TanTh

func (p4 *EEtaPhiM) TanTh() float64

type EtEtaPhiM

type EtEtaPhiM struct {
	P4 Vec4
}

func NewEtEtaPhiM

func NewEtEtaPhiM(et, eta, phi, m float64) EtEtaPhiM

func (*EtEtaPhiM) Clone

func (p4 *EtEtaPhiM) Clone() P4

func (*EtEtaPhiM) CosPhi

func (p4 *EtEtaPhiM) CosPhi() float64

func (*EtEtaPhiM) CosTh

func (p4 *EtEtaPhiM) CosTh() float64

func (*EtEtaPhiM) CotTh

func (p4 *EtEtaPhiM) CotTh() float64

func (*EtEtaPhiM) E

func (p4 *EtEtaPhiM) E() float64

func (*EtEtaPhiM) Et

func (p4 *EtEtaPhiM) Et() float64

func (*EtEtaPhiM) Eta

func (p4 *EtEtaPhiM) Eta() float64

func (*EtEtaPhiM) IPt

func (p4 *EtEtaPhiM) IPt() float64

func (*EtEtaPhiM) M

func (p4 *EtEtaPhiM) M() float64

func (*EtEtaPhiM) M2

func (p4 *EtEtaPhiM) M2() float64

func (*EtEtaPhiM) P

func (p4 *EtEtaPhiM) P() float64

func (*EtEtaPhiM) P2

func (p4 *EtEtaPhiM) P2() float64

func (*EtEtaPhiM) Phi

func (p4 *EtEtaPhiM) Phi() float64

func (*EtEtaPhiM) Pt

func (p4 *EtEtaPhiM) Pt() float64

func (*EtEtaPhiM) Px

func (p4 *EtEtaPhiM) Px() float64

func (*EtEtaPhiM) Py

func (p4 *EtEtaPhiM) Py() float64

func (*EtEtaPhiM) Pz

func (p4 *EtEtaPhiM) Pz() float64

func (*EtEtaPhiM) Rapidity

func (p4 *EtEtaPhiM) Rapidity() float64

func (*EtEtaPhiM) Set

func (p4 *EtEtaPhiM) Set(p P4)

func (*EtEtaPhiM) SinPhi

func (p4 *EtEtaPhiM) SinPhi() float64

func (*EtEtaPhiM) SinTh

func (p4 *EtEtaPhiM) SinTh() float64

func (EtEtaPhiM) String added in v0.25.0

func (p4 EtEtaPhiM) String() string

func (*EtEtaPhiM) TanTh

func (p4 *EtEtaPhiM) TanTh() float64

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.

func Add

func Add(p1, p2 P4) P4

Add returns the sum p1+p2.

func Boost added in v0.25.0

func Boost(p P4, vec r3.Vec) P4

Boost returns a copy of the provided four-vector boosted by the provided three-vector.

func IAdd

func IAdd(dst, src P4) P4

IAdd adds src into dst, and returns dst

func Scale

func Scale(a float64, p P4) P4

Scale returns a*p

type PtEtaPhiM

type PtEtaPhiM struct {
	P4 Vec4
}

func NewPtEtaPhiM

func NewPtEtaPhiM(pt, eta, phi, m float64) PtEtaPhiM

func (*PtEtaPhiM) Clone

func (p4 *PtEtaPhiM) Clone() P4

func (*PtEtaPhiM) CosPhi

func (p4 *PtEtaPhiM) CosPhi() float64

func (*PtEtaPhiM) CosTh

func (p4 *PtEtaPhiM) CosTh() float64

func (*PtEtaPhiM) CotTh

func (p4 *PtEtaPhiM) CotTh() float64

func (*PtEtaPhiM) E

func (p4 *PtEtaPhiM) E() float64

func (*PtEtaPhiM) Et

func (p4 *PtEtaPhiM) Et() float64

func (*PtEtaPhiM) Eta

func (p4 *PtEtaPhiM) Eta() float64

func (*PtEtaPhiM) IPt

func (p4 *PtEtaPhiM) IPt() float64

func (*PtEtaPhiM) M

func (p4 *PtEtaPhiM) M() float64

func (*PtEtaPhiM) M2

func (p4 *PtEtaPhiM) M2() float64

func (*PtEtaPhiM) P

func (p4 *PtEtaPhiM) P() float64

func (*PtEtaPhiM) P2

func (p4 *PtEtaPhiM) P2() float64

func (*PtEtaPhiM) Phi

func (p4 *PtEtaPhiM) Phi() float64

func (*PtEtaPhiM) Pt

func (p4 *PtEtaPhiM) Pt() float64

func (*PtEtaPhiM) Px

func (p4 *PtEtaPhiM) Px() float64

func (*PtEtaPhiM) Py

func (p4 *PtEtaPhiM) Py() float64

func (*PtEtaPhiM) Pz

func (p4 *PtEtaPhiM) Pz() float64

func (*PtEtaPhiM) Rapidity

func (p4 *PtEtaPhiM) Rapidity() float64

func (*PtEtaPhiM) Set

func (p4 *PtEtaPhiM) Set(p P4)

func (*PtEtaPhiM) SinPhi

func (p4 *PtEtaPhiM) SinPhi() float64

func (*PtEtaPhiM) SinTh

func (p4 *PtEtaPhiM) SinTh() float64

func (PtEtaPhiM) String added in v0.25.0

func (p4 PtEtaPhiM) String() string

func (*PtEtaPhiM) TanTh

func (p4 *PtEtaPhiM) TanTh() float64

type PxPyPzE

type PxPyPzE struct {
	P4 Vec4
}

func NewPxPyPzE

func NewPxPyPzE(px, py, pz, e float64) PxPyPzE

func (*PxPyPzE) Clone

func (p4 *PxPyPzE) Clone() P4

func (*PxPyPzE) CosPhi

func (p4 *PxPyPzE) CosPhi() float64

func (*PxPyPzE) CosTh

func (p4 *PxPyPzE) CosTh() float64

func (*PxPyPzE) CotTh

func (p4 *PxPyPzE) CotTh() float64

func (*PxPyPzE) E

func (p4 *PxPyPzE) E() float64

func (*PxPyPzE) Et

func (p4 *PxPyPzE) Et() float64

func (*PxPyPzE) Eta

func (p4 *PxPyPzE) Eta() float64

func (*PxPyPzE) IPt

func (p4 *PxPyPzE) IPt() float64

func (*PxPyPzE) M

func (p4 *PxPyPzE) M() float64

func (*PxPyPzE) M2

func (p4 *PxPyPzE) M2() float64

func (*PxPyPzE) P

func (p4 *PxPyPzE) P() float64

func (*PxPyPzE) P2

func (p4 *PxPyPzE) P2() float64

func (*PxPyPzE) Phi

func (p4 *PxPyPzE) Phi() float64

func (*PxPyPzE) Pt

func (p4 *PxPyPzE) Pt() float64

func (*PxPyPzE) Px

func (p4 *PxPyPzE) Px() float64

func (*PxPyPzE) Py

func (p4 *PxPyPzE) Py() float64

func (*PxPyPzE) Pz

func (p4 *PxPyPzE) Pz() float64

func (*PxPyPzE) Rapidity

func (p4 *PxPyPzE) Rapidity() float64

func (*PxPyPzE) Set

func (p4 *PxPyPzE) Set(p P4)

func (*PxPyPzE) SetPtEtaPhiE added in v0.28.4

func (p4 *PxPyPzE) SetPtEtaPhiE(pt, eta, phi, e float64)

func (*PxPyPzE) SetPtEtaPhiM added in v0.28.4

func (p4 *PxPyPzE) SetPtEtaPhiM(pt, eta, phi, m float64)

func (*PxPyPzE) SinPhi

func (p4 *PxPyPzE) SinPhi() float64

func (*PxPyPzE) SinTh

func (p4 *PxPyPzE) SinTh() float64

func (PxPyPzE) String added in v0.25.0

func (p4 PxPyPzE) String() string

func (*PxPyPzE) T

func (p4 *PxPyPzE) T() float64

func (*PxPyPzE) TanTh

func (p4 *PxPyPzE) TanTh() float64

func (*PxPyPzE) X

func (p4 *PxPyPzE) X() float64

func (*PxPyPzE) Y

func (p4 *PxPyPzE) Y() float64

func (*PxPyPzE) Z

func (p4 *PxPyPzE) Z() float64

type Vec4 added in v0.25.0

type Vec4 struct {
	X, Y, Z, T float64
}

Vec4 holds the four components of a Lorentz vector.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL