else: halflife = halflifeModule.double( 'base', halflife, quantityModule.stringToPhysicalUnit('s')) lepton.halflife.add(halflife) spin = spinModule.fraction('base', spinModule.fraction.toValueType(spin), quantityModule.stringToPhysicalUnit('hbar')) lepton.spin.add(spin) parity = parityModule.integer('base', parity, quantityModule.stringToPhysicalUnit('')) lepton.parity.add(parity) database.add(lepton) database.add(aliasModule.particle('electron', 'e-')) database.add(aliasModule.particle('e+', 'e-_anti')) database.add(aliasModule.particle('positron', 'e-_anti')) database.add(aliasModule.particle('h2', 'h2_e0')) database.add(aliasModule.particle('d', 'h2')) database.add(aliasModule.particle('h3', 'h3_e0')) database.add(aliasModule.particle('t', 'h3')) baryons = [['n', 1.00866491588, 0, 881.5, '1/2', 1], ['p', 1.007276466812, 1, 'stable', '1/2', 1]] for _id, _mass, _charge, _halflife, _spin, _parity in baryons: for anti in ['', '_anti']: baryon = baryonModule.particle(_id + anti) mass = massModule.double('base', _mass,
def aliases(element): for child in element: _alias = aliasModule.particle(child.get('id'), child.get('pid')) pops.add(_alias)
charge=(1, 'e'), halflife=('stable', 's'), generation='electronic') database.add(particle) particle = miscModule.buildParticleFromRawData(leptonModule.particle, 'mu', mass=(0.1134289267, 'amu'), spin=(oneHalf, spinUnit), parity=(1, ''), charge=(-1, 'e'), halflife=(2.1969811e-6, 's'), generation='muonic') database.add(particle) database.add(aliasModule.particle('electron', 'e-')) database.add(aliasModule.particle('e+', 'e-_anti')) database.add(aliasModule.particle('positron', 'e-_anti')) particle = miscModule.buildParticleFromRawData(baryonModule.particle, 'n', mass=(1.00866491588, 'amu'), spin=(oneHalf, spinUnit), parity=(1, ''), charge=(0, 'e'), halflife=(881., 's')) database.add(particle) particle = miscModule.buildParticleFromRawData(baryonModule.particle, 'p', mass=(1.007276466812, 'amu'),
checkFor('e-') checkFor('e-_anti') checkFor('e+') checkFor('e+_anti') checkFor('tau-_anti') # # photon and some aliases. # print '\n========== photon and some aliases ==========' checkFor('photon') checkFor('gamma') checkFor('x-ray') print 'Now add gamma and x-ray' database.add(aliasModule.particle('gamma', 'photon')) database.add(aliasModule.particle('x-ray', 'gamma')) checkFor('photon') checkFor('gamma') checkFor('x-ray') print '\n========== getting items ==========' getID('photon') gamma = getID('gamma') print ' mass %s: spin %s: parity %s: charge %s: halflife %s' % \ ( gamma.mass[0].pqu( ), gamma.spin[0].pqu( ), gamma.parity[0].pqu( ), gamma.charge[0].pqu( ), gamma.halflife[0].value ) getID('x-ray') print '\n ---- positron ----' database.add(aliasModule.particle('positron', 'e-_anti')) database.add(aliasModule.particle('b+', 'e-_anti'))