def getQuantumNumbrers(pdgid): QN = {} QN["I"] = Particle.from_pdgid(pdgid).I # Isospin QN["J"] = Particle.from_pdgid(pdgid).J # Total angular momentum QN["G"] = Particle.from_pdgid(pdgid).G # Parity: '', +, -, or ? QN["P"] = Particle.from_pdgid(pdgid).P # Space parity QN["C"] = Particle.from_pdgid(pdgid).C # Charge conjugation parity return QN
def test_simple(): lines, all_states = GooFitChain.read_AmpGen(text=''' # This is a test (should not affect output) EventType D0 K- pi+ pi+ pi- D0[D]{K*(892)bar0{K-,pi+},rho(770)0{pi+,pi-}} 2 1 0 2 0 0 ''') assert Particle.from_pdg(421) == all_states[0] # D0 assert Particle.from_pdg(-321) == all_states[1] # K- assert Particle.from_pdg(211) == all_states[2] # pi+ assert Particle.from_pdg(211) == all_states[3] # pi+ assert Particle.from_pdg(-211) == all_states[4] # pi-
def getTau(pdgid): width = Particle.from_pdgid(pdgid).width * u.GeV / u.MeV if width != 0.0: tau = width_to_lifetime(width) * u.nanosecond / u.picosecond else: tau = P.STABLE return tau
def getComposition(pdgid): quarks = list(Particle.from_pdgid(pdgid).quarks) quarkdict = { 'U': 'ubar', 'D': 'dbar', 'C': 'cbar', 'S': 'sbar', 'T': 'tbar', 'B': 'bbar' } for n, quark in enumerate(quarks): if quark in quarkdict.keys(): quarks[n] = quarkdict[quark] return quarks
def getWidthLimits(pdgid): return [ Particle.from_pdgid(pdgid).width_lower, Particle.from_pdgid(pdgid).wodth_upper ]
def getRadius(pdgid): return Particle.from_pdgid(pdgid).radius
def getMass(pdgid): return Particle.from_pdgid(pdgid).mass * u.GeV
def getMassLimits(pdgid): return [ Particle.from_pdgid(pdgid).mass_lower, Particle.from_pdgid(pdgid).mass_upper ]
def getLatexName(pdgid): return Particle.from_pdgid(pdgid).latex
def getHTMLName(pdgid): return Particle.from_pdgid(pdgid).html_name
def test_rep(): pi = Particle.from_pdg(211) assert 'val=211' in repr(pi) assert "name='pi'" in repr(pi) assert 'mass=0.13957' in repr(pi) assert 'charge=<Par.p: 1>' in repr(pi)
def getStatus(pdgid): return Particle.from_pdgid(pdgid).status.name
def test_pdg(): assert Particle.from_pdg(211).val == 211
def getPDGId(name): return Particle.from_search(name=name).val
def getCharge(pdgid): return Particle.from_pdgid(pdgid).charge
def getWidth(pdgid): return Particle.from_pdgid(pdgid).width * u.GeV
def getName(pdgid): return Particle.from_pdgid(pdgid).name
def test_str(): pi = Particle.from_pdg(211) assert str(pi) == 'pi+'
def getAnti(pdgid): if pdgid in [12, 14, 16, -12, -14, -16]: return -1 * pdgid else: return Particle.from_pdgid(pdgid).invert().val
def test_prop(): pi = Particle.from_pdg(211) assert pi.name == 'pi' assert pi.val == 211 assert pi.charge == Par.p
def getSpinType(pdgid): return Particle.from_pdgid(pdgid).spin_type.name