4949 type = "float" ,
5050 help = "Only print values if yield is less than this threshold." ,
5151)
52- parser .add_option (
53- "" ,
54- "--use-cms-histsum" ,
55- dest = "use_cms_histsum" ,
56- default = False ,
57- action = "store_true" ,
58- help = "Set to true if workspace built with --use-cms-histsum option." ,
59- )
52+ # parser.add_option(
53+ # "",
54+ # "--use-cms-histsum",
55+ # dest="use_cms_histsum",
56+ # default=False,
57+ # action="store_true",
58+ # help="Set to true if workspace built with --use-cms-histsum option.",
59+ # )
6060parser .add_option (
6161 "" ,
6262 "--procFilter" ,
@@ -169,17 +169,24 @@ def find_chan_proc(name):
169169 else :
170170 chan_procs [chan ] = [[proc , norm , 0 , 0 ]]
171171
172+ use_cms_histsum = False
173+
174+ all_props = ws .allFunctions ().selectByName ("prop_bin*" )
175+ if all_props .getSize () > 0 :
176+ use_cms_histsum = True
177+
172178# Look for cases where chan stored as CMSHistSum, set flag
173- if options . use_cms_histsum :
179+ if use_cms_histsum :
174180 chan_CMSHistSum_norms = {}
175- all_props = ws .allFunctions ().selectByName ("prop_bin*" )
181+ # all_props = ws.allFunctions().selectByName("prop_bin*")
176182 for chan in chan_procs .keys ():
177183 prop_it = all_props .createIterator ()
178184 for i in range (all_props .getSize ()):
179185 prop = prop_it .Next ()
180186 prop_name = prop .GetName ()
181187 if chan == prop_name .split ("_bin" )[- 1 ]:
182- if type (prop ) == ROOT .CMSHistSum :
188+ types = [ROOT .CMSHistSum , ROOT .CMSHistErrorPropagator ]
189+ if type (prop ) in types :
183190 chan_CMSHistSum_norms [chan ] = dict (prop .getProcessNorms ())
184191
185192
@@ -243,7 +250,7 @@ def printEndExpand():
243250 continue
244251 print ("<hr>" )
245252 print ("Top-level normalization for process {proc0} -> {proc1_name}<br>" .format (proc0 = proc [0 ], proc1_name = proc [1 ].GetName ()))
246- if options . use_cms_histsum :
253+ if use_cms_histsum :
247254 if chan in chan_CMSHistSum_norms :
248255 default_val = chan_CMSHistSum_norms [chan ][proc [1 ].GetName ()]
249256 else :
@@ -253,7 +260,7 @@ def printEndExpand():
253260 default_norms [chan ][proc [1 ].GetName ()] = default_val
254261
255262 if options .printValueOnly :
256- print ("default value = {default_val}<br>" .format (default_val = default_val ))
263+ print ("default value = {default_val:.5f }<br>" .format (default_val = default_val ))
257264 else :
258265 if proc [2 ]:
259266 proc_norm_var = ws .function ("n_exp_bin%s_proc_%s" % (chan , proc [0 ]))
@@ -289,7 +296,7 @@ def printEndExpand():
289296 print (" ... is a constant (RooRealVar)" )
290297 printEndExpand ()
291298
292- print (" default value = " , default_val , "<br>" )
299+ print (" default value = %.5f " % default_val , "<br>" )
293300 print ("</tr>" )
294301
295302 print (
@@ -320,7 +327,7 @@ def printEndExpand():
320327 print ("---------------------------------------------------------------------------" )
321328 print (" Top-level normalization for process %s -> %s" % (proc [0 ], proc [1 ].GetName ()))
322329 print ("---------------------------------------------------------------------------" )
323- if options . use_cms_histsum :
330+ if use_cms_histsum :
324331 if chan in chan_CMSHistSum_norms :
325332 default_val = chan_CMSHistSum_norms [chan ][proc [1 ].GetName ()]
326333 else :
@@ -330,7 +337,7 @@ def printEndExpand():
330337 default_norms [chan ][proc [1 ].GetName ()] = default_val
331338
332339 if options .printValueOnly :
333- print (" default value = " , default_val )
340+ print (" default value = %.5f " % default_val )
334341 # if options.printValueOnly: print " --xcp %s:%s "%(chan,proc[0]),
335342 else :
336343 if proc [2 ]:
@@ -354,7 +361,7 @@ def printEndExpand():
354361 proc [1 ].Print ()
355362 print (" ... is a constant (RooRealVar)" )
356363 print (" -------------------------------------------------------------------------" )
357- print (" default value = " , default_val )
364+ print (" default value = %.5f " % default_val )
358365
359366# Save norms to json file
360367if options .output_json != "" :
0 commit comments