HiggsAnalysis-KITHiggsToTauTau
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
makePlots_datacardsTauEsStudies.py File Reference

Namespaces

 makePlots_datacardsTauEsStudies
 

Functions

def makePlots_datacardsTauEsStudies.addArguments
 
def makePlots_datacardsTauEsStudies.matching_process
 
def makePlots_datacardsTauEsStudies.remove_procs_and_systs_with_zero_yield2
 
def makePlots_datacardsTauEsStudies.remove_procs_and_systs_with_zero_yield
 

Variables

tuple makePlots_datacardsTauEsStudies.log = logging.getLogger(__name__)
 
tuple makePlots_datacardsTauEsStudies.pp = pprint.PrettyPrinter(indent=4)
 
dictionary makePlots_datacardsTauEsStudies.decayMode_dict
 
tuple makePlots_datacardsTauEsStudies.parser
 
tuple makePlots_datacardsTauEsStudies.args = parser.parse_args()
 
list makePlots_datacardsTauEsStudies.es_shifts = [args.shift_ranges[0] + x * args.shift_binning for x in range(int((args.shift_ranges[1] - args.shift_ranges[0]) / args.shift_binning) + 1)]
 
list makePlots_datacardsTauEsStudies.es_shifts_str = [str(x) for x in es_shifts]
 
tuple makePlots_datacardsTauEsStudies.decay_modes = copy.deepcopy(args.decay_modes)
 
list makePlots_datacardsTauEsStudies.pt_ranges = ["0.0"]
 
list makePlots_datacardsTauEsStudies.pt_weights = ["(pt_2>20)"]
 
list makePlots_datacardsTauEsStudies.pt_strings = ["p_{T}(#tau_{h}) > 20 GeV"]
 
list makePlots_datacardsTauEsStudies.pt_bins = [str(x) for x in range(0, len(pt_ranges))]
 
list makePlots_datacardsTauEsStudies.eta_ranges = ["0.0", "1.479", "2.3"]
 
list makePlots_datacardsTauEsStudies.eta_weights = ["(abs(eta_2)<2.3)", "(abs(eta_2)<1.479)", "(abs(eta_2)>1.479)*(abs(eta_2)<2.3)"]
 
list makePlots_datacardsTauEsStudies.eta_strings = ["|#eta(#tau_{h})| < 2.3", "|#eta(#tau_{h})| < 1.479", "1.479 < |#eta(#tau_{h})| < 2.3"]
 
list makePlots_datacardsTauEsStudies.eta_bins = ["0", "1", "2"]
 
tuple makePlots_datacardsTauEsStudies.weight_type = ("eta" if args.eta_binning else "pt")
 
tuple makePlots_datacardsTauEsStudies.weight_ranges = (eta_ranges if args.eta_binning else pt_ranges)
 
tuple makePlots_datacardsTauEsStudies.extra_weights = (eta_weights if args.eta_binning else pt_weights)
 
tuple makePlots_datacardsTauEsStudies.weight_strings = (eta_strings if args.eta_binning else pt_strings)
 
tuple makePlots_datacardsTauEsStudies.weight_bins = (eta_bins if args.eta_binning else pt_bins)
 
tuple makePlots_datacardsTauEsStudies.sample_settings = samples.Samples()
 
tuple makePlots_datacardsTauEsStudies.systematics_factory = systematics.SystematicsFactory()
 
 makePlots_datacardsTauEsStudies.quantity = args.quantity
 
string makePlots_datacardsTauEsStudies.tmp_input_root_filename_template = "input/${ANALYSIS}_${CHANNEL}_${BIN}_${SYSTEMATIC}_${ERA}.root"
 
string makePlots_datacardsTauEsStudies.input_root_filename_template = "input/${ANALYSIS}_${CHANNEL}_${BIN}_${ERA}.root"
 
string makePlots_datacardsTauEsStudies.bkg_histogram_name_template = "${BIN}/${PROCESS}"
 
string makePlots_datacardsTauEsStudies.sig_histogram_name_template = "${BIN}/${PROCESS}${MASS}"
 
string makePlots_datacardsTauEsStudies.bkg_syst_histogram_name_template = "${BIN}/${PROCESS}_${SYSTEMATIC}"
 
