def testRuntimeImport(self): filename = "./testFiles/slha/gluino_squarks.slha" runtime.modelFile = 'mssm' reload(particlesLoader) from smodels.particlesLoader import BSMList model = Model(BSMparticles=BSMList, SMparticles=SMList) model.updateParticles(filename) runtime.modelFile = 'mssmQNumbers.slha' reload(particlesLoader) from smodels.particlesLoader import BSMList modelB = Model(BSMparticles=BSMList, SMparticles=SMList) modelB.updateParticles(filename) for ptc in model.BSMparticles: ptcB = modelB.getParticlesWith(pdg = ptc.pdg) if not ptcB: #If particule is its own anti-particle, it should not appear in modelB ptcB = modelB.getParticlesWith(pdg = -ptc.pdg) self.assertEqual(len(ptcB),1) ptcB = ptcB[0] for attr,val in ptc.__dict__.items(): if attr in ['_id','label','_comp','pdg','_isInvisible']: continue valB = getattr(ptcB,attr) if attr == 'decays': self.assertEqual(len(val),len(valB)) continue self.assertEqual(val,valB)
def testUniquePDGs(self): model = Model(SMparticles=SMList,BSMparticles=[]) allPDGs = model.getValuesFor('pdg') #Check if for each SM PDG there is a unique particle object defined for pdg in allPDGs: p = model.getParticlesWith(pdg=pdg) self.assertTrue(len(p) == 1)
spin=1. / 2.) #Define list of inclusive final states: SMfinalStates = [ eList, muList, taList, lpList, lmList, lList, WList, tList, LpList, LmList, LList, jetList, anyEven ] #Include list of exclusive final states: SMfinalStates += SMList #Define list of BSM final states: BSMfinalStates = [MET, HSCP, RHadronG, RHadronQ, anyOdd, gluino, chargino] allFinalStates = SMfinalStates + BSMfinalStates #Avoid double counting: for i, ptc in enumerate(allFinalStates): if any((ptc is p and i != j) for j, p in enumerate(allFinalStates)): allFinalStates.remove(ptc) #Define a dummy model just to use the facilities for filtering particles finalStates = Model(SMparticles=allFinalStates, BSMparticles=[], label='databaseParticles.py') #Check consistency: for label in finalStates.getValuesFor('label'): particles = finalStates.getParticlesWith(label=label) if len(particles) != 1: raise SModelSError( "%i particles defined with label %s. Particles defined in databaseParticles must have unique labels." % (len(particles), label))