package slha

import "go-hep.org/x/hep/slha"

Package slha implements encoding and decoding of SUSY Les Houches Accords (SLHA) data format.

Index

Functions

func Encode

func Encode(w io.Writer, data *SLHA) error

Encode writes the SLHA informations to w.

Types

type Block

type Block struct {
	Name    string
	Comment string
	Q       float64
	Data    DataArray
}

Block represents a block in a SLHA file.

func (*Block) Get

func (b *Block) Get(args ...int) (Value, error)

Get returns the Value at index args. Note that args are 1-based indices.

func (*Block) Set

func (b *Block) Set(v any, args ...int) error

Set sets the Value at index args with v. Set creates a new empty Value if none exists at args. Note that args are 1-based indices.

type Blocks

type Blocks []Block

Blocks is a list of Blocks.

func (Blocks) Get

func (b Blocks) Get(name string) *Block

Get returns the block named name or nil.

func (Blocks) Keys

func (b Blocks) Keys() []string

Keys returns the names of the contained blocks.

type DataArray

type DataArray []DataItem

DataArray is an ordered list of DataItems.

func (DataArray) Get

func (d DataArray) Get(idx Index) (Value, bool)

Get returns the value at the n-dim index idx.

type DataItem

type DataItem struct {
	Index Index
	Value Value
}

DataItem is a pair of (Index,Value). Index is a n-dim index (1-based indices)

type Decay

type Decay struct {
	Br      float64 // Branching Ratio
	IDs     []int   // list of PDG IDs to which the decay occur
	Comment string  // comment attached to this decay line - if any
}

Decay is a decay line in an SLHA file.

type Decays

type Decays []Decay

Decays is a list of decays in a Decay block.

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index is an n-dimensional index. Note that the indices are 1-based.

func NewIndex

func NewIndex(args ...int) Index

NewIndex creates a new n-dim index from args. Note that args are 1-based indices.

func (Index) Index

func (idx Index) Index() []int

Index returns the n-dim indices. Note that the indices are 1-based.

type Particle

type Particle struct {
	PdgID   int     // PDG-ID code
	Width   float64 // total width of that particle
	Mass    float64 // mass of that particle
	Comment string
	Decays  Decays
}

Particle is the representation of a single, specific particle, decay block from a SLHA file.

type Particles

type Particles []Particle

Particles is a block of particle's decays in an SLHA file.

func (Particles) Get

func (p Particles) Get(pdgid int) *Particle

Get returns the Particle with matching pdgid or nil.

func (Particles) Len

func (p Particles) Len() int

func (Particles) Less

func (p Particles) Less(i, j int) bool

func (Particles) Swap

func (p Particles) Swap(i, j int)

type SLHA

type SLHA struct {
	Blocks    Blocks
	Particles Particles
}

SLHA holds informations about a SUSY Les Houches Accords file.

func Decode

func Decode(r io.Reader) (*SLHA, error)

Decode reads SLHA informations from r and returns them as a *slha.SLHA.

type Value

type Value struct {
	// contains filtered or unexported fields
}

Value represents a value (string,int,float64) + comment in a SLHA line.

func (*Value) Comment

func (v *Value) Comment() string

Comment returns the comment string attached to this value

func (*Value) Float

func (v *Value) Float() float64

Float returns the value as a float64. Float panics if the underlying value isn't a float64.

func (*Value) Int

func (v *Value) Int() int64

Int returns the value as an int64. Int panics if the underlying value isn't an int64.

func (*Value) Interface

func (v *Value) Interface() any

Interface returns the value as an empty interface.

func (*Value) Kind

func (v *Value) Kind() reflect.Kind

Kind returns the kind of the value (reflect.String, reflect.Float64, reflect.Int)

Source Files

decode.go encode.go slha.go

Directories

PathSynopsis
slha/example
slha/example/go-slha-basic
Version
v0.37.0 (latest)
Published
May 20, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
1 hour ago

Tools for package owners.