# define a base event selection which is applied for all Samples # select only events with GEN weight > 0 because training with negative weights is weird base = "(N_Jets >= 4 and N_BTagsM >= 3 and Evt_MET_Pt > 20. and Weight_GEN_nom > 0.)" # single lepton selections single_mu_sel = "(N_LooseElectrons == 0 and N_TightMuons == 1 and Muon_Pt > 29. and Triggered_HLT_IsoMu27_vX == 1)" single_el_sel = "(N_LooseMuons == 0 and N_TightElectrons == 1 and (Triggered_HLT_Ele35_WPTight_Gsf_vX == 1 or Triggered_HLT_Ele28_eta2p1_WPTight_Gsf_HT150_vX == 1))" base_selection = "("+base+" and ("+single_mu_sel+" or "+single_el_sel+"))" ttH_selection = "(Evt_Odd == 1)" ttbb_selection = "(Evt_Odd == 1)" # define output classes ttH_categories = root2pandas.EventCategories() ttH_categories.addCategory("ttH", selection = None) ttlf_categories = root2pandas.EventCategories() ttlf_categories.addCategory("ttlf", selection = "(GenEvt_I_TTPlusBB == 0 and GenEvt_I_TTPlusCC == 0)") ttlf_categories.addCategory("ttcc", selection = "(GenEvt_I_TTPlusBB == 0 and GenEvt_I_TTPlusCC == 1)") ttbb_categories = root2pandas.EventCategories() ttbb_categories.addCategory("ttbb", selection = "(GenEvt_I_TTPlusBB == 3 and GenEvt_I_TTPlusCC == 0)") ttbb_categories.addCategory("tt2b", selection = "(GenEvt_I_TTPlusBB == 2 and GenEvt_I_TTPlusCC == 0)") ttbb_categories.addCategory("ttb", selection = "(GenEvt_I_TTPlusBB == 1 and GenEvt_I_TTPlusCC == 0)") ttbb_categories.addCategory("ttb_bb", selection = "(GenEvt_I_TTPlusBB == 3 and GenEvt_I_TTPlusCC == 0) or \ (GenEvt_I_TTPlusBB == 1 and GenEvt_I_TTPlusCC == 0)") ttbb_categories.addCategory("tthf", selection = "(GenEvt_I_TTPlusBB == 3 and GenEvt_I_TTPlusCC == 0) or \
ttbar_selection = "(\ abs(Weight_scale_variation_muR_0p5_muF_0p5) <= 100 and \ abs(Weight_scale_variation_muR_0p5_muF_1p0) <= 100 and \ abs(Weight_scale_variation_muR_0p5_muF_2p0) <= 100 and \ abs(Weight_scale_variation_muR_1p0_muF_0p5) <= 100 and \ abs(Weight_scale_variation_muR_1p0_muF_1p0) <= 100 and \ abs(Weight_scale_variation_muR_1p0_muF_2p0) <= 100 and \ abs(Weight_scale_variation_muR_2p0_muF_0p5) <= 100 and \ abs(Weight_scale_variation_muR_2p0_muF_1p0) <= 100 and \ abs(Weight_scale_variation_muR_2p0_muF_2p0) <= 100 \ )" ttH_selection = "(Evt_Odd == 1)" # define output classes ttH_categories = root2pandas.EventCategories() ttH_categories.addCategory("ttHbb", selection=None) ttbar_categories = root2pandas.EventCategories() ttbar_categories.addCategory( "ttbb", selection="(GenEvt_I_TTPlusBB == 3 and GenEvt_I_TTPlusCC == 0)") ttbar_categories.addCategory( "tt2b", selection="(GenEvt_I_TTPlusBB == 2 and GenEvt_I_TTPlusCC == 0)") ttbar_categories.addCategory( "ttb", selection="(GenEvt_I_TTPlusBB == 1 and GenEvt_I_TTPlusCC == 0)") ttbar_categories.addCategory( "ttlf", selection="(GenEvt_I_TTPlusBB == 0 and GenEvt_I_TTPlusCC == 0)") ttbar_categories.addCategory( "ttcc", selection="(GenEvt_I_TTPlusBB == 0 and GenEvt_I_TTPlusCC == 1)") # initialize dataset class
# initialize dataset class dataset = root2pandas.Dataset( outputdir=outputdir, naming=options.Name, addMEM=options.MEM, maxEntries=options.maxEntries, tree=options.treeName, varName_Run="runNumber", varName_LumiBlock="lumiBlock", varName_Event="eventNumber", ) ntuplesPath = "/nfs/dust/cms/user/missirol/sandbox/ttHbb/output_190914_DeepJet/2016/exe1/selectionRoot_reco_liteTreeTTH/Nominal" ttH_categories = root2pandas.EventCategories() ttH_categories.addCategory("ttH", selection=None) ttbar_categories = root2pandas.EventCategories() ttbar_categories.addCategory("ttbar", selection=None) ttbar_bb_categories = root2pandas.EventCategories() ttbar_bb_categories.addCategory("ttbb", selection=None) ttbar_b_categories = root2pandas.EventCategories() ttbar_b_categories.addCategory("ttb", selection=None) ttbar_2b_categories = root2pandas.EventCategories() ttbar_2b_categories.addCategory("tt2b", selection=None) ttbar_cc_categories = root2pandas.EventCategories()
if not os.path.isabs(options.outputDir): outputdir = basedir + "/workdir/" + options.outputDir elif os.path.exists(options.outputDir) or os.path.exists( os.path.dirname(options.outputDir)): outputdir = options.outputDir else: sys.exit("ERROR: Output Directory does not exist!") # define a base event selection which is applied for all Samples # select only events with GEN weight > 0 because training with negative weights is weird base = "(N_Jets >= 4 and N_BTagsM >= 3 and ttbbReco_matchable > 0.)" base_selection = "(" + base + ")" # define output classes sig_categories = root2pandas.EventCategories() sig_categories.addCategory("sig", selection=None) bkg_categories = root2pandas.EventCategories() bkg_categories.addCategory("bkg", selection=None) # initialize dataset class dataset = root2pandas.Dataset(outputdir=outputdir, naming=options.Name, addMEM=options.MEM, maxEntries=options.maxEntries, ttbarReco=options.ttbarReco, ncores=options.ncores) # add base event selection dataset.addBaseSelection(base_selection)
outputdir = outputdir, naming = options.Name, addMEM = options.MEM, maxEntries = options.maxEntries, tree = options.treeName, varName_Run = "runNumber", varName_LumiBlock = "lumiBlock", varName_Event = "eventNumber", ) # add base event selection dataset.addBaseSelection(base_selection) ntuplesPath = "/nfs/dust/cms/user/missirol/sandbox/ttHbb/output_190914_DeepJet/2017/exe1/selectionRoot_reco_liteTreeTTH/Nominal" ttH_categories = root2pandas.EventCategories() ttH_categories.addCategory("ttH", selection = None) ttbar_categories = root2pandas.EventCategories() ttbar_categories.addCategory("ttbar") ttbar_bb = root2pandas.EventCategories() ttbar_bb.addCategory("ttbb") ttbar_b = root2pandas.EventCategories() ttbar_b.addCategory("ttb") ttbar_2b = root2pandas.EventCategories() ttbar_2b.addCategory("tt2b") ttbar_cc = root2pandas.EventCategories()
basedir = os.path.dirname(os.path.dirname(filedir)) sys.path.append(basedir) import root2pandas import variable_sets.ntuplesVariablesWithIndex as variable_set # define a base event selection which is applied for all Samples base_selection = "(\ (N_LooseMuons == 0 and N_TightElectrons == 1) \ or \ (N_LooseElectrons == 0 and N_TightMuons == 1) \ )" categories = root2pandas.EventCategories() categories.addCategory("ttbar", selection = None) # initialize dataset class dataset = root2pandas.Dataset( outputdir = "/nfs/dust/cms/user/vdlinden/DNNInputFiles/ttbarMatcher/", naming = "input", addCNNmap = False, addMEM = False, maxEntries = 200000) # add base event selection dataset.addBaseSelection(base_selection) # add samples to dataset dataset.addSample(
single_el_sel_16 = "(N_LooseMuons == 0 and N_TightElectrons == 1 and Triggered_HLT_Ele27_WPTight_Gsf_vX == 1)" trigger_sel_16 = "(" + single_mu_sel_16 + " or " + single_el_sel_16 + ")" single_mu_sel_17 = "(N_LooseElectrons == 0 and N_TightMuons == 1 and Triggered_HLT_IsoMu27_vX == 1)" single_el_sel_17 = "(N_LooseMuons == 0 and N_TightElectrons == 1 and (Triggered_HLT_Ele28_eta2p1_WPTight_Gsf_HT150_vX == 1 or ( Triggered_HLT_Ele32_WPTight_Gsf_L1DoubleEG_vX == 1 and Triggered_HLT_Ele32_WPTight_Gsf_2017SeedsX == 1 )))" trigger_sel_17 = "(" + single_mu_sel_17 + " or " + single_el_sel_17 + ")" single_mu_sel_18 = "(N_LooseElectrons == 0 and N_TightMuons == 1 and Triggered_HLT_IsoMu24_vX == 1)" single_el_sel_18 = "(N_LooseMuons == 0 and N_TightElectrons == 1 and (Triggered_HLT_Ele28_eta2p1_WPTight_Gsf_HT150_vX == 1 or Triggered_HLT_Ele32_WPTight_Gsf_vX == 1))" trigger_sel_18 = "(" + single_mu_sel_18 + " or " + single_el_sel_18 + ")" # define output classes STXS_Stage0 = "abs(GenHiggs_Eta) < 2.5" # define output classes ttH_categories = root2pandas.EventCategories() ttH_categories.addCategory("ttH", selection=None) ttH_categories.addCategory("ttHbb", selection="(matchH_ft_RecoHiggs_matchable > 0.)") ttH_categories.addCategory("ttHnonbb", selection="(matchH_ft_RecoHiggs_matchable <= 0.)") ttH_categories.addCategory("ttH_STXS_0", selection=STXS_Stage0 + " and GenHiggs_Pt >= 0 and GenHiggs_Pt < 60") ttH_categories.addCategory("ttH_STXS_1", selection=STXS_Stage0 + " and GenHiggs_Pt >= 60 and GenHiggs_Pt < 120") ttH_categories.addCategory("ttH_STXS_2", selection=STXS_Stage0 + " and GenHiggs_Pt >= 120 and GenHiggs_Pt < 200")