string makePlots_datacardsTauEsStudies.sig_syst_histogram_name_template = "${BIN}/${PROCESS}${MASS}_${SYSTEMATIC}"
 
list makePlots_datacardsTauEsStudies.datacard_filename_templates = ["datacards/${BIN}/${ANALYSIS}_${CHANNEL}_${BIN}_${ERA}.txt"]
 
string makePlots_datacardsTauEsStudies.output_root_filename_template = "datacards/common/${ANALYSIS}.input_${ERA}.root"
 
list makePlots_datacardsTauEsStudies.categories = []
 
dictionary makePlots_datacardsTauEsStudies.mapping_category2binid = {}
 
string makePlots_datacardsTauEsStudies.category = channel+"_"
 
dictionary makePlots_datacardsTauEsStudies.ss_os_factors
 
tuple makePlots_datacardsTauEsStudies.datacards = taupogdatacards.TauEsDatacards(es_shifts_str, decay_modes, quantity, weight_bins, weight_type, args.era, mapping_category2binid)
 
tuple makePlots_datacardsTauEsStudies.channel = category.split("_")
 
tuple makePlots_datacardsTauEsStudies.decayMode = category.split("_")
 
tuple makePlots_datacardsTauEsStudies.weight_index = int(category.split("_")[-1].split(weight_type + "bin")[-1])
 
int makePlots_datacardsTauEsStudies.useRelaxedIsolation = weight_index>0
 
tuple makePlots_datacardsTauEsStudies.output_file
 
list makePlots_datacardsTauEsStudies.input_plot_configs = []
 
list makePlots_datacardsTauEsStudies.hadd_commands = []
 
tuple makePlots_datacardsTauEsStudies.datacards_per_channel_category = taupogdatacards.TauEsDatacards(cb=datacards.cb.cp().channel([channel]).bin([category]), mapping_category2binid=mapping_category2binid)
 
list makePlots_datacardsTauEsStudies.tmp_output_files = []
 
tuple makePlots_datacardsTauEsStudies.nominal = (shape_systematic == "nominal")
 
tuple makePlots_datacardsTauEsStudies.list_of_samples = (["data"] if nominal else [])
 
string makePlots_datacardsTauEsStudies.systematic = "nominal"
 
string makePlots_datacardsTauEsStudies.samples = "\", \""
 
float makePlots_datacardsTauEsStudies.wj_sf_shift = 0.0
 
dictionary makePlots_datacardsTauEsStudies.merged_config = {}
 
string makePlots_datacardsTauEsStudies.catForConfig = "cat"
 
tuple makePlots_datacardsTauEsStudies.config_rest
 
 makePlots_datacardsTauEsStudies.histogram_name_template = bkg_histogram_name_templateifnominalelsebkg_syst_histogram_name_template
 
tuple makePlots_datacardsTauEsStudies.PROCESS = datacards.configs.sample2process(sample)
 
 makePlots_datacardsTauEsStudies.BIN = category,
 
 makePlots_datacardsTauEsStudies.SYSTEMATIC = systematic
 
tuple makePlots_datacardsTauEsStudies.systematics_settings = systematics_factory.get(shape_systematic)
 
tuple makePlots_datacardsTauEsStudies.config_ztt
 
tuple makePlots_datacardsTauEsStudies.MASS = str(shift)
 
tuple makePlots_datacardsTauEsStudies.tmp_output_file
 
 makePlots_datacardsTauEsStudies.DST = output_file,
 
string makePlots_datacardsTauEsStudies.SRC = " "
 
tuple makePlots_datacardsTauEsStudies.output_files = list(set([os.path.join(config["output_dir"], config["filename"]+".root") for config in input_plot_configs[:args.n_plots[0]]]))
 
 makePlots_datacardsTauEsStudies.update_systematics = True
 
tuple makePlots_datacardsTauEsStudies.processes = datacards.cb.cp()
 
float makePlots_datacardsTauEsStudies.add_threshold = 0.1
 
dictionary makePlots_datacardsTauEsStudies.datacards_cbs = {}
 
tuple makePlots_datacardsTauEsStudies.datacards_workspaces = datacards.text2workspace(datacards_cbs, n_processes=args.n_processes)
 
 makePlots_datacardsTauEsStudies.VERBOSITY = args.combine_verbosity,
 
 makePlots_datacardsTauEsStudies.STABLE = datacards.stable_options
 
