pyslha.py

changeset 202
d3d069f4549a
parent 201
3ac555efdbba
child 203
ce90a0dace07
     1.1 --- a/pyslha.py	Sun Apr 28 21:20:55 2013 +0200
     1.2 +++ b/pyslha.py	Sun Apr 28 21:56:51 2013 +0200
     1.3 @@ -20,7 +20,9 @@
     1.4  TODOs:
     1.5  
     1.6  For 2.0.0:
     1.7 - * Convert ISAWIG reader/writer to use new block entries access scheme
     1.8 + * Provide a nice set_value(key=None, val) type function
     1.9 + * Provide a Block constructor that takes a dict of entries
    1.10 + * Rename add_entry to add_entry_from_tuple or similar
    1.11   * Output column alignment cosmetics
    1.12   * Precision setting obedience in SLHA output of values
    1.13   * Split writeSLHA into writeSLHA{Blocks,Decays}
    1.14 @@ -611,7 +613,7 @@
    1.15          hwid, mass, lifetime = getnextvalidlineitems()
    1.16          width = 1.0/(lifetime * 1.51926778e24) ## width in GeV == hbar/lifetime in seconds
    1.17          pdgid = herwigid2pdgid(hwid)
    1.18 -        masses.add_entry((pdgid, mass))
    1.19 +        masses[pdgid] = mass
    1.20          decays[pdgid] = Particle(pdgid, width, mass)
    1.21          #print pdgid, mass, width
    1.22      blocks["MASS"] = masses
    1.23 @@ -640,59 +642,59 @@
    1.24      ## Now the SUSY parameters
    1.25      TANB, ALPHAH = getnextvalidlineitems()
    1.26      blocks["MINPAR"] = Block("MINPAR")
    1.27 -    blocks["MINPAR"].add_entry((3, TANB))
    1.28 +    blocks["MINPAR"][3] = TANB
    1.29      blocks["ALPHA"] = Block("ALPHA")
    1.30 -    blocks["ALPHA"].add_entry((ALPHAH,))
    1.31 +    blocks["ALPHA"][None] = ALPHAH
    1.32      #
    1.33      ## Neutralino mixing matrix
    1.34      blocks["NMIX"] = Block("NMIX")
    1.35      for i in xrange(1, 5):
    1.36          nmix_i = getnextvalidlineitems()
    1.37          for j, v in enumerate(nmix_i):
    1.38 -            blocks["NMIX"].add_entry((i, j+1, v))
    1.39 +            blocks["NMIX"][i, j+1] = v
    1.40      #
    1.41      ## Chargino mixing matrices V and U
    1.42      blocks["VMIX"] = Block("VMIX")
    1.43      vmix = getnextvalidlineitems()
    1.44 -    blocks["VMIX"].add_entry((1, 1, vmix[0]))
    1.45 -    blocks["VMIX"].add_entry((1, 2, vmix[1]))
    1.46 -    blocks["VMIX"].add_entry((2, 1, vmix[2]))
    1.47 -    blocks["VMIX"].add_entry((2, 2, vmix[3]))
    1.48 +    blocks["VMIX"][1, 1] = vmix[0]
    1.49 +    blocks["VMIX"][1, 2] = vmix[1]
    1.50 +    blocks["VMIX"][2, 1] = vmix[2]
    1.51 +    blocks["VMIX"][2, 2] = vmix[3]
    1.52      blocks["UMIX"] = Block("UMIX")
    1.53      umix = getnextvalidlineitems()
    1.54 -    blocks["UMIX"].add_entry((1, 1, umix[0]))
    1.55 -    blocks["UMIX"].add_entry((1, 2, umix[1]))
    1.56 -    blocks["UMIX"].add_entry((2, 1, umix[2]))
    1.57 -    blocks["UMIX"].add_entry((2, 2, umix[3]))
    1.58 +    blocks["UMIX"][1, 1] = umix[0]
    1.59 +    blocks["UMIX"][1, 2] = umix[1]
    1.60 +    blocks["UMIX"][2, 1] = umix[2]
    1.61 +    blocks["UMIX"][2, 2] = umix[3]
    1.62      #
    1.63      THETAT, THETAB, THETAL = getnextvalidlineitems()
    1.64      import math
    1.65      blocks["STOPMIX"] = Block("STOPMIX")
    1.66 -    blocks["STOPMIX"].add_entry((1, 1,  math.cos(THETAT)))
    1.67 -    blocks["STOPMIX"].add_entry((1, 2, -math.sin(THETAT)))
    1.68 -    blocks["STOPMIX"].add_entry((2, 1,  math.sin(THETAT)))
    1.69 -    blocks["STOPMIX"].add_entry((2, 2,  math.cos(THETAT)))
    1.70 +    blocks["STOPMIX"][1, 1] =  math.cos(THETAT)
    1.71 +    blocks["STOPMIX"][1, 2] = -math.sin(THETAT)
    1.72 +    blocks["STOPMIX"][2, 1] =  math.sin(THETAT)
    1.73 +    blocks["STOPMIX"][2, 2] =  math.cos(THETAT)
    1.74      blocks["SBOTMIX"] = Block("SBOTMIX")
    1.75 -    blocks["SBOTMIX"].add_entry((1, 1,  math.cos(THETAB)))
    1.76 -    blocks["SBOTMIX"].add_entry((1, 2, -math.sin(THETAB)))
    1.77 -    blocks["SBOTMIX"].add_entry((2, 1,  math.sin(THETAB)))
    1.78 -    blocks["SBOTMIX"].add_entry((2, 2,  math.cos(THETAB)))
    1.79 +    blocks["SBOTMIX"][1, 1] =  math.cos(THETAB)
    1.80 +    blocks["SBOTMIX"][1, 2] = -math.sin(THETAB)
    1.81 +    blocks["SBOTMIX"][2, 1] =  math.sin(THETAB)
    1.82 +    blocks["SBOTMIX"][2, 2] =  math.cos(THETAB)
    1.83      blocks["STAUMIX"] = Block("STAUMIX")
    1.84 -    blocks["STAUMIX"].add_entry((1, 1,  math.cos(THETAL)))
    1.85 -    blocks["STAUMIX"].add_entry((1, 2, -math.sin(THETAL)))
    1.86 -    blocks["STAUMIX"].add_entry((2, 1,  math.sin(THETAL)))
    1.87 -    blocks["STAUMIX"].add_entry((2, 2,  math.cos(THETAL)))
    1.88 +    blocks["STAUMIX"][1, 1] =  math.cos(THETAL)
    1.89 +    blocks["STAUMIX"][1, 2] = -math.sin(THETAL)
    1.90 +    blocks["STAUMIX"][2, 1] =  math.sin(THETAL)
    1.91 +    blocks["STAUMIX"][2, 2] =  math.cos(THETAL)
    1.92      #
    1.93      ATSS, ABSS, ALSS = getnextvalidlineitems()
    1.94      blocks["AU"] = Block("AU")
    1.95 -    blocks["AU"].add_entry((3, 3, ATSS))
    1.96 +    blocks["AU"][3, 3] = ATSS))
    1.97      blocks["AD"] = Block("AD")
    1.98 -    blocks["AD"].add_entry((3, 3, ABSS))
    1.99 +    blocks["AD"][3, 3] = ABSS))
   1.100      blocks["AE"] = Block("AE")
   1.101 -    blocks["AE"].add_entry((3, 3, ALSS))
   1.102 +    blocks["AE"][3, 3] = ALSS))
   1.103      #
   1.104      MUSS = getnextvalidlineitems()[0]
   1.105 -    blocks["MINPAR"].add_entry((4, MUSS))
   1.106 +    blocks["MINPAR"][4] = MUSS
   1.107      #
   1.108  
   1.109      # TODO: Parse RPV boolean and couplings into SLHA2 blocks

mercurial