go-hep.org/x/hep@v0.38.1/slha/README.md (about)

     1  slha
     2  ====
     3  
     4  [![GoDoc](https://godoc.org/go-hep.org/x/hep/slha?status.svg)](https://godoc.org/go-hep.org/x/hep/slha)
     5  
     6  Package `slha` implements encoding and decoding of SUSY Les Houches
     7  Accords (SLHA) data format.
     8  
     9  ## Installation
    10  
    11  ```sh
    12  $ go get go-hep.org/x/hep/slha
    13  ```
    14  
    15  ## Example
    16  
    17  ```go
    18  package main
    19  
    20  import (
    21  	"fmt"
    22  	"os"
    23  
    24  	"go-hep.org/x/hep/slha"
    25  )
    26  
    27  func handle(err error) {
    28  	if err != nil {
    29  		panic(err)
    30  	}
    31  }
    32  
    33  func main() {
    34  	fname := "testdata/sps1a.spc"
    35  	if len(os.Args) > 1 {
    36  		fname = os.Args[1]
    37  	}
    38  	f, err := os.Open(fname)
    39  	handle(err)
    40  
    41  	defer f.Close()
    42  
    43  	data, err := slha.Decode(f)
    44  	handle(err)
    45  
    46  	spinfo := data.Blocks.Get("SPINFO")
    47  	value, err := spinfo.Get(1)
    48  	handle(err)
    49  	fmt.Printf("spinfo: %s -- %q\n", value.Interface(), value.Comment())
    50  
    51  	modsel := data.Blocks.Get("MODSEL")
    52  	value, err = modsel.Get(1)
    53  	handle(err)
    54  	fmt.Printf("modsel: %d -- %q\n", value.Interface(), value.Comment())
    55  
    56  	mass := data.Blocks.Get("MASS")
    57  	value, err = mass.Get(5)
    58  	handle(err)
    59  	fmt.Printf("mass[pdgid=5]: %v -- %q\n", value.Interface(), value.Comment())
    60  
    61  	nmix := data.Blocks.Get("NMIX")
    62  	value, err = nmix.Get(1, 2)
    63  	handle(err)
    64  	fmt.Printf("nmix[1,2] = %v -- %q\n", value.Interface(), value.Comment())
    65  }
    66  
    67  
    68  // Output:
    69  // spinfo: SOFTSUSY -- "spectrum calculator"
    70  // modsel: 1 -- "sugra"
    71  // mass[pdgid=5]: 4.88991651 -- "b-quark pole mass calculated from mb(mb)_Msbar"
    72  // nmix[1,2] = -0.0531103553 -- "N_12"
    73  ```
    74  
    75  ## Documentation
    76  
    77  Documentation is available on [godoc](https://godoc.org/go-hep.org/x/hep/slha):
    78  
    79    https://godoc.org/go-hep.org/x/hep/slha
    80