def make_tables_and_plots(input_file, plot_label): # Tables parallel_utils.run('./makeTables "%s" > "%s"' % (input_file, input_file.replace(".root", ".txt"))) # Plots plot_styles = ["std", "std_linear"] plot_years = ["", "_2016", "_2017", "_2018"] for plot_type in [x + y for x in plot_styles for y in plot_years]: parallel_utils.run('./makePlots "%s" "%s" "%s"' % (plot_type, input_file, plot_label))
<<<<<<< HEAD # Loopers #parallel_utils.run('python looper_wrapper.py --fcnc --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_MVA_Presel" --bkg_options "none" --bdt "%s"' % (args.baby_version, args.tag + "_hut_BDT", bdt_lep_hut)) #parallel_utils.run('python looper_wrapper.py --fcnc --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_MVA_Presel" --bkg_options "impute" --bdt "%s"' % (args.baby_version, args.tag + "_impute_hut_BDT", bdt_had_hut)) #parallel_utils.run('python looper_wrapper.py --fcnc --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_MVA_Presel" --bkg_options "none" --bdt "%s"' % (args.baby_version, args.tag + "_hct_BDT", bdt_lep_hct)) #parallel_utils.run('python looper_wrapper.py --fcnc --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_MVA_Presel" --bkg_options "impute" --bdt "%s"' % (args.baby_version, args.tag + "_impute_hct_BDT", bdt_had_hct)) # Loopers, signal regions #parallel_utils.run('python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "FCNC_Leptonic_Hut_RunII_SR_Inclusive" --bkg_options "none" --years "2017" --bdt "%s"' % (args.baby_version, args.tag + "_hut_BDT", bdt_lep_hut)) #parallel_utils.run('python looper_wrapper.py --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "FCNC_Hadronic_Hut_RunII_SR_Inclusive" --bkg_options "impute" --years "2017" --bdt "%s"' % (args.baby_version, args.tag + "_impute_hut_BDT", bdt_had_hut)) #parallel_utils.run('python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "FCNC_Leptonic_Hct_RunII_SR_Inclusive" --bkg_options "none" --years "2017" --bdt "%s"' % (args.baby_version, args.tag + "_hct_BDT", bdt_lep_hct)) #parallel_utils.run('python looper_wrapper.py --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "FCNC_Hadronic_Hct_RunII_SR_Inclusive" --bkg_options "impute" --years "2017" --bdt "%s"' % (args.baby_version, args.tag + "_impute_hct_BDT", bdt_had_hct)) # Data/MC Plots os.chdir("Plots") parallel_utils.run('python plot_wrapper.py --input_file "../%s" --plot_type "std" --plot_labels "FCNC Leptonic|Loose MVA Presel." --signals "TT_FCNC_hut|ST_FCNC_hut" --backgrounds "DiPhoton|GammaJets|TTGG|TTGJets|TTJets|VG"' % ("ttHLeptonic_RunII_MVA_Presel_%s_histogramsRunII.root" % (args.tag + "_hut_BDT_FCNC"))) parallel_utils.run('python plot_wrapper.py --input_file "../%s" --plot_type "std" --plot_labels "FCNC Leptonic|Loose MVA Presel." --signals "TT_FCNC_hct|ST_FCNC_hct" --backgrounds "DiPhoton|GammaJets|TTGG|TTGJets|TTJets|VG"' % ("ttHLeptonic_RunII_MVA_Presel_%s_histogramsRunII.root" % (args.tag + "_hct_BDT_FCNC"))) parallel_utils.run('python plot_wrapper.py --input_file "../%s" --plot_type "std" --plot_labels "FCNC Hadronic|Loose MVA Presel." --signals "TT_FCNC_hut|ST_FCNC_hut" --backgrounds "DiPhoton|QCD_GammaJets_imputed|TTGG|TTGJets|TTJets|VG"' % ("ttHHadronic_RunII_MVA_Presel_%s_histogramsRunII.root" % (args.tag + "_impute_hut_BDT_FCNC"))) parallel_utils.run('python plot_wrapper.py --input_file "../%s" --plot_type "std" --plot_labels "FCNC Hadronic|Loose MVA Presel." --signals "TT_FCNC_hct|ST_FCNC_hct" --backgrounds "DiPhoton|QCD_GammaJets_imputed|TTGG|TTGJets|TTJets|VG"' % ("ttHHadronic_RunII_MVA_Presel_%s_histogramsRunII.root" % (args.tag + "_impute_hct_BDT_FCNC"))) os.chdir("../") # MVA BabyMaker #parallel_utils.run('python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_MVA_Presel" --bkg_options "none" --babymaker --fcnc' % (args.baby_version, args.tag)) #parallel_utils.run('python looper_wrapper.py --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_MVA_Presel" --bkg_options "impute" --babymaker --fcnc' % (args.baby_version, args.tag + "_impute")) ======= bash_command('echo Hello World! "(from do_fcnc.py)"; ' + 'pwd; ') bash_command("make") # BabyMaker{{{
parser.add_argument("--nCores", help = "number of cores to use", type=int, default = 12) parser.add_argument("--nPoints", help = "number of different cuts to try", type=int, default = 100) parser.add_argument("--nBins", help = "number of bins", type=int, default = 2) args = parser.parse_args() job_dict = { "Hut_Leptonic" : { "file" : args.Hut_Leptonic, "tag" : "Hut_Leptonic_%s" % args.tag, "channel" : "FCNCLeptonicTag", "resonant_bkgs" : "ttH,tH", "signal" : "FCNC_Hut" }, "Hct_Leptonic" : { "file" : args.Hct_Leptonic, "tag" : "Hct_Leptonic_%s" % args.tag, "channel" : "FCNCLeptonicTag", "resonant_bkgs" : "ttH,tH", "signal" : "FCNC_Hct" }, "Hut_Hadronic" : { "file" : args.Hut_Hadronic, "tag" : "Hut_Hadronic_%s" % args.tag, "channel" : "FCNCHadronicTag", "resonant_bkgs" : "ttH,tH,ggH", "signal" : "FCNC_Hut" }, "Hct_Hadronic" : { "file" : args.Hct_Hadronic, "tag" : "Hct_Hadronic_%s" % args.tag, "channel" : "FCNCHadronicTag", "resonant_bkgs" : "ttH,tH,ggH", "signal" : "FCNC_Hct" } } # Run optimization for each channel and each coupling for job in job_dict.keys(): parallel_utils.run('python derive_binning.py --tag "%s" --channel "%s" --file "%s" --nCores %d --nPoints %d --nBins %d --resonant_bkgs "%s" --signal "%s" --limit' % (job_dict[job]["tag"], job_dict[job]["channel"], job_dict[job]["file"], args.nCores, args.nPoints, args.nBins, job_dict[job]["resonant_bkgs"], job_dict[job]["signal"])) # For each coupling, find best binning for each channel and combine cards to get expected limit for coupling in ["Hut", "Hct"]: for channel in ["Hadronic", "Leptonic"]: with open("results_%s.json" % job_dict[coupling + "_" + channel]["tag"], "r") as f_in: results = json.load(f_in) best_combination = None for combination in results.keys(): if not best_combination or results[combination]["limit"] < best_combination["limit"]: best_combination = results[combination].copy() job_dict[coupling + "_" + channel]["best_combination"] = best_combination #assumed_br = 0.1441 assumed_br = 1. # already factored in upstream in loopers (also have yields divided by 100)
do_looping = True if do_looping: #p = Popen("echo" + " Hello World! (from do_fcnc.py)", shell=True) p = Popen("pwd", shell=True) result = os.waitpid(p.pid, 0) # Loopers #parallel_utils.run('python looper_wrapper.py --fcnc --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_MVA_Presel" --bkg_options "none" --years "2017"' % (args.baby_version, args.tag + "_hut_BDT")) #parallel_utils.run('python looper_wrapper.py --fcnc --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_MVA_Presel" --bkg_options "impute" --years "2017"' % (args.baby_version, args.tag + "_impute_hut_BDT")) #parallel_utils.run('python looper_wrapper.py --fcnc --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_MVA_Presel" --bkg_options "none" --years "2017"' % (args.baby_version, args.tag + "_hct_BDT")) #parallel_utils.run('python looper_wrapper.py --fcnc --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_MVA_Presel" --bkg_options "impute" --years "2017"' % (args.baby_version, args.tag + "_impute_hct_BDT")) # Data/MC Plots os.chdir("Plots") parallel_utils.run( 'python plot_wrapper.py --input_file "../%s" --plot_type "std_2017" --plot_labels "FCNC Leptonic|Loose MVA Presel." --signals "TT_FCNC_hut|ST_FCNC_hut" --backgrounds "DiPhoton|GammaJets|TTGG|TTGJets|TTJets|VG"' % ("ttHLeptonic_RunII_MVA_Presel_%s_histogramsRunII.root" % (args.tag + "_hut_BDT_FCNC"))) parallel_utils.run( 'python plot_wrapper.py --input_file "../%s" --plot_type "std_2017" --plot_labels "FCNC Leptonic|Loose MVA Presel." --signals "TT_FCNC_hct|ST_FCNC_hct" --backgrounds "DiPhoton|GammaJets|TTGG|TTGJets|TTJets|VG"' % ("ttHLeptonic_RunII_MVA_Presel_%s_histogramsRunII.root" % (args.tag + "_hct_BDT_FCNC"))) parallel_utils.run( 'python plot_wrapper.py --input_file "../%s" --plot_type "std_2017" --plot_labels "FCNC Hadronic|Loose MVA Presel." --signals "TT_FCNC_hut|ST_FCNC_hut" --backgrounds "DiPhoton|QCD_GammaJets_imputed|TTGG|TTGJets|TTJets|VG"' % ("ttHHadronic_RunII_MVA_Presel_%s_histogramsRunII.root" % (args.tag + "_impute_hut_BDT_FCNC"))) parallel_utils.run( 'python plot_wrapper.py --input_file "../%s" --plot_type "std_2017" --plot_labels "FCNC Hadronic|Loose MVA Presel." --signals "TT_FCNC_hct|ST_FCNC_hct" --backgrounds "DiPhoton|QCD_GammaJets_imputed|TTGG|TTGJets|TTJets|VG"' % ("ttHHadronic_RunII_MVA_Presel_%s_histogramsRunII.root" % (args.tag + "_impute_hct_BDT_FCNC"))) os.chdir("../")
os.chdir("../") #plot_types = ["std", "std_linear", "std_2016", "std_2017", "std_2018"] plot_types = ["std"] do_syst = True if do_syst: syst = "--do_systematics" else: syst = "" derive_fake_shape = False if derive_fake_shape: # Derive photon fake ID shape parallel_utils.run( 'python looper_wrapper.py --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_DiPhotonFits_Presel" --bkg_options "none" --bdt "none"' % (args.baby_version, args.tag)) os.chdir("Plots") for plot_type in plot_types: parallel_utils.run( 'python plot_wrapper.py --input_file "../ttHHadronic_RunII_DiPhotonFits_Presel_%s_histogramsRunII.root" --backgrounds "DiPhoton|GammaJets|QCD|TTGG|TTGJets|TTJets" --signals "TT_FCNC_hut" --plot_type "%s" --plot_labels "Hadronic Channel|DiPhoton Fits Presel."' % (args.tag, plot_type)) os.chdir("../PhotonID_Sideband/") parallel_utils.run( 'python derive_shape_fake.py --input "../ttHHadronic_RunII_DiPhotonFits_Presel_%s_histogramsRunII.root" --hist_name "hFakePhotonIDMVA"' % (args.tag)) os.chdir("../") dummy_input = raw_input( "You probably want to update ttHLooper.h with results of deriving fake shape. Press any key to continue"
import argparse parser = argparse.ArgumentParser() parser.add_argument("--tag", help = "tag to denote with", type=str) parser.add_argument("--baby_version", help = "which version of babies to use", type=str) args = parser.parse_args() bdt = "none" os.chdir("../") #plot_types = ["std", "std_linear", "std_shape", "std_shape_sig_vs_data"] plot_types = ["std", "std_linear"] do_looping = False if do_looping: parallel_utils.run('python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_MVA_Presel" --bkg_options "none" --bdt "none" --do_systematics' % (args.baby_version, args.tag)) os.chdir("Plots") for plot_type in plot_types: parallel_utils.run('python plot_wrapper.py --input_file "../ttHLeptonic_RunII_MVA_Presel_%s_histogramsRunII.root" --backgrounds "DiPhoton|GammaJets|TTGG|TTGJets|TTJets|VG|Other" --signals "ttH" --plot_type "%s" --plot_labels "ttH Leptonic|Loose MVA Presel."' % (args.tag, plot_type)) os.chdir("../") do_ttZ = False if do_ttZ: #parallel_utils.run('python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_ttZ_CR" --bkg_options "none" --bdt "none"' % (args.baby_version, args.tag)) os.chdir("Plots") #for plot_type in plot_types: # parallel_utils.run('python plot_wrapper.py --input_file "../ttHLeptonic_RunII_ttZ_CR_%s_histogramsRunII.root" --backgrounds "DiPhoton|GammaJets|TTGG|TTGJets|TTJets|VG|DY|TGamma|TTV|VV|tV" --signals "ttH" --plot_type "%s" --plot_labels "ttH Leptonic|t#bar{t}Z CR|N_{jets} #geq 1"' % (args.tag, plot_type)) os.chdir("../") #parallel_utils.run('python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_ttZ_Tight_CR" --bkg_options "none" --bdt "none" --do_systematics' % (args.baby_version, args.tag)) os.chdir("Plots") for plot_type in plot_types:
parser = argparse.ArgumentParser() parser.add_argument("--tag", help = "tag to denote with", type=str) parser.add_argument("--baby_version", help = "which version of babies to use", type=str) args = parser.parse_args() bdt = "none" os.chdir("../") #plot_types = ["std", "std_linear", "std_shape", "std_shape_sig_vs_data", "std_2016", "std_2017", "std_2018"] plot_types = ["std", "std_linear"] derive_fake_shape = False if derive_fake_shape: # Derive photon fake ID shape parallel_utils.run('python looper_wrapper.py --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_DiPhotonFits_Presel" --bkg_options "none" --bdt "none"' % (args.baby_version, args.tag)) os.chdir("Plots") for plot_type in plot_types: parallel_utils.run('python plot_wrapper.py --input_file "../ttHHadronic_RunII_DiPhotonFits_Presel_%s_histogramsRunII.root" --backgrounds "DiPhoton|GammaJets|QCD|TTGG|TTGJets|TTJets" --signals "ttH" --plot_type "%s" --plot_labels "ttH Hadronic|DiPhoton Fits Presel.|Pre-Fit"' % (args.tag, plot_type)) os.chdir("../PhotonID_Sideband/") parallel_utils.run('python derive_shape_fake.py --input "../ttHHadronic_RunII_DiPhotonFits_Presel_%s_histogramsRunII.root" --hist_name "hFakePhotonIDMVA"' % (args.tag)) os.chdir("../") dummy_input = raw_input("You probably want to update ttHLooper.h with results of deriving fake shape. Press any key to continue") do_diphoton_fits = True if do_diphoton_fits: # Run imputing with no fit #parallel_utils.run('python looper_wrapper.py --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_MVA_Presel" --bkg_options "impute_no_scale" --bdt "none"' % (args.baby_version, args.tag + "_impute_no_scale"))
type=str, default="std") parser.add_argument("--plot_labels", help="labels to put on plots", type=str, default="") parser.add_argument("--hig_19_015", help="run special plotter for hig_19_015", action="store_true") args = parser.parse_args() import parallel_utils if args.hig_19_015: parallel_utils.run('./makePlots_hig-19-015 "%s" "%s" "%s" "%s" "%s"' % (args.plot_type, args.input_file, args.plot_labels, args.backgrounds, args.signals)) else: parallel_utils.run('./makePlots "%s" "%s" "%s" "%s" "%s"' % (args.plot_type, args.input_file, args.plot_labels, args.backgrounds, args.signals)) #full_bkgs = "DiPhoton|QCD_GammaJets_imputed|GammaJets|QCD|TTGG|TTGJets|TTJets|DY|VG|TGamma|TTV|VV|tV|ggH|VBF|VH|THQ|THW" if args.signals == "TT_FCNC_hut": args.signals = "TT_FCNC_hct|TT_FCNC_hut|ST_FCNC_hct|ST_FCNC_hut" full_bkgs = "DiPhoton|QCD_GammaJets_imputed|GammaJets|QCD|TTGG|TTGJets|TTJets|DY|VG|TGamma|TTZ|TTW|VV|tV|ggH|VBF|VH|THQ|THW|ttH" parallel_utils.run( './makeTables "%s" "%s" "%s" > tables_%s.txt' %
# Baseline 2017 only os.chdir("../Loopers") #parallel_utils.run('python looper_wrapper.py --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_MVA_Presel" --bkg_options "impute" --babymaker --years "2017"' % (args.baby_version, args.tag + "_2017_only_RunII_MVA_Presel_impute")) os.chdir("../MVAs") #parallel_utils.run('python prep_dnn.py --input "../Loopers/MVABaby_ttHHadronic_%s_RunII_MVA_Presel_impute.root" --channel "Hadronic" --signal "ttH" --background "dipho" --tag "dipho" --z_score' % (args.tag + "_2017_only")) #parallel_utils.run('python prep_dnn.py --input "../Loopers/MVABaby_ttHHadronic_%s_RunII_MVA_Presel_impute.root" --channel "Hadronic" --signal "ttH" --background "dipho" --tag "dipho"' % (args.tag + "_2017_only")) #parallel_utils.run('python train_dnn.py --input "ttHHadronic_%s_RunII_MVA_Presel_impute_dnn_features_dipho.hdf5" --tag "ttHHadronic_ttH_vs_dipho_%s" --channel "Hadronic"' % (args.tag + "_2017_only", args.tag + "_2017_only")) #parallel_utils.run('python prep_dnn.py --input "../Loopers/MVABaby_ttHHadronic_%s_RunII_MVA_Presel_impute.root" --channel "Hadronic" --signal "ttH" --background "ttGG" --tag "ttGG" --z_score' % (args.tag + "_2017_only")) #parallel_utils.run('python prep_dnn.py --input "../Loopers/MVABaby_ttHHadronic_%s_RunII_MVA_Presel_impute.root" --channel "Hadronic" --signal "ttH" --background "ttGG" --tag "ttGG"' % (args.tag + "_2017_only")) #parallel_utils.run('python train_dnn.py --input "ttHHadronic_%s_RunII_MVA_Presel_impute_dnn_features_ttGG.hdf5" --tag "ttHHadronic_ttH_vs_ttGG_%s" --channel "Hadronic"' % (args.tag + "_2017_only", args.tag + "_2017_only")) #parallel_utils.run('python prep.py --input "../Loopers/MVABaby_ttHHadronic_%s_RunII_MVA_Presel_impute.root" --channel "Hadronic"' % (args.tag + "_2017_only")) #parallel_utils.run('python train.py --input "ttHHadronic_%s_RunII_MVA_Presel_impute_features.hdf5" --channel "Hadronic" --tag "_%s_RunII_MVA_Presel_impute" --ext ""' % (args.tag + "_2017_only", args.tag + "_2017_only")) parallel_utils.run('python prep.py --input "../Loopers/MVABaby_ttHHadronic_%s_RunII_MVA_Presel_impute.root" --channel "Hadronic" --dnn_models "dnn_weights/ttHHadronic_ttH_vs_dipho_%s_2017_only_weights_00.hdf5,dnn_weights/ttHHadronic_ttH_vs_ttGG_%s_2017_only_weights_00.hdf5" --tag "addDNNs_addTopTag" --do_top_tag' % (args.tag + "_2017_only", args.tag, args.tag)) parallel_utils.run('python train.py --input "ttHHadronic_%s_RunII_MVA_Presel_impute_featuresaddDNNs_addTopTag.hdf5" --channel "Hadronic" --tag "_%s_RunII_MVA_Presel_impute_addDNNs_addTopTag" --ext ""' % (args.tag + "_2017_only", args.tag + "_2017_only")) # End Baseline 2017 only # Add year #parallel_utils.run('python prep.py --input "../Loopers/MVABaby_ttHHadronic_%s_RunII_MVA_Presel_impute.root" --channel "Hadronic" --tag "addTopTag_addYear" --do_top_tag --add_year' % (args.tag)) #parallel_utils.run('python train.py --input "ttHHadronic_%s_RunII_MVA_Presel_impute_featuresaddTopTag_addYear.hdf5" --channel "Hadronic" --tag "_%s_RunII_MVA_Presel_impute_addTopTag_addYear" --ext ""' % (args.tag, args.tag)) #parallel_utils.run('python prep.py --input "../Loopers/MVABaby_ttHHadronic_%s_RunII_MVA_Presel_impute.root" --channel "Hadronic" --dnn_models "dnn_weights/ttHHadronic_ttH_vs_dipho_v1.6_28May2019_weights_00.hdf5,dnn_weights/ttHHadronic_ttH_vs_ttGG_v1.6_28May2019_weights_00.hdf5" --tag "addDNNs_addTopTag_addYear" --do_top_tag --add_year' % (args.tag)) #parallel_utils.run('python train.py --input "ttHHadronic_%s_RunII_MVA_Presel_impute_featuresaddDNNs_addTopTag_addYear.hdf5" --channel "Hadronic" --tag "_%s_RunII_MVA_Presel_impute_addDNNs_addTopTag_addYear" --ext ""' % (args.tag, args.tag)) # Train and also zip in ttH vs. tH BDT score #reference_mva_name = "/home/users/sjmay/ttH/MVAs/Hadronic_ttH_vs_tH_test_tH_17Jun2019__bdt.xgb" #parallel_utils.run('python train.py --input "ttHHadronic_%s_RunII_MVA_Presel_impute_featuresaddDNNs_addTopTag.hdf5" --channel "Hadronic" --tag "_%s_RunII_MVA_Presel_impute_addDNNs_addTopTag_add_ttH_vs_tH_score" --ext "" --reference_mva "%s" --reference_mva_name "ttH_vs_tH_bdt_score"' % (args.tag, args.tag, reference_mva_name))
parser.add_argument("--baby_version", help="which version of babies to use", type=str) args = parser.parse_args() bdt_lep_hut = "../MVAs/Leptonic_v4.11_14Jan2020_hut__bdt.xml" bdt_lep_hct = "../MVAs/Leptonic_v4.11_14Jan2020_hct__bdt.xml" bdt_had_hut = "../MVAs/Hadronic_v4.11_14Jan2020_impute_hut__bdt.xml" bdt_had_hct = "../MVAs/Hadronic_v4.11_14Jan2020_impute_hct__bdt.xml" os.chdir("../") do_looping = False if do_looping: parallel_utils.run( 'python looper_wrapper.py --fcnc --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_MVA_Presel" --bkg_options "none" --bdt "%s"' % (args.baby_version, args.tag + "_hut_BDT", bdt_lep_hut)) parallel_utils.run( 'python looper_wrapper.py --fcnc --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_MVA_Presel" --bkg_options "impute" --bdt "%s"' % (args.baby_version, args.tag + "_impute_hut_BDT", bdt_had_hut)) parallel_utils.run( 'python looper_wrapper.py --fcnc --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_MVA_Presel" --bkg_options "none" --bdt "%s"' % (args.baby_version, args.tag + "_hct_BDT", bdt_lep_hct)) parallel_utils.run( 'python looper_wrapper.py --fcnc --channel "Hadronic" --baby_version "%s" --tag "%s" --selection "ttHHadronic_RunII_MVA_Presel" --bkg_options "impute" --bdt "%s"' % (args.baby_version, args.tag + "_impute_hct_BDT", bdt_had_hct)) os.chdir("Plots") parallel_utils.run( 'python plot_wrapper.py --input_file "../%s" --plot_type "std" --plot_labels "FCNC Leptonic|Loose MVA Presel." --signals "TT_FCNC_hut|ST_FCNC_hut" --backgrounds "DiPhoton|GammaJets|TTGG|TTGJets|TTJets|VG"' % ("ttHLeptonic_RunII_MVA_Presel_%s_histogramsRunII.root" %
os.chdir("../") #plot_types = ["std", "std_linear", "std_2016", "std_2017", "std_2018"] #plot_types = ["std_linear"] plot_types = ["std"] do_syst = True if do_syst: syst = "--do_systematics" else: syst = "" do_looping = False if do_looping: parallel_utils.run( 'python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_MVA_Presel" --bkg_options "none" --bdt "none" --fcnc %s' % (args.baby_version, args.tag, syst)) os.chdir("Plots") for plot_type in plot_types: #parallel_utils.run('python plot_wrapper.py --input_file "../ttHLeptonic_RunII_MVA_Presel_%s_histogramsRunII.root" --backgrounds "DiPhoton|GammaJets|TTGG|TTGJets|TTJets|VG|Other" --signals "TT_FCNC_hut" --plot_type "%s" --plot_labels "Leptonic Channel|Preselection"' % (args.tag + "_FCNC", plot_type)) parallel_utils.run( 'python plot_wrapper.py --input_file "../ttHLeptonic_RunII_MVA_Presel_%s_histogramsRunII.root" --backgrounds "DiPhoton|GammaJets|TTGG|TTGJets|TTJets|VG|Other" --signals "TT_FCNC_hut|TT_FCNC_hct|ST_FCNC_hut|ST_FCNC_hct" --plot_type "%s" --plot_labels "Leptonic Channel|Preselection"' % (args.tag + "_FCNC", plot_type)) os.system( "mv ttHLeptonic_RunII_MVA_Presel_%s_FCNC_histogramsRunIIstd.pdf ttHLeptonic_RunII_MVA_Presel_%s_FCNC_histogramsRunIIstd_allsig.pdf" % (args.tag, args.tag)) parallel_utils.run( 'python plot_wrapper.py --input_file "../ttHLeptonic_RunII_MVA_Presel_%s_histogramsRunII.root" --backgrounds "DiPhoton|GammaJets|TTGG|TTGJets|TTJets|VG|Other" --signals "TT_FCNC_hut||ST_FCNC_hut|ttH" --plot_type "%s" --plot_labels ""' % (args.tag + "_FCNC", plot_type)) os.system( "mv ttHLeptonic_RunII_MVA_Presel_%s_FCNC_histogramsRunIIstd.pdf ttHLeptonic_RunII_MVA_Presel_%s_FCNC_histogramsRunIIstd_Hut.pdf"
# Leptonic #parallel_utils.run('python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_MVA_Presel" --bkg_options "none"' % (args.baby_version, args.tag)) #parallel_utils.run('python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_SR_Inclusive" --bkg_options "none"' % (args.baby_version, args.tag)) #parallel_utils.run('python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_SR_Tight" --bkg_options "none"' % (args.baby_version, args.tag)) #parallel_utils.run('python looper_wrapper.py --channel "Leptonic" --baby_version "%s" --tag "%s" --selection "ttHLeptonic_RunII_SR_Inclusive" --bkg_options "none" --babymaker --ttH_vs_tH' % (args.baby_version, args.tag)) # Prep os.chdir("../MVAs/") command_list = [] #command_list.append('python prep.py --channel "Hadronic" --input "../Loopers/MVABaby_ttHHadronic_%s.root" --ttH_vs_tH' % (args.tag)) #command_list.append('python prep_dnn.py --channel "Hadronic" --input "../Loopers/MVABaby_ttHHadronic_%s.root" --signal "ttH" --backgrounds "tH"' % (args.tag)) #command_list.append('python prep.py --channel "Leptonic" --input "../Loopers/MVABaby_ttHLeptonic_%s.root" --ttH_vs_tH' % (args.tag)) #command_list.append('python prep_dnn.py --channel "Leptonic" --input "../Loopers/MVABaby_ttHLeptonic_%s.root" --signal "ttH" --backgrounds "tH" --z_score --tag "%s"' % (args.tag, args.tag)) parallel_utils.submit_jobs(command_list, 4) # Train #parallel_utils.run('python train.py --input "ttHHadronic_%s_features.hdf5" --channel "Hadronic" --tag "ttH_vs_tH_%s" --ext ""' % (args.tag, args.tag)) #parallel_utils.run('python train_dnn.py --input "ttHHadronic_%s_dnn_features_.hdf5" --tag "ttHHadronic_ttH_vs_tH_%s" --channel "Hadronic"' % (args.tag, args.tag)) #parallel_utils.run('python train.py --input "ttHLeptonic_%s_features.hdf5" --channel "Leptonic" --tag "ttH_vs_tH_%s" --ext ""' % (args.tag, args.tag)) #parallel_utils.run('python train_dnn.py --input "ttHLeptonic_%s_dnn_features_%s.hdf5" --tag "ttHLeptonic_ttH_vs_tH_%s" --channel "Leptonic" --preprocess_scheme "preprocess_scheme_%s_%s.json"' % (args.tag, args.tag, args.tag, "Leptonic", args.tag), True) #parallel_utils.submit_jobs(command_list, 4) # Zip BDT/DNN score into final fit ntuple command_list = [] #command_list.append('python prep.py --channel "Leptonic" --input "../Loopers/MVABaby_ttHLeptonic_%s.root" --ttH_vs_tH --dnn_models "dnn_weights/metadata_Leptonic_ttHLeptonic_ttH_vs_tH_%s.json" --dont_train_with_dnn --tag "%s"' % (args.tag, args.tag, args.tag)) parallel_utils.submit_jobs(command_list, 4) parallel_utils.run( 'python train.py --input "ttHLeptonic_%s_features%s.hdf5" --channel "Leptonic" --tag "ttH_vs_tH_%s" --ext "" --reference_mva "dnn_weights/metadata_Leptonic_ttHLeptonic_ttH_vs_tH_%s.json" --reference_mva_name "ttH_vs_tH_DNN"' % (args.tag, args.tag, args.tag, args.tag))
bdt = "none" os.chdir("../") command_list = [] command_list.append( './ttHHadronicLooper "ttHHadronic_RunII_DiPhotonFits_Presel" "RunII" "%s" "%s" "none"' % (args.tag + "prefit", bdt)) command_list.append( './ttHHadronicLooper "ttHHadronic_RunII_MVA_Presel" "RunII" "%s" "%s" "none"' % (args.tag + "prefit", bdt)) parallel_utils.submit_jobs(command_list, 2) os.chdir("tt_template_fit") parallel_utils.run( 'python do_fits_qcd.py --input_file "../ttHHadronic_RunII_DiPhotonFits_Presel_%s_histogramsRunII.root" --jet_bin "2+"' % (args.tag + "prefit")) os.chdir("../") dummy_input = raw_input( "You probably want to update ttHLooper.h with results of DiPhoton Fits. Press any key to continue" ) command_list = [] command_list.append( './ttHHadronicLooper "ttHHadronic_RunII_DiPhotonFits_Presel" "RunII" "%s" "%s" "scale_diphoton"' % (args.tag, bdt)) command_list.append( './ttHHadronicLooper "ttHHadronic_RunII_MVA_Presel" "RunII" "%s" "%s" "scale_diphoton"' % (args.tag, bdt)) parallel_utils.submit_jobs(command_list, 2)