def makeTreeFromPAT(process, outFileName, NJetsMin=2, HTMin=0., MHTMin=0., globalTag="none", isData=True, hltPath=[], reportEveryEvt=10, testFileName="", numProcessedEvt=100): ## --- Log output ------------------------------------------------------ process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr = cms.untracked.PSet( placeholder = cms.untracked.bool(True) ) process.MessageLogger.cout = cms.untracked.PSet( INFO = cms.untracked.PSet(reportEvery = cms.untracked.int32(reportEveryEvt)) ) process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) ) ## --- Files to process ------------------------------------------------ process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(numProcessedEvt) ) process.source = cms.Source( "PoolSource", fileNames = cms.untracked.vstring(testFileName) ) ## --- Output file ----------------------------------------------------- process.TFileService = cms.Service( "TFileService", fileName = cms.string(outFileName+".root") ) ## --- Selection sequences --------------------------------------------- # HLT process.load('HLTrigger.HLTfilters.hltHighLevel_cfi') process.hltHighLevel.HLTPaths = cms.vstring(hltPath) process.hltHighLevel.andOr = cms.bool(True) process.hltHighLevel.throw = cms.bool(False) process.HLTSelection = cms.Sequence( process.hltHighLevel ) if not isData: print "Running over MC: removing HLT selection" process.HLTSelection.remove(process.hltHighLevel) elif not hltPath: print "Empty list of HLT paths: removing HLT selection" process.HLTSelection.remove(process.hltHighLevel) # Filter-related selection from RecoMET.METFilters.jetIDFailureFilter_cfi import jetIDFailure process.PBNRFilter = jetIDFailure.clone( JetSource = cms.InputTag('patJetsPF'), MinJetPt = cms.double(30.0), taggingMode = cms.bool(True) ) from RecoMET.METFilters.multiEventFilter_cfi import multiEventFilter process.HCALLaserEvtFilterList2012 = multiEventFilter.clone( file = cms.FileInPath('RA2Classic/AdditionalInputFiles/data/HCALLaserEventList_20Nov2012-v2_HT-HTMHT.txt'), taggingMode = cms.bool(True) ) process.ResidualNoiseEventFilter = multiEventFilter.clone( file = cms.FileInPath('RA2Classic/AdditionalInputFiles/data/NoiseEventList.txt'), taggingMode = cms.bool(True) ) from SandBox.Skims.hoNoiseFilter_cfi import hoNoiseFilter process.RA2HONoiseFilter = hoNoiseFilter.clone( patJetsInputTag = cms.InputTag('patJetsPF'), jetPtMin = cms.double(30), jetEtaMax = cms.double(5), maxHOEfrac = cms.double(0.4), taggingMode = cms.bool(True) ) # Produce RA2 jets (produces the collections HTJets and MHTJets) process.load('RA2Classic.Utils.produceRA2JetsPFCHS_cff') process.ProduceRA2Jets = cms.Sequence( process.produceRA2JetsPFCHS ) # Select events with at least 'NJetsMin' of the above jets from PhysicsTools.PatAlgos.selectionLayer1.jetCountFilter_cfi import countPatJets process.NumJetSelection = countPatJets.clone( src = cms.InputTag('HTJets'), minNumber = cms.uint32(NJetsMin) ) # HT selection htInputCol = 'htPFchs' from SandBox.Skims.RA2HT_cff import htPFFilter process.HTSelection = htPFFilter.clone( HTSource = cms.InputTag(htInputCol), MinHT = cms.double(HTMin) ) # MHT selection mhtInputCol = 'mhtPFchs' from SandBox.Skims.RA2MHT_cff import mhtPFFilter process.MHTSelection = mhtPFFilter.clone( MHTSource = cms.InputTag(mhtInputCol), MinMHT = cms.double(MHTMin) ) ## --- Compute muon-MT ------------------------------------------------ from RA2Classic.Utils.mtProducer_cfi import mtProducer process.MuonMT = mtProducer.clone( CandidateCollectionTag = cms.InputTag("patMuonsPFIDIso"), METTag = cms.InputTag("patMETsPF") ) ## --- Setup WeightProducer ------------------------------------------- from RA2Classic.WeightProducer.getWeightProducer_cff import getWeightProducer process.WeightProducer = getWeightProducer(testFileName) process.WeightProducer.Lumi = cms.double(19466) process.WeightProducer.PU = cms.int32(3) # PU S10 process.WeightProducer.FileNamePUDataDistribution = cms.string("RA2Classic/WeightProducer/data/DataPileupHistogram_RA2Summer12_190456-208686_ABCD.root") ## --- Setup of TreeMaker ---------------------------------------------- FilterNames = cms.VInputTag() FilterNames.append(cms.InputTag("HBHENoiseFilterRA2","HBHENoiseFilterResult","PAT")) FilterNames.append(cms.InputTag("beamHaloFilter")) FilterNames.append(cms.InputTag("trackingFailureFilter")) FilterNames.append(cms.InputTag("inconsistentMuons")) FilterNames.append(cms.InputTag("greedyMuons")) FilterNames.append(cms.InputTag("ra2EcalTPFilter")) FilterNames.append(cms.InputTag("ra2EcalBEFilter")) FilterNames.append(cms.InputTag("hcalLaserEventFilter")) FilterNames.append(cms.InputTag("ecalLaserCorrFilter")) FilterNames.append(cms.InputTag("eeBadScFilter")) FilterNames.append(cms.InputTag("PBNRFilter")) FilterNames.append(cms.InputTag("HCALLaserEvtFilterList2012")) FilterNames.append(cms.InputTag("manystripclus53X")) FilterNames.append(cms.InputTag("toomanystripclus53X")) FilterNames.append(cms.InputTag("logErrorTooManyClusters")) FilterNames.append(cms.InputTag("RA2CaloVsPFMHTFilter")) FilterNames.append(cms.InputTag("RA2HONoiseFilter")) FilterNames.append(cms.InputTag("ResidualNoiseEventFilter")) from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName = cms.string("RA2PreSelection"), VertexCollection = cms.InputTag('goodVertices'), HT = cms.InputTag(htInputCol), HTJets = cms.InputTag('HTJets'), MHT = cms.InputTag(mhtInputCol), MHTJets = cms.InputTag('MHTJets'), VarsDouble = cms.VInputTag(cms.InputTag('WeightProducer:weight')), VarsDoubleNamesInTree = cms.vstring('Weight'), METs = cms.VInputTag(mhtInputCol,'patMETsPF'), METNamesInTree = cms.vstring('PFMHT','patMETsPF'), PatJetCollInputTag = cms.InputTag('patJetsPF'), PatJetsMinPt = cms.double(30.), PatJetsNameInTree = cms.string('MHTJets'), CandidateCollections = cms.VInputTag('patElectronsIDIso','patMuonsPFIDIso'), CandidateNamesInTree = cms.vstring('IsoElectrons','IsoMuons'), VarsDoubleV = cms.VInputTag(cms.InputTag('MuonMT')), VarsDoubleNamesInTreeV = cms.vstring('MTIsoMuons'), Filters = FilterNames ) ## --- Final paths ---------------------------------------------------- process.WriteTree = cms.Path( process.HLTSelection * process.ProduceRA2Jets * process.PBNRFilter * process.HCALLaserEvtFilterList2012 * process.RA2HONoiseFilter * process.ResidualNoiseEventFilter * process.NumJetSelection * process.HTSelection * process.MHTSelection * process.MuonMT * process.WeightProducer * process.RA2TreeMaker )
############################################################################### # Lepton Veto ############################################################################### process.load('SandBox.Skims.RA2Leptons_cff') ############################################################################### ############################################################################### ## --- Setup of TreeMaker ---------------------------------------------- from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName=cms.string("RA2PreSelection"), VarsDouble=cms.VInputTag(cms.InputTag('weightProducer:weight')), VarsDoubleNamesInTree=cms.vstring('Weight'), VertexCollection=cms.InputTag('goodVertices'), # HT = cms.InputTag('htPF'), HT=cms.InputTag('htPFchs'), HTJets=cms.InputTag('HTJets'), # MHT = cms.InputTag('mhtPF'), MHT=cms.InputTag('mhtPFchs'), MHTJets=cms.InputTag('MHTJets')) process.load('RA2Classic.Utils.produceRA2JetsPFCHS_cff') #process.load('RA2Classic.Utils.produceRA2JetsAK5PF_cff') ############################################################################### ############################################################################### # HLThltEventAnalyzer ############################################################################### process.load("HLTrigger.HLTcore.hltEventAnalyzerAOD_cfi") ###############################################################################
process.RA2TreeMaker = TreeMaker.clone( TreeName=cms.string("RA2PreSelection"), VertexCollection=cms.InputTag('goodVertices'), HT=cms.InputTag('htPFchs'), HTJets=cms.InputTag('patJetsPFchsPt50Eta25'), MHT=cms.InputTag('mhtPFchs'), MHTJets=cms.InputTag('patJetsPFchsPt30'), Filters=cms.VInputTag(cms.InputTag('eeNoiseFilter'), cms.InputTag('trackingFailureFilter'), cms.InputTag('inconsistentMuons'), cms.InputTag('greedyMuons'), cms.InputTag('ra2EcalTPFilter'), cms.InputTag('ra2EcalBEFilter'), cms.InputTag('hcalLaserEventFilter'), cms.InputTag('ecalLaserCorrFilter'), cms.InputTag('eeBadScFilter'), cms.InputTag('PBNRFilter')), VarsDouble=cms.VInputTag(cms.InputTag('WeightProducer:weight'), cms.InputTag('PUInfo:Num'), cms.InputTag('kt6PFJets:rho'), cms.InputTag('myProducerLabel:ISRWeight'), cms.InputTag('myProducerLabel:SusyMoSumE'), cms.InputTag('myProducerLabel:SusyMoSumEta'), cms.InputTag('myProducerLabel:SusyMoSumPhi'), cms.InputTag('myProducerLabel:SusyMoSumPt'), cms.InputTag('susyparams:m0'), cms.InputTag('susyparams:m12'), cms.InputTag('susyparams:evtProcID')), VarsDoubleNamesInTree=cms.vstring('Weight', 'NumPUInteractions', 'rho', 'ISRWeight', 'SusyMoSumE', 'SusyMoSumEta', 'SusyMoSumPhi', 'SusyMoSumPt', 'massMom', 'massDau', 'procID'), CandidateCollections=cms.VInputTag('patJetsPFchs', 'genJets', 'caloJets', 'patMuonsPFIDIso', 'patElectronsIDIso', 'patMETsPF'), CandidateNamesInTree=cms.vstring('Jets', 'GenJets', 'CaloJetsRaw', 'PATMuonsPFIDIso', 'PATElectronsIDIso', 'PATMETsPF'), CandidateCollectionsJetInfo=cms.VInputTag('AdditionalJetInfo:Area', 'AdditionalJetInfo:NeutHadF', 'AdditionalJetInfo:NeutEmF', 'AdditionalJetInfo:BTagCSV'), CandidateNamesInTreeJetInfo=cms.vstring('JetArea', 'JetNeutHadF', 'JetNeutEmF', 'BTagCSV'), VarsDoubleV=cms.VInputTag("pdfWeight:cteq66", "pdfWeight:MSTW2008nlo68cl", "pdfWeight:NNPDF20"), VarsDoubleNamesInTreeV=cms.vstring("cteq66", "MSTW2008nlo68cl", "NNPDF20"))
def makeTreeFromSignalScan(process, globalTag, smsModel, smsMotherMass, smsLSPMass, SMStopol, xs=1, numEvtsInSample=1, lumi=5.088, reportEveryEvt=5000, testFileName="/store/mc/Summer12/WJetsToLNu_HT-400ToInf_8TeV-madgraph/AODSIM/PU_S7_START52_V9-v1/0000/041CF749-57A0-E111-B6DD-0026189438DA.root", numProcessedEvt=20): #-- Meta data to be logged in DBS --------------------------------------------- process.configurationMetadata = cms.untracked.PSet( version = cms.untracked.string('$Revision: 1.1 $'), name = cms.untracked.string('$Source: /local/reps/CMSSW/UserCode/kheine/RA2Classic/TreeMaker/python/makeTreeFromSignalScan_cff.py,v $'), annotation = cms.untracked.string('SUSY pattuple definition') ) #-- Message Logger ------------------------------------------------------------ process.MessageLogger.categories.append('PATSummaryTables') process.MessageLogger.cerr.PATSummaryTables = cms.untracked.PSet( limit = cms.untracked.int32(-1), reportEvery = cms.untracked.int32(1) ) process.MessageLogger.cerr.FwkReport.reportEvery = reportEveryEvt #-- Input Source -------------------------------------------------------------- process.maxEvents.input = numProcessedEvt process.source.duplicateCheckMode = cms.untracked.string('noDuplicateCheck') process.source = cms.Source("PoolSource",fileNames = cms.untracked.vstring(testFileName)) #-- SUSYPAT specifics --------------------------------------------------------- from PhysicsTools.Configuration.SUSY_pattuple_cff import addDefaultSUSYPAT, getSUSY_pattuple_outputCommands hltMenu = 'REDIGI' theJetColls = ['AK5PF'] jetMetCorr = ['L1FastJet', 'L2Relative', 'L3Absolute'] process.GlobalTag.globaltag = globalTag addDefaultSUSYPAT(process, mcInfo=True, HLTMenu=hltMenu, jetMetCorrections=jetMetCorr, mcVersion='', theJetNames=theJetColls, doSusyTopProjection=False) # Remove the PAT cleaning and filtering sequences process.patDefaultSequence.remove(process.selectedPatCandidates) process.patDefaultSequence.remove(process.cleanPatCandidates) process.patDefaultSequence.remove(process.countPatCandidates) # Disable embedment so that lepton cleaning method works process.patJetsAK5PF.embedCaloTowers = False process.patJetsAK5PF.embedPFCandidates = False process.patJetsPF.embedCaloTowers = False process.patJetsPF.embedPFCandidates = False #-- Adjust collections to use PFNoPU jets ------------------------------------- # do not use Z-mass window for PU subtraction # such that JEC works properly process.pfPileUpPF.checkClosestZVertex = cms.bool(False) # do not remove muons and electrons from the jet clustering input # (patMuons and patElectrons use relaxed pfMuon and pfElectron collections) process.pfIsolatedElectronsPF.isolationCut = -1 process.pfIsolatedMuonsPF.isolationCut = -1 # make loose clones of the original electron collection process.pfRelaxedElectronsPF = process.pfIsolatedElectronsPF.clone() process.pfRelaxedElectronsPF.isolationCut = 9999 process.pfElectronsFromVertexPF.dzCut = 9999.0 process.pfElectronsFromVertexPF.d0Cut = 9999.0 process.pfSelectedElectronsPF.cut = "" process.patElectronsPF.pfElectronSource = "pfRelaxedElectronsPF" process.pfElectronSequencePF.replace(process.pfIsolatedElectronsPF, process.pfIsolatedElectronsPF + process.pfRelaxedElectronsPF) # make loose clones of the original muon collection process.pfRelaxedMuonsPF = process.pfIsolatedMuonsPF.clone() process.pfRelaxedMuonsPF.isolationCut = 9999 process.pfMuonsFromVertexPF.dzCut = 9999.0 process.pfMuonsFromVertexPF.d0Cut = 9999.0 process.pfSelectedMuonsPF.cut = "" process.patMuonsPF.pfMuonSource = "pfRelaxedMuonsPF" process.pfMuonSequencePF.replace(process.pfIsolatedMuonsPF, process.pfIsolatedMuonsPF + process.pfRelaxedMuonsPF) # do not remove taus from the jet collection process.pfTausPF.discriminators = cms.VPSet() process.pfUnclusteredTausPF = process.pfTausPF.clone( cut = cms.string("pt < 0") ) process.pfTauSequencePF.replace(process.pfTausPF, process.pfTausPF+ process.pfUnclusteredTausPF) process.pfNoTauPF.topCollection = "pfUnclusteredTausPF" #------------------------------------------------------------------------------ #-- Overwrite default output content ------------------------------------------ from SandBox.Skims.RA2Content_cff import getRA2PATOutput process.out.outputCommands = getRA2PATOutput(process) process.out.dropMetaData = cms.untracked.string('DROPPED') #-- RA2 filtering ------------------------------------------------------------- process.prefilterCounter = cms.EDProducer("EventCountProducer") process.postStdCleaningCounter = cms.EDProducer("EventCountProducer") process.postPostCleaningCounter = cms.EDProducer("EventCountProducer") process.postPFchsJetsCounter = cms.EDProducer("EventCountProducer") process.postPFchsHTCounter = cms.EDProducer("EventCountProducer") process.postPFchsMHTCounter = cms.EDProducer("EventCountProducer") process.load('SandBox.Skims.RA2Objects_cff') process.load('SandBox.Skims.RA2Selection_cff') process.load('SandBox.Skims.RA2Cleaning_cff') # Adjust object filters for signal-scan values process.htPFchsFilter.MinHT = cms.double(300.0) process.mhtPFchsFilter.MinMHT = cms.double(100.0) process.countJetsPFchsPt50Eta25.minNumber = cms.uint32(2) ## please comment this block to remove tagging mode of ##filters and reject events failing any of following filters process.eeNoiseFilter.taggingMode = False process.trackingFailureFilter.taggingMode = False process.beamHaloFilter.taggingMode = False process.ra2NoiseCleaning.remove(process.HBHENoiseFilter) process.inconsistentMuons.taggingMode = False process.greedyMuons.taggingMode = False process.ra2EcalTPFilter.taggingMode = False process.ra2EcalBEFilter.taggingMode = False process.hcalLaserEventFilter.taggingMode = False process.eeBadScFilter.taggingMode = False process.load("SandBox.Skims.provInfoMuons_cfi") process.load("SandBox.Skims.provInfoElectrons_cfi") process.cleanpatseq = cms.Sequence( process.susyPatDefaultSequence * process.prefilterCounter * process.ra2StdCleaning * process.postStdCleaningCounter * process.ra2Objects * process.provInfoMuons * process.provInfoElectrons * process.ra2PostCleaning * process.postPostCleaningCounter ) ## --- Setup WeightProducer -------------------------------------------- from RA2Classic.WeightProducer.weightProducer_cfi import weightProducer process.WeightProducer = weightProducer.clone( weight = cms.double(-1.0), Method = cms.string("Constant"), XS = cms.double(xs), NumberEvts = cms.double(numEvtsInSample), Lumi = cms.double(lumi), LumiScale = cms.double(1.0), FileNamePUDataDistribution = cms.string("NONE"), PU = cms.int32(0) ) ## --- SMS Model Filter ------------------------------------------------ # Filter files for specified signal point out of dataset # Code from UserCode/seema/SusyAnalysis/AnalysisUtils from SusyAnalysis.AnalysisUtils.smsModelFilter_cfi import smsModelFilter process.SMSModelFilter = smsModelFilter.clone( SusyScanTopology = cms.string(smsModel), SusyScanMotherMass = cms.double(smsMotherMass), SusyScanLSPMass = cms.double(smsLSPMass), SusyScanFracLSP = cms.double(0.0) ) #---JL #--for PDF sys process.pdfWeight = cms.EDProducer("PdfWeightProducer", PdfInfoTag = cms.untracked.InputTag("generator"), PdfSetNames = cms.untracked.vstring("cteq66.LHgrid","MSTW2008nlo68cl.LHgrid","NNPDF20_100.LHgrid") #PdfSetNames = cms.untracked.vstring("NNPDF20_100.LHgrid") ) #---for ISR sys process.lastParticles = cms.EDProducer("ISRProducer") process.ISRsys = cms.Sequence(process.lastParticles) #---put the susy params process.load("RA2Classic.SUSYParams.susyparams_cfi") process.susyparams.Model = cms.string(SMStopol) #-- end JL ## --- Setup of TreeMaker ---------------------------------------------- process.TFileService = cms.Service( "TFileService", fileName = cms.string("RA2Selection.root") ) from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName = cms.string("RA2PreSelection"), VertexCollection = cms.InputTag('goodVertices'), HT = cms.InputTag('htPFchs'), HTJets = cms.InputTag('patJetsPFchsPt50Eta25'), MHT = cms.InputTag('mhtPFchs'), MHTJets = cms.InputTag('patJetsPFchsPt30'), VarsDouble = cms.VInputTag(cms.InputTag('WeightProducer:weight'),"susyparams:m0","susyparams:m12","susyparams:evtProcID"), VarsDoubleNamesInTree = cms.vstring('Weight',"massMom","massDau","procID"), CandidateCollections = cms.VInputTag('patJetsPFchsPt30','patMuonsPFIDIso','patElectronsIDIso'), CandidateNamesInTree = cms.vstring('Jets','PATMuonsPFIDIso','PATElectronsIDIso'), VarsDoubleV = cms.VInputTag("pdfWeight:cteq66","pdfWeight:MSTW2008nlo68cl","pdfWeight:NNPDF20"), VarsDoubleNamesInTreeV = cms.vstring("cteq66","MSTW2008nlo68cl","NNPDF20") ) #process.dump = cms.EDAnalyzer("EventContentAnalyzer") process.ppfchs = cms.Path( process.SMSModelFilter * process.cleanpatseq * process.countJetsPFchsPt50Eta25 * process.postPFchsJetsCounter * process.htPFchsFilter * process.postPFchsHTCounter * process.mhtPFchsFilter * process.postPFchsMHTCounter * process.WeightProducer * #--JL process.pdfWeight* process.ISRsys* process.susyparams* #--end JL process.RA2TreeMaker ) process.schedule = cms.Schedule(process.ppfchs)
def makeTreeFromPAT( process, outFileName, useCHSJets=True, invertLeptonVeto=False, NJetsMin=2, HTMin=500., MHTMin=200., reportEveryEvt=10, Global_Tag="", MC=False, RecoLeptonStudyBool=False, DebugBool=False, testFileName=[ "/store/user/kheine/HT/RA2PreSelectionOnData_Run2012A_HT_PromptReco-v1_v5/71cce229addb17644d40a607fa20b5d7/RA2SkimsOnData_99_3_TPC.root" ], numProcessedEvt=1000): process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = Global_Tag ## --- Log output ------------------------------------------------------ process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr = cms.untracked.PSet( placeholder=cms.untracked.bool(True)) process.MessageLogger.statistics.append('cout') process.MessageLogger.cout = cms.untracked.PSet(INFO=cms.untracked.PSet( reportEvery=cms.untracked.int32(reportEveryEvt))) ## --- Files to process ------------------------------------------------ process.maxEvents = cms.untracked.PSet( input=cms.untracked.int32(numProcessedEvt)) process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(testFileName)) hltPath = ['HLT_PFHT350_PFMET100_v*', 'HLT_PFNoPUHT350_PFMET100_v*'] process.load('HLTrigger.HLTfilters.hltHighLevel_cfi') process.hltHighLevel.HLTPaths = cms.vstring(hltPath) process.hltHighLevel.andOr = cms.bool(True) process.hltHighLevel.throw = cms.bool(False) process.HLTSelection = cms.Sequence(process.hltHighLevel) if MC: print "Running over MC: removing HLT selection" process.HLTSelection.remove(process.hltHighLevel) elif not hltPath: print "Empty list of HLT paths: removing HLT selection" process.HLTSelection.remove(process.hltHighLevel) ## --- Output file ----------------------------------------------------- process.TFileService = cms.Service("TFileService", fileName=cms.string(outFileName + ".root")) ## --- Selection sequences --------------------------------------------- # Filter-related selection process.load('RA2Classic.TreeMaker.filterSelection_cff') process.load('SandBox.Skims.RA2Leptons_cff') process.CleaningSelection = cms.Sequence(process.filterSelection) # Filter-related selection # process.load('RA2Classic.TreeMaker.filterSelection_cff') # from RecoMET.METFilters.jetIDFailureFilter_cfi import jetIDFailure # process.PBNRFilter = jetIDFailure.clone( # JetSource = cms.InputTag('MHTJets'), # MinJetPt = cms.double(30.0), # taggingMode = cms.bool(False) # ) # process.filterSelection += process.PBNRFilter # from RecoMET.METFilters.multiEventFilter_cfi import multiEventFilter # process.HCALLaserEvtFilterList2012 = multiEventFilter.clone( # file = cms.FileInPath('EventFilter/HcalRawToDigi/data/AllBadHCALLaser.txt'), # taggingMode = cms.bool(False) # ) # process.filterSelection += process.HCALLaserEvtFilterList2012 # Produce RA2 jets if useCHSJets: process.load('RA2Classic.Utils.produceRA2JetsPFCHS_cff') process.ProduceRA2Jets = cms.Sequence(process.produceRA2JetsPFCHS) else: process.load('RA2Classic.Utils.produceRA2JetsAK5PF_cff') process.ProduceRA2Jets = cms.Sequence(process.produceRA2JetsAK5PF) # Select events with at least 'NJetsMin' of the above jets from PhysicsTools.PatAlgos.selectionLayer1.jetCountFilter_cfi import countPatJets process.NumJetSelection = countPatJets.clone( src=cms.InputTag('HTJets'), minNumber=cms.uint32(NJetsMin)) # HT selection htInputCol = 'htPF' if useCHSJets: htInputCol = 'htPFchs' from SandBox.Skims.RA2HT_cff import htPFFilter process.HTSelection = htPFFilter.clone(HTSource=cms.InputTag(htInputCol), MinHT=cms.double(HTMin)) # MHT selection mhtMin = 0. mhtInputCol = 'mhtPF' if useCHSJets: mhtInputCol = 'mhtPFchs' from SandBox.Skims.RA2MHT_cff import mhtPFFilter process.MHTSelection = mhtPFFilter.clone( MHTSource=cms.InputTag(mhtInputCol), MinMHT=cms.double(MHTMin)) ## --- Additional Filters (not tagging mode) ------------------------------ from RecoMET.METFilters.jetIDFailureFilter_cfi import jetIDFailure process.PBNRFilter = jetIDFailure.clone( JetSource=cms.InputTag('patJetsPF'), MinJetPt=cms.double(30.0), taggingMode=cms.bool(False)) from SandBox.Skims.hoNoiseFilter_cfi import hoNoiseFilter process.RA2HoNoiseFitler = hoNoiseFilter.clone( patJetsInputTag=cms.InputTag('patJetsPF')) from RecoMET.METFilters.multiEventFilter_cfi import multiEventFilter process.HCALLaserEvtFilterList2012 = multiEventFilter.clone( file=cms.FileInPath( 'RA2Classic/LostLeptonBkg/data/HCALLaserEventList_20Nov2012-v2_HT-HTMHT.txt' ), taggingMode=cms.bool(False)) process.AdditionalFiltersInTagMode = cms.Sequence(process.PBNRFilter) FilterNames = cms.VInputTag() FilterNames.append( cms.InputTag("HBHENoiseFilterRA2", "HBHENoiseFilterResult", "PAT")) FilterNames.append(cms.InputTag("beamHaloFilter")) FilterNames.append(cms.InputTag("trackingFailureFilter")) FilterNames.append(cms.InputTag("inconsistentMuons")) FilterNames.append(cms.InputTag("greedyMuons")) FilterNames.append(cms.InputTag("ra2EcalTPFilter")) FilterNames.append(cms.InputTag("ra2EcalBEFilter")) FilterNames.append(cms.InputTag("hcalLaserEventFilter")) FilterNames.append(cms.InputTag("ecalLaserCorrFilter")) FilterNames.append(cms.InputTag("eeBadScFilter")) FilterNames.append(cms.InputTag("PBNRFilter")) FilterNames.append(cms.InputTag("HCALLaserEvtFilterList2012")) FilterNames.append(cms.InputTag("manystripclus53X")) FilterNames.append(cms.InputTag("toomanystripclus53X")) FilterNames.append(cms.InputTag("logErrorTooManyClusters")) # FilterNames.append(cms.InputTag("RA2CaloVsPFMHTFilter")) FilterNames.append(cms.InputTag("RA2HONoiseFilter")) ## --- Setup WeightProducer ------------------------------------------- from RA2Classic.WeightProducer.getWeightProducer_cff import getWeightProducer process.WeightProducer = getWeightProducer(process.source.fileNames[0]) ## --- Setup of TreeMaker ---------------------------------------------- FilterNames = cms.VInputTag() # All filters in AdditionalFiltersInTagMode for f in process.AdditionalFiltersInTagMode.moduleNames(): FilterNames.append(cms.InputTag(f)) ## FilterNames.append(cms.InputTag("HBHENoiseFilterRA2","HBHENoiseFilterResult","PAT")) ## FilterNames.append(cms.InputTag("beamHaloFilter")) ## FilterNames.append(cms.InputTag("eeNoiseFilter")) ## FilterNames.append(cms.InputTag("trackingFailureFilter")) ## FilterNames.append(cms.InputTag("inconsistentMuons")) ## FilterNames.append(cms.InputTag("greedyMuons")) ## FilterNames.append(cms.InputTag("ra2EcalTPFilter")) ## FilterNames.append(cms.InputTag("ra2EcalBEFilter")) ## FilterNames.append(cms.InputTag("hcalLaserEventFilter")) ## FilterNames.append(cms.InputTag("eeBadScFilter")) from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName=cms.string("RA2PreSelection"), VertexCollection=cms.InputTag('goodVertices'), HT=cms.InputTag(htInputCol), HTJets=cms.InputTag('HTJets'), MHT=cms.InputTag(mhtInputCol), MHTJets=cms.InputTag('MHTJets'), VarsDouble=cms.VInputTag( cms.InputTag('WeightProducer:weight'), cms.InputTag('LostLeptonBkgProducer:LostLeptonWeight'), cms.InputTag('LostLeptonBkgProducer:Met'), cms.InputTag('LostLeptonBkgProducer:nMu'), cms.InputTag('LostLeptonBkgProducer:MuPt'), cms.InputTag('LostLeptonBkgProducer:MuEta'), cms.InputTag('LostLeptonBkgProducer:MuPhi'), cms.InputTag('LostLeptonBkgProducer:deltaRMuJet'), cms.InputTag('LostLeptonBkgProducer:deltaRMuMHT'), cms.InputTag('LostLeptonBkgProducer:deltaPtMuJet')), VarsDoubleNamesInTree=cms.vstring('Weight', 'LostLeptonWeight', 'Met', 'numberOfMuons', 'MuPT', 'MuEta', 'MuPhi', 'DeltaRMuJet', 'DeltaRMuMHT', 'DeltaPtMuJet'), Filters=FilterNames) # filter used to slecte the RA2 baseline important for efficiency caluclaiton from RA2Classic.Utils.RA2Selection_cfi import RA2Selection process.RA2Selector = RA2Selection.clone( nJets=cms.uint32(3), HTMin=cms.double(500), MHTMin=cms.double(200), ) ## ---- Load lost lepton moduels # special calo jets for delta R in efficiencies process.load('JetMETCorrections.Configuration.DefaultJEC_cff') # from RA2Classic.LostLeptonBkg.llPrediction_cff import llPrediction # process.lostLeptonPrediction = llPrediction() from RA2Classic.LostLeptonBkg.MCEffCalculator_cfi import MCEffCalculator process.LostLeptonBkgMCEffCalculator = MCEffCalculator.clone( MuonIDTag=cms.InputTag("patMuonsPFID"), MuonIDISOTag=cms.InputTag("patMuonsPFIDIso"), ElecIDTag=cms.InputTag("ra2ElectronsID"), ElecIDISOTag=cms.InputTag("ra2ElectronsIDIso"), # ElecIDTag = cms.InputTag("patElectronsIDIso"), # ElecIDISOTag = cms.InputTag("patElectronsIDIso"), HTTag=cms.InputTag(htInputCol), MHTTag=cms.InputTag(mhtInputCol), CaloJetTag=cms.InputTag('ak5CaloJetsL2L3'), # CaloJetTag = cms.InputTag('cleanPatJetsAK5Calo'), UseZResonanze=cms.bool(False), debug=DebugBool, ) from RA2Classic.LostLeptonBkg.promtisomu_cfi import promtIsoMu process.promtLeptons = promtIsoMu.clone( MuonIDISOTag=cms.InputTag("patMuonsPFIDIso"), CaloJetTag=cms.InputTag("ak5CaloJetsL2L3"), # CaloJetTag = cms.InputTag('cleanPatJetsAK5Calo'), ) # process.lostLeptonPrediction = llPrediction() from RA2Classic.LostLeptonBkg.bkglostlepton_cfi import bkglostlepton process.LostLeptonBkgProducer = bkglostlepton.clone( HTJets=cms.InputTag('HTJets'), MetTag=cms.InputTag('patMETsPF'), CaloJetTag=cms.InputTag('ak5CaloJetsL2L3'), # CaloJetTag = cms.InputTag('cleanPatJetsAK5Calo'), # MuonTag = cms.InputTag('promtLeptons:PromtMuon'), MuonTag=cms.InputTag('patMuonsPFIDIso'), ElecTag=cms.InputTag("ra2ElectronsIDIso"), # ElecTag = cms.InputTag("patElectronsIDIso"), MTWCut=cms.bool(True), EfficiencyFileName=cms.string('MCEff.root'), HTTag=cms.InputTag(htInputCol), MHTTag=cms.InputTag(mhtInputCol), MetJetTagUp=cms.InputTag('jesUp:METs'), MetJetTagDown=cms.InputTag('jesDown:METs'), IsoPlots=cms.bool(True), TAPUncertaintiesHTNJET=cms.bool(False), statErrorEffmaps=cms.bool(True), debug=DebugBool, ) from RA2Classic.LostLeptonBkg.RecoLeptonStudy_cfi import RecoLeptonStudy process.RecoLeptonStudyProducer = RecoLeptonStudy.clone( MuonIDTag=cms.InputTag("patMuonsPFID"), MuonIDISOTag=cms.InputTag("patMuonsPFIDIso"), ElecIDTag=cms.InputTag("ra2ElectronsID"), ElecIDISOTag=cms.InputTag("ra2ElectronsIDIso"), # ElecIDTag = cms.InputTag("patElectronsIDIso"), # ElecIDISOTag = cms.InputTag("patElectronsIDIso"), HTTag=cms.InputTag(htInputCol), MHTTag=cms.InputTag(mhtInputCol), CaloJetTag=cms.InputTag('ak5CaloJetsL2L3'), # CaloJetTag = cms.InputTag('cleanPatJetsAK5Calo'), UseZResonanze=cms.bool(False), debug=DebugBool, ) #electrons selectors for ID electrons from SandBox.Skims.RA2Leptons_cff import patElectronsID from SandBox.Skims.RA2Leptons_cff import patElectronsIDIso process.ra2ElectronsID = patElectronsID.clone() process.ra2ElectronsIDIso = patElectronsIDIso.clone() # JES variation for MET from RA2Classic.Utils.jesUncertaintyVariation_cfi import jesUncertaintyVariation process.jesUp = jesUncertaintyVariation.clone( Jets=cms.InputTag('MHTJets'), # The input jet collection JetTypeId=cms.string( 'AK5PFchs' ), # Type of the input jets (to obtain the uncertainty from the data base). Variation=cms.string( 'Up' ) # Either 'Up' or 'Dn' to produce jets with JES +/- 1 sigma, respectively ) process.jesDown = jesUncertaintyVariation.clone( Jets=cms.InputTag('MHTJets'), # The input jet collection JetTypeId=cms.string( 'AK5PFchs' ), # Type of the input jets (to obtain the uncertainty from the data base). Variation=cms.string( 'Down' ) # Either 'Up' or 'Dn' to produce jets with JES +/- 1 sigma, respectively ) from RA2Classic.LostLeptonBkg.ra2Filters_cfi import ra2FilterSelection process.RA2Filters = ra2FilterSelection.clone(Filters=FilterNames) process.LostLepton = cms.Sequence() if MC: process.LostLepton += process.LostLeptonBkgMCEffCalculator process.LostLepton += process.LostLeptonBkgProducer if RecoLeptonStudyBool: process.LostLepton += process.RecoLeptonStudyProducer ## --- Final paths ---------------------------------------------------- process.dump = cms.EDAnalyzer("EventContentAnalyzer") process.WriteTree = cms.Path( process.HLTSelection * process.CleaningSelection * process.HCALLaserEvtFilterList2012 * process.ProduceRA2Jets * process.NumJetSelection * process.HTSelection * process.MHTSelection * process.AdditionalFiltersInTagMode * process.WeightProducer * process.ra2ElectronsID * process.ra2ElectronsIDIso * # process.jesUp * # process.jesDown * # process.promtLeptons * process.RA2Selector * process.RA2Filters * process.RA2HoNoiseFitler * process.ak5CaloJetsL2L3 * # process.dump * # process.LostLeptonBkgMCEffCalculator * process.LostLepton # process.RA2TreeMaker )
process.VaryJESDn = cms.Sequence( process.patJetsPFJESDn * process.patJetsPFchsPt30JESDn * process.patJetsPFchsPt50Eta25JESDn * process.htPFchsJESDn * process.mhtPFchsJESDn ) ## --- Setup of TreeMaker ---------------------------------------------- from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName = cms.string("RA2PreSelection"), VertexCollection = cms.InputTag('goodVertices'), HT = cms.InputTag('htPFchs'), HTJets = cms.InputTag('patJetsPFchsPt50Eta25'), MHT = cms.InputTag('mhtPFchs'), MHTJets = cms.InputTag('patJetsPFchsPt30'), ) process.RA2TreeMakerJESUp = process.RA2TreeMaker.clone( HT = cms.InputTag('htPFchsJESUp'), HTJets = cms.InputTag('patJetsPFchsPt50Eta25JESUp'), MHT = cms.InputTag('mhtPFchsJESUp'), MHTJets = cms.InputTag('patJetsPFchsPt30JESUp'), ) process.RA2TreeMakerJESDn = process.RA2TreeMaker.clone( HT = cms.InputTag('htPFchsJESDn'), HTJets = cms.InputTag('patJetsPFchsPt50Eta25JESDn'), MHT = cms.InputTag('mhtPFchsJESDn'), MHTJets = cms.InputTag('patJetsPFchsPt30JESDn'), )
def makeTreeFromPAT(process, outFileName, useCHSJets=True, invertLeptonVeto=False, NJetsMin=2, HTMin=500., MHTMin=200., reportEveryEvt=10, Global_Tag="", testFileName=["/store/user/kheine/HT/RA2PreSelectionOnData_Run2012A_HT_PromptReco-v1_v5/71cce229addb17644d40a607fa20b5d7/RA2SkimsOnData_99_3_TPC.root"], numProcessedEvt=1000): process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = Global_Tag ## --- Log output ------------------------------------------------------ process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr = cms.untracked.PSet( placeholder = cms.untracked.bool(True) ) process.MessageLogger.statistics.append('cout') process.MessageLogger.cout = cms.untracked.PSet( INFO = cms.untracked.PSet(reportEvery = cms.untracked.int32(reportEveryEvt)) ) ## --- Files to process ------------------------------------------------ process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(numProcessedEvt) ) process.source = cms.Source( "PoolSource", fileNames = cms.untracked.vstring(testFileName) ) ## --- Output file ----------------------------------------------------- process.TFileService = cms.Service( "TFileService", fileName = cms.string(outFileName+".root") ) ## --- Selection sequences --------------------------------------------- # Filter-related selection process.load('RA2Classic.TreeMaker.filterSelection_cff') process.load('SandBox.Skims.RA2Leptons_cff') process.CleaningSelection = cms.Sequence( process.filterSelection ) # Filter-related selection # process.load('RA2Classic.TreeMaker.filterSelection_cff') # from RecoMET.METFilters.jetIDFailureFilter_cfi import jetIDFailure # process.PBNRFilter = jetIDFailure.clone( # JetSource = cms.InputTag('MHTJets'), # MinJetPt = cms.double(30.0), # taggingMode = cms.bool(False) # ) # process.filterSelection += process.PBNRFilter # from RecoMET.METFilters.multiEventFilter_cfi import multiEventFilter # process.HCALLaserEvtFilterList2012 = multiEventFilter.clone( # file = cms.FileInPath('EventFilter/HcalRawToDigi/data/AllBadHCALLaser.txt'), # taggingMode = cms.bool(False) # ) # process.filterSelection += process.HCALLaserEvtFilterList2012 # Produce RA2 jets if useCHSJets: process.load('RA2Classic.Utils.produceRA2JetsPFCHS_cff') process.ProduceRA2Jets = cms.Sequence( process.produceRA2JetsPFCHS ) else: process.load('RA2Classic.Utils.produceRA2JetsAK5PF_cff') process.ProduceRA2Jets = cms.Sequence( process.produceRA2JetsAK5PF ) # Select events with at least 'NJetsMin' of the above jets from PhysicsTools.PatAlgos.selectionLayer1.jetCountFilter_cfi import countPatJets process.NumJetSelection = countPatJets.clone( src = cms.InputTag('HTJets'), minNumber = cms.uint32(NJetsMin) ) # HT selection htInputCol = 'htPF' if useCHSJets: htInputCol = 'htPFchs' from SandBox.Skims.RA2HT_cff import htPFFilter process.HTSelection = htPFFilter.clone( HTSource = cms.InputTag(htInputCol), MinHT = cms.double(HTMin) ) # MHT selection mhtMin = 0. mhtInputCol = 'mhtPF' if useCHSJets: mhtInputCol = 'mhtPFchs' from SandBox.Skims.RA2MHT_cff import mhtPFFilter process.MHTSelection = mhtPFFilter.clone( MHTSource = cms.InputTag(mhtInputCol), MinMHT = cms.double(MHTMin) ) ## --- Additional Filters (not tagging mode) ------------------------------ from RecoMET.METFilters.jetIDFailureFilter_cfi import jetIDFailure process.PBNRFilter = jetIDFailure.clone( JetSource = cms.InputTag('MHTJets'), MinJetPt = cms.double(30.0), taggingMode = cms.bool(False) ) from RecoMET.METFilters.multiEventFilter_cfi import multiEventFilter process.HCALLaserEvtFilterList2012 = multiEventFilter.clone( file = cms.FileInPath('RA2Classic/LostLeptonBkg/data/HCALLaserEventList_20Nov2012-v2_HT-HTMHT.txt'), taggingMode = cms.bool(False) ) process.AdditionalFiltersInTagMode = cms.Sequence( process.PBNRFilter ) FilterNames = cms.VInputTag() FilterNames.append(cms.InputTag("HBHENoiseFilterRA2","HBHENoiseFilterResult","PAT")) FilterNames.append(cms.InputTag("beamHaloFilter")) FilterNames.append(cms.InputTag("trackingFailureFilter")) FilterNames.append(cms.InputTag("inconsistentMuons")) FilterNames.append(cms.InputTag("greedyMuons")) FilterNames.append(cms.InputTag("ra2EcalTPFilter")) FilterNames.append(cms.InputTag("ra2EcalBEFilter")) FilterNames.append(cms.InputTag("hcalLaserEventFilter")) FilterNames.append(cms.InputTag("ecalLaserCorrFilter")) FilterNames.append(cms.InputTag("eeBadScFilter")) FilterNames.append(cms.InputTag("PBNRFilter")) FilterNames.append(cms.InputTag("HCALLaserEvtFilterList2012")) FilterNames.append(cms.InputTag("manystripclus53X")) FilterNames.append(cms.InputTag("toomanystripclus53X")) FilterNames.append(cms.InputTag("logErrorTooManyClusters")) # FilterNames.append(cms.InputTag("RA2CaloVsPFMHTFilter")) FilterNames.append(cms.InputTag("RA2HONoiseFilter")) ## --- Setup WeightProducer ------------------------------------------- from RA2Classic.WeightProducer.getWeightProducer_cff import getWeightProducer process.WeightProducer = getWeightProducer(process.source.fileNames[0]) ## --- Setup of TreeMaker ---------------------------------------------- FilterNames = cms.VInputTag() # All filters in AdditionalFiltersInTagMode for f in process.AdditionalFiltersInTagMode.moduleNames(): FilterNames.append(cms.InputTag(f)) ## FilterNames.append(cms.InputTag("HBHENoiseFilterRA2","HBHENoiseFilterResult","PAT")) ## FilterNames.append(cms.InputTag("beamHaloFilter")) ## FilterNames.append(cms.InputTag("eeNoiseFilter")) ## FilterNames.append(cms.InputTag("trackingFailureFilter")) ## FilterNames.append(cms.InputTag("inconsistentMuons")) ## FilterNames.append(cms.InputTag("greedyMuons")) ## FilterNames.append(cms.InputTag("ra2EcalTPFilter")) ## FilterNames.append(cms.InputTag("ra2EcalBEFilter")) ## FilterNames.append(cms.InputTag("hcalLaserEventFilter")) ## FilterNames.append(cms.InputTag("eeBadScFilter")) from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName = cms.string("RA2PreSelection"), VertexCollection = cms.InputTag('goodVertices'), HT = cms.InputTag(htInputCol), HTJets = cms.InputTag('HTJets'), MHT = cms.InputTag(mhtInputCol), MHTJets = cms.InputTag('MHTJets'), VarsDouble = cms.VInputTag(cms.InputTag('WeightProducer:weight'),cms.InputTag('LostLeptonBkgProducer:LostLeptonWeight'),cms.InputTag('LostLeptonBkgProducer:Met'),cms.InputTag('LostLeptonBkgProducer:nMu'),cms.InputTag('LostLeptonBkgProducer:MuPt'),cms.InputTag('LostLeptonBkgProducer:MuEta'),cms.InputTag('LostLeptonBkgProducer:MuPhi' ),cms.InputTag('LostLeptonBkgProducer:deltaRMuJet'),cms.InputTag('LostLeptonBkgProducer:deltaRMuMHT' ),cms.InputTag('LostLeptonBkgProducer:deltaPtMuJet') ), VarsDoubleNamesInTree = cms.vstring('Weight','LostLeptonWeight','Met','numberOfMuons','MuPT','MuEta','MuPhi','DeltaRMuJet','DeltaRMuMHT','DeltaPtMuJet'), Filters = FilterNames ) # filter used to slecte the RA2 baseline important for efficiency caluclaiton from RA2Classic.Utils.RA2Selection_cfi import RA2Selection process.RA2Selector = RA2Selection.clone( nJets = cms.uint32 (3), HTMin = cms.double(500), MHTMin = cms.double(100), ) ## ---- Load lost lepton moduels # special calo jets for delta R in efficiencies process.load('JetMETCorrections.Configuration.DefaultJEC_cff') # from RA2Classic.LostLeptonBkg.llPrediction_cff import llPrediction # process.lostLeptonPrediction = llPrediction() from RA2Classic.LostLeptonBkg.MCEffCalculator_cfi import MCEffCalculator process.LostLeptonBkgMCEffCalculator = MCEffCalculator.clone( MuonIDTag = cms.InputTag("patMuonsPFID"), MuonIDISOTag = cms.InputTag("patMuonsPFIDIso"), ElecIDTag = cms.InputTag("ra2ElectronsID"), ElecIDISOTag = cms.InputTag("ra2ElectronsIDIso"), # ElecIDTag = cms.InputTag("patElectronsIDIso"), # ElecIDISOTag = cms.InputTag("patElectronsIDIso"), HTTag = cms.InputTag(htInputCol), MHTTag = cms.InputTag(mhtInputCol), CaloJetTag = cms.InputTag('ak5CaloJetsL2L3'), # CaloJetTag = cms.InputTag('cleanPatJetsAK5Calo'), ) from RA2Classic.LostLeptonBkg.promtisomu_cfi import promtIsoMu process.promtLeptons = promtIsoMu.clone( MuonIDISOTag = cms.InputTag("patMuonsPFIDIso"), CaloJetTag = cms.InputTag("ak5CaloJetsL2L3"), # CaloJetTag = cms.InputTag('cleanPatJetsAK5Calo'), ) # process.lostLeptonPrediction = llPrediction() from RA2Classic.LostLeptonBkg.bkglostlepton_cfi import bkglostlepton process.LostLeptonBkgProducer = bkglostlepton.clone( HTJets = cms.InputTag('HTJets'), MetTag = cms.InputTag('patMETsPF'), CaloJetTag = cms.InputTag('ak5CaloJetsL2L3'), # CaloJetTag = cms.InputTag('cleanPatJetsAK5Calo'), # MuonTag = cms.InputTag('promtLeptons:PromtMuon'), MuonTag = cms.InputTag('patMuonsPFIDIso'), ElecTag = cms.InputTag("ra2ElectronsIDIso"), # ElecTag = cms.InputTag("patElectronsIDIso"), MTWCut = cms.bool(True), EfficiencyFileName = cms.string('MCEff.root'), HTTag = cms.InputTag(htInputCol), MHTTag = cms.InputTag(mhtInputCol), MetJetTagUp = cms.InputTag('jesUp:METs'), MetJetTagDown = cms.InputTag('jesDown:METs'), IsoPlots = cms.bool(True), TAPUncertaintiesHTNJET = cms.bool(True), statErrorEffmaps = cms.bool(True), ) #electrons selectors for ID electrons from SandBox.Skims.RA2Leptons_cff import patElectronsID from SandBox.Skims.RA2Leptons_cff import patElectronsIDIso process.ra2ElectronsID = patElectronsID.clone() process.ra2ElectronsIDIso = patElectronsIDIso.clone() # JES variation for MET from RA2Classic.Utils.jesUncertaintyVariation_cfi import jesUncertaintyVariation process.jesUp = jesUncertaintyVariation.clone( Jets = cms.InputTag('MHTJets'), # The input jet collection JetTypeId = cms.string('AK5PFchs'), # Type of the input jets (to obtain the uncertainty from the data base). Variation = cms.string('Up') # Either 'Up' or 'Dn' to produce jets with JES +/- 1 sigma, respectively ) process.jesDown = jesUncertaintyVariation.clone( Jets = cms.InputTag('MHTJets'), # The input jet collection JetTypeId = cms.string('AK5PFchs'), # Type of the input jets (to obtain the uncertainty from the data base). Variation = cms.string('Down') # Either 'Up' or 'Dn' to produce jets with JES +/- 1 sigma, respectively ) from RA2Classic.LostLeptonBkg.ra2Filters_cfi import ra2FilterSelection process.RA2Filters = ra2FilterSelection.clone( Filters = FilterNames ) ## --- Final paths ---------------------------------------------------- process.dump = cms.EDAnalyzer("EventContentAnalyzer") process.WriteTree = cms.Path( process.CleaningSelection * process.HCALLaserEvtFilterList2012 * process.ProduceRA2Jets * process.NumJetSelection * process.HTSelection * process.MHTSelection * process.AdditionalFiltersInTagMode * process.WeightProducer * process.ra2ElectronsID * process.ra2ElectronsIDIso * # process.jesUp * # process.jesDown * # process.promtLeptons * process.RA2Selector * process.RA2Filters * process.ak5CaloJetsL2L3 * # process.dump * process.LostLeptonBkgMCEffCalculator * process.LostLeptonBkgProducer # process.RA2TreeMaker )
def makeTreeFromPAT(process, outFileName, NJetsMin=2, HTMin=350., MHTMin=0., globalTag="none", isData=True, hltPath=[], reportEveryEvt=10, testFileName="", numProcessedEvt=100): ## --- Log output ------------------------------------------------------ process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr = cms.untracked.PSet( placeholder=cms.untracked.bool(True)) process.MessageLogger.cout = cms.untracked.PSet(INFO=cms.untracked.PSet( reportEvery=cms.untracked.int32(reportEveryEvt))) process.options = cms.untracked.PSet(wantSummary=cms.untracked.bool(True)) ## --- Files to process ------------------------------------------------ process.maxEvents = cms.untracked.PSet( input=cms.untracked.int32(numProcessedEvt)) process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(testFileName)) ## --- Output file ----------------------------------------------------- process.TFileService = cms.Service("TFileService", fileName=cms.string(outFileName + ".root")) ## --- Selection sequences --------------------------------------------- # HLT process.load('HLTrigger.HLTfilters.hltHighLevel_cfi') process.hltHighLevel.HLTPaths = cms.vstring(hltPath) process.hltHighLevel.andOr = cms.bool(True) process.hltHighLevel.throw = cms.bool(False) process.HLTSelection = cms.Sequence(process.hltHighLevel) if not isData: print "Running over MC: removing HLT selection" process.HLTSelection.remove(process.hltHighLevel) elif not hltPath: print "Empty list of HLT paths: removing HLT selection" process.HLTSelection.remove(process.hltHighLevel) # Filter-related selection process.load('RA2Classic.TreeMaker.filterSelection_cff') from RecoMET.METFilters.jetIDFailureFilter_cfi import jetIDFailure process.PBNRFilter = jetIDFailure.clone( JetSource=cms.InputTag('patJetsPF'), MinJetPt=cms.double(30.0), taggingMode=cms.bool(True)) process.filterSelection += process.PBNRFilter from RecoMET.METFilters.multiEventFilter_cfi import multiEventFilter process.HCALLaserEvtFilterList2012 = multiEventFilter.clone( file=cms.FileInPath( 'RA2Classic/AdditionalInputFiles/data/HCALLaserEventList_20Nov2012-v2_HT-HTMHT.txt' ), taggingMode=cms.bool(True)) process.filterSelection += process.HCALLaserEvtFilterList2012 from SandBox.Skims.hoNoiseFilter_cfi import hoNoiseFilter process.RA2HONoiseFilter = hoNoiseFilter.clone( patJetsInputTag=cms.InputTag('patJetsPF'), jetPtMin=cms.double(30), jetEtaMax=cms.double(5), maxHOEfrac=cms.double(0.4), taggingMode=cms.bool(True)) process.filterSelection += process.RA2HONoiseFilter process.load('JetMETCorrections.Configuration.DefaultJEC_cff') process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = globalTag process.load('SandBox.Skims.RA2CaloVsPFMHTFilterSequence_cff') process.RA2CaloVsPFMHTFilter.TaggingMode = cms.bool(True) process.filterSelection += process.RA2CaloVsPFMHTFilterSequence process.load('SandBox.Skims.RA2Leptons_cff') process.LeptonVeto = cms.Sequence(process.ra2PFMuonVeto * process.ra2ElectronVeto) # Produce RA2 jets (produces the collections HTJets and MHTJets) process.load('RA2Classic.Utils.produceRA2JetsPFCHS_cff') process.ProduceRA2Jets = cms.Sequence(process.produceRA2JetsPFCHS) # Select events with at least 'NJetsMin' of the above jets from PhysicsTools.PatAlgos.selectionLayer1.jetCountFilter_cfi import countPatJets process.NumJetSelection = countPatJets.clone( src=cms.InputTag('HTJets'), minNumber=cms.uint32(NJetsMin)) # HT selection htInputCol = 'htPFchs' from SandBox.Skims.RA2HT_cff import htPFFilter process.HTSelection = htPFFilter.clone(HTSource=cms.InputTag(htInputCol), MinHT=cms.double(HTMin)) # MHT selection mhtInputCol = 'mhtPFchs' from SandBox.Skims.RA2MHT_cff import mhtPFFilter process.MHTSelection = mhtPFFilter.clone( MHTSource=cms.InputTag(mhtInputCol), MinMHT=cms.double(MHTMin)) ## --- HLT decisions -------------------------------------------------- process.load('RA2Classic.TreeMaker.hltDecisions_cff') ## --- Setup WeightProducer ------------------------------------------- from RA2Classic.WeightProducer.getWeightProducer_cff import getWeightProducer process.WeightProducer = getWeightProducer(testFileName) process.WeightProducer.Lumi = cms.double(19466) process.WeightProducer.PU = cms.int32(3) # PU S10 process.WeightProducer.FileNamePUDataDistribution = cms.string( "RA2Classic/WeightProducer/data/DataPileupHistogram_RA2Summer12_190456-208686_ABCD.root" ) ## --- Setup of TreeMaker ---------------------------------------------- FilterNames = cms.VInputTag() FilterNames.append( cms.InputTag("HBHENoiseFilterRA2", "HBHENoiseFilterResult", "PAT")) FilterNames.append(cms.InputTag("beamHaloFilter")) FilterNames.append(cms.InputTag("trackingFailureFilter")) FilterNames.append(cms.InputTag("inconsistentMuons")) FilterNames.append(cms.InputTag("greedyMuons")) FilterNames.append(cms.InputTag("ra2EcalTPFilter")) FilterNames.append(cms.InputTag("ra2EcalBEFilter")) FilterNames.append(cms.InputTag("hcalLaserEventFilter")) FilterNames.append(cms.InputTag("ecalLaserCorrFilter")) FilterNames.append(cms.InputTag("eeBadScFilter")) FilterNames.append(cms.InputTag("PBNRFilter")) FilterNames.append(cms.InputTag("HCALLaserEvtFilterList2012")) FilterNames.append(cms.InputTag("manystripclus53X")) FilterNames.append(cms.InputTag("toomanystripclus53X")) FilterNames.append(cms.InputTag("logErrorTooManyClusters")) FilterNames.append(cms.InputTag("RA2CaloVsPFMHTFilter")) FilterNames.append(cms.InputTag("RA2HONoiseFilter")) # for f in process.hltDecisions.moduleNames(): # FilterNames.append(cms.InputTag(f)) from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName=cms.string("RA2PreSelection"), VertexCollection=cms.InputTag('goodVertices'), HT=cms.InputTag(htInputCol), HTJets=cms.InputTag('HTJets'), MHT=cms.InputTag(mhtInputCol), MHTJets=cms.InputTag('MHTJets'), VarsDouble=cms.VInputTag(cms.InputTag('WeightProducer:weight')), VarsDoubleNamesInTree=cms.vstring('Weight'), METs=cms.VInputTag(mhtInputCol, 'mhtCalo'), METNamesInTree=cms.vstring('PFMHT', 'CaloMHT'), PatJetCollInputTag=cms.InputTag('patJetsPF'), PatJetsMinPt=cms.double(30.), PatJetsNameInTree=cms.string('Jets'), Filters=FilterNames) ## --- Final paths ---------------------------------------------------- # process.dump = cms.EDAnalyzer("EventContentAnalyzer") process.WriteTree = cms.Path( process.HLTSelection * #process.hltDecisions * process.ProduceRA2Jets * #process.filterSelection * process.PBNRFilter * process.HCALLaserEvtFilterList2012 * process.RA2CaloVsPFMHTFilterSequence * process.RA2HONoiseFilter * process.LeptonVeto * process.NumJetSelection * process.HTSelection * process.MHTSelection * ## process.dump process.WeightProducer * process.RA2TreeMaker)
process.VaryJESUp = cms.Sequence( process.patJetsPFJESUp * process.patJetsPFchsPt30JESUp * process.patJetsPFchsPt50Eta25JESUp * process.htPFchsJESUp * process.mhtPFchsJESUp) process.VaryJESDn = cms.Sequence( process.patJetsPFJESDn * process.patJetsPFchsPt30JESDn * process.patJetsPFchsPt50Eta25JESDn * process.htPFchsJESDn * process.mhtPFchsJESDn) ## --- Setup of TreeMaker ---------------------------------------------- from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName=cms.string("RA2PreSelection"), VertexCollection=cms.InputTag('goodVertices'), HT=cms.InputTag('htPFchs'), HTJets=cms.InputTag('patJetsPFchsPt50Eta25'), MHT=cms.InputTag('mhtPFchs'), MHTJets=cms.InputTag('patJetsPFchsPt30'), ) process.RA2TreeMakerJESUp = process.RA2TreeMaker.clone( HT=cms.InputTag('htPFchsJESUp'), HTJets=cms.InputTag('patJetsPFchsPt50Eta25JESUp'), MHT=cms.InputTag('mhtPFchsJESUp'), MHTJets=cms.InputTag('patJetsPFchsPt30JESUp'), ) process.RA2TreeMakerJESDn = process.RA2TreeMaker.clone( HT=cms.InputTag('htPFchsJESDn'), HTJets=cms.InputTag('patJetsPFchsPt50Eta25JESDn'), MHT=cms.InputTag('mhtPFchsJESDn'), MHTJets=cms.InputTag('patJetsPFchsPt30JESDn'), )
############################################################################### ############################################################################### process.load("SandBox.Skims.RA2Leptons_cff") ############################################################################### ############################################################################### ## --- Setup of TreeMaker ---------------------------------------------- from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName=cms.string("RA2PreSelection"), VarsDouble=cms.VInputTag(cms.InputTag("weightProducer:weight")), VarsDoubleNamesInTree=cms.vstring("Weight"), VertexCollection=cms.InputTag("goodVertices"), # HT = cms.InputTag('htPF'), HT=cms.InputTag("htPFchs"), HTJets=cms.InputTag("HTJets"), # MHT = cms.InputTag('mhtPF'), MHT=cms.InputTag("mhtPFchs"), MHTJets=cms.InputTag("MHTJets"), ) process.load("RA2Classic.Utils.produceRA2JetsPFCHS_cff") # process.load('RA2Classic.Utils.produceRA2JetsAK5PF_cff') ############################################################################### ############################################################################### process.dump = cms.EDAnalyzer("EventContentAnalyzer") ############################################################################### process.prediction = cms.Path( # process.dump *
def makeTreeFromPAT( process, outFileName, useCHSJets=True, invertLeptonVeto=False, NJetsMin=2, HTMin=500., MHTMin=200., reportEveryEvt=10, testFileName=[ "/store/user/kheine/HT/RA2PreSelectionOnData_Run2012A_HT_PromptReco-v1_v5/71cce229addb17644d40a607fa20b5d7/RA2SkimsOnData_99_3_TPC.root" ], numProcessedEvt=1000): ## --- Log output ------------------------------------------------------ process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr = cms.untracked.PSet( placeholder=cms.untracked.bool(True)) process.MessageLogger.statistics.append('cout') process.MessageLogger.cout = cms.untracked.PSet(INFO=cms.untracked.PSet( reportEvery=cms.untracked.int32(reportEveryEvt))) ## --- Files to process ------------------------------------------------ process.maxEvents = cms.untracked.PSet( input=cms.untracked.int32(numProcessedEvt)) process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(testFileName)) ## --- Output file ----------------------------------------------------- process.TFileService = cms.Service("TFileService", fileName=cms.string(outFileName + ".root")) ## --- Selection sequences --------------------------------------------- # Filter-related selection process.load('RA2Classic.TreeMaker.filterSelection_cff') process.load('SandBox.Skims.RA2Leptons_cff') process.CleaningSelection = cms.Sequence(process.filterSelection) # Select muon comtrol sample if invertLeptonVeto: from SandBox.Skims.RA2Leptons_cff import countPatMuons process.CSMuon = countPatMuons.clone() process.CSMuon.src = cms.InputTag('promtLeptons:PromtMuon') process.CSMuon.minNumber = cms.uint32(1) process.CSMuon.maxNumber = cms.uint32(1) process.LeptonVeto = cms.Sequence(process.CSMuon * process.ra2ElectronVeto) else: # Veto muons and electrons process.LeptonVeto = cms.Sequence(process.ra2PFMuonVeto * process.ra2ElectronVeto) # Produce RA2 jets if useCHSJets: process.load('RA2Classic.Utils.produceRA2JetsPFCHS_cff') process.ProduceRA2Jets = cms.Sequence(process.produceRA2JetsPFCHS) else: process.load('RA2Classic.Utils.produceRA2JetsAK5PF_cff') process.ProduceRA2Jets = cms.Sequence(process.produceRA2JetsAK5PF) # Include Muon information ## from SandBox.Skims.RA2Jets_cff import patJetsAK5PFPt30, patJetsAK5PFPt50Eta25 ## if useCHSJets: ## process.HTJets = patJetsAK5PFPt50Eta25.clone( ## src = cms.InputTag('patJetsPF') ## ) ## process.MHTJets = patJetsAK5PFPt30.clone( ## src = cms.InputTag('patJetsPF') ## ) ## else: ## process.HTJets = patJetsAK5PFPt50Eta25.clone( ## src = cms.InputTag('patJetsAK5PF') ## ) ## process.MHTJets = patJetsAK5PFPt30.clone( ## src = cms.InputTag('patJetsAK5PF') ## ) ## process.ProduceRA2Jets = cms.Sequence( ## process.MHTJets * ## process.HTJets ## ) # Select events with at least 'NJetsMin' of the above jets from PhysicsTools.PatAlgos.selectionLayer1.jetCountFilter_cfi import countPatJets process.NumJetSelection = countPatJets.clone( src=cms.InputTag('HTJets'), minNumber=cms.uint32(NJetsMin)) # HT selection htInputCol = 'htPF' if useCHSJets: htInputCol = 'htPFchs' from SandBox.Skims.RA2HT_cff import htPFFilter process.HTSelection = htPFFilter.clone(HTSource=cms.InputTag(htInputCol), MinHT=cms.double(HTMin)) # MHT selection mhtInputCol = 'mhtPF' if useCHSJets: mhtInputCol = 'mhtPFchs' from SandBox.Skims.RA2MHT_cff import mhtPFFilter process.MHTSelection = mhtPFFilter.clone( MHTSource=cms.InputTag(mhtInputCol), MinMHT=cms.double(MHTMin)) ## --- Additional Filters (tagging mode) ------------------------------ from RecoMET.METFilters.jetIDFailureFilter_cfi import jetIDFailure process.PBNRFilter = jetIDFailure.clone(JetSource=cms.InputTag('MHTJets'), MinJetPt=cms.double(30.0), taggingMode=cms.bool(True)) process.AdditionalFiltersInTagMode = cms.Sequence(process.PBNRFilter) ## --- Setup WeightProducer ------------------------------------------- from RA2Classic.WeightProducer.getWeightProducer_cff import getWeightProducer process.WeightProducer = getWeightProducer(process.source.fileNames[0]) ## --- Setup of TreeMaker ---------------------------------------------- FilterNames = cms.VInputTag() # All filters in AdditionalFiltersInTagMode for f in process.AdditionalFiltersInTagMode.moduleNames(): FilterNames.append(cms.InputTag(f)) ## FilterNames.append(cms.InputTag("HBHENoiseFilterRA2","HBHENoiseFilterResult","PAT")) ## FilterNames.append(cms.InputTag("beamHaloFilter")) ## FilterNames.append(cms.InputTag("eeNoiseFilter")) ## FilterNames.append(cms.InputTag("trackingFailureFilter")) ## FilterNames.append(cms.InputTag("inconsistentMuons")) ## FilterNames.append(cms.InputTag("greedyMuons")) ## FilterNames.append(cms.InputTag("ra2EcalTPFilter")) ## FilterNames.append(cms.InputTag("ra2EcalBEFilter")) ## FilterNames.append(cms.InputTag("hcalLaserEventFilter")) ## FilterNames.append(cms.InputTag("eeBadScFilter")) from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName=cms.string("RA2PreSelection"), VertexCollection=cms.InputTag('goodVertices'), HT=cms.InputTag(htInputCol), HTJets=cms.InputTag('HTJets'), MHT=cms.InputTag(mhtInputCol), MHTJets=cms.InputTag('MHTJets'), VarsDouble=cms.VInputTag( cms.InputTag('WeightProducer:weight'), cms.InputTag('LostLeptonBkgProducer:LostLeptonWeight'), cms.InputTag('LostLeptonBkgProducer:Met'), cms.InputTag('LostLeptonBkgProducer:nMu'), cms.InputTag('LostLeptonBkgProducer:MuPt'), cms.InputTag('LostLeptonBkgProducer:MuEta'), cms.InputTag('LostLeptonBkgProducer:MuPhi'), cms.InputTag('LostLeptonBkgProducer:deltaRMuJet'), cms.InputTag('LostLeptonBkgProducer:deltaRMuMHT'), cms.InputTag('LostLeptonBkgProducer:deltaPtMuJet'), cms.InputTag('LostLeptonBkgProducer:muonTotalWeight'), cms.InputTag('LostLeptonBkgProducer:elecTotalWeight'), cms.InputTag('LostLeptonBkgProducer:muonIsoWeight'), cms.InputTag('LostLeptonBkgProducer:muonRecoWeight'), cms.InputTag('LostLeptonBkgProducer:muonAccWeight'), cms.InputTag('LostLeptonBkgProducer:elecIsoWeight'), cms.InputTag('LostLeptonBkgProducer:elecRecoWeight'), cms.InputTag('LostLeptonBkgProducer:elecAccWeight'), cms.InputTag('LostLeptonBkgProducer:muonAccEff'), cms.InputTag('LostLeptonBkgProducer:elecAccEff'), cms.InputTag('LostLeptonBkgProducer:muonRecoEff'), cms.InputTag('LostLeptonBkgProducer:elecRecoEff'), cms.InputTag('LostLeptonBkgProducer:muonIsoEff'), cms.InputTag('LostLeptonBkgProducer:elecIsoEff'), cms.InputTag('LostLeptonBkgProducer:MTW'), cms.InputTag('LostLeptonBkgProducer:mtwCorrectionWeight'), cms.InputTag('LostLeptonBkgProducer:nLeptons')), VarsDoubleNamesInTree=cms.vstring( 'Weight', 'LostLeptonWeight', 'Met', 'numberOfMuons', 'MuPT', 'MuEta', 'MuPhi', 'DeltaRMuJet', 'DeltaRMuMHT', 'DeltaPtMuJet', 'muonTotalWeight', 'elecTotalWeight', 'muonIsoWeight', 'muonRecoWeight', 'muonAccWeight', 'elecIsoWeight', 'elecRecoWeight', 'elecAccWeight', 'muonAccEff', 'elecAccEff', 'muonRecoEff', 'elecRecoEff', 'muonIsoEff', 'elecIsoEff', 'MTW', 'mtwCorrectionWeight', 'nLeptons'), Filters=FilterNames) # filter used to slecte the RA2 baseline important for efficiency caluclaiton from RA2Classic.Utils.RA2Selection_cfi import RA2Selection process.RA2Selector = RA2Selection.clone() ## ---- Load lost lepton moduels # from RA2Classic.LostLeptonBkg.llPrediction_cff import llPrediction # process.lostLeptonPrediction = llPrediction() from RA2Classic.LostLeptonBkg.bkglostlepton_cfi import bkglostlepton process.LostLeptonBkgProducer = bkglostlepton.clone( HTJets=cms.InputTag('HTJets'), MetTag=cms.InputTag('pfMet'), CaloJetTag=cms.InputTag('cleanPatJetsAK5Calo'), MuonTag=cms.InputTag('promtLeptons:PromtMuon'), MTWCut=cms.bool(True), EfficiencyFileName=cms.string('MCEffOnlyW.root'), ) from RA2Classic.LostLeptonBkg.promtisomu_cfi import promtIsoMu process.promtLeptons = promtIsoMu.clone( MuonIDISOTag=cms.InputTag("patMuonsPFIDIso") # CaloJetTag = cms.InputTag("ak5CaloJetsL2L3") ) ## --- Final paths ---------------------------------------------------- process.dump = cms.EDAnalyzer("EventContentAnalyzer") process.WriteTree = cms.Path( process.CleaningSelection * process.promtLeptons * # process.LeptonVeto * process.ProduceRA2Jets * process.NumJetSelection * process.HTSelection * process.MHTSelection * process.AdditionalFiltersInTagMode * process.WeightProducer * process.RA2Selector * process.LostLeptonBkgProducer # process.dump * # process.RA2TreeMaker )
def makeTreeFromPAT(process, outFileName, useCHSJets=True, invertLeptonVeto=False, NJetsMin=2, HTMin=500., MHTMin=200., reportEveryEvt=10, testFileName=["/store/user/kheine/HT/RA2PreSelectionOnData_Run2012A_HT_PromptReco-v1_v5/71cce229addb17644d40a607fa20b5d7/RA2SkimsOnData_99_3_TPC.root"], numProcessedEvt=1000): ## --- Log output ------------------------------------------------------ process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr = cms.untracked.PSet( placeholder = cms.untracked.bool(True) ) process.MessageLogger.statistics.append('cout') process.MessageLogger.cout = cms.untracked.PSet( INFO = cms.untracked.PSet(reportEvery = cms.untracked.int32(reportEveryEvt)) ) ## --- Files to process ------------------------------------------------ process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(numProcessedEvt) ) process.source = cms.Source( "PoolSource", fileNames = cms.untracked.vstring(testFileName) ) ## --- Output file ----------------------------------------------------- process.TFileService = cms.Service( "TFileService", fileName = cms.string(outFileName+".root") ) ## --- Selection sequences --------------------------------------------- # Filter-related selection process.load('RA2Classic.TreeMaker.filterSelection_cff') process.load('SandBox.Skims.RA2Leptons_cff') process.CleaningSelection = cms.Sequence( process.filterSelection ) # Select muon comtrol sample if invertLeptonVeto: from SandBox.Skims.RA2Leptons_cff import countPatMuons process.CSMuon = countPatMuons.clone() process.CSMuon.src = cms.InputTag('promtLeptons:PromtMuon') process.CSMuon.minNumber = cms.uint32(1) process.CSMuon.maxNumber = cms.uint32(1) process.LeptonVeto = cms.Sequence( process.CSMuon * process.ra2ElectronVeto ) else: # Veto muons and electrons process.LeptonVeto = cms.Sequence( process.ra2PFMuonVeto * process.ra2ElectronVeto ) # Produce RA2 jets if useCHSJets: process.load('RA2Classic.Utils.produceRA2JetsPFCHS_cff') process.ProduceRA2Jets = cms.Sequence( process.produceRA2JetsPFCHS ) else: process.load('RA2Classic.Utils.produceRA2JetsAK5PF_cff') process.ProduceRA2Jets = cms.Sequence( process.produceRA2JetsAK5PF ) # Include Muon information ## from SandBox.Skims.RA2Jets_cff import patJetsAK5PFPt30, patJetsAK5PFPt50Eta25 ## if useCHSJets: ## process.HTJets = patJetsAK5PFPt50Eta25.clone( ## src = cms.InputTag('patJetsPF') ## ) ## process.MHTJets = patJetsAK5PFPt30.clone( ## src = cms.InputTag('patJetsPF') ## ) ## else: ## process.HTJets = patJetsAK5PFPt50Eta25.clone( ## src = cms.InputTag('patJetsAK5PF') ## ) ## process.MHTJets = patJetsAK5PFPt30.clone( ## src = cms.InputTag('patJetsAK5PF') ## ) ## process.ProduceRA2Jets = cms.Sequence( ## process.MHTJets * ## process.HTJets ## ) # Select events with at least 'NJetsMin' of the above jets from PhysicsTools.PatAlgos.selectionLayer1.jetCountFilter_cfi import countPatJets process.NumJetSelection = countPatJets.clone( src = cms.InputTag('HTJets'), minNumber = cms.uint32(NJetsMin) ) # HT selection htInputCol = 'htPF' if useCHSJets: htInputCol = 'htPFchs' from SandBox.Skims.RA2HT_cff import htPFFilter process.HTSelection = htPFFilter.clone( HTSource = cms.InputTag(htInputCol), MinHT = cms.double(HTMin) ) # MHT selection mhtInputCol = 'mhtPF' if useCHSJets: mhtInputCol = 'mhtPFchs' from SandBox.Skims.RA2MHT_cff import mhtPFFilter process.MHTSelection = mhtPFFilter.clone( MHTSource = cms.InputTag(mhtInputCol), MinMHT = cms.double(MHTMin) ) ## --- Additional Filters (tagging mode) ------------------------------ from RecoMET.METFilters.jetIDFailureFilter_cfi import jetIDFailure process.PBNRFilter = jetIDFailure.clone( JetSource = cms.InputTag('MHTJets'), MinJetPt = cms.double(30.0), taggingMode = cms.bool(True) ) process.AdditionalFiltersInTagMode = cms.Sequence( process.PBNRFilter ) ## --- Setup WeightProducer ------------------------------------------- from RA2Classic.WeightProducer.getWeightProducer_cff import getWeightProducer process.WeightProducer = getWeightProducer(process.source.fileNames[0]) ## --- Setup of TreeMaker ---------------------------------------------- FilterNames = cms.VInputTag() # All filters in AdditionalFiltersInTagMode for f in process.AdditionalFiltersInTagMode.moduleNames(): FilterNames.append(cms.InputTag(f)) ## FilterNames.append(cms.InputTag("HBHENoiseFilterRA2","HBHENoiseFilterResult","PAT")) ## FilterNames.append(cms.InputTag("beamHaloFilter")) ## FilterNames.append(cms.InputTag("eeNoiseFilter")) ## FilterNames.append(cms.InputTag("trackingFailureFilter")) ## FilterNames.append(cms.InputTag("inconsistentMuons")) ## FilterNames.append(cms.InputTag("greedyMuons")) ## FilterNames.append(cms.InputTag("ra2EcalTPFilter")) ## FilterNames.append(cms.InputTag("ra2EcalBEFilter")) ## FilterNames.append(cms.InputTag("hcalLaserEventFilter")) ## FilterNames.append(cms.InputTag("eeBadScFilter")) from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName = cms.string("RA2PreSelection"), VertexCollection = cms.InputTag('goodVertices'), HT = cms.InputTag(htInputCol), HTJets = cms.InputTag('HTJets'), MHT = cms.InputTag(mhtInputCol), MHTJets = cms.InputTag('MHTJets'), VarsDouble = cms.VInputTag(cms.InputTag('WeightProducer:weight'),cms.InputTag('LostLeptonBkgProducer:LostLeptonWeight'),cms.InputTag('LostLeptonBkgProducer:Met'),cms.InputTag('LostLeptonBkgProducer:nMu'),cms.InputTag('LostLeptonBkgProducer:MuPt'),cms.InputTag('LostLeptonBkgProducer:MuEta'),cms.InputTag('LostLeptonBkgProducer:MuPhi' ),cms.InputTag('LostLeptonBkgProducer:deltaRMuJet'),cms.InputTag('LostLeptonBkgProducer:deltaRMuMHT' ),cms.InputTag('LostLeptonBkgProducer:deltaPtMuJet'),cms.InputTag('LostLeptonBkgProducer:muonTotalWeight'),cms.InputTag('LostLeptonBkgProducer:elecTotalWeight'),cms.InputTag('LostLeptonBkgProducer:muonIsoWeight'),cms.InputTag('LostLeptonBkgProducer:muonRecoWeight') ,cms.InputTag('LostLeptonBkgProducer:muonAccWeight'),cms.InputTag('LostLeptonBkgProducer:elecIsoWeight'),cms.InputTag('LostLeptonBkgProducer:elecRecoWeight'),cms.InputTag('LostLeptonBkgProducer:elecAccWeight'),cms.InputTag('LostLeptonBkgProducer:muonAccEff'),cms.InputTag('LostLeptonBkgProducer:elecAccEff'),cms.InputTag('LostLeptonBkgProducer:muonRecoEff'),cms.InputTag('LostLeptonBkgProducer:elecRecoEff'),cms.InputTag('LostLeptonBkgProducer:muonIsoEff'),cms.InputTag('LostLeptonBkgProducer:elecIsoEff'),cms.InputTag('LostLeptonBkgProducer:MTW'),cms.InputTag('LostLeptonBkgProducer:mtwCorrectionWeight'),cms.InputTag('LostLeptonBkgProducer:nLeptons') ), VarsDoubleNamesInTree = cms.vstring('Weight','LostLeptonWeight','Met','numberOfMuons','MuPT','MuEta','MuPhi','DeltaRMuJet','DeltaRMuMHT','DeltaPtMuJet','muonTotalWeight','elecTotalWeight','muonIsoWeight','muonRecoWeight','muonAccWeight','elecIsoWeight','elecRecoWeight','elecAccWeight','muonAccEff','elecAccEff','muonRecoEff','elecRecoEff','muonIsoEff','elecIsoEff','MTW','mtwCorrectionWeight','nLeptons'), Filters = FilterNames ) # filter used to slecte the RA2 baseline important for efficiency caluclaiton from RA2Classic.Utils.RA2Selection_cfi import RA2Selection process.RA2Selector = RA2Selection.clone( ) ## ---- Load lost lepton moduels # from RA2Classic.LostLeptonBkg.llPrediction_cff import llPrediction # process.lostLeptonPrediction = llPrediction() from RA2Classic.LostLeptonBkg.bkglostlepton_cfi import bkglostlepton process.LostLeptonBkgProducer = bkglostlepton.clone( HTJets = cms.InputTag('HTJets'), MetTag = cms.InputTag('pfMet'), CaloJetTag = cms.InputTag('cleanPatJetsAK5Calo'), MuonTag = cms.InputTag('promtLeptons:PromtMuon'), MTWCut = cms.bool(True), EfficiencyFileName = cms.string('MCEffOnlyW.root'), ) from RA2Classic.LostLeptonBkg.promtisomu_cfi import promtIsoMu process.promtLeptons = promtIsoMu.clone( MuonIDISOTag = cms.InputTag("patMuonsPFIDIso") # CaloJetTag = cms.InputTag("ak5CaloJetsL2L3") ) ## --- Final paths ---------------------------------------------------- process.dump = cms.EDAnalyzer("EventContentAnalyzer") process.WriteTree = cms.Path( process.CleaningSelection * process.promtLeptons * # process.LeptonVeto * process.ProduceRA2Jets * process.NumJetSelection * process.HTSelection * process.MHTSelection * process.AdditionalFiltersInTagMode * process.WeightProducer * process.RA2Selector * process.LostLeptonBkgProducer # process.dump * # process.RA2TreeMaker )
process.RA2TreeMaker = TreeMaker.clone( TreeName = cms.string("RA2PreSelection"), VertexCollection = cms.InputTag('goodVertices'), HT = cms.InputTag('htPFchs'), HTJets = cms.InputTag('patJetsPFchsPt50Eta25'), MHT = cms.InputTag('mhtPFchs'), MHTJets = cms.InputTag('patJetsPFchsPt30'), Filters = cms.VInputTag(cms.InputTag('eeNoiseFilter'), cms.InputTag('trackingFailureFilter'), cms.InputTag('inconsistentMuons'), cms.InputTag('greedyMuons'), cms.InputTag('ra2EcalTPFilter'), cms.InputTag('ra2EcalBEFilter'), cms.InputTag('hcalLaserEventFilter'), cms.InputTag('ecalLaserCorrFilter'), cms.InputTag('eeBadScFilter'), cms.InputTag('PBNRFilter') ), VarsDouble = cms.VInputTag(cms.InputTag('WeightProducer:weight'), cms.InputTag('PUInfo:Num'), cms.InputTag('kt6PFJets:rho'), cms.InputTag('myProducerLabel:ISRWeight'), cms.InputTag('myProducerLabel:SusyMoSumE'), cms.InputTag('myProducerLabel:SusyMoSumEta'), cms.InputTag('myProducerLabel:SusyMoSumPhi'), cms.InputTag('myProducerLabel:SusyMoSumPt'), cms.InputTag('susyparams:m0'), cms.InputTag('susyparams:m12'), cms.InputTag('susyparams:evtProcID') ), VarsDoubleNamesInTree = cms.vstring('Weight', 'NumPUInteractions', 'rho', 'ISRWeight', 'SusyMoSumE', 'SusyMoSumEta', 'SusyMoSumPhi', 'SusyMoSumPt', 'massMom', 'massDau', 'procID' ), CandidateCollections = cms.VInputTag('patJetsPFchs', 'genJets', 'caloJets', 'patMuonsPFIDIso', 'patElectronsIDIso', 'patMETsPF' ), CandidateNamesInTree = cms.vstring('Jets', 'GenJets', 'CaloJetsRaw', 'PATMuonsPFIDIso', 'PATElectronsIDIso', 'PATMETsPF' ), CandidateCollectionsJetInfo = cms.VInputTag('AdditionalJetInfo:Area', 'AdditionalJetInfo:NeutHadF', 'AdditionalJetInfo:NeutEmF', 'AdditionalJetInfo:BTagCSV' ), CandidateNamesInTreeJetInfo = cms.vstring('JetArea', 'JetNeutHadF', 'JetNeutEmF', 'BTagCSV' ), VarsDoubleV = cms.VInputTag("pdfWeight:cteq66", "pdfWeight:MSTW2008nlo68cl", "pdfWeight:NNPDF20" ), VarsDoubleNamesInTreeV = cms.vstring("cteq66", "MSTW2008nlo68cl", "NNPDF20" ) )
def makeTreeFromSignalScan( process, globalTag, smsModel, smsMotherMass, smsLSPMass, SMStopol, xs=1, numEvtsInSample=1, lumi=5.088, reportEveryEvt=5000, testFileName="/store/mc/Summer12/WJetsToLNu_HT-400ToInf_8TeV-madgraph/AODSIM/PU_S7_START52_V9-v1/0000/041CF749-57A0-E111-B6DD-0026189438DA.root", numProcessedEvt=20): #-- Meta data to be logged in DBS --------------------------------------------- process.configurationMetadata = cms.untracked.PSet( version=cms.untracked.string('$Revision: 1.1 $'), name=cms.untracked.string( '$Source: /local/reps/CMSSW/UserCode/kheine/RA2Classic/TreeMaker/python/makeTreeFromSignalScan_cff.py,v $' ), annotation=cms.untracked.string('SUSY pattuple definition')) #-- Message Logger ------------------------------------------------------------ process.MessageLogger.categories.append('PATSummaryTables') process.MessageLogger.cerr.PATSummaryTables = cms.untracked.PSet( limit=cms.untracked.int32(-1), reportEvery=cms.untracked.int32(1)) process.MessageLogger.cerr.FwkReport.reportEvery = reportEveryEvt #-- Input Source -------------------------------------------------------------- process.maxEvents.input = numProcessedEvt process.source.duplicateCheckMode = cms.untracked.string( 'noDuplicateCheck') process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(testFileName)) #-- SUSYPAT specifics --------------------------------------------------------- from PhysicsTools.Configuration.SUSY_pattuple_cff import addDefaultSUSYPAT, getSUSY_pattuple_outputCommands hltMenu = 'REDIGI' theJetColls = ['AK5PF'] jetMetCorr = ['L1FastJet', 'L2Relative', 'L3Absolute'] process.GlobalTag.globaltag = globalTag addDefaultSUSYPAT(process, mcInfo=True, HLTMenu=hltMenu, jetMetCorrections=jetMetCorr, mcVersion='', theJetNames=theJetColls, doSusyTopProjection=False) # Remove the PAT cleaning and filtering sequences process.patDefaultSequence.remove(process.selectedPatCandidates) process.patDefaultSequence.remove(process.cleanPatCandidates) process.patDefaultSequence.remove(process.countPatCandidates) # Disable embedment so that lepton cleaning method works process.patJetsAK5PF.embedCaloTowers = False process.patJetsAK5PF.embedPFCandidates = False process.patJetsPF.embedCaloTowers = False process.patJetsPF.embedPFCandidates = False #-- Adjust collections to use PFNoPU jets ------------------------------------- # do not use Z-mass window for PU subtraction # such that JEC works properly process.pfPileUpPF.checkClosestZVertex = cms.bool(False) # do not remove muons and electrons from the jet clustering input # (patMuons and patElectrons use relaxed pfMuon and pfElectron collections) process.pfIsolatedElectronsPF.isolationCut = -1 process.pfIsolatedMuonsPF.isolationCut = -1 # make loose clones of the original electron collection process.pfRelaxedElectronsPF = process.pfIsolatedElectronsPF.clone() process.pfRelaxedElectronsPF.isolationCut = 9999 process.pfElectronsFromVertexPF.dzCut = 9999.0 process.pfElectronsFromVertexPF.d0Cut = 9999.0 process.pfSelectedElectronsPF.cut = "" process.patElectronsPF.pfElectronSource = "pfRelaxedElectronsPF" process.pfElectronSequencePF.replace( process.pfIsolatedElectronsPF, process.pfIsolatedElectronsPF + process.pfRelaxedElectronsPF) # make loose clones of the original muon collection process.pfRelaxedMuonsPF = process.pfIsolatedMuonsPF.clone() process.pfRelaxedMuonsPF.isolationCut = 9999 process.pfMuonsFromVertexPF.dzCut = 9999.0 process.pfMuonsFromVertexPF.d0Cut = 9999.0 process.pfSelectedMuonsPF.cut = "" process.patMuonsPF.pfMuonSource = "pfRelaxedMuonsPF" process.pfMuonSequencePF.replace( process.pfIsolatedMuonsPF, process.pfIsolatedMuonsPF + process.pfRelaxedMuonsPF) # do not remove taus from the jet collection process.pfTausPF.discriminators = cms.VPSet() process.pfUnclusteredTausPF = process.pfTausPF.clone( cut=cms.string("pt < 0")) process.pfTauSequencePF.replace( process.pfTausPF, process.pfTausPF + process.pfUnclusteredTausPF) process.pfNoTauPF.topCollection = "pfUnclusteredTausPF" #------------------------------------------------------------------------------ #-- Overwrite default output content ------------------------------------------ from SandBox.Skims.RA2Content_cff import getRA2PATOutput process.out.outputCommands = getRA2PATOutput(process) process.out.dropMetaData = cms.untracked.string('DROPPED') #-- RA2 filtering ------------------------------------------------------------- process.prefilterCounter = cms.EDProducer("EventCountProducer") process.postStdCleaningCounter = cms.EDProducer("EventCountProducer") process.postPostCleaningCounter = cms.EDProducer("EventCountProducer") process.postPFchsJetsCounter = cms.EDProducer("EventCountProducer") process.postPFchsHTCounter = cms.EDProducer("EventCountProducer") process.postPFchsMHTCounter = cms.EDProducer("EventCountProducer") process.load('SandBox.Skims.RA2Objects_cff') process.load('SandBox.Skims.RA2Selection_cff') process.load('SandBox.Skims.RA2Cleaning_cff') # Adjust object filters for signal-scan values process.htPFchsFilter.MinHT = cms.double(300.0) process.mhtPFchsFilter.MinMHT = cms.double(100.0) process.countJetsPFchsPt50Eta25.minNumber = cms.uint32(2) ## please comment this block to remove tagging mode of ##filters and reject events failing any of following filters process.eeNoiseFilter.taggingMode = False process.trackingFailureFilter.taggingMode = False process.beamHaloFilter.taggingMode = False process.ra2NoiseCleaning.remove(process.HBHENoiseFilter) process.inconsistentMuons.taggingMode = False process.greedyMuons.taggingMode = False process.ra2EcalTPFilter.taggingMode = False process.ra2EcalBEFilter.taggingMode = False process.hcalLaserEventFilter.taggingMode = False process.eeBadScFilter.taggingMode = False process.load("SandBox.Skims.provInfoMuons_cfi") process.load("SandBox.Skims.provInfoElectrons_cfi") process.cleanpatseq = cms.Sequence( process.susyPatDefaultSequence * process.prefilterCounter * process.ra2StdCleaning * process.postStdCleaningCounter * process.ra2Objects * process.provInfoMuons * process.provInfoElectrons * process.ra2PostCleaning * process.postPostCleaningCounter) ## --- Setup WeightProducer -------------------------------------------- from RA2Classic.WeightProducer.weightProducer_cfi import weightProducer process.WeightProducer = weightProducer.clone( weight=cms.double(-1.0), Method=cms.string("Constant"), XS=cms.double(xs), NumberEvts=cms.double(numEvtsInSample), Lumi=cms.double(lumi), LumiScale=cms.double(1.0), FileNamePUDataDistribution=cms.string("NONE"), PU=cms.int32(0)) ## --- SMS Model Filter ------------------------------------------------ # Filter files for specified signal point out of dataset # Code from UserCode/seema/SusyAnalysis/AnalysisUtils from SusyAnalysis.AnalysisUtils.smsModelFilter_cfi import smsModelFilter process.SMSModelFilter = smsModelFilter.clone( SusyScanTopology=cms.string(smsModel), SusyScanMotherMass=cms.double(smsMotherMass), SusyScanLSPMass=cms.double(smsLSPMass), SusyScanFracLSP=cms.double(0.0)) #---JL #--for PDF sys process.pdfWeight = cms.EDProducer( "PdfWeightProducer", PdfInfoTag=cms.untracked.InputTag("generator"), PdfSetNames=cms.untracked.vstring("cteq66.LHgrid", "MSTW2008nlo68cl.LHgrid", "NNPDF20_100.LHgrid") #PdfSetNames = cms.untracked.vstring("NNPDF20_100.LHgrid") ) #---for ISR sys process.lastParticles = cms.EDProducer("ISRProducer") process.ISRsys = cms.Sequence(process.lastParticles) #---put the susy params process.load("RA2Classic.SUSYParams.susyparams_cfi") process.susyparams.Model = cms.string(SMStopol) #-- end JL ## --- Setup of TreeMaker ---------------------------------------------- process.TFileService = cms.Service( "TFileService", fileName=cms.string("RA2Selection.root")) from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName=cms.string("RA2PreSelection"), VertexCollection=cms.InputTag('goodVertices'), HT=cms.InputTag('htPFchs'), HTJets=cms.InputTag('patJetsPFchsPt50Eta25'), MHT=cms.InputTag('mhtPFchs'), MHTJets=cms.InputTag('patJetsPFchsPt30'), VarsDouble=cms.VInputTag(cms.InputTag('WeightProducer:weight'), "susyparams:m0", "susyparams:m12", "susyparams:evtProcID"), VarsDoubleNamesInTree=cms.vstring('Weight', "massMom", "massDau", "procID"), CandidateCollections=cms.VInputTag('patJetsPFchsPt30', 'patMuonsPFIDIso', 'patElectronsIDIso'), CandidateNamesInTree=cms.vstring('Jets', 'PATMuonsPFIDIso', 'PATElectronsIDIso'), VarsDoubleV=cms.VInputTag("pdfWeight:cteq66", "pdfWeight:MSTW2008nlo68cl", "pdfWeight:NNPDF20"), VarsDoubleNamesInTreeV=cms.vstring("cteq66", "MSTW2008nlo68cl", "NNPDF20")) #process.dump = cms.EDAnalyzer("EventContentAnalyzer") process.ppfchs = cms.Path( process.SMSModelFilter * process.cleanpatseq * process.countJetsPFchsPt50Eta25 * process.postPFchsJetsCounter * process.htPFchsFilter * process.postPFchsHTCounter * process.mhtPFchsFilter * process.postPFchsMHTCounter * process.WeightProducer * #--JL process.pdfWeight * process.ISRsys * process.susyparams * #--end JL process.RA2TreeMaker) process.schedule = cms.Schedule(process.ppfchs)
def makeTreeFromFSIM(process, globalTag, reportEveryEvt=5000, testFileName="/store/mc/Summer12/WJetsToLNu_HT-400ToInf_8TeV-madgraph/AODSIM/PU_S7_START52_V9-v1/0000/041CF749-57A0-E111-B6DD-0026189438DA.root", numProcessedEvt=20): #-- Meta data to be logged in DBS --------------------------------------------- process.configurationMetadata = cms.untracked.PSet( version = cms.untracked.string('$Revision: 1.2 $'), name = cms.untracked.string('$Source: /local/reps/CMSSW/UserCode/kheine/RA2Classic/TreeMaker/python/makeTreeFromSignalScan_cff.py,v $'), annotation = cms.untracked.string('SUSY pattuple definition') ) #-- Message Logger ------------------------------------------------------------ process.MessageLogger.categories.append('PATSummaryTables') process.MessageLogger.cerr.PATSummaryTables = cms.untracked.PSet( limit = cms.untracked.int32(-1), reportEvery = cms.untracked.int32(1) ) process.MessageLogger.cerr.FwkReport.reportEvery = reportEveryEvt #-- Input Source -------------------------------------------------------------- process.maxEvents.input = numProcessedEvt process.source.duplicateCheckMode = cms.untracked.string('noDuplicateCheck') process.source = cms.Source("PoolSource",fileNames = cms.untracked.vstring(testFileName)) #-- SUSYPAT specifics --------------------------------------------------------- from PhysicsTools.Configuration.SUSY_pattuple_cff import addDefaultSUSYPAT, getSUSY_pattuple_outputCommands hltMenu = 'REDIGI' theJetColls = ['AK5PF'] jetMetCorr = ['L1FastJet', 'L2Relative', 'L3Absolute'] process.GlobalTag.globaltag = globalTag addDefaultSUSYPAT(process, mcInfo=True, HLTMenu=hltMenu, jetMetCorrections=jetMetCorr, mcVersion='', theJetNames=theJetColls, doSusyTopProjection=False) # Remove the PAT cleaning and filtering sequences process.patDefaultSequence.remove(process.selectedPatCandidates) process.patDefaultSequence.remove(process.cleanPatCandidates) process.patDefaultSequence.remove(process.countPatCandidates) # Disable embedment so that lepton cleaning method works process.patJetsAK5PF.embedCaloTowers = False process.patJetsAK5PF.embedPFCandidates = False process.patJetsPF.embedCaloTowers = False process.patJetsPF.embedPFCandidates = False #-- Adjust collections to use PFNoPU jets ------------------------------------- # do not use Z-mass window for PU subtraction # such that JEC works properly process.pfPileUpPF.checkClosestZVertex = cms.bool(False) # do not remove muons and electrons from the jet clustering input # (patMuons and patElectrons use relaxed pfMuon and pfElectron collections) process.pfIsolatedElectronsPF.isolationCut = -1 process.pfIsolatedMuonsPF.isolationCut = -1 # make loose clones of the original electron collection process.pfRelaxedElectronsPF = process.pfIsolatedElectronsPF.clone() process.pfRelaxedElectronsPF.isolationCut = 9999 process.pfElectronsFromVertexPF.dzCut = 9999.0 process.pfElectronsFromVertexPF.d0Cut = 9999.0 process.pfSelectedElectronsPF.cut = "" process.patElectronsPF.pfElectronSource = "pfRelaxedElectronsPF" process.pfElectronSequencePF.replace(process.pfIsolatedElectronsPF, process.pfIsolatedElectronsPF + process.pfRelaxedElectronsPF) # make loose clones of the original muon collection process.pfRelaxedMuonsPF = process.pfIsolatedMuonsPF.clone() process.pfRelaxedMuonsPF.isolationCut = 9999 process.pfMuonsFromVertexPF.dzCut = 9999.0 process.pfMuonsFromVertexPF.d0Cut = 9999.0 process.pfSelectedMuonsPF.cut = "" process.patMuonsPF.pfMuonSource = "pfRelaxedMuonsPF" process.pfMuonSequencePF.replace(process.pfIsolatedMuonsPF, process.pfIsolatedMuonsPF + process.pfRelaxedMuonsPF) # do not remove taus from the jet collection process.pfTausPF.discriminators = cms.VPSet() process.pfUnclusteredTausPF = process.pfTausPF.clone( cut = cms.string("pt < 0") ) process.pfTauSequencePF.replace(process.pfTausPF, process.pfTausPF+ process.pfUnclusteredTausPF) process.pfNoTauPF.topCollection = "pfUnclusteredTausPF" #------------------------------------------------------------------------------ #-- Overwrite default output content ------------------------------------------ from SandBox.Skims.RA2Content_cff import getRA2PATOutput process.out.outputCommands = getRA2PATOutput(process) process.out.dropMetaData = cms.untracked.string('DROPPED') #-- RA2 filtering ------------------------------------------------------------- process.prefilterCounter = cms.EDProducer("EventCountProducer") process.postStdCleaningCounter = cms.EDProducer("EventCountProducer") process.postPostCleaningCounter = cms.EDProducer("EventCountProducer") process.postPFchsJetsCounter = cms.EDProducer("EventCountProducer") process.postPFchsHTCounter = cms.EDProducer("EventCountProducer") process.postPFchsMHTCounter = cms.EDProducer("EventCountProducer") process.load('SandBox.Skims.RA2Objects_cff') process.load('SandBox.Skims.RA2Selection_cff') process.load('SandBox.Skims.RA2Cleaning_cff') # Adjust object filters for signal-scan values process.htPFchsFilter.MinHT = cms.double(300.0) process.mhtPFchsFilter.MinMHT = cms.double(100.0) process.countJetsPFchsPt50Eta25.minNumber = cms.uint32(2) ## RA2 cleaning process.ra2NoiseCleaning.remove(process.HBHENoiseFilterRA2) # Not in FASTSIM process.ra2NoiseCleaning.remove(process.HBHENoiseFilter) # Not in FASTSIM process.ra2NoiseCleaning.remove(process.beamHaloFilter) # Not in FASTSIM process.trackingFailureFilter.taggingMode = False process.inconsistentMuons.taggingMode = False process.greedyMuons.taggingMode = False process.ra2EcalTPFilter.taggingMode = False process.ra2EcalBEFilter.taggingMode = False process.hcalLaserEventFilter.taggingMode = False process.ecalLaserCorrFilter.taggingMode = False process.eeBadScFilter.taggingMode = False process.manystripclus53X.taggedMode = cms.untracked.bool(False) process.toomanystripclus53X.taggedMode = cms.untracked.bool(False) process.logErrorTooManyClusters.taggedMode = cms.untracked.bool(False) process.trackingPOGCleaning = cms.Sequence( ~process.manystripclus53X * ~process.toomanystripclus53X * ~process.logErrorTooManyClusters ) #process.ra2NoiseCleaning += process.trackingPOGCleaning process.ra2NoiseCleaning += process.ra2PBNR from SandBox.Skims.hoNoiseFilter_cfi import hoNoiseFilter process.RA2HONoiseFilter = hoNoiseFilter.clone( patJetsInputTag = cms.InputTag('patJetsPFchsPt30'), jetPtMin = cms.double(30), jetEtaMax = cms.double(5), maxHOEfrac = cms.double(0.4), taggingMode = cms.bool(False) ) process.ra2NoiseCleaning += process.RA2HONoiseFilter process.load("SandBox.Skims.provInfoMuons_cfi") process.load("SandBox.Skims.provInfoElectrons_cfi") process.cleanpatseq = cms.Sequence( process.susyPatDefaultSequence * process.prefilterCounter * process.ra2StdCleaning * process.postStdCleaningCounter * process.ra2Objects * process.provInfoMuons * process.provInfoElectrons * process.ra2PostCleaning * process.postPostCleaningCounter ) ## Lepton veto process.load('SandBox.Skims.RA2Leptons_cff') process.LeptonVeto = cms.Sequence( process.ra2PFMuonVeto * process.ra2ElectronVeto ) ## --- Setup WeightProducer -------------------------------------------- from RA2Classic.WeightProducer.weightProducer_cfi import weightProducer process.WeightProducer = weightProducer.clone( weight = cms.double(-1.0), Method = cms.string("Constant"), XS = cms.double(1), NumberEvts = cms.double(1), Lumi = cms.double(1), LumiScale = cms.double(1.0), PU = cms.int32(2), # PU Summer12S7 FileNamePUDataDistribution = cms.string("RA2Classic/WeightProducer/data/DataPileupHistogram_RA2Summer12_190456-208686_ABCD.root") ) ## --- Setup of TreeMaker ---------------------------------------------- process.TFileService = cms.Service( "TFileService", fileName = cms.string("RA2Selection.root") ) from RA2Classic.TreeMaker.treemaker_cfi import TreeMaker process.RA2TreeMaker = TreeMaker.clone( TreeName = cms.string("RA2Selection"), VertexCollection = cms.InputTag('goodVertices'), HT = cms.InputTag('htPFchs'), HTJets = cms.InputTag('patJetsPFchsPt50Eta25'), MHT = cms.InputTag('mhtPFchs'), MHTJets = cms.InputTag('patJetsPFchsPt30'), VarsDouble = cms.VInputTag(cms.InputTag('WeightProducer:weight')), VarsDoubleNamesInTree = cms.vstring('Weight'), ) #process.dump = cms.EDAnalyzer("EventContentAnalyzer") process.ppfchs = cms.Path( process.cleanpatseq * process.LeptonVeto * process.countJetsPFchsPt50Eta25 * process.postPFchsJetsCounter * process.htPFchsFilter * process.postPFchsHTCounter * process.mhtPFchsFilter * process.postPFchsMHTCounter * process.WeightProducer * process.RA2TreeMaker ) process.schedule = cms.Schedule(process.ppfchs)