if args.year == '2018': jetmetCorrector = createJMECorrector(isMC=False, dataYear="UL2018", runPeriod=args.period, metBranchName="MET") Modules = [muonScaleRes2018(),FakeLep_first_Template_Module(),jetmetCorrector(),ApplyRegionFakeLeptonModule_18()] if args.year == '2017': jetmetCorrector = createJMECorrector(isMC=False, dataYear="UL2017", runPeriod=args.period, metBranchName="MET") Modules = [muonScaleRes2017(),FakeLep_first_Template_Module(),jetmetCorrector(),ApplyRegionFakeLeptonModule_17()] if args.year == '2016': jetmetCorrector = createJMECorrector(isMC=False, dataYear="UL2016", runPeriod=args.period, metBranchName="MET") Modules = [muonScaleRes2016b(),jetmetCorrector(),ApplyRegionFakeLeptonModule()] if args.year == '2016_PreVFP': jetmetCorrector = createJMECorrector(isMC=False, dataYear="UL2016_PreVFP", runPeriod=args.period, metBranchName="MET") Modules = [muonScaleRes2016a(),jetmetCorrector(),ApplyRegionFakeLeptonModule()] else: if args.year == '2018': jetmetCorrector = createJMECorrector(isMC=True, dataYear="UL2018", jesUncert="Total", metBranchName="MET", splitJER=False, applyHEMfix=True) Modules = [countHistogramsProducer(),muonScaleRes2018(),FakeLep_first_Template_Module(),puAutoWeight_2018(),muonIDISOSF2018(),eleRECOSF2018(),eleIDSF2018(),phoIDSF2018(),jetmetCorrector(),btagSFUL2018(),btagWeightModule_18(),ApplyRegionFakeLeptonModule_18()] if args.year == '2017': jetmetCorrector = createJMECorrector(isMC=True, dataYear="UL2017", jesUncert="Total", metBranchName="MET", splitJER=False) Modules = [countHistogramsProducer(),muonScaleRes2017(),FakeLep_first_Template_Module(),puAutoWeight_2017(),PrefCorrUL17(),muonIDISOSF2017(),eleRECOSF2017(),eleIDSF2017(),phoIDSF2017(),jetmetCorrector(),btagSFUL2017(),btagWeightModule_17(),ApplyRegionFakeLeptonModule_17()] if args.year == '2016': jetmetCorrector = createJMECorrector(isMC=True, dataYear="UL2016", jesUncert="Total", metBranchName="MET", splitJER=False) Modules = [countHistogramsProducer(),puAutoWeight_2016(),PrefCorrUL16_postVFP(),muonIDISOSF2016(),muonScaleRes2016b(),eleRECOSF2016(),eleIDSF2016(),jetmetCorrector(),ApplyRegionFakeLeptonModule()] if args.year == '2016_PreVFP': jetmetCorrector = createJMECorrector(isMC=True, dataYear="UL2016_PreVFP", jesUncert="Total", metBranchName="MET", splitJER=False) Modules = [countHistogramsProducer(),puAutoWeight_2016(),PrefCorrUL16_preVFP(),muonIDISOSF2016(),muonScaleRes2016a(),eleRECOSF2016(),eleIDSF2016(),jetmetCorrector(),ApplyRegionFakeLeptonModule()] if args.file: infilelist = [] jsoninput = None fwkjobreport = False
if args.year == '2016Pre': jetmetCorrector = createJMECorrector(isMC=False, dataYear="UL2016_PreVFP", runPeriod=args.period, metBranchName="MET") Modules = [muonScaleRes2016a(), jetmetCorrector(), WZG_select_Module()] else: if args.year == '2018': jetmetCorrector = createJMECorrector(isMC=True, dataYear="UL2018", jesUncert="Total", metBranchName="MET", splitJER=False, applyHEMfix=True) Modules = [ countHistogramsProducer(), muonScaleRes2018(), pre_select_Producer(), puAutoWeight_2018(), muonIDISOSF2018(), eleRECOSF2018(), eleIDSF2018(), phoIDSF2018(), jetmetCorrector(), btagSFUL2018(), btagWeightModule_18(), define_object_Module_18(), WZG_select_multi_Module() ] # Modules = [countHistogramsProducer(),muonScaleRes2018(),first_Template_Producer(),puAutoWeight_2018(),muonIDISOSF2018(),eleRECOSF2018(),eleIDSF2018(),phoIDSF2018(),jetmetCorrector(),btagSFUL2018(),btagWeightModule_18(),WZG_select_Module_18()] if args.year == '2017':
else: search.getLFN(dataset, args.name + "_" + args.year) with open("filepath_" + args.name + "_" + args.year + ".txt", "r") as f: lines = f.readlines() for line in lines: line = line.rstrip('\n') files.append(search.getValidSite(line) + line) print 'from DAS input files: ', files p = PostProcessor(".", files, branchsel="WZG_input_branch.txt", modules=[countHistogramsProducer(), WZG.WZG_Producer()], provenance=True, outputbranchsel="WZG_output_branch.txt") p.run() else: files = [] # condor can't use dasgoclient, so we should upload the filepath for condor run. sth. different with local run here # designed for single file here in order to run in parallel if 'condor' in args.mode: files.append(search.getValidSite(args.file) + args.file) print 'input files: ', files print 'test' # local specific file input, also support root://xxx
dest='mode', default='local', help='runmode local/condor') parser.add_argument('-y', dest='year', default='2018', help='year') parser.add_argument('-d', dest='isdata', action='store_true', default=False) args = parser.parse_args() print "mode: ", args.mode print "input file: ", args.file if args.isdata: Modules = [WZG.HLT_template_Producer()] print "processing data" else: if args.year == '2018': Modules = [countHistogramsProducer(), WZG.HLT_template_Producer()] if args.year == '2017': Modules = [countHistogramsProducer(), WZG.HLT_template_Producer()] if args.year == '2016Pre' or args.year == '2016Post': Modules = [countHistogramsProducer(), WZG.HLT_template_Producer()] print "processing MC samples" if args.file: infilelist = [] jsoninput = None fwkjobreport = False if args.mode == 'condor': import DAS_filesearch as search infilelist.append(search.getValidSite(args.file) + args.file)
self.out.fillBranch("muon_eta",muons[muon_select[i]].eta) self.out.fillBranch("muon_phi",muons[muon_select[i]].phi) self.out.fillBranch("event",event.event) self.out.fillBranch("dilepton_mass",dileptonmass) self.out.fillBranch("Generator_weight",event.Generator_weight) return True # files=["root://cms-xrd-global.cern.ch//store/mc/RunIISummer16NanoAODv6/WZG_TuneCUETP8M1_13TeV-amcatnlo-pythia8/NANOAODSIM/PUMoriond17_Nano25Oct2019_102X_mcRun2_asymptotic_v7-v1/260000/EE33CA79-B0A1-1145-A457-FE7B7C1A03BC.root"] # files=["root://cms-xrd-global.cern.ch//store/mc/RunIISummer16NanoAODv6/WZG_TuneCUETP8M1_13TeV-amcatnlo-pythia8/NANOAODSIM/PUMoriond17_Nano25Oct2019_102X_mcRun2_asymptotic_v7-v1/260000/356CFA55-E91B-1940-ACFC-FE3E769A44D5.root"] # files=["root://cms-xrd-global.cern.ch//store/mc/RunIISummer16NanoAODv4/TTWJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8/NANOAODSIM/PUMoriond17_Nano14Dec2018_102X_mcRun2_asymptotic_v6_ext1-v1/260000/FA76270A-417C-174F-B403-8FE5E5A3EFE4.root"] # files=["root://cms-xrd-global.cern.ch//store/mc/RunIISummer16NanoAODv4/ttZJets_13TeV_madgraphMLM/NANOAODSIM/Nano14Dec2018_102X_mcRun2_asymptotic_v6-v1/280000/AF15D61D-C169-1F49-B287-DCF0B7F44B8B.root"] # files=["root://cms-xrd-global.cern.ch//store/mc/RunIISummer16NanoAODv6/tZq_ll_4f_13TeV-amcatnlo-pythia8/NANOAODSIM/PUMoriond17_Nano25Oct2019_102X_mcRun2_asymptotic_v7_ext1-v1/280000/A85C5B62-D4C8-6845-B005-C0CE9B0AB4EA.root"] # files=["/afs/cern.ch/work/s/sdeng/config_file/bwcutoff_15_test_submit/10k/SMP-RunIISummer16NanoAODv6-00310.root"] # files=["/afs/cern.ch/work/s/sdeng/config_file/bwcutoff_15_test_submit/WZG_bw15_420k.root"] # files=["/afs/cern.ch/work/s/sdeng/config_file/bwcutoff_30_test_submit/10k/SMP-RunIISummer16NanoAODv6-00310.root"] # files=["/afs/cern.ch/work/s/sdeng/config_file/bwcutoff_30_test_submit/WZG_bw30_232k.root"] # files=["/afs/cern.ch/work/s/sdeng/config_file/background/TTWJetsToLNu.root"] # files=["/afs/cern.ch/work/s/sdeng/config_file/background/TTZJets.root"] files=["/afs/cern.ch/work/s/sdeng/config_file/background/WZ.root"] # files=["/afs/cern.ch/work/s/sdeng/config_file/background/tZq_ll.root"] p=PostProcessor(".",files,branchsel="input_branch_sel.txt",modules=[countHistogramsProducer(),WZAAnalysis()],provenance=True,outputbranchsel="output_branch_sel.txt") p.run() print "MET_pass","\t","=","\t",MET_pass print "photon_pass","\t","=","\t",photon_pass # print "electron_pass","\t","=","\t",electron_pass # print "muon_pass","\t","=","\t",muon_pass print "lepton_pass","\t","=","\t",lepton_pass print "threelepton_pass","\t","=","\t",threelepton_pass print "emumu_pass","\t","=","\t",emumu_pass print "btagjet_pass","\t","=","\t",btagjet_pass