Module: PDG

Defined in:
lib/pdg.rb,
lib/pdg/version.rb,
lib/pdg/particle.rb,
lib/pdg/particle_table.rb,
lib/pdg/lorentz_violation.rb

Defined Under Namespace

Classes: LorentzViolation, Particle, ParticleTable

Constant Summary collapse

HBAR =

Reduced Planck’s constant in GeV ps

6.5821193E-13
SPEED_OF_LIGHT =

Speed of light in mm ps^-1 “C” is a little short for a variable name…

2.9979246E-01
DEFAULT_DATA =

Path to PDG MC table

File.expand_path "../pdg/mass_width_2012.mcd", __FILE__
VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.[](id) ⇒ Object

Convenience method Returns the particle with ‘id`



23
24
25
# File 'lib/pdg.rb', line 23

def [](id)
  particles[id]
end

.particles(path = DEFAULT_DATA) ⇒ Object

Returns a ParticleTable object



17
18
19
# File 'lib/pdg.rb', line 17

def particles(path = DEFAULT_DATA)
  @@particles ||= ParticleTable.new path
end

.pretty_print(objs, properties) ⇒ Object



27
28
29
# File 'lib/pdg.rb', line 27

def pretty_print(objs, properties)
  Hirb::Helpers::AutoTable.render objs, {:fields => properties}
end

.single_character(str, idx = 0) ⇒ Object

Ruby 1.8: “Hello“ => 72 Ruby 1.9: ”Hello“ => “H” assuming non-multibyte strings. This functions returns the ASCII representation of the ‘idx`th byte of the string



37
38
39
40
# File 'lib/pdg.rb', line 37

def single_character(str, idx = 0)
  substr = str[idx]
  substr.class == Fixnum ? substr.chr : substr
end