HiggsAnalysis-KITHiggsToTauTau
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
makePlots_datacardsZttEfficiency Namespace Reference

Functions

def matching_process
 
def remove_procs_and_systs_with_zero_yield
 

Variables

tuple log = logging.getLogger(__name__)
 
dictionary models
 
tuple parser
 
string help = "Input directory."
 
tuple choices = models.keys()
 
list default = ["all"]
 
tuple args = parser.parse_args()
 
string weight_string = "(fabs(eta_2) < 1.460)"
 
tuple sample_settings = samples.Samples()
 
tuple systematics_factory = systematics.SystematicsFactory()
 
list plot_configs = []
 
list hadd_commands = []
 
tuple datacards = zttxsecdatacards.ZttLepTauFakeRateDatacards()
 
tuple model_settings = models.get(args.model, {})
 
tuple fit_settings = model_settings.get("fit", {"" : {}})
 
list excludecut_settings = model_settings['exclude_cuts']
 
string tmp_input_root_filename_template = "input/${ANALYSIS}_${CHANNEL}_${BIN}_${SYSTEMATIC}_${ERA}.root"
 
string input_root_filename_template = "input/${ANALYSIS}_${CHANNEL}_${BIN}_${ERA}.root"
 
string bkg_histogram_name_template = "${BIN}/${PROCESS}"
 
string sig_histogram_name_template = "${BIN}/${PROCESS}"
 
string bkg_syst_histogram_name_template = "${BIN}/${PROCESS}_${SYSTEMATIC}"
 
string sig_syst_histogram_name_template = "${BIN}/${PROCESS}_${SYSTEMATIC}"
 
list datacard_filename_templates
 
string output_root_filename_template = "datacards/common/${ANALYSIS}.input_${ERA}.root"
 
tuple categories = datacards.cb.cp()
 
tuple datacards_per_channel_category = zttxsecdatacards.ZttLepTauFakeRateDatacards(cb=datacards.cb.cp().channel([channel]).bin([category]))
 
tuple output_file
 
list tmp_output_files = []
 
tuple nominal = (shape_systematic == "nominal")
 
list list_of_samples = [datacards.configs.process2sample(process) for process in list_of_samples]
 
string systematic = "nominal"
 
string samples = "\", \""
 
 channel = channel,
 
 category = category,
 
float wj_sf_shift = 0.0
 
tuple config
 
int sub_conf_index = 0
 
tuple systematics_settings = systematics_factory.get(shape_systematic)
 
 histogram_name_template = bkg_histogram_name_templateifnominalelsebkg_syst_histogram_name_template
 
tuple PROCESS = datacards.configs.sample2process(sample)
 
 BIN = category,
 
 SYSTEMATIC = systematic
 
tuple tmp_output_file
 
 DST = output_file,
 
string SRC = " "
 
tuple output_files = list(set([os.path.join(config["output_dir"], config["filename"]+".root") for config in plot_configs[:args.n_plots[0]]]))
 
 update_systematics = False
 
tuple processes = datacards.cb.cp()
 
float add_threshold = 0.1
 
dictionary datacards_cbs = {}
 
dictionary datacards_workspaces = {}
 
dictionary efficiency = {}
 
int nPassPre = 0
 
int nFailPre = 0
 
tuple sig_process = cb.cp()
 
list command
 
 STABLE = datacards.stable_options
 
tuple datacards_postfit_shapes = datacards.postfit_shapes_fromworkspace(datacards_cbs, datacards_workspaces, True, args.n_processes, "--sampling" + (" --print" if args.n_processes <= 1 else ""))
 
dictionary plotting_args = {"ratio" : args.ratio, "args" : args.args, "lumi" : args.lumi, "x_expressions" : "m_vis", "era" : "2016"}
 
 n_processes = args.n_processes,
 
 signal_stacked_on_bkg = True
 
list bkg_plotting_order = ["ZL", "ZTT", "ZJ", "TT", "VV", "QCD"]
 
tuple postfit_shapes = datacards_postfit_shapes.get("fit_s", {})
 
int nPass = 0
 
int nFail = 0
 
tuple results_file = ROOT.TFile(os.path.join(os.path.dirname(datacard), "fitDiagnostics.root"))
 
tuple results_tree = results_file.Get("tree_fit_sb")
 
 bestfit = results_tree.r
 
list bkg_process = datacards_cbs[datacard]
 
 signal_scale = bestfit
 
list effnom = efficiency[category[:2]]
 
tuple processes_to_plot = list(processes)
 

Function Documentation

