def getDataSample(pd, runName, lumi, dirs, redirector=None, fromDPM=True): if fromDPM: sample = Sample.fromDPMDirectory(name=(pd + '_' + runName), treeName="Events", redirector=redirector, texName=(pd + ' (' + runName + ')'), directory=dirs[pd + '_' + runName], noCheckProxy=True) else: sample = Sample.fromDirectory(name=(pd + '_' + runName), treeName="Events", texName=(pd + ' (' + runName + ')'), directory=dirs[pd + '_' + runName]) sample.lumi = lumi return sample
def getSample(pd, runName, lumi): sample = Sample.fromDirectory(name=(pd + '_' + runName), treeName="Events", texName=(pd + ' (' + runName + ')'), directory=dirs[pd + '_' + runName]) sample.lumi = lumi return sample
def fromHeppySample(sample, data_path, module = None, maxN = None): ''' Load CMG tuple from local directory ''' from RootTools.core.Sample import Sample import importlib if module is not None: module_ = module elif "Run2016" in sample: module_ = 'CMGTools.RootTools.samples.samples_13TeV_DATA2016' elif "T2tt" in sample: module_ = 'CMGTools.RootTools.samples.samples_13TeV_signals' else: module_ = 'CMGTools.RootTools.samples.samples_13TeV_RunIISpring16MiniAODv2' try: heppy_sample = getattr(importlib.import_module( module_ ), sample) except: raise ValueError( "Could not load sample '%s' from %s "%( sample, module_ ) ) # helpers subDir = getSubDir(heppy_sample.dataset, data_path) if not subDir: raise ValueError( "Not a good dataset name: '%s'"%heppy_sample.dataset ) path = os.path.join( data_path, subDir ) sample = Sample.fromCMGOutput( heppy_sample.name, path, treeFilename = 'tree.root', treeName = 'tree', isData = heppy_sample.isData, maxN = maxN) sample.heppy = heppy_sample return sample
def getSample(base, pd, runName, lumi): sample = Sample.fromDirectory(name=(pd + '_' + runName), treeName="Events", texName=(pd + ' (' + runName + ')'), directory=map( lambda d: os.path.join(base, d), dirs[pd + '_' + runName])) sample.lumi = lumi return sample
def getMCSample(name, texName, directory, redirector=None, color=None, noCheckProxy=True, fromDPM=True): if fromDPM: sample = Sample.fromDPMDirectory(name=name, isData=False, color=color, treeName="Events", redirector=redirector, texName=texName, directory=directory, noCheckProxy=noCheckProxy) else: sample = Sample.fromDirectory(name=name, isData=False, color=color, treeName="Events", texName=texName, directory=directory) return sample
def deepCheckWeight(file): """ some root files only contain the branches kept from the beginning but not those from the filler, e.g. the weight branch Those files are identified here, as weight==nan and thus the yield is nan """ from math import isnan from RootTools.core.Sample import Sample # convert dpm file pathes sample = Sample.fromFiles(name="sample", treeName="Events", files=file) # check for branch: l = sample.chain.GetListOfBranches() if not 'weight' in [l.At(i).GetName() for i in range(l.GetSize())]: return 0 val = sample.getYieldFromDraw(weightString="weight")['val'] del sample #logger.debug("Val in deepCheckWeight: %r", val) return not isnan(val)
#dirs['WJets_LO'] = ['WJetsToLNu_LO'] #dirs['WJets'] = ['WJetsToLNu'] #dirs['pseudoData'] = dirs['TTZtoLLNuNu'] + dirs["WZ"] + dirs['TTW'] + dirs['TTX'] + dirs['TZQ'] + dirs['rare'] + dirs['nonprompt'] #dirs['pseudoDataPriv'] = dirs['ewkDM_ttZ_ll_noH'] + dirs["WZ"] + dirs['TTW'] + dirs['TTX'] + dirs['TZQ'] + dirs['rare'] + dirs['nonprompt'] #dirs['background'] = dirs["WZ"] + dirs['TTW'] + dirs['TTX'] + dirs['TZQ'] + dirs['rare'] #dirs['nonprompt'] = ['DYJetsToLL_M50', 'TTJets'] # no v4 version atm directories = { key : [ os.path.join( data_directory, postProcessing_directory, dir) for dir in dirs[key]] for key in dirs.keys()} #pseudoData = Sample.fromDirectory(name="pseudoData", treeName="Events", isData=False, color=ROOT.kBlack, texName="pseudo-data", directory=directories['pseudoData']) #pseudoDataPriv = Sample.fromDirectory(name="pseudoDataPriv", treeName="Events", isData=False, color=ROOT.kBlack, texName="pseudo-data", directory=directories['pseudoDataPriv']) #TTZtoLLNuNu = Sample.fromDirectory(name="TTZtoLLNuNu", treeName="Events", isData=False, color=color.TTZtoLLNuNu, texName="t#bar{t}Z (l#bar{l}/#nu#bar{#nu})", directory=directories['TTZtoLLNuNu']) #TTZ_LO = Sample.fromDirectory(name="TTZ_LO", treeName="Events", isData=False, color=color.TTZtoLLNuNu+1, texName="t#bar{t}Z (LO)", directory=directories['TTZ_LO']) DY_LO = Sample.fromDirectory(name="DY_LO", treeName="Events", isData=False, color=color.DY, texName="DYToLL (LO)", directory=directories['DY_LO']) WZ = Sample.fromDirectory(name="WZ", treeName="Events", isData=False, color=color.WZ, texName="WZ", directory=directories['WZ']) WW = Sample.fromDirectory(name="WW", treeName="Events", isData=False, color=color.WW, texName="WW", directory=directories['WW']) ZZ = Sample.fromDirectory(name="ZZ", treeName="Events", isData=False, color=color.ZZ, texName="ZZ", directory=directories['ZZ']) #WJets_LO = Sample.fromDirectory(name="WJets_LO", treeName="Events", isData=False, color=color.WJetsToLNu, texName="W+jets (LO)", directory=directories['WJets_LO']) #WJets = Sample.fromDirectory(name="WJets", treeName="Events", isData=False, color=color.WJetsToLNu+2, texName="W+jets (NLO)", directory=directories['WJets']) #TTX = Sample.fromDirectory(name="TTX", treeName="Events", isData=False, color=ROOT.kRed-10, texName="t(t)X", directory=directories['TTX']) #TTW = Sample.fromDirectory(name="TTW", treeName="Events", isData=False, color=color.TTX, texName="t#bar{t}W", directory=directories['TTW']) #TZQ = Sample.fromDirectory(name="TZQ", treeName="Events", isData=False, color=ROOT.kOrange+7, texName="tZq", directory=directories['TZQ']) #rare = Sample.fromDirectory(name="rare", treeName="Events", isData=False, color=color.rare, texName="rare", directory=directories['rare']) nonprompt = Sample.fromDirectory(name="nonprompt", treeName="Events", isData=False, color=color.nonprompt, texName="nonprompt", directory=directories['nonprompt']) TT_pow = Sample.fromDirectory(name="TTLep_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TT_pow']) #background = Sample.fromDirectory(name="background", treeName="Events", isData=False, color=color.nonprompt, texName="background", directory=directories['background'])
else: import logging logger = logging.getLogger(__name__) ov = False from Samples.Tools.config import dbDir, redirector, redirector_global dbFile = dbDir + "DB_Run2017_31Mar2018_private.sql" logger.info("Using db file: %s", dbFile) # DoubleMuon DoubleMuon_Run2017B_31Mar2018 = Sample.nanoAODfromDAS( "DoubleMuon_Run2017B_31Mar2018", "/DoubleMuon/schoef-crab_Run2017B-31Mar2018-v1_legacy_nano_v4-ef59f0c1717f190a6e4b4df4955a4722/USER", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov) DoubleMuon_Run2017C_31Mar2018 = Sample.nanoAODfromDAS( "DoubleMuon_Run2017C_31Mar2018", "/DoubleMuon/schoef-crab_Run2017C-31Mar2018-v1_legacy_nano_v4-ef59f0c1717f190a6e4b4df4955a4722/USER", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov) DoubleMuon_Run2017D_31Mar2018 = Sample.nanoAODfromDAS( "DoubleMuon_Run2017D_31Mar2018", "/DoubleMuon/schoef-crab_Run2017D-31Mar2018-v1_legacy_nano_v4-ef59f0c1717f190a6e4b4df4955a4722/USER", dbFile=dbFile, redirector=redirector,
def __init__(self, heppy_samples, dpm_directories, cache_file, multithreading=True): # Read cache file, if exists if os.path.exists(cache_file) and not overwrite: self.sample_map = pickle.load(file(cache_file)) logger.info("Loaded cache file %s" % cache_file) else: logger.info("Cache file %s not found. Recreate map.", cache_file) logger.info("Check proxy.") # Proxy certificate from RootTools.core.helpers import renew_proxy # Make proxy in afs to allow batch jobs to run proxy_path = os.path.expandvars('$HOME/private/.proxy') proxy = renew_proxy(proxy_path) logger.info("Using proxy %s" % proxy) # Read dpm directories self.cmg_directories = {} for data_path in dpm_directories: logger.info("Walking dpm directory %s", data_path) walker = walk_dpm(data_path) self.cmg_directories[ data_path] = walker.walk_dpm_cmgdirectories('.', maxN=maxN) #del walker logger.info("Now mapping directories to heppy samples") for heppy_sample in heppy_samples: heppy_sample.candidate_directories = [] pd, era = heppy_sample.dataset.split('/')[1:3] for data_path in self.cmg_directories.keys(): for dpm_directory in self.cmg_directories[data_path].keys( ): if not ('/%s/' % pd in dpm_directory): logger.debug("/%s/ not in dpm_directory %s", pd, dpm_directory) continue if not ('/' + era in dpm_directory): logger.debug("/%s not in dpm_directory %s", era, dpm_directory) continue heppy_sample.candidate_directories.append( [data_path, dpm_directory]) logger.debug("heppy sample %s in %s", heppy_sample.name, dpm_directory) logger.info("Found heppy sample %s in %i directories.", heppy_sample.name, len(heppy_sample.candidate_directories)) # Merge from RootTools.core.Sample import Sample logger.info( "Now making new sample map from %i directories and for %i heppy samples to be stored in %s", len(dpm_directories), len(heppy_samples), cache_file) self.sample_map = {} for heppy_sample in heppy_samples: if len(heppy_sample.candidate_directories) == 0: logger.info("No directory found for %s", heppy_sample.name) else: normalization, files = walker.combine_cmg_directories(\ cmg_directories = {dpm_directory:self.cmg_directories[data_path][dpm_directory] for data_path, dpm_directory in heppy_sample.candidate_directories }, multithreading = multithreading, ) logger.info( "Sample %s: Found a total of %i files with normalization %3.2f", heppy_sample.name, len(files), normalization) tmp_files = [] for f in files: isGoodFile = False try: isGoodFile = checkRootFile( "root://hephyse.oeaw.ac.at/" + os.path.join(f)) logger.debug("File %s got added", f) except IOError: logger.info("File %s is corrupted, skipping", f) if isGoodFile: tmp_files.append(f) self.sample_map[heppy_sample] = Sample.fromFiles( heppy_sample.name, files=[ 'root://hephyse.oeaw.ac.at/' + f for f in tmp_files ], normalization=normalization, treeName='tree', isData=heppy_sample.isData, maxN=maxN) logger.info( "Combined %i directories for sample %s to a total of %i files with normalization %3.2f", len(heppy_sample.candidate_directories), heppy_sample.name, len(files), normalization) # Store cache file dir_name = os.path.dirname(cache_file) if len(self.sample_map.keys()) > 0: if not os.path.exists(dir_name): os.makedirs(dir_name) pickle.dump(self.sample_map, file(cache_file, 'w')) logger.info("Created MC sample cache %s", cache_file) else: logger.info("Skipping to write %s because map is empty.", cache_file)
dirs = {} for (run, version) in [('B', '_ver2'), ('C', ''), ('D', ''), ('E', ''), ('F', ''), ('G', ''), ('H', '')]: runTag = 'Run2016' + run + '_05Feb2018' + version for pd in allSamples: dirs[pd + "_Run2016" + run + version] = [pd + "_" + runTag] for pd in allSamples: merge(pd, 'Run2016BCD', ['Run2016B_ver2', 'Run2016C', 'Run2016D'], dirs) merge(pd, 'Run2016BCDEFG', ['Run2016BCD', 'Run2016E', 'Run2016F', 'Run2016G'], dirs) merge(pd, 'Run2016', ['Run2016BCDEFG', 'Run2016H'], dirs) for key in dirs: dirs[key] = [ os.path.join(data_directory, postprocessing_datadirectory2016, dir) for dir in dirs[key] ] allSamples_Data25ns = [] for pd in allSamples: vars()[pd + '_Run2016'] = getSample(pd, 'Run2016', lumi * 1000, dirs) allSamples_Data25ns += [vars()[pd + '_Run2016']] Run2016 = Sample.combine("Run2016", allSamples_Data25ns, texName="Data") Run2016.lumi = lumi * 1000 for s in allSamples_Data25ns: s.color = ROOT.kBlack s.isData = True
#dirs['WZ'] = ["WZTo1L3Nu", "WZTo1L1Nu2Q", "WZTo2L2Q", "WZTo3LNu"] #dirs['ZZ'] = ["ZZTo2L2Nu", "ZZTo2L2Q"] #dirs['ZZ'] = ["ZZTo2L2Nu", "ZZTo2L2Q", "ZZTo2Q2Nu", "ZZTo4L"] #dirs['GluGlu'] = ["GluGluToContinToZZTo2e2mu", "GluGluToContinToZZTo2e2tau", "GluGluToContinToZZTo2mu2tau", "GluGluToContinToZZTo4e", "GluGluToContinToZZTo4mu", "GluGluToContinToZZTo4tau"] dirs['GluGlu'] = ["GluGluToContinToZZTo2e2mu", "GluGluToContinToZZTo2e2tau"] dirs['other'] = [] #dirs['other'] += dirs['TZQ'] + dirs['THQ'] + dirs['THW'] #+ dirs['TWZ'] #dirs['other'] += dirs['TTW'] + dirs['TTZ'] + dirs['TTH'] #dirs['other'] += dirs['TTWZ'] + dirs['TTZZ'] + dirs['TTWW'] #dirs['other'] += dirs['WWW'] + dirs['WWZ'] + dirs['WZG'] + dirs['WZZ'] + dirs['ZZZ'] #dirs['other'] += dirs['VV'] + dirs['WW'] + dirs['WZ'] + dirs['ZZ'] dirs['other'] += dirs['WW'] dirs['other'] += dirs['GluGlu'] directories = { key : [ os.path.join( data_directory, postprocessing_directory2018, dir) for dir in dirs[key] ] for key in dirs.keys() } # Samples DY_LO_18 = Sample.fromDirectory(name="DY_LO", treeName="Events", isData=False, color=color.DY, texName="DY (LO)", directory=directories['DY_LO']) TT_pow_18 = Sample.fromDirectory(name="TTLep_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TTLep_pow']) #TTbar_18 = Sample.fromDirectory(name="TTbar", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TTbar']) #singleTop_18 = Sample.fromDirectory(name="singleTop", treeName="Events", isData=False, color=color.singleTop, texName="single-t", directory=directories['singleTop']) #TTGLep_18 = Sample.fromDirectory(name="TTGLep", treeName="Events", isData=False, color=color.TTG, texName="t#bar{t}#gamma", directory=directories['TTGLep']) #TTG_18 = Sample.fromDirectory(name="TTGLep", treeName="Events", isData=False, color=color.TTG, texName="t#bar{t}#gamma", directory=directories['TTG']) #ZGTo2LG_18 = Sample.fromDirectory(name="ZGTo2LG", treeName="Events", isData=False, color=color.diBoson, texName="Z#gamma", directory=directories['ZGTo2LG'] ) #ZGToLLG_18 = Sample.fromDirectory(name="ZGToLLG", treeName="Events", isData=False, color=color.diBoson, texName="Z#gamma", directory=directories['ZGToLLG'] ) other_18 = Sample.fromDirectory(name="other", treeName="Events", isData=False, color=color.other, texName="other", directory=directories['other']) signals = []
ov = False # Redirector from nanoMET.tools.user import redirector_global as redirector # DB from nanoMET.tools.user import dbDir dbFile = dbDir + "/samples/DB_Fall17_UL17_central_legacy.sql" logger.info("Using db file: %s", dbFile) ## DY DYJetsToLL_M50_LO = Sample.nanoAODfromDAS( "DYJetsToLL_M50_LO", "/DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer19UL17NanoAODv2-106X_mc2017_realistic_v8-v1/NANOAODSIM", dbFile=dbFile, redirector=redirector, instance="global", overwrite=ov, xSection=2075.14 * 3) DY = [ DYJetsToLL_M50_LO, ] ## ttbar TTLep_pow = Sample.nanoAODfromDAS( "TTLep_pow", "/TTTo2L2Nu_TuneCP5_13TeV-powheg-pythia8/RunIISummer19UL17NanoAODv2-106X_mc2017_realistic_v8-v1/NANOAODSIM", dbFile=dbFile, redirector=redirector, instance="global",
import copy, os, sys from RootTools.core.Sample import Sample import ROOT from StopsDilepton.tools.user import data_directory from StopsDilepton.samples.color import color # Take post processing directory if defined in main module try: import sys postProcessing_directory = sys.modules['__main__'].postProcessing_directory except: postProcessing_directory = "postProcessed_Fall15_mAODv2/dilepTiny" dirs = {} dirs['TTGJets'] = ["TTGJets"] dirs['ZG'] = ["ZGTo2LG"] dirs['WG'] = ["WGToLNuG"] dirs['WWG'] = ["WWG"] directories = { key : [ os.path.join( data_directory, postProcessing_directory, dir) for dir in dirs[key]] for key in dirs.keys()} TTG = Sample.fromDirectory(name="TTGJets", treeName="Events", isData=False, color=color.TTG, texName="t#bar{t}#gamma + Jets", directory=directories['TTGJets']) ZG = Sample.fromDirectory(name="ZG", treeName="Events", isData=False, color=color.WZ, texName="ZG", directory=directories['ZG']) WG = Sample.fromDirectory(name="WG", treeName="Events", isData=False, color=color.WG, texName="WG", directory=directories['WG']) WWG = Sample.fromDirectory(name="WWG", treeName="Events", isData=False, color=color.WWG, texName="WWG", directory=directories['WWG'])
# Redirector try: redirector = sys.modules['__main__'].redirector except: from Samples.Tools.config import redirector as redirector # DB from Samples.Tools.config import dbDir dbFile = dbDir+"/DB_Run2017_31Mar2018.sql" logger.info("Using db file: %s", dbFile) # specify a local directory if you want to create (and afterwards automatically use) a local copy of the sample, otherwise use the grid. ## DoubleMuon DoubleMuon_Run2017B_31Mar2018 = Sample.nanoAODfromDAS("DoubleMuon_Run2017B_31Mar2018", "/DoubleMuon/Run2017B-31Mar2018-v1/NANOAOD", dbFile=dbFile, overwrite=ov, redirector=redirector) DoubleMuon_Run2017C_31Mar2018 = Sample.nanoAODfromDAS("DoubleMuon_Run2017C_31Mar2018", "/DoubleMuon/Run2017C-31Mar2018-v1/NANOAOD", dbFile=dbFile, overwrite=ov, redirector=redirector) DoubleMuon_Run2017D_31Mar2018 = Sample.nanoAODfromDAS("DoubleMuon_Run2017D_31Mar2018", "/DoubleMuon/Run2017D-31Mar2018-v1/NANOAOD", dbFile=dbFile, overwrite=ov, redirector=redirector) DoubleMuon_Run2017E_31Mar2018 = Sample.nanoAODfromDAS("DoubleMuon_Run2017E_31Mar2018", "/DoubleMuon/Run2017E-31Mar2018-v1/NANOAOD", dbFile=dbFile, overwrite=ov, redirector=redirector) DoubleMuon_Run2017F_31Mar2018 = Sample.nanoAODfromDAS("DoubleMuon_Run2017F_31Mar2018", "/DoubleMuon/Run2017F-31Mar2018-v1/NANOAOD", dbFile=dbFile, overwrite=ov, redirector=redirector) DoubleMuon_Run2017 = [\ DoubleMuon_Run2017B_31Mar2018, DoubleMuon_Run2017C_31Mar2018, DoubleMuon_Run2017D_31Mar2018, DoubleMuon_Run2017E_31Mar2018, DoubleMuon_Run2017F_31Mar2018, ] ## MuonEG MuonEG_Run2017B_31Mar2018 = Sample.nanoAODfromDAS("MuonEG_Run2017B_31Mar2018", "/MuonEG/Run2017B-31Mar2018-v1/NANOAOD", dbFile=dbFile, overwrite=ov, redirector=redirector)
except: postProcessing_directory = "postProcessed_Fall15_mAODv2/dilepTiny" logger.info("Loading data samples from directory %s", os.path.join(data_directory, postProcessing_directory)) dirs = {} dirs['DoubleEG'] = ["DoubleEG_Run2015D_16Dec"] dirs['DoubleMuon'] = ["DoubleMuon_Run2015D_16Dec"] dirs['MuonEG'] = ["MuonEG_Run2015D_16Dec"] dirs['SingleElectron'] = ["SingleElectron_Run2015D_16Dec"] dirs['SingleMuon'] = ["SingleMuon_Run2015D_16Dec"] for key in dirs: dirs[key] = [ os.path.join( data_directory, postProcessing_directory, dir) for dir in dirs[key]] DoubleEG_Run2015D = Sample.fromDirectory(name="DoubleEG_Run2015D", treeName="Events", texName="DoubleEG (Run2015D)", directory=dirs["DoubleEG"]) DoubleMuon_Run2015D = Sample.fromDirectory(name="DoubleMuon_Run2015D", treeName="Events", texName="DoubleMuon (Run2015D)", directory=dirs["DoubleMuon"]) MuonEG_Run2015D = Sample.fromDirectory(name="MuonEG_Run2015D", treeName="Events", texName="MuonEG (Run2015D)", directory=dirs["MuonEG"]) SingleElectron_Run2015D = Sample.fromDirectory(name="SingleElectron_Run2015D", treeName="Events", texName="SingleElectron (Run2015D)", directory=dirs["SingleElectron"]) SingleMuon_Run2015D = Sample.fromDirectory(name="SingleMuon_Run2015D", treeName="Events", texName="SingleMuon (Run2015D)", directory=dirs["SingleMuon"]) DoubleEG_Run2015D .lumi = 1000*(2.165) DoubleMuon_Run2015D .lumi = 1000*(2.165) MuonEG_Run2015D .lumi = 1000*(2.137) SingleElectron_Run2015D.lumi = 1000*(2.165) SingleMuon_Run2015D .lumi = 1000*(2.165) allSamples_Data25ns = [DoubleEG_Run2015D, MuonEG_Run2015D, DoubleMuon_Run2015D, SingleElectron_Run2015D, SingleMuon_Run2015D] for s in allSamples_Data25ns: s.color = ROOT.kBlack s.isData = True
import copy, os, sys from RootTools.core.Sample import Sample import ROOT from StopsDilepton.tools.user import data_directory from StopsDilepton.samples.color import color # Take post processing directory if defined in main module try: import sys postProcessing_directory = sys.modules['__main__'].postProcessing_directory except: postProcessing_directory = "postProcessed_Fall15_mAODv2/gen" dirs = {} dirs['TTZtoLLNuNu'] = ["TTZToLLNuNu"] dirs['TTGJets'] = ["TTGJets"] directories = { key : [ os.path.join( data_directory, postProcessing_directory, dir) for dir in dirs[key]] for key in dirs.keys()} TTZtoLLNuNu = Sample.fromDirectory(name="TTZtoNuNu", treeName="Events", isData=False, color=color.TTZtoLLNuNu, texName="t#bar{t}Z (#nu#bar{#nu})", directory=directories['TTZtoLLNuNu']) TTG = Sample.fromDirectory(name="TTGJets", treeName="Events", isData=False, color=color.TTG, texName="t#bar{t}#gamma + Jets", directory=directories['TTGJets'])
#dirs['QCD_EM+bcToE'] = ["QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched"] #dirs['QCD_EM+bcToE'] = ["QCD_Pt_15to20_bcToE", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt30to50_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched", "QCD_Pt300toInf_EMEnriched"] #dirs['QCD_Mu5+EM+bcToE'] = ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched"] #dirs['QCD_Mu5+EM+bcToE']= ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5", "QCD_Pt_15to20_bcToE", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt30to50_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched", "QCD_Pt300toInf_EMEnriched"] #dirs['QCD'] = ["QCD_Pt30to50", "QCD_Pt50to80", "QCD_Pt80to120", "QCD_Pt120to170", "QCD_Pt170to300", "QCD_Pt300to470", "QCD_Pt470to600", "QCD_Pt600to800", "QCD_Pt800to1000", "QCD_Pt1000to1400", "QCD_Pt1400to1800", "QCD_Pt1800to2400", "QCD_Pt2400to3200"] #dirs['QCD'] = ["QCD_Pt10to15", "QCD_Pt15to30", "QCD_Pt30to50", "QCD_Pt50to80", "QCD_Pt80to120", "QCD_Pt120to170", "QCD_Pt170to300", "QCD_Pt300to470", "QCD_Pt470to600", "QCD_Pt600to800", "QCD_Pt800to1000", "QCD_Pt1000to1400", "QCD_Pt1400to1800", "QCD_Pt1800to2400", "QCD_Pt2400to3200", "QCD_Pt3200"] #dirs['WGToLNuG'] = ["WGToLNuG"] dirs['ZGTo2LG'] = ["ZGTo2LG"] #dirs['WGJets'] = ["WGJets"] dirs['ZGJets'] = ["ZGJets"] dirs['ZG'] = dirs['ZGTo2LG'] + dirs['ZGJets'] directories = { key : [ os.path.join( data_directory, postProcessing_directory, dir) for dir in dirs[key]] for key in dirs.keys()} DY = Sample.fromDirectory(name="DY", treeName="Events", isData=False, color=color.DY, texName="DY", directory=directories['DY']) DY_LO = Sample.fromDirectory(name="DY_LO", treeName="Events", isData=False, color=color.DY, texName="DY (LO)", directory=directories['DY_LO']) DY_HT_LO = Sample.fromDirectory(name="DY_HT_LO", treeName="Events", isData=False, color=color.DY, texName="DY (LO,HT)", directory=directories['DY_HT_LO']) TTJets = Sample.fromDirectory(name="TTJets", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TTJets']) TTJets_Lep = Sample.fromDirectory(name="TTJets_Lep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}(lep)", directory=directories['TTJets_Lep']) TTJets_Singlelep= Sample.fromDirectory(name="TTJets_Singlelep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TTJets_Singlelep']) TTJets_Singlelep_singleTop = Sample.fromDirectory(name="TTJets_Singlelep_singleTop", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}/t (1l)", directory=directories['TTJets_Singlelep']+directories['singleTop']) TTJets_Dilep = Sample.fromDirectory(name="TTJets_Dilep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TTJets_Dilep']) #TTJets_LO = Sample.fromDirectory(name="TTJets_LO", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (LO)", directory=directories['TTJets_LO']) TTLep_pow = Sample.fromDirectory(name="TTLep_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (lep,pow)", directory=directories['TTLep_pow']) TT_pow = Sample.fromDirectory(name="TT_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (powheg)", directory=directories['TT_pow']) Top = Sample.fromDirectory(name="Top", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}/single-t", directory=directories['Top']) Top_pow = Sample.fromDirectory(name="Top_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}/single-t(powHeg)", directory=directories['Top_pow']) Top_pow_incl = Sample.fromDirectory(name="Top_pow_incl", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}/single-t(pow incl)", directory=directories['Top_pow_incl']) Top_amc = Sample.fromDirectory(name="Top_amc", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}/single-t(amc@NLO)", directory=directories['Top_amc'])
dirs['ZZ'] = ["ZZTo2L2Q", "ZZTo2Q2Nu"] dirs['WZ'] = ["WZTo1L1Nu2Q", "WZTo2L2Q", "WZTo3LNu"] dirs['triBoson'] = ["WWZ","WZZ","ZZZ"] # No Fall15 production for WWZ and ZZZ? dirs['WZZ'] = ["WZZ"] dirs['QCD_HT'] = ["QCD_HT100to200", "QCD_HT200to300", "QCD_HT300to500", "QCD_HT500to700", "QCD_HT700to1000", "QCD_HT1000to1500", "QCD_HT1500to2000", "QCD_HT2000toInf"] dirs['QCD_Mu5'] = ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5"] dirs['QCD_EM+bcToE'] = ["QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched"] #dirs['QCD_EM+bcToE'] = ["QCD_Pt_15to20_bcToE", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt30to50_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched", "QCD_Pt300toInf_EMEnriched"] dirs['QCD_Mu5+EM+bcToE'] = ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched"] #dirs['QCD_Mu5+EM+bcToE']= ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5", "QCD_Pt_15to20_bcToE", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt30to50_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched", "QCD_Pt300toInf_EMEnriched"] dirs['QCD'] = ["QCD_Pt30to50", "QCD_Pt50to80", "QCD_Pt80to120", "QCD_Pt120to170", "QCD_Pt170to300", "QCD_Pt300to470", "QCD_Pt470to600", "QCD_Pt600to800", "QCD_Pt800to1000", "QCD_Pt1000to1400", "QCD_Pt1400to1800", "QCD_Pt1800to2400", "QCD_Pt2400to3200"] #dirs['QCD'] = ["QCD_Pt10to15", "QCD_Pt15to30", "QCD_Pt30to50", "QCD_Pt50to80", "QCD_Pt80to120", "QCD_Pt120to170", "QCD_Pt170to300", "QCD_Pt300to470", "QCD_Pt470to600", "QCD_Pt600to800", "QCD_Pt800to1000", "QCD_Pt1000to1400", "QCD_Pt1400to1800", "QCD_Pt1800to2400", "QCD_Pt2400to3200", "QCD_Pt3200"] directories = { key : [ os.path.join( data_directory, postProcessing_directory, dir) for dir in dirs[key]] for key in dirs.keys()} DY = Sample.fromDirectory(name="DY", treeName="Events", isData=False, color=color.DY, texName="DY + Jets", directory=directories['DY']) DY_LO = Sample.fromDirectory(name="DY_LO", treeName="Events", isData=False, color=color.DY, texName="DY + Jets (LO)", directory=directories['DY_LO']) DY_HT_LO = Sample.fromDirectory(name="DY_HT_LO", treeName="Events", isData=False, color=color.DY, texName="DY + Jets (LO,HT)", directory=directories['DY_HT_LO']) TTJets = Sample.fromDirectory(name="TTJets", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets", directory=directories['TTJets']) TTJets_LO = Sample.fromDirectory(name="TTJets_LO", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (LO)", directory=directories['TTJets_LO']) TTLep_pow = Sample.fromDirectory(name="TTLep_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (lep,pow)", directory=directories['TTLep_pow']) TTJets_Lep = Sample.fromDirectory(name="TTJets_Lep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (lep)", directory=directories['TTJets_Lep']) TTJets_HT_LO = Sample.fromDirectory(name="TTJets_HT_LO", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (HT,LO)", directory=directories['TTJets_HT_LO']) singleTop = Sample.fromDirectory(name="singleTop", treeName="Events", isData=False, color=color.singleTop, texName="single top", directory=directories['singleTop']) TTX = Sample.fromDirectory(name="TTX", treeName="Events", isData=False, color=color.TTX, texName="t#bar{t}H/W/Z, tZq", directory=directories['TTX']) TTXNoZ = Sample.fromDirectory(name="TTXNoZ", treeName="Events", isData=False, color=color.TTXNoZ, texName="t#bar{t}H/W, tZq", directory=directories['TTXNoZ']) TTH = Sample.fromDirectory(name="TTH", treeName="Events", isData=False, color=color.TTH, texName="t#bar{t}H", directory=directories['TTH']) TTW = Sample.fromDirectory(name="TTW", treeName="Events", isData=False, color=color.TTW, texName="t#bar{t}W", directory=directories['TTW']) TTZ = Sample.fromDirectory(name="TTZ", treeName="Events", isData=False, color=color.TTZ, texName="t#bar{t}Z", directory=directories['TTZ']) TTZtoLLNuNu = Sample.fromDirectory(name="TTZtoNuNu", treeName="Events", isData=False, color=color.TTZtoLLNuNu, texName="t#bar{t}Z (l#bar{l}/#nu#bar{#nu})", directory=directories['TTZtoLLNuNu']) TTZtoQQ = Sample.fromDirectory(name="TTZtoQQ", treeName="Events", isData=False, color=color.TTZtoQQ, texName="t#bar{t}Z (q#bar{q})", directory=directories['TTZtoQQ'])
argParser.add_argument('--outputDir', dest='outputDir', action='store', nargs='?', type=str, default='/data/rschoefbeck/JetMET/localJEC/', help="output directory" ) args = argParser.parse_args() logger = get_logger(args.logLevel, logFile = None) #make samples. maxN = -1 #qcd_AllChGood_Flat0to50 = Sample.fromCMGOutput("qcd_AllChGood_Flat0to50", "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AllChlgoodAsymptFlat0to50bx25_AllChannelsGood_v0-v2_RunIISpring15MiniAODv2-74X", treeFilename='tree.root', maxN=maxN) #qcd_Flat0to50 = Sample.fromCMGOutput("qcd_Flat0to50", "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AsymptFlat0to50bx25Reco_MCRUN2_74_V9-v3_RunIISpring15MiniAODv2-74X_3", treeFilename='tree.root', maxN=maxN) qcd_AllChGood_noPU = Sample.fromCMGOutput("qcd_AllChGood_noPU", "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AllChlgoodAsymptNoPUbx25_AllChannelsGood_v0-v2_RunIISpring15MiniAODv2-74X", treeFilename='tree.root', maxN=maxN) qcd_noPU = Sample.fromCMGOutput("qcd_noPU", "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AsymptNoPUbx25Reco_MCRUN2_74_V9-v3_RunIISpring15MiniAODv2-74X_3", treeFilename='tree.root', maxN=maxN) # Select samples sample_ideal, sample_real = qcd_AllChGood_noPU, qcd_noPU # Pickle file which will hold the commonf events positions_filename = os.path.join(args.outputDir, "common_positions_%s_%s.pkl"%(sample_ideal.name, sample_real.name) ) # Make common event lists if not os.path.isfile(positions_filename): logger.info( "File %s not found, therefore finding positions of common events.", positions_filename) variables = map( Variable.fromString, ['evt/l','run/I', 'lumi/I'] ) reader_ideal = sample_ideal.treeReader( variables = variables , selectionString = "1") reader_ideal.start()
dirs['WZ'] = ["WZTo1L1Nu2Q", "WZTo2L2Q", "WZTo3LNu"] #dirs['triBoson'] = ["WWZ","WZZ","ZZZ"] # No Fall15 production for WWZ and ZZZ? dirs['WZZ'] = ["WZZ"] #dirs['QCD_HT'] = ["QCD_HT100to200", "QCD_HT200to300", "QCD_HT300to500", "QCD_HT500to700", "QCD_HT700to1000", "QCD_HT1000to1500", "QCD_HT1500to2000", "QCD_HT2000toInf"] #dirs['QCD_Mu5'] = ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5"] dirs['QCD_Mu5'] = [ "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5"] #dirs['QCD_EM+bcToE'] = ["QCD_Pt_15to20_bcToE", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt30to50_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched", "QCD_Pt300toInf_EMEnriched"] dirs['QCD_EM+bcToE'] = ["QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt20to30_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched", "QCD_Pt300toInf_EMEnriched"] dirs['QCD_Mu5+EM+bcToE'] = ["QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt20to30_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched"] #dirs['QCD_Mu5+EM+bcToE'] = ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5", "QCD_Pt_15to20_bcToE", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt30to50_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched", "QCD_Pt300toInf_EMEnriched"] directories = { key : [ os.path.join( data_directory, postProcessing_directory, dir) for dir in dirs[key]] for key in dirs.keys()} from StopsDilepton.samples.color import color DY = Sample.fromDirectory(name="DY", treeName="Events", isData=False, color=color.DY, texName="DY + Jets", directory=directories['DY']) #DY_LO = Sample.fromDirectory(name="DY_LO", treeName="Events", isData=False, color=color.DY, texName="DY + Jets (LO)", directory=directories['DY_LO']) #DY_HT_LO = Sample.fromDirectory(name="DY_HT_LO", treeName="Events", isData=False, color=color.DY, texName="DY + Jets (LO,HT)", directory=directories['DY_HT_LO']) TTJets = Sample.fromDirectory(name="TTJets", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets", directory=directories['TTJets']) #TTJets_LO = Sample.fromDirectory(name="TTJets_LO", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (LO)", directory=directories['TTJets_LO']) #TTLep_pow = Sample.fromDirectory(name="TTLep_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (lep,pow)", directory=directories['TTLep_pow']) TTJets_Lep = Sample.fromDirectory(name="TTJets_Lep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (lep)", directory=directories['TTJets_Lep']) #TTJets_HT_LO = Sample.fromDirectory(name="TTJets_HT_LO", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (HT,LO)", directory=directories['TTJets_HT_LO']) singleTop = Sample.fromDirectory(name="singleTop", treeName="Events", isData=False, color=color.singleTop, texName="single top", directory=directories['singleTop']) #TTX = Sample.fromDirectory(name="TTX", treeName="Events", isData=False, color=color.TTX, texName="t#bar{t}X", directory=directories['TTX']) #TTXNoZ = Sample.fromDirectory(name="TTXNoZ", treeName="Events", isData=False, color=color.TTXNoZ, texName="t#bar{t}H/W, tZq", directory=directories['TTXNoZ']) #TTH = Sample.fromDirectory(name="TTH", treeName="Events", isData=False, color=color.TTH, texName="t#bar{t}H", directory=directories['TTH']) #TTW = Sample.fromDirectory(name="TTW", treeName="Events", isData=False, color=color.TTW, texName="t#bar{t}W", directory=directories['TTW']) #TTZ = Sample.fromDirectory(name="TTZ", treeName="Events", isData=False, color=color.TTZ, texName="t#bar{t}Z", directory=directories['TTZ']) #TTZtoLLNuNu = Sample.fromDirectory(name="TTZtoNuNu", treeName="Events", isData=False, color=color.TTZtoLLNuNu, texName="t#bar{t}Z (l#bar{l}/#nu#bar{#nu})", directory=directories['TTZtoLLNuNu']) #TTZtoQQ = Sample.fromDirectory(name="TTZtoQQ", treeName="Events", isData=False, color=color.TTZtoQQ, texName="t#bar{t}Z (q#bar{q})", directory=directories['TTZtoQQ'])
except: if "clip" in os.getenv("HOSTNAME").lower(): if __name__ == "__main__" and not options.check_completeness: from Samples.Tools.config import redirector_global as redirector else: from Samples.Tools.config import redirector_clip as redirector else: from Samples.Tools.config import redirector as redirector # DB from Samples.Tools.config import dbDir dbFile = dbDir+'/DB_Run2018_ULnanoAODv2.sql' logger.info("Using db file: %s", dbFile) # DoubleMuon DoubleMuon_Run2018A_UL = Sample.nanoAODfromDAS("DoubleMuon_Run2018A_UL", "/DoubleMuon/Run2018A-UL2018_MiniAODv1_NanoAODv2-v1/NANOAOD", dbFile=dbFile, redirector=redirector, overwrite=ov) DoubleMuon_Run2018B_UL = Sample.nanoAODfromDAS("DoubleMuon_Run2018B_UL", "/DoubleMuon/Run2018B-UL2018_MiniAODv1_NanoAODv2-v2/NANOAOD", dbFile=dbFile, redirector=redirector, overwrite=ov) DoubleMuon_Run2018C_UL = Sample.nanoAODfromDAS("DoubleMuon_Run2018C_UL", "/DoubleMuon/Run2018C-UL2018_MiniAODv1_NanoAODv2-v1/NANOAOD", dbFile=dbFile, redirector=redirector, overwrite=ov) DoubleMuon_Run2018D_UL = Sample.nanoAODfromDAS("DoubleMuon_Run2018D_UL", "/DoubleMuon/Run2018D-UL2018_MiniAODv1_NanoAODv2-v1/NANOAOD", dbFile=dbFile, redirector=redirector, overwrite=ov) DoubleMuon = [ DoubleMuon_Run2018A_UL, DoubleMuon_Run2018B_UL, DoubleMuon_Run2018C_UL, DoubleMuon_Run2018D_UL, ] # MuonEG MuonEG_Run2018A_UL = Sample.nanoAODfromDAS("MuonEG_Run2018A_UL", "/MuonEG/Run2018A-UL2018_MiniAODv1_NanoAODv2-v1/NANOAOD", dbFile=dbFile, redirector=redirector, overwrite=ov) MuonEG_Run2018B_UL = Sample.nanoAODfromDAS("MuonEG_Run2018B_UL", "/MuonEG/Run2018B-UL2018_MiniAODv1_NanoAODv2-v1/NANOAOD", dbFile=dbFile, redirector=redirector, overwrite=ov)
# argParser import argparse argParser = argparse.ArgumentParser(description = "Argument parser") argParser.add_argument('--logLevel', action='store', nargs='?', choices=['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'TRACE', 'NOTSET'], default='INFO', help="Log level for logging" ) args = argParser.parse_args() logger = get_logger(args.logLevel, logFile = None) #make samples. Samples are statisticall compatible. jetHT_M2_5_500 = Sample.fromCMGOutput("jetHT_M2_5_500", baseDirectory = "/data/rschoefbeck/cmgTuples/JetHT_HCal/", chunkString = "JetHT_schoef-crab_JetHT_Run2015D_M2_5_500", treeFilename='tree.root') jetHT = Sample.fromCMGOutput("JetHT", baseDirectory = "/data/rschoefbeck/cmgTuples/JetHT_HCal/", chunkString = "JetHT_schoef-crab_JetHT_Run2015D", treeFilename='tree.root') QCD_Pt_15to3000_M2_5_500 = Sample.fromCMGOutput("QCD_Pt_15to3000_M2_5_500", baseDirectory = "/data/rschoefbeck/cmgTuples/QCD_HCal/QCD_Pt_15to3000_M2_5_500", treeFilename='tree.root') QCD_Pt_15to3000 = Sample.fromCMGOutput("QCD_Pt_15to3000", baseDirectory = "/data/rschoefbeck/cmgTuples/QCD_HCal/QCD_Pt_15to3000", treeFilename='tree.root') variables = map( Variable.fromString, ['evt/l','run/I', 'lumi/I', 'Jet[pt/F,rawPt/F,phi/F,eta/F]', 'nJet/I'] ) maxN = 10000 # define TProfiles thresholds = [10**(x/10.) for x in range(11,36)] jetResponse_data = ROOT.TProfile("response_data", "response_data", len(thresholds)-1, array.array('d', thresholds) ) jetResponse_data.texName = "JetHT 260431" jetResponse_data.style = lineStyle(ROOT.kBlue) jetResponse_mc = ROOT.TProfile("response_mc", "response_mc", len(thresholds)-1, array.array('d', thresholds) ) jetResponse_mc.texName = "QCD flat"
dirs = {} # mu enriched QCD (few bins missing!) dirs['QCD_mu'] = [ "QCD_Mu_pt1000toInf_comb", "QCD_Mu_pt120to170", "QCD_Mu_pt15to20", "QCD_Mu_pt170to300_comb", "QCD_Mu_pt20to30", "QCD_Mu_pt300to470_comb", "QCD_Mu_pt30to50", "QCD_Mu_pt470to600_comb", "QCD_Mu_pt50to80", "QCD_Mu_pt600to800_comb", "QCD_Mu_pt800to1000_comb", "QCD_Mu_pt80to120_comb" ] QCD_mu = Sample.fromDirectory(name="QCD_mu", treeName="Events", isData=False, color=color.QCD, texName="QCD(#mu)", directory=make_dirs(locations.fakes_mu_2016, dirs['QCD_mu'])) # pt binned inclusive QCD (mu) #dirs['QCD_pt'] = ["QCD_pt15to30", "QCD_pt30to50", "QCD_pt50to80", "QCD_pt80to120_comb", "QCD_pt120to170_comb", "QCD_pt170to300_comb", "QCD_pt300to470_comb", "QCD_pt470to600", "QCD_pt600to800_comb", "QCD_pt1400to1800_comb", "QCD_pt1800to2400_comb", "QCD_pt2400to3200_comb",] #QCD_pt_mu = Sample.fromDirectory(name="QCD_pt_mu", treeName="Events", isData=False, color=color.QCD, texName="QCD p_{T} (#mu)", directory=make_dirs( locations.fakes_mu_2016, dirs['QCD_pt'])) # EM enriched QCD (bcToE missing!) dirs['QCD_ele'] = [ "QCD_Ele_pt20to30", "QCD_Ele_pt30to50_comb", "QCD_Ele_pt50to80_comb", "QCD_Ele_pt80to120_comb", "QCD_Ele_pt120to170_comb", "QCD_Ele_pt170to300", "QCD_Ele_pt300toInf" ] # "QCD_Ele_pt20to30"
redirector = sys.modules['__main__'].redirector except: from Samples.Tools.config import redirector as redirector # DB from Samples.Tools.config import dbDir dbFile = dbDir + "/DB_Run2016_22Aug2018.sql" logger.info("Using db file: %s", dbFile) # specify a local directory if you want to create (and afterwards automatically use) a local copy of the sample, otherwise use the grid. ## DoubleMuon DoubleMuon_Run2016B_22Aug2018_ver1 = Sample.nanoAODfromDAS( "DoubleMuon_Run2016B_22Aug2018_ver1", "/DoubleMuon/Run2016B-22Aug2018_ver1-v1/NANOAOD", dbFile=dbFile, overwrite=ov, redirector=redirector) DoubleMuon_Run2016B_22Aug2018_ver2 = Sample.nanoAODfromDAS( "DoubleMuon_Run2016B_22Aug2018_ver2", "/DoubleMuon/Run2016B-22Aug2018_ver2-v1/NANOAOD", dbFile=dbFile, overwrite=ov, redirector=redirector) DoubleMuon_Run2016C_22Aug2018 = Sample.nanoAODfromDAS( "DoubleMuon_Run2016C_22Aug2018", "/DoubleMuon/Run2016C-22Aug2018-v1/NANOAOD", dbFile=dbFile, overwrite=ov, redirector=redirector) DoubleMuon_Run2016D_22Aug2018 = Sample.nanoAODfromDAS(
#dirs['other'] += dirs['WWW'] + dirs['WWZ'] + dirs['WZG'] + dirs['WZZ'] + dirs['ZZZ'] dirs['other'] += dirs['VV'] + dirs['WW'] + dirs['WZ'] + dirs['ZZ'] dirs['other'] += dirs['GluGlu'] directories = { key: [ os.path.join(data_directory, postprocessing_directory2016, dir) for dir in dirs[key] ] for key in dirs.keys() } # Samples DY_LO_16 = Sample.fromDirectory(name="DY_LO", treeName="Events", isData=False, color=color.DY, texName="DY (LO)", directory=directories['DY_LO']) TT_pow_16 = Sample.fromDirectory(name="TTLep_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TTLep_pow']) TTbar_16 = Sample.fromDirectory(name="TTbar", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TTbar']) singleTop_16 = Sample.fromDirectory(name="singleTop",
#dirs['pseudoDataPriv'] = dirs['ewkDM_ttZ_ll_noH'] + dirs["WZ"] + dirs['TTW'] + dirs['TTX'] + dirs['TZQ'] + dirs['rare'] + dirs['nonprompt'] dirs['background'] = dirs["WZ_amcatnlo"] + dirs['TTW'] + dirs['TTX'] + dirs[ 'TZQ'] + dirs['rare'] directories = { key: [ os.path.join(data_directory, postProcessing_directory, dir) for dir in dirs[key] ] for key in dirs.keys() } pseudoData = Sample.fromDirectory(name="pseudoData", treeName="Events", isData=False, color=ROOT.kBlack, texName="pseudo-data", directory=directories['pseudoData']) #pseudoDataPriv = Sample.fromDirectory(name="pseudoDataPriv", treeName="Events", isData=False, color=ROOT.kBlack, texName="pseudo-data", directory=directories['pseudoDataPriv']) TTZtoLLNuNu = Sample.fromDirectory(name="TTZtoLLNuNu", treeName="Events", isData=False, color=color.TTZtoLLNuNu, texName="t#bar{t}Z (l#bar{l}/#nu#bar{#nu})", directory=directories['TTZtoLLNuNu']) #TTZ_LO = Sample.fromDirectory(name="TTZ_LO", treeName="Events", isData=False, color=color.TTZtoLLNuNu+1, texName="t#bar{t}Z (LO)", directory=directories['TTZ_LO']) TTG = Sample.fromDirectory(name="TTG", treeName="Events", isData=False, color=color.TTG_signal, texName="t#bar{t}#gamma",
MuonEG_Run2018D = getSample('MuonEG', 'Run2018D', ((31.93) * 1000)) SingleMuon_Run2018D = getSample('SingleMuon', 'Run2018D', ((31.93) * 1000)) allSamples_Data25ns += [ MuonEG_Run2018D, EGamma_Run2018D, DoubleMuon_Run2018D, SingleMuon_Run2018D ] EGamma_Run2018 = getSample('EGamma', 'Run2018', ((59.97) * 1000)) DoubleMuon_Run2018 = getSample('DoubleMuon', 'Run2018', ((59.97) * 1000)) MuonEG_Run2018 = getSample('MuonEG', 'Run2018', ((59.97) * 1000)) SingleMuon_Run2018 = getSample('SingleMuon', 'Run2018', ((59.97) * 1000)) allSamples_Data25ns += [ MuonEG_Run2018, EGamma_Run2018, DoubleMuon_Run2018, SingleMuon_Run2018 ] Run2018A = Sample.combine("Run2018A", [ MuonEG_Run2018A, EGamma_Run2018A, DoubleMuon_Run2018A, SingleMuon_Run2018A ], texName="Run2018") Run2018A.lumi = (14.00) * 1000 allSamples_Data25ns.append(Run2018A) Run2018B = Sample.combine("Run2018B", [ MuonEG_Run2018B, EGamma_Run2018B, DoubleMuon_Run2018B, SingleMuon_Run2018B ], texName="Run2018B") Run2018B.lumi = (7.10) * 1000 allSamples_Data25ns.append(Run2018B) Run2018C = Sample.combine("Run2018C", [ MuonEG_Run2018C, EGamma_Run2018C, DoubleMuon_Run2018C, SingleMuon_Run2018C ], texName="Run2018C")
"DoubleEG_Run2016H_v2_backup"] + dirs["DoubleEG_Run2016H_v3_backup"] dirs["DoubleMuon_Run2016_backup"] = dirs[ "DoubleMuon_Run2016BCDEFG_backup"] + dirs[ "DoubleMuon_Run2016H_v2_backup"] + dirs["DoubleMuon_Run2016H_v3_backup"] dirs["MuonEG_Run2016_backup"] = dirs["MuonEG_Run2016BCDEFG_backup"] + dirs[ "MuonEG_Run2016H_v2_backup"] + dirs["MuonEG_Run2016H_v3_backup"] for key in dirs: dirs[key] = [ os.path.join(data_directory, postProcessing_directory, dir) for dir in dirs[key] ] DoubleEG_Run2016H_v3_backup = Sample.fromDirectory( name="DoubleEG_Run2016H_v3_backup", treeName="Events", texName="DoubleEG (Run2016H_v3)", directory=dirs["DoubleEG_Run2016H_v3_backup"]) DoubleEG_Run2016G_backup = Sample.fromDirectory( name="DoubleEG_Run2016G_backup", treeName="Events", texName="DoubleEG (Run2016G)", directory=dirs["DoubleEG_Run2016G_backup"]) DoubleEG_Run2016BCD_backup = Sample.fromDirectory( name="DoubleEG_Run2016BCD_backup", treeName="Events", texName="DoubleEG (Run2016BCD)", directory=dirs["DoubleEG_Run2016BCD_backup"]) DoubleMuon_Run2016BCD_backup = Sample.fromDirectory( name="DoubleMuon_Run2016BCD_backup",
dirs[pd + '_' + totalRunName] = [] for r in listOfRuns: dirs[pd + '_' + totalRunName].extend(dirs[pd + '_' + r]) for pd in ['DoubleMuon']: merge(pd, 'Run2016BCD', ['Run2016B_ver2', 'Run2016C', 'Run2016D']) merge(pd, 'Run2016BCDEFG', ['Run2016BCD', 'Run2016E', 'Run2016F', 'Run2016G']) merge(pd, 'Run2016', ['Run2016BCDEFG', 'Run2016H']) for key in dirs: dirs[key] = [ os.path.join( data_directory, postProcessing_directory, dir) for dir in dirs[key]] def getSample(pd, runName, lumi): sample = Sample.fromDirectory(name=(pd + '_' + runName), treeName="Events", texName=(pd + ' (' + runName + ')'), directory=dirs[pd + '_' + runName]) sample.lumi = lumi return sample DoubleMuon_Run2016 = getSample('DoubleMuon', 'Run2016', (35.9)*1000) allSamples_Data25ns = [] allSamples_Data25ns += [DoubleMuon_Run2016] Run2016 = Sample.combine("Run2016", [DoubleMuon_Run2016], texName = "Data") Run2016.lumi = (35.9)*1000 for s in allSamples_Data25ns: s.color = ROOT.kBlack s.isData = True
#dirs['QCD_Mu5+EM+bcToE'] = ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched"] #dirs['QCD_Mu5+EM+bcToE']= ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5", "QCD_Pt_15to20_bcToE", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt15to20_EMEnriched", "QCD_Pt20to30_EMEnriched", "QCD_Pt30to50_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched", "QCD_Pt300toInf_EMEnriched"] #dirs['QCD'] = ["QCD_Pt30to50", "QCD_Pt50to80", "QCD_Pt80to120", "QCD_Pt120to170", "QCD_Pt170to300", "QCD_Pt300to470", "QCD_Pt470to600", "QCD_Pt600to800", "QCD_Pt800to1000", "QCD_Pt1000to1400", "QCD_Pt1400to1800", "QCD_Pt1800to2400", "QCD_Pt2400to3200"] #dirs['QCD'] = ["QCD_Pt10to15", "QCD_Pt15to30", "QCD_Pt30to50", "QCD_Pt50to80", "QCD_Pt80to120", "QCD_Pt120to170", "QCD_Pt170to300", "QCD_Pt300to470", "QCD_Pt470to600", "QCD_Pt600to800", "QCD_Pt800to1000", "QCD_Pt1000to1400", "QCD_Pt1400to1800", "QCD_Pt1800to2400", "QCD_Pt2400to3200", "QCD_Pt3200"] #dirs['WGToLNuG'] = ["WGToLNuG"] #dirs['ZGTo2LG'] = ["ZGTo2LG_ext"] #dirs['WGJets'] = ["WGJets"] #dirs['ZGJets'] = ["ZGJets"] #dirs['ZG'] = dirs['ZGTo2LG'] + dirs['ZGJets'] directories = { key : [ os.path.join( data_directory, postProcessing_directory, dir) for dir in dirs[key]] for key in dirs.keys()} #DY = Sample.fromDirectory(name="DY", treeName="Events", isData=False, color=color.DY, texName="DY", directory=directories['DY']) #DY_HT_LO = Sample.fromDirectory(name="DY_HT_LO", treeName="Events", isData=False, color=color.DY, texName="DY (LO) HT binned", directory=directories['DY_HT_LO']) DYnJets = Sample.fromDirectory(name="DYnJets", treeName="Events", isData=False, color=color.DY, texName="DY (LO) 1-4 Jets", directory=directories['DYnJets']) ##TTJets = Sample.fromDirectory(name="TTJets", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TTJets']) #TTJets_Lep = Sample.fromDirectory(name="TTJets_Lep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}(lep)", directory=directories['TTJets_Lep']) #TTJets_Singlelep= Sample.fromDirectory(name="TTJets_Singlelep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TTJets_Singlelep']) ##TTJets_Singlelep_singleTop = Sample.fromDirectory(name="TTJets_Singlelep_singleTop", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}/t (1l)", directory=directories['TTJets_Singlelep']+directories['singleTop']) #TTJets_Dilep = Sample.fromDirectory(name="TTJets_Dilep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}", directory=directories['TTJets_Dilep']) ##TTJets_LO = Sample.fromDirectory(name="TTJets_LO", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (LO)", directory=directories['TTJets_LO']) TTLep_pow = Sample.fromDirectory(name="TTLep_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (lep,pow)", directory=directories['TTLep_pow']) ##TT_pow = Sample.fromDirectory(name="TT_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (powheg)", directory=directories['TT_pow']) #FIXME dilep #Top = Sample.fromDirectory(name="Top", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}/single-t", directory=directories['Top']) #Top_pow = Sample.fromDirectory(name="Top_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}/single-t", directory=directories['Top_pow']) ##Top_pow_incl = Sample.fromDirectory(name="Top_pow_incl", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}/single-t(pow incl)", directory=directories['Top_pow_incl']) #FIXME dilep ##Top_amc = Sample.fromDirectory(name="Top_amc", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t}/single-t(amc@NLO)", directory=directories['Top_amc']) # # ##TTJets_HT_LO = Sample.fromDirectory(name="TTJets_HT_LO", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (HT,LO)", directory=directories['TTJets_HT_LO'])
ov = False # Redirector from nanoMET.tools.user import redirector_global as redirector # DB from nanoMET.tools.user import dbDir dbFile = dbDir + "/samples/DB_Summer16_central_legacy.sql" logger.info("Using db file: %s", dbFile) ## DY DYJetsToLL_M50_LO_ext1 = Sample.nanoAODfromDAS( "DYJetsToLL_M50_LO_ext1", "/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16NanoAODv7-PUMoriond17_Nano02Apr2020_102X_mcRun2_asymptotic_v8_ext1-v1/NANOAODSIM", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov, xSection=2075.14 * 3) DY = [ DYJetsToLL_M50_LO_ext1, ] ## ttbar TTLep_pow_noSC = Sample.nanoAODfromDAS( "TTLep_pow_noSC", "/TTTo2L2Nu_noSC_TuneCUETP8M2T4_13TeV-powheg-pythia8/RunIISummer16NanoAODv7-PUMoriond17_Nano02Apr2020_102X_mcRun2_asymptotic_v8-v1/NANOAODSIM", dbFile=dbFile, redirector=redirector, instance="phys03",
redirector = sys.modules['__main__'].redirector except: from Samples.Tools.config import redirector as redirector # DB from Samples.Tools.config import dbDir dbFile = dbDir + "DB_Summer16_private_legacy.sql" logger.info("Using db file: %s", dbFile) ## DY DYJetsToLL_M50_LO_ext1 = Sample.nanoAODfromDAS( "DYJetsToLL_M50_LO_ext1", "/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/dspitzba-crab_RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3_ext1-v2_legacy_nano_v1-b9659cf3bef5e21efe24288a402778f7/USER", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov, xSection=2008. * 3) DYJetsToLL_M50_LO_ext2 = Sample.nanoAODfromDAS( "DYJetsToLL_M50_LO_ext2", "/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/dspitzba-crab_RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3_ext2-v2_legacy_nano_v1-b9659cf3bef5e21efe24288a402778f7/USER", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov, xSection=2008. * 3) DYJetsToLL_M50_ext2 = Sample.nanoAODfromDAS( "DYJetsToLL_M50_ext2", "/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/dspitzba-crab_RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3_ext2-v1_legacy_nano_v1-b9659cf3bef5e21efe24288a402778f7/USER", dbFile=dbFile,
# Redirector try: redirector = sys.modules['__main__'].redirector except: from Samples.Tools.config import redirector as redirector # DB from Samples.Tools.config import dbDir dbFile = dbDir + "/DB_Autumn18_private.sql" logger.info("Using db file: %s", dbFile) TTGNoFullyHad_priv = Sample.nanoAODfromDPM( "TTGNoFullyHad_priv", "/dpm/oeaw.ac.at/home/cms/store/user/llechner/nanoAOD/legacy_nano_v3/Autumn18_private_TTGamma_nofullyhad_LO_A18_private/", dbFile=dbFile, redirector=redirector, overwrite=ov, xSection=1.512 * 1.616 + 5.125 * 1.994, maxN=1) TTGHad_priv = Sample.nanoAODfromDPM( "TTGHad_priv", "/dpm/oeaw.ac.at/home/cms/store/user/llechner/nanoAOD/legacy_nano_v3/Autumn18_private_TTGamma_had_LO_A18_private/", dbFile=dbFile, redirector=redirector, overwrite=ov, xSection=4.213 * 2.565) TTGSemi_priv = Sample.nanoAODfromDPM( "TTGSemi_priv", "/dpm/oeaw.ac.at/home/cms/store/user/llechner/nanoAOD/legacy_nano_v3/Autumn18_private_TTGamma_semilep_LO_A18_private/", dbFile=dbFile, redirector=redirector,
def make_dirs( dirs ): return [ os.path.join( directory_, dir_ ) for dir_ in dirs ] dirs = {} # 2016 analysis ## tWZ_sample, TTZtoLLNuNu, TTX_rare_TWZ, TZQ, WZ_amcatnlo, rare, ZZ, nonprompt_TWZ_3l # diboson #dirs['diBosonInclusive'] = ["WW", "WZ", "ZZ"] # diboson exclusive #dirs['WZ'] = ["WZTo1L1Nu2Q", "WZTo1L3Nu", "WZTo2L2Q", "WZTo3LNu"] dirs['WZ'] = ["WZTo1L3Nu", "WZTo2L2Q", "WZTo3LNu_amcatnlo"] WZ = Sample.fromDirectory(name="WZ", treeName="Events", isData=False, color=color.WZ, texName="WZ", directory=make_dirs( dirs['WZ'])) dirs['ZZ'] = ["ZZTo2L2Q_redBy5", "ZZTo2Q2Nu", "ZZTo4L"] ZZ = Sample.fromDirectory(name="ZZ", treeName="Events", isData=False, color=color.ZZ, texName="ZZ", directory=make_dirs( dirs['ZZ'])) dirs['WW'] = ["WWToLNuQQ"] dirs['VVTo2L2Nu'] = ["VVTo2L2Nu"] # covered by VVTo2L2Nu: #dirs['WWTo2L2Nu'] = ['WWTo2L2Nu'] #dirs['ZZTo2L2Nu'] = ['ZZTo2L2Nu', "ZZTo2L2Q"] #dirs['ZZTo2L2Nu_2'] = ['ZZTo2L2Nu'] dirs['triBoson'] = ["WWW_4F","WWZ","WZZ","ZZZ"] triBoson = Sample.fromDirectory(name="triBoson", treeName="Events", isData=False, color=color.triBoson, texName="VVV", directory=make_dirs( dirs['triBoson']))
else: import logging logger = logging.getLogger(__name__) ov = False from Samples.Tools.config import dbDir, redirector, redirector_global dbFile = dbDir + "DB_Spring16_private.sql" logger.info("Using db file: %s", dbFile) # Signals T2tt_mStop400to1200 = Sample.nanoAODfromDAS( "T2tt_mStop400to1200", "/SMS-T2tt_mStop-400to1200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/dspitzba-crab_RunIISpring16MiniAODv2-PUSpring16Fast_80X_mcRun2_asymptotic_2016_miniAODv2_v0-v1_METSig_v1-874c0b83f53e95cd92fa366b95b462ff/USER", dbFile=dbFile, overwrite=ov, redirector=redirector, instance="phys03", xSection=1) signals = [ T2tt_mStop400to1200, ] other = [] allSamples = signals for s in allSamples: s.isData = False
try: redirector = sys.modules['__main__'].redirector except: from Samples.Tools.config import redirector as redirector # DB from Samples.Tools.config import dbDir dbFile = dbDir + "/DB_Summer16_private.sql" logger.info("Using db file: %s", dbFile) ## DY DYJetsToLL_M50_MLM_FS_S16_80X_priv = Sample.nanoAODfromDAS( "DYJetsToLL_M50_MLM_FS_S16_80X_priv", "/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/dspitzba-crab_RunIISummer16MiniAODv2-LHE_PUSummer16Fast_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v1_METSig_v1-874c0b83f53e95cd92fa366b95b462ff/USER", dbFile=dbFile, overwrite=ov, redirector=redirector, instance="phys03", xSection=2075.14 * 3) DYJetsToLL_M50_MLM_S16_80X_priv = Sample.nanoAODfromDAS( "DYJetsToLL_M50_MLM_S16_80X_priv", "/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/dspitzba-crab_RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v2_METSig_v1-95163dc1655e9579f2e671fa6cceb399/USER", dbFile=dbFile, overwrite=ov, redirector=redirector, instance="phys03", xSection=2075.14 * 3) DY = [ DYJetsToLL_M50_MLM_FS_S16_80X_priv, DYJetsToLL_M50_MLM_S16_80X_priv,
dirs['DY_LO'] = ["DYJetsToLL_M50_LO"] dirs['Top'] = ["TTLep_pow", "T_tWch_ext", "TBar_tWch_ext"] dirs['diboson'] = ['VVTo2L2Nu', 'WZTo3LNu', 'WZTo1L3Nu'] dirs['triboson'] = ['WWZ_4F', 'WZZ', 'ZZZ'] directories = { key: [ os.path.join(data_directory, postProcessing_directory, dir) for dir in dirs[key] ] for key in dirs.keys() } DY_LO_17 = Sample.fromDirectory(name="DY_LO", treeName="Events", isData=False, color=color.DY, texName="DY (LO)", directory=directories['DY_LO']) Top_17 = Sample.fromDirectory(name="Top", treeName="Events", isData=False, color=color.TTJets, texName="t(#bar{t})", directory=directories['Top']) diboson_17 = Sample.fromDirectory(name="diboson", treeName="Events", isData=False, color=color.diboson, texName="diboson", directory=directories['diboson']) rare_17 = Sample.fromDirectory(name="rare",
dirs['ZZInclusive'] = ["ZZ"] dirs['ZZ'] = ["ZZTo2L2Q", "ZZTo2Q2Nu"] dirs['WZ'] = ["WZTo1L1Nu2Q", "WZTo2L2Q", "WZTo3LNu"] #dirs['triBoson'] = ["WWZ","WZZ","ZZZ"] # No Fall15 production for WWZ and ZZZ? dirs['WZZ'] = ["WZZ"] #dirs['QCD_HT'] = ["QCD_HT100to200", "QCD_HT200to300", "QCD_HT300to500", "QCD_HT500to700", "QCD_HT700to1000", "QCD_HT1000to1500", "QCD_HT1500to2000", "QCD_HT2000toInf"] dirs['QCD_Mu5'] = ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5"] dirs['QCD_EM+bcToE'] = ["QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt20to30_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched"] #dirs['QCD_EM+bcToE'] = ["QCD_Pt_15to20_bcToE", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt20to30_EMEnriched", "QCD_Pt30to50_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched", "QCD_Pt300toInf_EMEnriched"] dirs['QCD_Mu5+EM+bcToE'] = ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt20to30_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched"] #dirs['QCD_Mu5+EM+bcToE'] = ["QCD_Pt20to30_Mu5", "QCD_Pt50to80_Mu5", "QCD_Pt80to120_Mu5", "QCD_Pt120to170_Mu5", "QCD_Pt170to300_Mu5", "QCD_Pt300to470_Mu5", "QCD_Pt470to600_Mu5", "QCD_Pt600to800_Mu5", "QCD_Pt800to1000_Mu5", "QCD_Pt1000toInf_Mu5", "QCD_Pt_15to20_bcToE", "QCD_Pt_20to30_bcToE", "QCD_Pt_30to80_bcToE", "QCD_Pt_80to170_bcToE", "QCD_Pt_170to250_bcToE", "QCD_Pt_250toInf_bcToE", "QCD_Pt20to30_EMEnriched", "QCD_Pt30to50_EMEnriched", "QCD_Pt50to80_EMEnriched", "QCD_Pt80to120_EMEnriched", "QCD_Pt120to170_EMEnriched", "QCD_Pt170to300_EMEnriched", "QCD_Pt300toInf_EMEnriched"] #dirs['QCD'] = ["QCD_Pt10to15", "QCD_Pt15to30", "QCD_Pt30to50", "QCD_Pt50to80", "QCD_Pt80to120", "QCD_Pt120to170", "QCD_Pt170to300", "QCD_Pt300to470", "QCD_Pt470to600", "QCD_Pt600to800", "QCD_Pt800to1000", "QCD_Pt1000to1400", "QCD_Pt1400to1800", "QCD_Pt1800to2400", "QCD_Pt2400to3200", "QCD_Pt3200"] directories = { key : [ os.path.join( data_directory, postProcessing_directory, dir) for dir in dirs[key]] for key in dirs.keys()} DY = Sample.fromDirectory(name="DY", treeName="Events", isData=False, color=color.DY, texName="DY + Jets", directory=directories['DY']) #DY_LO = Sample.fromDirectory(name="DY_LO", treeName="Events", isData=False, color=color.DY, texName="DY + Jets (LO)", directory=directories['DY_LO']) DY_HT_LO = Sample.fromDirectory(name="DY_HT_LO", treeName="Events", isData=False, color=color.DY, texName="DY + Jets (LO,HT)", directory=directories['DY_HT_LO']) TTJets = Sample.fromDirectory(name="TTJets", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets", directory=directories['TTJets']) #TTJets_LO = Sample.fromDirectory(name="TTJets_LO", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (LO)", directory=directories['TTJets_LO']) #TTLep_pow = Sample.fromDirectory(name="TTLep_pow", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (lep,pow)", directory=directories['TTLep_pow']) TTJets_Lep = Sample.fromDirectory(name="TTJets_Lep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (lep)", directory=directories['TTJets_Lep']) TTJets_Dilep = Sample.fromDirectory(name="TTJets_Dilep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (2 lep)", directory=directories['TTJets_Dilep']) TTJets_Singlelep= Sample.fromDirectory(name="TTJets_Singlelep", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (1 lep)", directory=directories['TTJets_Singlelep']) #TTJets_HT_LO = Sample.fromDirectory(name="TTJets_HT_LO", treeName="Events", isData=False, color=color.TTJets, texName="t#bar{t} + Jets (HT,LO)", directory=directories['TTJets_HT_LO']) singleTop = Sample.fromDirectory(name="singleTop", treeName="Events", isData=False, color=color.singleTop, texName="single top", directory=directories['singleTop']) TTX = Sample.fromDirectory(name="TTX", treeName="Events", isData=False, color=color.TTX, texName="t#bar{t}X", directory=directories['TTX']) TTXNoZ = Sample.fromDirectory(name="TTXNoZ", treeName="Events", isData=False, color=color.TTXNoZ, texName="t#bar{t}H/W, tZq", directory=directories['TTXNoZ']) TTH = Sample.fromDirectory(name="TTH", treeName="Events", isData=False, color=color.TTH, texName="t#bar{t}H", directory=directories['TTH']) TTW = Sample.fromDirectory(name="TTW", treeName="Events", isData=False, color=color.TTW, texName="t#bar{t}W", directory=directories['TTW']) TTZ = Sample.fromDirectory(name="TTZ", treeName="Events", isData=False, color=color.TTZ, texName="t#bar{t}Z", directory=directories['TTZ'])
if "clip" in os.getenv("HOSTNAME").lower(): if __name__ == "__main__" and not options.check_completeness: from Samples.Tools.config import redirector_global as redirector else: from Samples.Tools.config import redirector_clip as redirector else: from Samples.Tools.config import redirector as redirector # DB from Samples.Tools.config import dbDir dbFile = dbDir+'/DB_Run2017_private_nanoAODv6.sql' logger.info("Using db file: %s", dbFile) # DoubleMuon DoubleMuon_Run2017B_25Oct2019 = Sample.nanoAODfromDAS("DoubleMuon_Run2017B_25Oct2019", "/DoubleMuon/schoef-TopNanoAODv6-1-2-4_DoubleMuon_Run2017B-9721c24ccc7f925c513e24ff74941177/USER", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov) DoubleMuon_Run2017C_25Oct2019 = Sample.nanoAODfromDAS("DoubleMuon_Run2017C_25Oct2019", "/DoubleMuon/schoef-TopNanoAODv6-1-2-4_DoubleMuon_Run2017C-9721c24ccc7f925c513e24ff74941177/USER", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov) DoubleMuon_Run2017D_25Oct2019 = Sample.nanoAODfromDAS("DoubleMuon_Run2017D_25Oct2019", "/DoubleMuon/schoef-TopNanoAODv6-1-2-4_DoubleMuon_Run2017D-9721c24ccc7f925c513e24ff74941177/USER", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov) DoubleMuon_Run2017E_25Oct2019 = Sample.nanoAODfromDAS("DoubleMuon_Run2017E_25Oct2019", "/DoubleMuon/schoef-TopNanoAODv6-1-2-4_DoubleMuon_Run2017E-9721c24ccc7f925c513e24ff74941177/USER", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov) DoubleMuon_Run2017F_25Oct2019 = Sample.nanoAODfromDAS("DoubleMuon_Run2017F_25Oct2019", "/DoubleMuon/schoef-TopNanoAODv6-1-2-4_DoubleMuon_Run2017F-9721c24ccc7f925c513e24ff74941177/USER", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov) DoubleMuon = [ DoubleMuon_Run2017B_25Oct2019, DoubleMuon_Run2017C_25Oct2019, DoubleMuon_Run2017D_25Oct2019, DoubleMuon_Run2017E_25Oct2019, DoubleMuon_Run2017F_25Oct2019, ] # MuonEG MuonEG_Run2017B_25Oct2019 = Sample.nanoAODfromDAS("MuonEG_Run2017B_25Oct2019", "/MuonEG/schoef-TopNanoAODv6-1-2-4_MuonEG_Run2017B-9721c24ccc7f925c513e24ff74941177/USER", dbFile=dbFile, redirector=redirector, instance="phys03", overwrite=ov)
def getSample(pd, runName, lumi): sample = Sample.fromDirectory(name=(pd + '_' + runName + '_backup'), treeName="Events", texName=(pd + ' (' + runName + ')'), directory=dirs[pd + '_' + runName + '_backup']) sample.lumi = lumi return sample