# Scale the histograms by the luminosity taken by CMS in each year if args.year == 2016: lumi_scale = 35.92 elif args.year == 2017: lumi_scale = 41.53 elif args.year == 2018: lumi_scale = 59.74 # add all samples to the Stack stack = Stack(mc) else: # Data Sample definition # define the name on the plot postFix = " (%s)" % args.mode.replace("mu", "#mu").replace("all", "e+#mu") data_sample.texName = "data" + postFix data_sample.name = "data" # add here variables that should be read only for Data samples data_sample.read_variables = read_variables_Data # set additional cuts specific for data data_sample.setSelectionString([filterCutData, "triggered==1"]) # change the style of the data sample (dots with error bars) data_sample.style = styles.errorStyle(ROOT.kBlack) # you can scale the histograms of each sample by defining sample.scale (don't scale data) data_sample.scale = 1 # Scale the MC histograms by the luminosity taken by CMS in each year lumi_scale = data_sample.lumi * 0.001 # add all samples to the Stack stack = Stack(mc, data_sample) # settings for MC Samples for sample in mc: # add here variables that should be read only for MC samples sample.read_variables = read_variables_MC # set additional cuts specific for MC # overlapremoval for separating samples with and without a photon (e.g. ttbar from ttgamma)
# Sample definition os.environ["gammaSkim"] = "False" #always false for QCD estimate if args.year == 2016: from TTGammaEFT.Samples.nanoTuples_Run2016_14Dec2018_semilep_postProcessed import Run2016 as data_sample elif args.year == 2017: from TTGammaEFT.Samples.nanoTuples_Run2017_14Dec2018_semilep_postProcessed import Run2017 as data_sample elif args.year == 2018: from TTGammaEFT.Samples.nanoTuples_Run2018_14Dec2018_semilep_postProcessed import Run2018 as data_sample elif args.year == "RunII": from TTGammaEFT.Samples.nanoTuples_RunII_postProcessed import RunII as data_sample filterCutData = getFilterCut(args.year, isData=True, skipBadChargedCandidate=True) data_sample.setSelectionString([filterCutData, "reweightHEM>0"]) data_sample.setWeightString("weight") lumi_scale = data_sample.lumi * 0.001 replaceSelection = { # "nLeptonVetoIsoCorr": "nLeptonVetoNoIso", "nLeptonTight": "nLeptonTightInvIso", "nMuonTight": "nMuonTightInvIso", "nElectronTight": "nElectronTightInvIso", "mLtight0Gamma": "mLinvtight0Gamma", "nPhotonGood": "nPhotonGoodInvLepIso", "nJetGood": "nJetGoodInvLepIso", "nBTagGood": "nBTagGoodInvLepIso", "mT": "mTinv", "m3": "m3inv", "LeptonTight0": "LeptonTightInvIso0",
# add all samples to the Stack stack = Stack(mc) else: # Data Sample definition # mc samples are defined in TTGammaEFT/Samples/python/nanoTuples_Run201X_14Dec2018_semilep_postProcessed.py if args.year == 2016: data_sample = Run2016 elif args.year == 2017: data_sample = Run2017 elif args.year == 2018: data_sample = Run2018 # define the name on the plot postFix = " (%s)" % args.mode.replace("mu", "#mu").replace("all", "e+#mu") data_sample.texName = "data" + postFix data_sample.name = "data" # add here variables that should be read only for Data samples data_sample.read_variables = read_variables_Data # set additional cuts specific for data data_sample.setSelectionString([filterCutData]) # change the style of the data sample (dots with error bars) data_sample.style = styles.errorStyle(ROOT.kBlack) # you can scale the histograms of each sample by defining sample.scale (don't scale data) data_sample.scale = 1 # Scale the MC histograms by the luminosity taken by CMS in each year lumi_scale = data_sample.lumi * 0.001 # add all samples to the Stack stack = Stack(mc, data_sample) # settings for MC Samples for sample in mc: # add here variables that should be read only for MC samples sample.read_variables = read_variables_MC # set additional cuts specific for MC # overlapremoval for separating samples with and without a photon (e.g. ttbar from ttgamma)
logger.info("Computing plots for mode %s", mode) yields[mode] = {} # always initialize with [], elso you get in trouble with pythons references! plots = [] plots += addPlots # Define 2l selections leptonSelection = cutInterpreter.cutString(mode) if args.sideband == "chgIso": data_sample.texName = "data (%s) chg Iso fit region" % mode.replace( "mu", "#mu").replace("all", "e+#mu") data_sample.setSelectionString([ cutInterpreter.cutString("lowChgIsoNoSieie"), filterCutData, leptonSelection, "triggered==1" ]) mc_fit.setSelectionString( [cutInterpreter.cutString("lowChgIsoNoSieie"), leptonSelection] + mcSelection) mc_sb.setSelectionString( [cutInterpreter.cutString("highChgIsoNoSieie"), leptonSelection] + mcSelection) elif args.sideband == "sieie": data_sample.texName = "data (%s) #sigma_{i#eta i#eta} fit region" % mode.replace( "mu", "#mu").replace("all", "e+#mu") data_sample.setSelectionString([ cutInterpreter.cutString("lowSieieNoChgIso"), filterCutData, leptonSelection, "triggered==1" ]) mc_fit.setSelectionString(