def makePlots_datacardsZttEfficiency.matching_process (   obj1,
  obj2 
)
def makePlots_datacardsZttEfficiency.remove_procs_and_systs_with_zero_yield (   proc)

Variable Documentation

float makePlots_datacardsZttEfficiency.add_threshold = 0.1
tuple makePlots_datacardsZttEfficiency.args = parser.parse_args()
makePlots_datacardsZttEfficiency.bestfit = results_tree.r
makePlots_datacardsZttEfficiency.BIN = category,
string makePlots_datacardsZttEfficiency.bkg_histogram_name_template = "${BIN}/${PROCESS}"
list makePlots_datacardsZttEfficiency.bkg_plotting_order = ["ZL", "ZTT", "ZJ", "TT", "VV", "QCD"]
list makePlots_datacardsZttEfficiency.bkg_process = datacards_cbs[datacard]
string makePlots_datacardsZttEfficiency.bkg_syst_histogram_name_template = "${BIN}/${PROCESS}_${SYSTEMATIC}"
tuple makePlots_datacardsZttEfficiency.categories = datacards.cb.cp()
makePlots_datacardsZttEfficiency.category = category,
makePlots_datacardsZttEfficiency.channel = channel,
tuple makePlots_datacardsZttEfficiency.choices = models.keys()
list makePlots_datacardsZttEfficiency.command
Initial value:
1 = ["text2workspace.py -m {MASS} -P {MODEL} --PO \"eff={EFF}\" {DATACARD} -o {OUTPUT}".format(
2  MASS=[mass for mass in cb.mass_set() if mass != "*"][0],
3  MODEL=model_settings["P"],
4  EFF=efficiency[channel].nominal_value,
5  DATACARD=datacard,
6  OUTPUT=os.path.splitext(datacard)[0]+".root")]
dictionary makePlots_datacardsZttEfficiency.config
Initial value:
1 = sample_settings.get_config(
2  samples=[getattr(samples.Samples, sample) for sample in list_of_samples],
3  channel=channel,
4  category=None,
5  weight = weight_string,
6  lumi = args.lumi * 1000,
7  exclude_cuts=excludecut_settings,
8  cut_type=category[3:],
9  estimationMethod=args.background_method,
10  wj_sf_shift=wj_sf_shift
11  )
list makePlots_datacardsZttEfficiency.datacard_filename_templates
Initial value:
1 = [
2  "datacards/${CHANNEL}/${ANALYSIS}_${CHANNEL}_${ERA}.txt",
3  "datacards/combined/${ANALYSIS}_${ERA}.txt",
4  ]
tuple makePlots_datacardsZttEfficiency.datacards = zttxsecdatacards.ZttLepTauFakeRateDatacards()
dictionary makePlots_datacardsZttEfficiency.datacards_cbs = {}
tuple makePlots_datacardsZttEfficiency.datacards_per_channel_category = zttxsecdatacards.ZttLepTauFakeRateDatacards(cb=datacards.cb.cp().channel([channel]).bin([category]))
tuple makePlots_datacardsZttEfficiency.datacards_postfit_shapes = datacards.postfit_shapes_fromworkspace(datacards_cbs, datacards_workspaces, True, args.n_processes, "--sampling" + (" --print" if args.n_processes <= 1 else ""))
dictionary makePlots_datacardsZttEfficiency.datacards_workspaces = {}
string makePlots_datacardsZttEfficiency.default = ["all"]
makePlots_datacardsZttEfficiency.DST = output_file,
dictionary makePlots_datacardsZttEfficiency.efficiency = {}
list makePlots_datacardsZttEfficiency.effnom = efficiency[category[:2]]
list makePlots_datacardsZttEfficiency.excludecut_settings = model_settings['exclude_cuts']
tuple makePlots_datacardsZttEfficiency.fit_settings = model_settings.get("fit", {"" : {}})
list makePlots_datacardsZttEfficiency.hadd_commands = []
string makePlots_datacardsZttEfficiency.help = "Input directory."
makePlots_datacardsZttEfficiency.histogram_name_template = bkg_histogram_name_templateifnominalelsebkg_syst_histogram_name_template
string makePlots_datacardsZttEfficiency.input_root_filename_template = "input/${ANALYSIS}_${CHANNEL}_${BIN}_${ERA}.root"
list makePlots_datacardsZttEfficiency.list_of_samples = [datacards.configs.process2sample(process) for process in list_of_samples]
tuple makePlots_datacardsZttEfficiency.log = logging.getLogger(__name__)
tuple makePlots_datacardsZttEfficiency.model_settings = models.get(args.model, {})
dictionary makePlots_datacardsZttEfficiency.models
makePlots_datacardsZttEfficiency.n_processes = args.n_processes,
tuple makePlots_datacardsZttEfficiency.nFail = 0
tuple makePlots_datacardsZttEfficiency.nFailPre = 0
tuple makePlots_datacardsZttEfficiency.nominal = (shape_systematic == "nominal")
tuple makePlots_datacardsZttEfficiency.nPass = 0
tuple makePlots_datacardsZttEfficiency.nPassPre = 0
tuple makePlots_datacardsZttEfficiency.output_file
Initial value:
1 = os.path.join(args.output_dir, input_root_filename_template.replace("$", "").format(
2  ANALYSIS="ztt",
3  CHANNEL=channel,
4  BIN=category,
5  ERA="13TeV"
6  ))
tuple makePlots_datacardsZttEfficiency.output_files = list(set([os.path.join(config["output_dir"], config["filename"]+".root") for config in plot_configs[:args.n_plots[0]]]))
string makePlots_datacardsZttEfficiency.output_root_filename_template = "datacards/common/${ANALYSIS}.input_${ERA}.root"
tuple makePlots_datacardsZttEfficiency.parser
Initial value:
1 = argparse.ArgumentParser(description="Create ROOT inputs and datacards for tau ID efficiency or lep->tau fake-rate measurement.",
2  parents=[logger.loggingParser])
list makePlots_datacardsZttEfficiency.plot_configs = []
dictionary makePlots_datacardsZttEfficiency.plotting_args = {"ratio" : args.ratio, "args" : args.args, "lumi" : args.lumi, "x_expressions" : "m_vis", "era" : "2016"}
tuple makePlots_datacardsZttEfficiency.postfit_shapes = datacards_postfit_shapes.get("fit_s", {})
tuple makePlots_datacardsZttEfficiency.PROCESS = datacards.configs.sample2process(sample)
list makePlots_datacardsZttEfficiency.processes = datacards.cb.cp()
list makePlots_datacardsZttEfficiency.processes_to_plot = list(processes)
tuple makePlots_datacardsZttEfficiency.results_file = ROOT.TFile(os.path.join(os.path.dirname(datacard), "fitDiagnostics.root"))
tuple makePlots_datacardsZttEfficiency.results_tree = results_file.Get("tree_fit_sb")
tuple makePlots_datacardsZttEfficiency.sample_settings = samples.Samples()
string makePlots_datacardsZttEfficiency.samples = "\", \""
string makePlots_datacardsZttEfficiency.sig_histogram_name_template = "${BIN}/${PROCESS}"
list makePlots_datacardsZttEfficiency.sig_process = cb.cp()
string makePlots_datacardsZttEfficiency.sig_syst_histogram_name_template = "${BIN}/${PROCESS}_${SYSTEMATIC}"
tuple makePlots_datacardsZttEfficiency.signal_scale = bestfit
makePlots_datacardsZttEfficiency.signal_stacked_on_bkg = True
string makePlots_datacardsZttEfficiency.SRC = " "
makePlots_datacardsZttEfficiency.STABLE = datacards.stable_options
int makePlots_datacardsZttEfficiency.sub_conf_index = 0
makePlots_datacardsZttEfficiency.systematic = "nominal"
makePlots_datacardsZttEfficiency.SYSTEMATIC = systematic
tuple makePlots_datacardsZttEfficiency.systematics_factory = systematics.SystematicsFactory()
tuple makePlots_datacardsZttEfficiency.systematics_settings = systematics_factory.get(shape_systematic)
string makePlots_datacardsZttEfficiency.tmp_input_root_filename_template = "input/${ANALYSIS}_${CHANNEL}_${BIN}_${SYSTEMATIC}_${ERA}.root"
tuple makePlots_datacardsZttEfficiency.tmp_output_file
Initial value:
1 = os.path.join(args.output_dir, tmp_input_root_filename_template.replace("$", "").format(
2  ANALYSIS="ztt",
3  CHANNEL=channel,
4  BIN=category,
5  SYSTEMATIC=systematic,
6  ERA="13TeV"
7  ))
list makePlots_datacardsZttEfficiency.tmp_output_files = []
makePlots_datacardsZttEfficiency.update_systematics = False
string makePlots_datacardsZttEfficiency.weight_string = "(fabs(eta_2) < 1.460)"
float makePlots_datacardsZttEfficiency.wj_sf_shift = 0.0