-
Notifications
You must be signed in to change notification settings - Fork 429
Expand file tree
/
Copy pathDegenerateMatrixRank.py
More file actions
224 lines (212 loc) · 10.1 KB
/
DegenerateMatrixRank.py
File metadata and controls
224 lines (212 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
from HiggsAnalysis.CombinedLimit.PhysicsModel import *
class AllMuiLambdaHiggs(SMLikeHiggsModel):
def __init__(self):
SMLikeHiggsModel.__init__(self) # not using 'super(x,self).__init__' since I don't understand it
self.decays = ["hbb", "htt", "hgg", "hww", "hzz"]
self.productions = ["ggH", "qqH", "VH", "ttH"]
self.fixDecays = []
self.mHRange = []
def setPhysicsOptions(self, physOptions):
for po in physOptions:
if po.startswith("decays="):
self.decays = po.replace("decays=", "").split(",")
if po.startswith("productions="):
self.productions = po.replace("productions=", "").split(",")
if po.startswith("fixDecays="):
self.fixDecays = po.replace("fixDecays=", "").split(",")
if po.startswith("higgsMassRange="):
self.mHRange = po.replace("higgsMassRange=", "").split(",")
if len(self.mHRange) != 2:
raise RuntimeError("Higgs mass range definition requires two extrema")
elif float(self.mHRange[0]) >= float(self.mHRange[1]):
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger than the first")
def doParametersOfInterest(self):
"""Create POI out of signal strength and MH"""
# --- Signal Strength as only POI ---
# self.modelBuilder.doVar("Rvf[1,-5,20]")
self.modelBuilder.doVar("lambda[1,0,10]")
self.modelBuilder.doVar("lambdav[1,0,10]")
self.modelBuilder.doVar("lambdat[1,0,10]")
# --- put a higgs mass, just because the code might need it
# self.modelBuilder.doVar("MH[125]")
poi = []
poi.append("lambda")
poi.append("lambdav")
poi.append("lambdat")
for decay in self.decays:
# poi.append('mu_'+decay);
if decay in self.fixDecays:
print(
"It seems that you set signal strength ggH->"
+ decay
+ " as missing, I will set that as POI. Please set it to unity when running HybridNew."
)
self.modelBuilder.doVar("mu_%s[1,0,5]" % decay)
poi.append("mu_" + decay)
else:
self.modelBuilder.doVar("mu_%s[1,0,5]" % decay)
self.modelBuilder.factory_(f'expr::lambdamu_{decay}("@0*@1",lambda,mu_{decay})')
self.modelBuilder.factory_(f'expr::lambdavmu_{decay}("@0*@1",lambdav,mu_{decay})')
self.modelBuilder.factory_(f'expr::lambdatmu_{decay}("@0*@1",lambdat,mu_{decay})')
self.modelBuilder.doSet("POI", ",".join(poi))
if self.modelBuilder.out.var("MH"):
var = self.modelBuilder.out.var("MH")
if len(self.mHRange):
print(
"MH will be left floating within",
self.mHRange[0],
"and",
self.mHRange[1],
)
var.setRange(float(self.mHRange[0]), float(self.mHRange[1]))
var.setConstant(False)
poi.append("MH")
self.modelBuilder.doSet("POI", ",".join(poi))
# self.modelBuilder.doSet('POI','poi,MH')
else:
print("MH will be assumed to be", self.options.mass)
var.removeMin()
var.removeMax()
var.setVal(self.options.mass)
else:
if len(self.mHRange):
print(
"MH will be left floating within",
self.mHRange[0],
"and",
self.mHRange[1],
)
self.modelBuilder.doVar(f"MH[{self.mHRange[0]},{self.mHRange[1]}]")
poi.append("MH")
self.modelBuilder.doSet("POI", ",".join(poi))
# self.modelBuilder.doSet('POI','poi,MH')
else:
print("MH (not there before) will be assumed to be", self.options.mass)
self.modelBuilder.doVar("MH[%g]" % self.options.mass)
for item in poi:
print(item)
# the next part is for the special case, where the ratio (look for your papers) is constant
def getHiggsSignalYieldScale(self, production, decay, energy):
if decay == "hmm":
decay = "htt"
if decay == "hzg":
decay = "hgg"
if decay in ["hgluglu", "hcc", "hss", "huu", "hdd"]:
decay = "hbb"
if production == "ggH":
return "mu_" + decay
elif production == "qqH":
return "lambdamu_" + decay
elif production == "VH" or production == "ZH" or production == "WH":
return "lambdavmu_" + decay
elif production == "ttH":
return "lambdatmu_" + decay
else:
raise RuntimeError("Unknown production mode '%s'" % production)
class AllMuiLambdasHiggs(SMLikeHiggsModel):
def __init__(self):
SMLikeHiggsModel.__init__(self) # not using 'super(x,self).__init__' since I don't understand it
self.decays = ["hbb", "htt", "hgg", "hww", "hzz"]
self.productions = ["ggH", "qqH", "VH", "ttH"]
self.fixDecays = []
self.mHRange = []
def setPhysicsOptions(self, physOptions):
for po in physOptions:
if po.startswith("decays="):
self.decays = po.replace("decays=", "").split(",")
if po.startswith("productions="):
self.productions = po.replace("productions=", "").split(",")
if po.startswith("fixDecays="):
self.fixDecays = po.replace("fixDecays=", "").split(",")
if po.startswith("higgsMassRange="):
self.mHRange = po.replace("higgsMassRange=", "").split(",")
if len(self.mHRange) != 2:
raise RuntimeError("Higgs mass range definition requires two extrema")
elif float(self.mHRange[0]) >= float(self.mHRange[1]):
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger than the first")
def doParametersOfInterest(self):
"""Create POI out of signal strength and MH"""
# --- Signal Strength as only POI ---
# self.modelBuilder.doVar("Rvf[1,-5,20]")
# --- put a higgs mass, just because the code might need it
# self.modelBuilder.doVar("MH[125]")
poi = []
for decay in self.decays:
# poi.append('mu_'+decay);
for production in self.productions:
if production == "qqH":
poi.append("lambda_" + decay)
elif production == "VH":
poi.append("lambdav_" + decay)
elif production == "ttH":
poi.append("lambdat_" + decay)
if decay in self.fixDecays:
print("It seems that you set signal strength ggH->" + decay + " as missing, I will set that equal to unity.")
self.modelBuilder.doVar("mu_%s[1.0]" % decay)
else:
self.modelBuilder.doVar("mu_%s[1,0,5]" % decay)
self.modelBuilder.doVar("lambda_%s[1,0,10]" % decay)
self.modelBuilder.doVar("lambdav_%s[1,0,10]" % decay)
self.modelBuilder.doVar("lambdat_%s[1,0,10]" % decay)
self.modelBuilder.factory_(f'expr::lambda_{decay}mu_{decay}("@0*@1",lambda_{decay},mu_{decay})')
self.modelBuilder.factory_(f'expr::lambdav_{decay}mu_{decay}("@0*@1",lambdav_{decay},mu_{decay})')
self.modelBuilder.factory_(f'expr::lambdat_{decay}mu_{decay}("@0*@1",lambdat_{decay},mu_{decay})')
self.modelBuilder.doSet("POI", ",".join(poi))
if self.modelBuilder.out.var("MH"):
var = self.modelBuilder.out.var("MH")
if len(self.mHRange):
print(
"MH will be left floating within",
self.mHRange[0],
"and",
self.mHRange[1],
)
var.setRange(float(self.mHRange[0]), float(self.mHRange[1]))
var.setConstant(False)
poi.append("MH")
self.modelBuilder.doSet("POI", ",".join(poi))
# self.modelBuilder.doSet('POI','poi,MH')
else:
print("MH will be assumed to be", self.options.mass)
var.removeMin()
var.removeMax()
var.setVal(self.options.mass)
else:
if len(self.mHRange):
print(
"MH will be left floating within",
self.mHRange[0],
"and",
self.mHRange[1],
)
self.modelBuilder.doVar(f"MH[{self.mHRange[0]},{self.mHRange[1]}]")
poi.append("MH")
self.modelBuilder.doSet("POI", ",".join(poi))
# self.modelBuilder.doSet('POI','poi,MH')
else:
print("MH (not there before) will be assumed to be", self.options.mass)
self.modelBuilder.doVar("MH[%g]" % self.options.mass)
for item in poi:
print(item)
# the next part is for the special case, where the ratio (look for your papers) is constant
def getHiggsSignalYieldScale(self, production, decay, energy):
# print 'Printing out:', production, decay, energy, 'mu_'+decay
# return 'mu_'+decay
if decay == "hmm":
decay = "htt"
if decay == "hzg":
decay = "hgg"
if decay in ["hgluglu", "hcc", "hss", "huu", "hdd"]:
decay = "hbb"
if production == "ggH":
return "mu_" + decay
elif production == "qqH":
return "lambda_" + decay + "mu_" + decay
elif production == "VH" or production == "ZH" or production == "WH":
return "lambdav_" + decay + "mu_" + decay
elif production == "ttH":
return "lambdat_" + decay + "mu_" + decay
else:
raise RuntimeError("Unknown production mode '%s'" % production)
allmuilambda = AllMuiLambdaHiggs()
allmuilambdas = AllMuiLambdasHiggs()