tuple makePlots_datacardsTauEsStudies.BINNING = int((args.shift_ranges[1]-args.shift_ranges[0])/args.shift_binning)
 
tuple makePlots_datacardsTauEsStudies.RANGE = str(args.shift_ranges[0])
 
tuple makePlots_datacardsTauEsStudies.datacards_postfit_shapes = datacards.postfit_shapes_fromworkspace(datacards_cbs, datacards_workspaces, True, args.n_processes, "--sampling" + (" --print" if args.n_processes <= 1 else ""))
 
list makePlots_datacardsTauEsStudies.www_output_dirs_postfit = []
 
list makePlots_datacardsTauEsStudies.www_output_dirs_weightbin = []
 
list makePlots_datacardsTauEsStudies.www_output_dirs_parabola = []
 
list makePlots_datacardsTauEsStudies.postfit_plot_configs = []
 
list makePlots_datacardsTauEsStudies.bkg_plotting_order = ["ZTT", "ZL", "ZJ", "TTT","TTJJ", "VVT", "VVJ", "W", "QCD"]
 
tuple makePlots_datacardsTauEsStudies.postfit_shapes = datacards_postfit_shapes.get("fit_s", {})
 
tuple makePlots_datacardsTauEsStudies.weightBin = int(category.split("_")[-1].split(weight_type+"bin")[-1])
 
list makePlots_datacardsTauEsStudies.bkg_process = datacards_cbs[datacard]
 
list makePlots_datacardsTauEsStudies.sig_process = datacards_cbs[datacard]
 
dictionary makePlots_datacardsTauEsStudies.config = {}
 
tuple makePlots_datacardsTauEsStudies.processes_to_plot = list(processes)
 
list makePlots_datacardsTauEsStudies.parabola_plot_configs = []
 
list makePlots_datacardsTauEsStudies.weightbin_plot_configs = []
 
tuple makePlots_datacardsTauEsStudies.filename_mlfit = os.path.join(os.path.dirname(datacard), args.combine_cmssw==8 * "fitDiagnostics.root" + args.combine_cmssw==7 * "mlfit.root")
 
tuple makePlots_datacardsTauEsStudies.file_mlfit = ROOT.TFile(filename_mlfit)
 
tuple makePlots_datacardsTauEsStudies.tree_mlfit = file_mlfit.Get("tree_fit_sb")
 
tuple makePlots_datacardsTauEsStudies.filename_multidimfit = os.path.join(os.path.dirname(datacard), "higgsCombineTest.MultiDimFit.mH0.root")
 
tuple makePlots_datacardsTauEsStudies.file_multidimfit = ROOT.TFile(filename_multidimfit)
 
tuple makePlots_datacardsTauEsStudies.tree_multidimfit = file_multidimfit.Get("limit")
 
list makePlots_datacardsTauEsStudies.mes_list = []
 
list makePlots_datacardsTauEsStudies.deltaNLL_list = []
 
list makePlots_datacardsTauEsStudies.deltaNLLshifted_list = []
 
list makePlots_datacardsTauEsStudies.min_nll = deltaNLL_list[0]
 
list makePlots_datacardsTauEsStudies.min_shift = mes_list[0]
 
list makePlots_datacardsTauEsStudies.mes_list_nll_belowX = []
 
list makePlots_datacardsTauEsStudies.nll_belowX = []
 
int makePlots_datacardsTauEsStudies.nllMax = 10
 
 makePlots_datacardsTauEsStudies.found2sigmaLow = True
 
tuple makePlots_datacardsTauEsStudies.err2sigmaLow = abs((mes_list[index-1]+mes_list[index])/2.0 - min_shift)
 
 makePlots_datacardsTauEsStudies.found1sigmaLow = True
 
tuple makePlots_datacardsTauEsStudies.err1sigmaLow = abs((mes_list[index-1]+mes_list[index])/2.0 - min_shift)
 
 makePlots_datacardsTauEsStudies.found1sigmaHi = True
 
tuple makePlots_datacardsTauEsStudies.err1sigmaHi = abs((mes_list[index]+mes_list[index+1])/2.0 - min_shift)
 
 makePlots_datacardsTauEsStudies.found2sigmaHi = True
 
