3 from __future__
import print_function
10 return os.path.realpath(os.path.abspath(os.path.expanduser(path)))
16 if not os.path.isdir(path):
20 print(
"Underflowing datacard")
21 print(
"date {}".format(datetime.datetime.now().strftime(
"%Y.%m.%d")))
22 print(
"imax * number of channels")
23 print(
"jmax * number of backgrounds")
24 print(
"kmax * number of nuisance parameters")
26 print(
"Observation",end=
"")
27 for ibin
in range(nbins):
29 print(
"\t\t{}".format(bin_yield),end=
"")
31 print(
"\t{}".format(bin_yield),end=
"")
32 print(
"\n------------")
34 for ibin
in range(nbins):
35 print(
"\t{0}\t{0}".format(ibin+1),end=
"")
36 print(
"\nprocess",end=
"")
37 for ibin
in range(nbins):
38 print(
"\tS\tB",end=
"")
39 print(
"\nprocess",end=
"")
40 for ibin
in range(nbins):
41 print(
"\t0\t1",end=
"")
42 print(
"\nrate",end=
"")
43 for ibin
in range(nbins):
44 print(
"\t{0}\t{0}".format(bin_yield),end=
"")
45 print(
"\n------------")
47 if __name__ ==
"__main__":
48 parser = argparse.ArgumentParser(description=
"Create datacard with large number of high-yield bins designed to cause underflow when fit in combine.",
49 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
50 parser.add_argument(
"nbins", type=int, help=
"Number of bins")
51 parser.add_argument(
"bin_yield", type=int, help=
"Yield in each bin")
52 args = parser.parse_args()
def Underflow(nbins, bin_yield)