pyslha.py

changeset 199
80d4b063103a
parent 198
6a10f5f8a9b0
child 200
651b0fac2163
equal deleted inserted replaced
198:6a10f5f8a9b0 199:80d4b063103a
115 self.entries[tuple(entry[:-1])] = entry[-1] 115 self.entries[tuple(entry[:-1])] = entry[-1]
116 116
117 def is_single_valued(self): 117 def is_single_valued(self):
118 """Return true if there is only one entry, and it has no index: the 118 """Return true if there is only one entry, and it has no index: the
119 'value()' attribute may be used in that case without an argument.""" 119 'value()' attribute may be used in that case without an argument."""
120 return not( len(self.entries) == 1 and self.entries.keys[0] is None ) 120 return len(self.entries) == 1 and self.entries.keys()[0] is None
121 121
122 def value(self, key=None): 122 def value(self, key=None):
123 """Get a value from the block with the supplied key. 123 """Get a value from the block with the supplied key.
124 124
125 If no key is given, then the block must contain only one non-indexed 125 If no key is given, then the block must contain only one non-indexed
818 nme = 100 818 nme = 100
819 ## Extra SUSY MEs 819 ## Extra SUSY MEs
820 if len(d.ids) == 3: 820 if len(d.ids) == 3:
821 # TODO: How to determine the conditions for using 200 and 300 MEs? Enumeration of affected decays? 821 # TODO: How to determine the conditions for using 200 and 300 MEs? Enumeration of affected decays?
822 pass 822 pass
823 decayout += "%d " + fmte + " %d " % (hwid, d.br, nme) 823 decayout += ("%d " + fmte + " %d ") % (hwid, d.br, nme)
824 824
825 def is_quark(pid): 825 def is_quark(pid):
826 return (abs(pid) in range(1, 7)) 826 return (abs(pid) in range(1, 7))
827 827
828 def is_lepton(pid): 828 def is_lepton(pid):
865 return False 865 return False
866 return cmp(a, b) 866 return cmp(a, b)
867 if len(absids) == 2: 867 if len(absids) == 2:
868 ## 2 body mode, to Higgs: Higgs; Bottom 868 ## 2 body mode, to Higgs: Higgs; Bottom
869 if (25 in absids or 26 in absids) and 5 in absids: 869 if (25 in absids or 26 in absids) and 5 in absids:
870 d.ids = sorted(d.ids, key=cmp_bottomlast) 870 d.ids = sorted(d.ids, cmp=cmp_bottomlast)
871 elif len(absids) == 3: 871 elif len(absids) == 3:
872 ## 3 body mode, via charged Higgs/W: quarks or leptons from W/Higgs; Bottom 872 ## 3 body mode, via charged Higgs/W: quarks or leptons from W/Higgs; Bottom
873 if 37 in absids or 23 in absids: 873 if 37 in absids or 23 in absids:
874 d.ids = sorted(d.ids, key=cmp_bottomlast) 874 d.ids = sorted(d.ids, cmp=cmp_bottomlast)
875 ## Gluino 875 ## Gluino
876 elif abs(pid) == 1000021: 876 elif abs(pid) == 1000021:
877 if len(absids) == 2: 877 if len(absids) == 2:
878 ## 2 body mode 878 ## 2 body mode
879 ## without gluon: any order 879 ## without gluon: any order
884 if a == 21: 884 if a == 21:
885 return False 885 return False
886 if b == 21: 886 if b == 21:
887 return True 887 return True
888 return cmp(a, b) 888 return cmp(a, b)
889 d.ids = sorted(d.ids, key=cmp_gluonfirst) 889 d.ids = sorted(d.ids, cmp=cmp_gluonfirst)
890 elif len(absids) == 3: 890 elif len(absids) == 3:
891 ## 3-body modes, R-parity conserved: colour neutral; q or qbar 891 ## 3-body modes, R-parity conserved: colour neutral; q or qbar
892 def cmp_quarkslast(a, b): 892 def cmp_quarkslast(a, b):
893 """Comparison function which always puts quarks last""" 893 """Comparison function which always puts quarks last"""
894 if is_quark(a): 894 if is_quark(a):
895 return True 895 return True
896 if is_quark(b): 896 if is_quark(b):
897 return False 897 return False
898 return cmp(a, b) 898 return cmp(a, b)
899 d.ids = sorted(d.ids, key=cmp_quarkslast) 899 d.ids = sorted(d.ids, cmp=cmp_quarkslast)
900 ## Squark/Slepton 900 ## Squark/Slepton
901 elif is_squark(pid) or is_slepton(pid): 901 elif is_squark(pid) or is_slepton(pid):
902 def cmp_susy_quark_lepton(a, b): 902 def cmp_susy_quark_lepton(a, b):
903 if is_susy(a): 903 if is_susy(a):
904 return False 904 return False
915 ## Squark 915 ## Squark
916 ## 2 body modes: Lepton Number Violated quark lepton 916 ## 2 body modes: Lepton Number Violated quark lepton
917 ## Baryon number violated quark quark 917 ## Baryon number violated quark quark
918 ## Slepton 918 ## Slepton
919 ## 2 body modes: Lepton Number Violated q or qbar 919 ## 2 body modes: Lepton Number Violated q or qbar
920 d.ids = sorted(d.ids, key=cmp_bottomlast) 920 d.ids = sorted(d.ids, cmp=cmp_bottomlast)
921 ## Higgs 921 ## Higgs
922 elif pid in (25, 26): 922 elif pid in (25, 26):
923 # TODO: Includes SUSY Higgses? 923 # TODO: Includes SUSY Higgses?
924 ## Higgs 924 ## Higgs
925 ## 2 body modes: (s)quark-(s)qbar (s)q or (s)qbar 925 ## 2 body modes: (s)quark-(s)qbar (s)q or (s)qbar
931 if is_quark(a): 931 if is_quark(a):
932 return True 932 return True
933 if is_quark(b): 933 if is_quark(b):
934 return False 934 return False
935 return cmp(a, b) 935 return cmp(a, b)
936 d.ids = sorted(d.ids, key=cmp_quarkslast) 936 d.ids = sorted(d.ids, cmp=cmp_quarkslast)
937 elif is_gaugino(pid): 937 elif is_gaugino(pid):
938 # TODO: Is there actually anything to do here? 938 # TODO: Is there actually anything to do here?
939 ## Gaugino 939 ## Gaugino
940 ## 2 body modes: Squark-quark q or sq 940 ## 2 body modes: Squark-quark q or sq
941 ## Slepton-lepton l or sl 941 ## Slepton-lepton l or sl
948 if is_quark(a): 948 if is_quark(a):
949 return True 949 return True
950 if is_quark(b): 950 if is_quark(b):
951 return False 951 return False
952 return cmp(a, b) 952 return cmp(a, b)
953 d.ids = sorted(d.ids, key=cmp_quarkslast) 953 d.ids = sorted(d.ids, cmp=cmp_quarkslast)
954 954
955 # TODO: Gaugino/Gluino 955 # TODO: Gaugino/Gluino
956 ## 3 body modes: R-parity violating: Particles in the same order as the R-parity violating superpotential 956 ## 3 body modes: R-parity violating: Particles in the same order as the R-parity violating superpotential
957 957
958 ## Pad out IDs list with zeros 958 ## Pad out IDs list with zeros
964 decayout = "%d\n" % decayout.count("\n") + decayout 964 decayout = "%d\n" % decayout.count("\n") + decayout
965 out += decayout 965 out += decayout
966 966
967 ## Now the SUSY parameters 967 ## Now the SUSY parameters
968 ## TANB, ALPHAH: 968 ## TANB, ALPHAH:
969 out += (fmte + " " + fmte + "\n") % (blocks["MINPAR"].entries[3], blocks["ALPHA"].entries) 969 out += (fmte + " " + fmte + "\n") % (blocks["MINPAR"].value(3), blocks["ALPHA"].value())
970 ## Neutralino mixing matrix 970 ## Neutralino mixing matrix
971 nmix = blocks["NMIX"].entries 971 nmix = blocks["NMIX"].entries
972 for i in xrange(1, 5): 972 for i in xrange(1, 5):
973 out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (nmix[i][1], nmix[i][2], nmix[i][3], nmix[i][4]) 973 out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (nmix[i,1], nmix[i,2], nmix[i,3], nmix[i,4])
974 ## Chargino mixing matrices V and U 974 ## Chargino mixing matrices V and U
975 vmix = blocks["VMIX"].entries 975 vmix = blocks["VMIX"].entries
976 out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (vmix[1][1], vmix[1][2], vmix[2][1], vmix[2][2]) 976 out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (vmix[1,1], vmix[1,2], vmix[2,1], vmix[2,2])
977 umix = blocks["UMIX"].entries 977 umix = blocks["UMIX"].entries
978 out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (umix[1][1], umix[1][2], umix[2][1], umix[2][2]) 978 out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (umix[1,1], umix[1,2], umix[2,1], umix[2,2])
979 ## THETAT,THETAB,THETAL 979 ## THETAT,THETAB,THETAL
980 import math 980 import math
981 out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (math.acos(blocks["STOPMIX"].entries[1][1]), 981 out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (math.acos(blocks["STOPMIX"].entries[1,1]),
982 math.acos(blocks["SBOTMIX"].entries[1][1]), 982 math.acos(blocks["SBOTMIX"].entries[1,1]),
983 math.acos(blocks["STAUMIX"].entries[1][1])) 983 math.acos(blocks["STAUMIX"].entries[1,1]))
984 ## ATSS,ABSS,ALSS 984 ## ATSS,ABSS,ALSS
985 out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (blocks["AU"].entries[3][3], 985 out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (blocks["AU"].entries[3,3],
986 blocks["AD"].entries[3][3], 986 blocks["AD"].entries[3,3],
987 blocks["AE"].entries[3][3]) 987 blocks["AE"].entries[3,3])
988 ## MUSS == sign(mu) 988 ## MUSS == sign(mu)
989 out += "%f\n" % blocks["MINPAR"].entries[4] 989 out += "%f\n" % blocks["MINPAR"].entries[4]
990 990
991 ## RPV SUSY 991 ## RPV SUSY
992 isRPV = False 992 isRPV = False

mercurial