from Core.ComponentList import * from Core.Dataset import Dataset from Core.Utils.MakeComponent import makeComponents sampleName = "WWDoubleTo2L" fileName = "treeProducerSusyRA5.root" TreeDir = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v2_LeptonJetRecleaner/" sumweight_path = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v1/" inUFTier2 = True filePath = os.path.join(sumweight_path, sampleName, fileName) #cmp = makeComponents(sampleName, TreeDir, "Events", inUFTier2) cmpList = ComponentList([ Component("WWDoubleTo2L", TreeDir + sampleName + "/" + "WWDoubleTo2L_%s_SkimTree.root" % i, "tree", inUFTier2) for i in range(0, 1) ]) WWDoubleTo2L = Dataset( "WWDoubleTo2L", cmpList, isMC=True, xs=1, ) WWDoubleTo2L.setSumWeight(filePath, "SumGenWeights", inUFTier2) Samples = [WWDoubleTo2L]
# ____________________________________________________________________________________________________________________________________________ || darkSUSY_SkimTreeDir = "/raid/raid7/lucien/Higgs/DarkZ-NTuple/20190131/SkimTree_DarkSUSY_Run2016Data_m4l70/" darkSUSY_SumWeightDir = "/cms/data/store/user/t2/users/klo/Higgs/HToZdZd/DarkSUSY_Run2016/" skimTreeName = "passedEvents" sumWeightHist = "Ana/sumWeights" kappa = 0.005 # ____________________________________________________________________________________________________________________________________________ || DarkSUSY_mN1_10_mGammaD_8p5_cT_0_cmpList = ComponentList([ Component( "DarkSUSY_mN1_10_mGammaD_8p5_cT_0_cmpList", darkSUSY_SkimTreeDir + "DarkSUSY_mH_125_mN1_10_mGammaD_8p5_cT_0_13TeV-pythia8.root", skimTreeName, False, ), ]) DarkSUSY_mN1_10_mGammaD_8p5_cT_0 = Dataset( "DarkSUSY_mH_125_mN1_10_mGammaD_8p5_cT_0", DarkSUSY_mN1_10_mGammaD_8p5_cT_0_cmpList, isMC=True, isSignal=True, xs=48.58 * kappa**2 * 108.21481671424391, ) DarkSUSY_mN1_10_mGammaD_8p5_cT_0.setSumWeight( darkSUSY_SumWeightDir + "DarkSUSY_mH_125_mN1_10_mGammaD_8p5_cT_0_13TeV-pythia8.root", sumWeightHist, True, )
qqZZ_cmpList = ComponentList( [ Component("qqZZTo4L",bkgSkimTreeDir+"ZZTo4L_13TeV_powheg_pythia8_RunIIFall17MiniAOD-94X_mc2017_realistic_v10_ext1-v1.root","passedEvents",inUFTier2=inUFTier2), ] ) qqZZTo4L = Dataset( "qqZZTo4L", qqZZ_cmpList, isMC = True, xs = 1.256, ) if sumWeightFromT2: qqZZTo4L.setSumWeight( bkgTreeDir+"ZZTo4L_13TeV_powheg_pythia8_RunIIFall17MiniAOD-94X_mc2017_realistic_v10_ext1-v1.root", sumWeightHist, True, ) else: qqZZTo4L.sumw = 6669988.0 # ____________________________________________________________________________________________________________________________________________ || # ggH ggH_cmpList = ComponentList( [ Component("ggH",bkgSkimTreeDir+"GluGluHToZZTo4L_M125_13TeV_powheg2_JHUGenV7011_pythia8.root","passedEvents",inUFTier2=inUFTier2), ] ) ggH = Dataset( "ggH",
for sigName in sigList: prodType, massStr, decayType = sigName.split("_") decay1, decay2 = decayType.split("-") if decay1 == decay2: br = br_Tprime**2 else: br = br_Tprime**2 * 2 ljmetSigName = "".join([prodType, massStr, decay1, decay2]) tmpDataset = Dataset( sigName, ComponentList([ Component( sigName, dir_prefix + samples[ljmetSigName] + ".root", treeName, False, ), ]), isMC=True, xs=xsec[prodType + massStr], #sumw = nRun[sigName], isSignal=True, ) tmpDataset.setSumWeight( dir_prefix + samples[ljmetSigName] + ".root", "nevents", ) tmpDataset.sumw *= br sigSamples.append(tmpDataset) sigDict[sigName] = tmpDataset
#componentList = [] sampleDict = {} sampleFileNames = listdir_uberftp(common_path,selection=lambda x: True) for sampleName in sampleFileNames: if "TT_pow" in sampleName: continue if any([dataSample in sampleName for dataSample in dataSamples]): continue parentName = sampleName for postfix in postfixs: if postfix in sampleName: parentName = parentName.replace("_"+postfix,"") filePath = os.path.join(common_path,sampleName,fileName) cmpList = ComponentList( [Component(parentName,filePath,treeName,inUFTier2,)] ) tmpDataset = Dataset(parentName,cmpList,) tmpDataset.setSumWeight(filePath,sumWeight,inUFTier2) #componentList.append(tmpDataset) if parentName not in sampleDict: sampleDict[parentName] = tmpDataset else: sampleDict[parentName].add(tmpDataset) # Exceptionally handling TT Powheg sample TT_pow_comps = makeComponents("TT_pow","/cms/data/store/user/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v1/TT_pow/180712_162135/0000/",treeName,inUFTier2) TT_pow = Dataset("TT_pow",ComponentList([]),xs=1.) TT_pow.sumw = 0. for comp in TT_pow_comps: temp_comp_list = ComponentList([comp]) tmpDataset = Dataset("TT_pow",temp_comp_list,xs=1.) tmpDataset.setSumWeight(comp.path,sumWeight,inUFTier2) TT_pow.add(tmpDataset)
from Core.ComponentList import * from Core.Dataset import Dataset cmp = Component( "TGJets", "/cms/data/store/user/klo/RA5/NTuples/2016/NanoAOD/MC/TGJets_TuneCUETP8M1_13TeV_amcatnlo_madspin_pythia8/InclusiveSelection_v1/180509_144401/0000/", "Events", keyword="tree", inUFTier2=True, ) cmpList = ComponentList([ cmp, ], ) TGJets = Dataset( "TGJets", cmpList, xs=2.967, #pb ) TGJets.setSumWeight( "/raid/raid7/lucien/SUSY/RA5/SumGenWeight/NanoAOD_InclusiveSelection_v1/Run2016/TGJets/EventWeight.root" )
from Core.ComponentList import * from Core.Dataset import Dataset from Core.Utils.MakeComponent import makeComponents sampleName = "WGToLNuG" fileName = "treeProducerSusyRA5.root" TreeDir = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v2_LeptonJetRecleaner/" sumweight_path = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v1/" inUFTier2 = True filePath = os.path.join(sumweight_path, sampleName, fileName) #cmp = makeComponents(sampleName, TreeDir, "Events", inUFTier2) cmpList = ComponentList([ Component("WGToLNuG", TreeDir + sampleName + "/" + "WGToLNuG_%s_SkimTree.root" % i, "tree", inUFTier2) for i in range(0, 1) ]) WGToLNuG = Dataset( "WGToLNuG", cmpList, isMC=True, xs=1, ) WGToLNuG.setSumWeight(filePath, "SumGenWeights", inUFTier2) Samples = [WGToLNuG]
# T1tbs 1000 comp_1000 = Component("SMS-T1tbs", treeDir + "SMS-T1tbs_mGluino1000/" + fileName, treeName, inUFTier2=inUFTier2) cmpList_1000 = ComponentList([comp_1000]) T1tbs_1000 = Dataset( "SMS-T1tbs_mGluino1000", cmpList_1000, isSignal=True, isMC=True, xsFactor=0.09, plotLabel="T1tbs, m_{Gluino} = 1000", ) T1tbs_1000.setSumWeight(sumweight_path + "mGluino1000/" + sumweight_file, sumWeight, inUFTier2=inUFTier2) # _______________________________________________________________________________________________________________ || # T1tbs 1500 comp_1500 = Component("SMS-T1tbs", treeDir + "SMS-T1tbs_mGluino1500/" + fileName, treeName, inUFTier2=inUFTier2) cmpList_1500 = ComponentList([comp_1500]) T1tbs_1500 = Dataset( "SMS-T1tbs_mGluino1500", cmpList_1500, isSignal=True, isMC=True, xsFactor=0.09,
from Core.ComponentList import * from Core.Dataset import Dataset from Core.Utils.MakeComponent import makeComponents sampleName = "WZTo3LNu" fileName = "treeProducerSusyRA5.root" TreeDir = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v2_LeptonJetRecleaner/" sumweight_path = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v1/" inUFTier2 = True filePath = os.path.join(sumweight_path,sampleName,fileName) #cmp = makeComponents(sampleName, TreeDir, "Events", inUFTier2) cmpList = ComponentList( [ Component("WZTo3LNu",TreeDir + sampleName +"/"+ "WZTo3LNu_%s_SkimTree.root"%i,"tree",inUFTier2) for i in range(0,1)] ) WZTo3LNu= Dataset( "WZTo3LNu", cmpList, isMC = True, xs = 1, ) WZTo3LNu.setSumWeight(filePath,"SumGenWeights",inUFTier2) Samples = [ WZTo3LNu ]
"ggZZTo4tau", bkgSkimTreeDir + "GluGluToContinToZZTo4tau_13TeV_MCFM701_pythia8_RunIISummer16MiniAODv2.root", "passedEvents", inUFTier2=inUFTier2), ]) ggZZTo4tau = Dataset( "ggZZTo4tau", ggZZTo4L_cmpList, isMC=True, xs=0.001586, ) if sumWeightFromT2: ggZZTo4tau.setSumWeight( bkgTreeDir + "GluGluToContinToZZTo4tau_13TeV_MCFM701_pythia8_RunIISummer16MiniAODv2.root", sumWeightHist, True) else: ggZZTo4tau.sumw = 495800.000000 # ____________________________________________________________________________________________________________________________________________ || # ggZZTo4e ggZZTo4L_cmpList = ComponentList([ Component( "ggZZTo4e", bkgSkimTreeDir + "GluGluToContinToZZTo4e_13TeV_MCFM701_pythia8_RunIISummer16MiniAODv2.root", "passedEvents", inUFTier2=inUFTier2), ])
import os # _______________________________________________________________________________________________________________ || common_path = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v1_SMS-T1tbs/" fileName = "treeProducerSusyRA5.root" inUFTier2 = True treeName = "tree" sumWeight = "SumGenWeights" # _______________________________________________________________________________________________________________ || # T1qqqqL 1000 comp_1000 = Component("SMS-T1tbs",common_path+"mGluino1000/"+fileName,treeName,inUFTier2=inUFTier2) cmpList_1000 = ComponentList([comp_1000]) T1tbs_1000 = Dataset( "SMS-T1tbs_mGluino1000", cmpList_1000, ) T1tbs_1000.setSumWeight(common_path+"mGluino1000/"+fileName,sumWeight,inUFTier2=inUFTier2) # _______________________________________________________________________________________________________________ || # T1qqqqL 1500 comp_1500 = Component("SMS-T1tbs",common_path+"mGluino1500/"+fileName,treeName,inUFTier2=inUFTier2) cmpList_1500 = ComponentList([comp_1500]) T1tbs_1500 = Dataset( "SMS-T1tbs_mGluino1500", cmpList_1500, ) T1tbs_1500.setSumWeight(common_path+"mGluino1500/"+fileName,sumWeight,inUFTier2=inUFTier2) # _______________________________________________________________________________________________________________ ||
from Core.ComponentList import * from Core.Dataset import Dataset from Core.Utils.MakeComponent import makeComponents sampleName = "TTZToLLNuNu" sumweightName = "TTZToLLNuNu_ext" fileName = "treeProducerSusyRA5.root" TreeDir = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v2_LeptonJetRecleaner/" sumweight_path = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v1/" inUFTier2 = True filePath = os.path.join(sumweight_path, sumweightName, fileName) #cmp = makeComponents(sampleName, TreeDir, "Events", inUFTier2) cmpList = ComponentList([ Component("TTZToLLNuNu", TreeDir + sampleName + "/" + "TTZToLLNuNu_%s_SkimTree.root" % i, "tree", inUFTier2) for i in range(0, 1) ]) TTZToLLNuNu = Dataset( "TTZToLLNuNu", cmpList, isMC=True, xs=1, ) TTZToLLNuNu.setSumWeight(filePath, "SumGenWeights", inUFTier2) Samples = [TTZToLLNuNu]
#cmp = makeComponents(sampleName, TreeDir, "tree", inUFTier2) cmpList = ComponentList([ Component( "DYJetsToLL_M50_LO", TreeDir + sampleName + "/" + "DYJetsToLL_M50_LO_%s_SkimTree.root" % i, "tree", inUFTier2) for i in range(0, 2) ]) DYJetsToLL_M50_LO_ext = Dataset( "DYJetsToLL_M50_LO_ext", cmpList, isMC=True, xs=1, ) DYJetsToLL_M50_LO_ext2 = Dataset( "DYJetsToLL_M50_LO_ext2", ComponentList([]), isMC=True, xs=1, ) DYJetsToLL_M50_LO_ext.setSumWeight(filePath1, "SumGenWeights", inUFTier2) DYJetsToLL_M50_LO_ext2.setSumWeight(filePath2, "SumGenWeights", inUFTier2) #DYJetsToLL_M50_LO_ext.add(DYJetsToLL_M50_LO_ext2) Samples = [DYJetsToLL_M50_LO_ext]
inUFTier2 = True tree_path = "tree" # __________________________________________________________________________________________ || DYJetsToLL_M10to50_LO_cmpList = ComponentList([ Component("DYJetsToLL_M10to50_LO", mc_dir + "DYJetsToLL_M10to50_LO.root", tree_path, inUFTier2), ]) DYJetsToLL_M10to50_LO = Dataset( "DYJetsToLL_M10to50_LO", DYJetsToLL_M10to50_LO_cmpList, isMC=True, xs=1, ) DYJetsToLL_M10to50_LO.setSumWeight(mc_dir + "DYJetsToLL_M10to50_LO.root", "SumGenWeights", inUFTier2) # __________________________________________________________________________________________ || DYJetsToLL_M50_LO_cmpList = ComponentList([ Component("DYJetsToLL_M50_LO", mc_dir + "DYJetsToLL_M50_LO_ext.root", tree_path, inUFTier2), ]) DYJetsToLL_M50_LO_ext = Dataset( "DYJetsToLL_M50_LO", DYJetsToLL_M50_LO_cmpList, isMC=True, xs=1, ) DYJetsToLL_M50_LO_ext.setSumWeight(mc_dir + "DYJetsToLL_M50_LO_ext.root", "SumGenWeights", inUFTier2)
from Core.ComponentList import * from Core.Dataset import Dataset from Core.Utils.MakeComponent import makeComponents sampleName = "TGJets" fileName = "treeProducerSusyRA5.root" TreeDir = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v2_LeptonJetRecleaner/" sumweight_path = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v1/" inUFTier2 = True filePath = os.path.join(sumweight_path, sampleName, fileName) #cmp = makeComponents(sampleName, TreeDir, "Events", inUFTier2) cmpList = ComponentList([ Component("TGJets", TreeDir + sampleName + "/" + "TGJets_%s_SkimTree.root" % i, "tree", inUFTier2) for i in range(0, 1) ]) TGJets = Dataset( "TGJets", cmpList, isMC=True, xs=1, ) TGJets.setSumWeight(filePath, "SumGenWeights", inUFTier2) Samples = [TGJets]
#cmp = makeComponents(sampleName, TreeDir, "Events", inUFTier2) cmpList = ComponentList([ Component( "WJetsToLNu_LO", TreeDir + sampleName + "/" + "WJetsToLNu_LO_%s_SkimTree.root" % i, "tree", inUFTier2) for i in range(0, 2) ]) WJetsToLNu_LO = Dataset( "WJetsToLNu_LO", cmpList, isMC=True, xs=1, ) WJetsToLNu_LO_ext = Dataset( "WJetsToLNu_LO_ext", ComponentList([]), isMC=True, xs=1, ) WJetsToLNu_LO.setSumWeight(filePath1, "SumGenWeights", inUFTier2) WJetsToLNu_LO_ext.setSumWeight(filePath2, "SumGenWeights", inUFTier2) WJetsToLNu_LO.add(WJetsToLNu_LO_ext) Samples = [WJetsToLNu_LO]
# ____________________________________________________________________________________________________________________________________________ || DYJetsToLL_M50_cmpList = ComponentList([ Component("DYJetsToLL_M50", bkgTreeDir + "DYJetsToLL_M50.root", "passedEvents", inUFTier2=inUFTier2), ]) DYJetsToLL_M50 = Dataset( "DYJetsToLL_M50", DYJetsToLL_M50_cmpList, isMC=True, xs=6104, ) path_DYJetsToLL_M50 = bkgTreeDirT2 + "DYJetsToLL_M50.root" if system.getSystemMode() == system.remote_str: DYJetsToLL_M50.setSumWeight(path_DYJetsToLL_M50, sumWeightHist, True) if saveSumWeightTxt: DYJetsToLL_M50.saveSumWeightToPath(bkgTreeDir + "DYJetsToLL_M50.txt") elif system.getSystemMode() == system.local_str: DYJetsToLL_M50.setSumWeightByTxt(bkgTreeDir + "DYJetsToLL_M50.txt") # ____________________________________________________________________________________________________________________________________________ || DYJetsToLL_M10To50_cmpList = ComponentList([ Component("DYJetsToLL_M10To50", bkgTreeDir + "DYJetsToLL_M10To50.root", "passedEvents", inUFTier2=inUFTier2), ]) DYJetsToLL_M10To50 = Dataset( "DYJetsToLL_M10To50", DYJetsToLL_M10To50_cmpList,
Component("WrongFC_Irreducible", bkgTreeDir + "ZZTo4L_13TeV_powheg_pythia8_RunIISummer16MiniAODv2.root", "passedEvents", inUFTier2=inUFTier2), ]) qqZZTo4L = Dataset( "WrongFC_Irreducible", qqZZ_cmpList, isMC=True, xs=1.256, ) qqZZTo4L.setSumWeight( qqZZSumWFile + "ZZTo4L_13TeV_powheg_pythia8_RunIISummer16MiniAODv2.root", sumWeightHist, True, ) # ____________________________________________________________________________________________________________________________________________ || DYJetsToLL_M50_cmpList = ComponentList([ Component( "DYJetsToLL_M50", bkgTreeDir + "DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_RunIISummer16MiniAODv2.root", "passedEvents", inUFTier2=inUFTier2), ]) DYJetsToLL_M50 = Dataset( "DYJetsToLL_M50", DYJetsToLL_M50_cmpList,
from Core.ComponentList import * from Core.Dataset import Dataset from Core.Utils.MakeComponent import makeComponents sampleName = "VHToNonbb" fileName = "treeProducerSusyRA5.root" TreeDir = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v2_LeptonJetRecleaner/" sumweight_path = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v1/" inUFTier2 = True filePath = os.path.join(sumweight_path, sampleName, fileName) #cmp = makeComponents(sampleName, TreeDir, "Events", inUFTier2) cmpList = ComponentList([ Component("VHToNonbb", TreeDir + sampleName + "/" + "VHToNonbb_%s_SkimTree.root" % i, "tree", inUFTier2) for i in range(0, 1) ]) VHToNonbb = Dataset( "VHToNonbb", cmpList, isMC=True, xs=1, ) VHToNonbb.setSumWeight(filePath, "SumGenWeights", inUFTier2) Samples = [VHToNonbb]
inUFTier2 = False cmpList = ComponentList([Component( sampleName, filePath, "tree", inUFTier2, )]) SyncMC = Dataset( "SyncMC", cmpList, isMC=True, xs=1, ) SyncMC.setSumWeight(filePath, "SumGenWeights", inUFTier2) # ________________________________________________________________________________________________ || # Skim Tree skimCmpList = ComponentList([ Component( "SkimSyncMC", "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/SyncMC2016/TTW_RA5_sync_LeptonJetRecleaner/SyncMC/SkimTree.root", #"/raid/raid7/lucien/SUSY/RA5/HeppyTree/SyncMC2016/TTW_RA5_sync_LeptonJetRecleaner/SyncMC/SkimTree.root", "tree", True, ) ]) SkimSyncMC = Dataset( "SkimSyncMC",
from Core.ComponentList import * from Core.Dataset import Dataset from Core.Utils.MakeComponent import makeComponents sampleName = "DYJetsToLL_M10to50_LO" fileName = "treeProducerSusyRA5.root" TreeDir = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v2_LeptonJetRecleaner/" sumweight_path = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v1/" inUFTier2 = True filePath = os.path.join(sumweight_path, sampleName, fileName) #cmp = makeComponents(sampleName, TreeDir, "tree", inUFTier2) cmpList = ComponentList([ Component( "DYJetsToLL_M10to50_LO", TreeDir + sampleName + "/" + "DYJetsToLL_M10to50_LO_%s_SkimTree.root" % i, "tree", inUFTier2) for i in range(0, 1) ]) DYJetsToLL_M10to50_LO = Dataset( "DYJetsToLL_M10to50_LO", cmpList, isMC=True, xs=1, ) DYJetsToLL_M10to50_LO.setSumWeight(filePath, "SumGenWeights", inUFTier2) Samples = [DYJetsToLL_M10to50_LO]
from Core.ComponentList import * from Core.Dataset import Dataset from Core.Utils.MakeComponent import makeComponents sampleName = "TTHnobb_pow" fileName = "treeProducerSusyRA5.root" TreeDir = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v2_LeptonJetRecleaner/" sumweight_path = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/July18_v1/" inUFTier2 = True filePath = os.path.join(sumweight_path, sampleName, fileName) #cmp = makeComponents(sampleName, TreeDir, "Events", inUFTier2) cmpList = ComponentList([ Component("TTHnobb_pow", TreeDir + sampleName + "/" + "TTHnobb_pow_%s_SkimTree.root" % i, "tree", inUFTier2) for i in range(0, 1) ]) TTHnobb_pow = Dataset( "TTHnobb_pow", cmpList, isMC=True, xs=1, ) TTHnobb_pow.setSumWeight(filePath, "SumGenWeights", inUFTier2) Samples = [TTHnobb_pow]
import os from Core.ComponentList import * from Core.Dataset import Dataset from DataMC.NanoAOD.CrossSection import xs_dict fileName = "SkimTree.root" #common_path = "/raid/raid7/lucien/SUSY/RPV/SkimTree/ZMuMu/2018-06-19/BkgMC_ZMuMuSelection_v1/" common_path = "/raid/raid7/kshi/SUSY/RPV/SkimTree/mc/TTbar/" inUFTier2 = False #sumw_path = "/raid/raid7/lucien/SUSY/RPV/SumGenWeight/NanoAOD_InclusiveSelection_v2/%s/EventWeight.root" sumw_path = "/raid/raid7/kshi/SUSY/RPV/sum_weight/%s/EventWeight.root" sampleNames = [ n for n in os.listdir(common_path) if os.path.isdir(os.path.join(common_path, n)) ] allMCSamples = [] for sampleName in sampleNames: if sampleName != "DYJetsToLL_M50_LO": tmpList = ComponentList([ Component(sampleName, "/".join([common_path, sampleName, fileName]), "Events", inUFTier2, maxEvents=-1) ], ) tmpDataset = Dataset(sampleName, tmpList, xs=xs_dict[sampleName]) tmpDataset.setSumWeight(sumw_path % sampleName) allMCSamples.append(tmpDataset)
#dir_path = "/cms/data/store/user/t2/users/klo/HeppyTree/heppy_80X_RA5_Legacy/Sept18_v1/" dir_path = "/raid/raid7/lucien/SUSY/RA5/HeppyTree/Sept18_v1/" inUFTier2 = False treeName = "tree" componentDict = {} if inUFTier2: fileNames = [ n for n in listdir_uberftp(dir_path) if n.endswith(".root") ] else: fileNames = [ n for n in os.listdir(dir_path) if n.endswith(".root") ] for fileName in fileNames: if "SMS" in fileName: continue # New signal model ntuples in Oct18_v1 if "ext" not in fileName: sampleName = fileName.replace(".root","") else: sampleName = fileName.split("_ext")[0] tmpDataset = Dataset( sampleName, ComponentList( [Component(sampleName,os.path.join(dir_path,fileName),treeName,inUFTier2,),] ), isMC = True, isSignal = "SMS" in fileName, ) tmpDataset.setSumWeight(os.path.join(dir_path,fileName),"SumGenWeights",inUFTier2) if sampleName not in componentDict: componentDict[sampleName] = tmpDataset else: componentDict[sampleName].add(tmpDataset)
filePath2 = os.path.join(sumweight_path,sumweightName2,fileName) #cmp = makeComponents(sampleName, TreeDir, "Events", inUFTier2) cmpList = ComponentList( [ Component("TTWToLNu",TreeDir + sampleName +"/"+ "TTWToLNu_%s_SkimTree.root"%i,"tree",inUFTier2) for i in range(0,2)] ) TTWToLNu_ext= Dataset( "TTWToLNu_ext", cmpList, isMC = True, xs = 1, ) TTWToLNu_ext2= Dataset( "TTWToLNu_ext2", ComponentList([]), isMC = True, xs = 1, ) TTWToLNu_ext.setSumWeight(filePath1,"SumGenWeights",inUFTier2) TTWToLNu_ext2.setSumWeight(filePath2,"SumGenWeights",inUFTier2) TTWToLNu_ext.add(TTWToLNu_ext2) Samples = [ TTWToLNu_ext ]