go-hep.org/x/hep@v0.38.1/heppdt/particle.go (about)

     1  // Copyright ©2017 The go-hep Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package heppdt
     6  
     7  import (
     8  	"math"
     9  )
    10  
    11  // Particle holds informations on a particle as per the PDG booklet
    12  type Particle struct {
    13  	ID          PID           // particle ID
    14  	Name        string        // particle name
    15  	PDG         int           // PDG code of the particle
    16  	Mass        float64       // particle mass in GeV
    17  	Charge      float64       // electrical charge
    18  	ColorCharge float64       // color charge
    19  	Spin        SpinState     // spin state
    20  	Quarks      []Constituent // constituents
    21  	Resonance   Resonance     // resonance
    22  }
    23  
    24  // IsStable returns whether this particle is stable
    25  func (p *Particle) IsStable() bool {
    26  	res := &p.Resonance
    27  	if res.Width.Value == -1. {
    28  		return false
    29  	}
    30  	lt := res.Lifetime()
    31  	if res.Width.Value > 0 || lt.Value > 0 {
    32  		// FIXME(sbinet): res.Width.Value should be == -1.
    33  		// when lifetime.Value == +inf
    34  		return math.IsInf(lt.Value, +1)
    35  	}
    36  	return true
    37  }