allModes = ['mumu'] for index, mode in enumerate(allModes): lumi_scale = 35.9 weight_ = lambda event, sample: event.weight for sample in mc: sample.style = styles.fillStyle(sample.color) for sample in mc: sample.scale = lumi_scale sample.read_variables = ['puWeight/F', 'Pileup_nTrueInt/F'] sample.weight = lambda event, sample: event.puWeight sample.setSelectionString([ getFilterCut(isData=False, year=year), getLeptonSelection(mode), "(%s)" % "||".join(triggers) ]) stack = Stack(mc) if args.small: for sample in stack.samples: sample.normalization = 1. sample.reduceFiles(factor=40) sample.scale /= sample.normalization #sample.reduceFiles( to = 3 ) if args.verySmall: for sample in stack.samples: sample.normalization = 1.
yields = {} allPlots = {} allModes = ['mumu'] for index, mode in enumerate(allModes): lumi_scale = 35.9 weight_ = lambda event, sample: event.weight for sample in mc: sample.style = styles.fillStyle(sample.color) for sample in mc: sample.scale = lumi_scale sample.read_variables = ['puWeight/F','Pileup_nTrueInt/F'] sample.weight = lambda event, sample: event.puWeight sample.setSelectionString([getFilterCut(isData=False, year=year), getLeptonSelection(mode), "(%s)"%"||".join(triggers)]) stack = Stack(mc) if args.small: for sample in stack.samples: sample.normalization=1. sample.reduceFiles( factor=40 ) sample.scale /= sample.normalization #sample.reduceFiles( to = 3 ) if args.verySmall: for sample in stack.samples: sample.normalization=1. sample.reduceFiles( to = 1 ) sample.scale /= sample.normalization
jer = "Summer16_25nsV1_MC" METPtVar = "MET_pt_nom" METPhiVar = "MET_phi_nom" JetCollection = "Jet_pt_nom" vetoEtaRegion = (10., 10.) minimize = True ttbarModifier = 1 maxSig = 25 jetThreshold = 15 pTdepMetSig = False # calculate setting preselection = cutInterpreter.cutString(selection) triggerSel = "(%s)" % "||".join( ["Alt$(%s,0)" % trigg for trigg in trigger]) eventfilter = getFilterCut(2016, isData=False) sel = "&&".join([preselection, triggerSel, eventfilter]) JR = JetResolution(jer) version = postProcessing_directory.split("/")[0] outfile = "results/test_tune_%s_%s_puWeight_sumPt%i_max%i_ttbar%i_%s" % ( jer, selection, jetThreshold, maxSig, ttbarModifier, version) r = run(samples, sel, JR, outfile=outfile, maxN=3e5, METPtVar=METPtVar, METPhiVar=METPhiVar, JetCollection=JetCollection, vetoEtaRegion=vetoEtaRegion,
JetCollection = "Jet_pt_nom" vetoEtaRegion = (10., 10.) if args.runData: from nanoMET.samples.nanoTuples_Run2018_17Sep2018_postProcessed import * samples = [DoubleMuon_Run2018] jer = "Autumn18_V7b_DATA" else: from nanoMET.samples.nanoTuples_Autumn18_postProcessed import * samples = [DY_LO_18, Top_18, diboson_18, rare_18] jer = "Autumn18_V7b_MC" # calculate setting preselection = cutInterpreter.cutString(args.selection) triggerSel = "(%s)" % "||".join(trigger) eventfilter = getFilterCut(args.year, isData=args.runData) sel = "&&".join([preselection, triggerSel, eventfilter]) JR = JetResolution(jer) version = postProcessing_directory.split("/")[0] outfile = "results/tune_%s_%i_%s_%s_sumPt%i_max%i" % ( "DATA" if args.runData else "MC", args.year, jer, args.selection, args.jetThreshold, args.maxSig) if args.addon: outfile += "_" + str(args.addon) if args.pTdependent: outfile += "_pTdep" outfile += "_" + version # run r = run(samples, sel,
if args.calcMETSig: sequence += [ calcMETSig ] sequence += [getNJet] if year == 2017: sequence += [ getMET_neEmEBalace, getSoftJetWeight ] # Loop over channels yields = {} allPlots = {} allModes = ['mumu'] for index, mode in enumerate(allModes): yields[mode] = {} if mode=="mumu": data_sample.texName = "data (2 #mu)" data_selectionString = '&&'.join([getFilterCut(isData=True, year=year), "(%s)"%"||".join(trigger)]) # maybe add singleMu backup data_sample.setSelectionString([data_selectionString]) data_sample.scale = 1 if mode=="mumu": data_sample.texName = "data (2 #mu)" data_sample.name = "data" data_sample.read_variables = ["event/I","run/I"]#,"jsonPassed/I"] data_sample.style = styles.errorStyle(ROOT.kBlack) lumi_scale = data_sample.lumi/1000 if args.noData: lumi_scale = 35.9 weight_ = lambda event, sample: event.weight #weightJetEn = lambda event, sample: event.Jet_pt*
read_variables = [ "weight/F", "Jet[pt/F,eta/F,phi/F,pt_nom/F]", "MET_pt/F", "MET_phi/F", "MET_pt_nom/F", "MET_phi_nom/F" ] sequence = [] # Loop over channels allPlots = {} allModes = ['mumu'] for index, mode in enumerate(allModes): logger.info("Modes") logger.info('Working on mode ' + str(mode)) data_selectionString = '&&'.join([ getFilterCut(isData=True, year=args.year), "(%s)" % "||".join(triggers) ]) data_sample.setSelectionString([data_selectionString]) data_sample.scale = 1 lumi_scale = data_sample.lumi / 1000 data_sample.texName = "data" data_sample.read_variables = ['weight/F'] data_sample.style = styles.errorStyle(ROOT.kBlack) data_weight = lambda event, sample: event.weight data_weight_string = "weight" logger.info('Lumi scale is ' + str(lumi_scale))