tuple makePlots_datacardsTauEsStudies.err2sigmaHi = abs((mes_list[index]+mes_list[index+1])/2.0 - min_shift)
 
list makePlots_datacardsTauEsStudies.xvaluesF = []
 
string makePlots_datacardsTauEsStudies.xvalues = ""
 
string makePlots_datacardsTauEsStudies.yvalues = ""
 
list makePlots_datacardsTauEsStudies.xvaluesF_belowX = []
 
tuple makePlots_datacardsTauEsStudies.RooFitGraph_Parabola
 
tuple makePlots_datacardsTauEsStudies.fitf = ROOT.TF1("f1","pol2",min(xvaluesF_belowX),max(xvaluesF_belowX))
 
tuple makePlots_datacardsTauEsStudies.minimumScanFit = fitf.GetMinimumX(min(xvaluesF_belowX),max(xvaluesF_belowX))
 
tuple makePlots_datacardsTauEsStudies.minimumScanFitY = fitf.GetMinimum(min(xvaluesF_belowX),max(xvaluesF_belowX))
 
tuple makePlots_datacardsTauEsStudies.sigmaScanFit = abs(fitf.GetX(minimumScanFitY+1)-minimumScanFit)
 
tuple makePlots_datacardsTauEsStudies.graphfilename = os.path.join(os.path.dirname(datacard), "parabola_" + category + ("_tightenedMassWindow" if args.tighten_mass_window else "")+".root")
 
tuple makePlots_datacardsTauEsStudies.graphfile = ROOT.TFile(graphfilename, "RECREATE")
 
list makePlots_datacardsTauEsStudies.weight_bins_loop = weight_binsifargs.no_inclusiveelseweight_bins[1:]
 
list makePlots_datacardsTauEsStudies.weight_ranges_loop = weight_rangesifargs.no_inclusiveelseweight_ranges[1:]
 
string makePlots_datacardsTauEsStudies.xval = "0.7395 2.2185"
 
string makePlots_datacardsTauEsStudies.xerrsval = "0.7395 0.7395"
 
list makePlots_datacardsTauEsStudies.xbinsF = [0.7395, 2.2185]
 
list makePlots_datacardsTauEsStudies.xerrsF = [0.7395, 0.7395]
 
tuple makePlots_datacardsTauEsStudies.RooFitGraph_Linear
 
tuple makePlots_datacardsTauEsStudies.fit_polZero = ROOT.TF1("f2","pol0",min(xbinsF),max(xbinsF))
 
tuple makePlots_datacardsTauEsStudies.fit_polOne = ROOT.TF1("f3","pol1",min(xbinsF),max(xbinsF))
 
tuple makePlots_datacardsTauEsStudies.polZero_filename = os.path.join(args.output_dir, "datacards/result_fit_" + ("eta" if args.eta_binning else "pt") + "_pol0_" + decayMode + "_" + quantity + ".root")
 
tuple makePlots_datacardsTauEsStudies.polZero_file = ROOT.TFile(polZero_filename, "RECREATE")
 
tuple makePlots_datacardsTauEsStudies.polOne_filename = os.path.join(args.output_dir, "datacards/result_fit_" + ("eta" if args.eta_binning else "pt") + "_pol1_" + decayMode + "_" + quantity + ".root")
 
tuple makePlots_datacardsTauEsStudies.polOne_file = ROOT.TFile(polOne_filename, "RECREATE")
 
string makePlots_datacardsTauEsStudies.row_format = "{:^22}"
 
string makePlots_datacardsTauEsStudies.polZero_string1 = "%1.2f"
 
string makePlots_datacardsTauEsStudies.polZero_string2 = "%1.2f"
 
string makePlots_datacardsTauEsStudies.polOne_string1 = "%1.2f"
 
string makePlots_datacardsTauEsStudies.polOne_string2 = "%1.2f"
 
tuple makePlots_datacardsTauEsStudies.subpath = os.path.normpath(output_dir)
 
list makePlots_datacardsTauEsStudies.output_filenames = []
 
tuple makePlots_datacardsTauEsStudies.www = args.wwwif(subpath == "tauEsStudies_datacards")
 
 makePlots_datacardsTauEsStudies.output_dir = output_dir,
 
 makePlots_datacardsTauEsStudies.export_json = False,