import FWCore.ParameterSet.Config as cms process = cms.Process("AnalysisProc") process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr.FwkReport.reportEvery = 10000 import PhysicsTools.PythonAnalysis.LumiList as LumiList LumiList.LumiList().getVLuminosityBlockRange() process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring('')) from RecoJets.JetProducers.PileupJetIDParams_cfi import cutbased as pu_jetid ###### Electron VID from RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Spring15_25ns_V1_cff import * if hasattr(cutBasedElectronID_Spring15_25ns_V1_standalone_loose, 'isPOGApproved'): del cutBasedElectronID_Spring15_25ns_V1_standalone_loose.isPOGApproved if hasattr(cutBasedElectronID_Spring15_25ns_V1_standalone_medium, 'isPOGApproved'): del cutBasedElectronID_Spring15_25ns_V1_standalone_medium.isPOGApproved if hasattr(cutBasedElectronID_Spring15_25ns_V1_standalone_tight, 'isPOGApproved'): del cutBasedElectronID_Spring15_25ns_V1_standalone_tight.isPOGApproved myVidElectronId = cms.PSet( loose=cutBasedElectronID_Spring15_25ns_V1_standalone_loose, medium=cutBasedElectronID_Spring15_25ns_V1_standalone_medium, tight=cutBasedElectronID_Spring15_25ns_V1_standalone_tight) #######
process.source = cms.Source('PoolSource', fileNames = cms.untracked.vstring( # Comma terminated list of input files. Comment out to disable files selectively. 'rfio:/tmp/ikesisog/TestFiles/00000000-0000-0000-0000-000000000000.root', 'rfio:/tmp/ikesisog/TestFiles/00000000-0000-0000-0000-000000000000.root', 'rfio:/tmp/ikesisog/TestFiles/00000000-0000-0000-0000-000000000000.root', ) ) # Load locally provided JSON (if activated) # if useJSON: import PhysicsTools.PythonAnalysis.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes myLumis = LumiList.LumiList(filename = jsonFile).getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.load("Configuration.StandardSequences.Geometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") # Global Tag: # process.GlobalTag.globaltag = cms.string('GR_R_39X_V5::All') process.load("Configuration.StandardSequences.MagneticField_cff")
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) # This might prove useful when running over lots of data import FWCore.Utilities.FileUtils as FileUtils mylist = FileUtils.loadListFromFile('sourceList%INSTANCE%') process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(*mylist) ) import PhysicsTools.PythonAnalysis.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList(filename = '%LUMIFILE%').getVLuminosityBlockRange() process.options = cms.untracked.PSet( ) process.load("FWCore.MessageService.MessageLogger_cfi") #May need this in future processings process.MessageLogger.cerr.FwkReport.reportEvery = 1000 process.TFileService = cms.Service("TFileService", fileName=cms.string('jobOutput%INSTANCE%.root'), ) # Production Info process.configurationMetadata = cms.untracked.PSet(
# ) # # source - Use an input list to bypass the 255 file limit import FWCore.Utilities.FileUtils as FileUtils filelist = FileUtils.loadListFromFile(lstFile) process.source = cms.Source('PoolSource', fileNames=cms.untracked.vstring(*filelist)) # using locally provided JSON import PhysicsTools.PythonAnalysis.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes myLumis = LumiList.LumiList( filename='Cert_136033-149442_7TeV_Nov4ReReco_Collisions10_JSON.json' ).getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked( CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(-1)) ## Load additional processes # process.load("Configuration.StandardSequences.Geometry_cff") process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") ## global tags: #
fileNames=cms.untracked.vstring(ivars.inputFiles)) # DATA EMULATION process.source.inputCommands = cms.untracked.vstring("keep *", "drop *_hiSignal*_*_*", "drop *_*GenJet*_*_*", "drop *_*GenPar*_*_*", "drop *_gen*_*_*") process.source.dropDescendantsOfDroppedBranches = cms.untracked.bool(False) # Number of events we want to process, -1 = all events process.maxEvents = cms.untracked.PSet( input=cms.untracked.int32(ivars.maxEvents)) process.source.lumisToProcess = LumiList.LumiList( filename='./Cert_181530-183126_HI7TeV_PromptReco_Collisions11_JSON.txt' ).getVLuminosityBlockRange() ##################################################################################### # Load some general stuff ##################################################################################### process.load( 'Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.load('Configuration.StandardSequences.Services_cff') process.load('Configuration.StandardSequences.GeometryExtended_cff') process.load('Configuration.StandardSequences.MagneticField_38T_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') process.load('Configuration.StandardSequences.Digi_cff') process.load('Configuration.StandardSequences.SimL1Emulator_cff') process.load('Configuration.StandardSequences.DigiToRaw_cff')
) process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) ) # ********************************************************************** # set the maximum number of events to be processed * # this number (argument of int32) is to be modified by the user * # according to need and wish * # default is preset to 10000 events * # ********************************************************************** process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10000) ) # set the number of events to be skipped (if any) at end of file below # define JSON file goodJSON = '/home/cms-opendata/CMSSW_4_2_8/src/Demo/DemoAnalyzer/datasets/Cert_136033-149442_7TeV_Apr21ReReco_Collisions10_JSON_v2.txt' myLumis = LumiList.LumiList(filename = goodJSON).getCMSSWString().split(',') # **************************************************************************** # define the input data set here by inserting the appropriate .txt file list * # **************************************************************************** import FWCore.Utilities.FileUtils as FileUtils # # **************************************************************** # load the data set * # For MUO-10-004, the default is the Mu data set. * # To run over all data subsets, replace '0000' by '0001' etc. * # consecutively (make sure you save the output before rerunning) * # and add up the histograms using root tools. * # **************************************************************** # # *** Mu data set ***
if options.eventsToProcess: process.source.eventsToProcess = cms.untracked.VEventRange( options.eventsToProcess) print process.source.eventsToProcess #------------------------------------------------------------------------------- # _ ____ ___ _ # | | (_) \/ | | | # | | _ _ _ __ ___ _| . . | __ _ ___| | __ # | | | | | | '_ ` _ \| | |\/| |/ _` / __| |/ / # | |___| |_| | | | | | | | | | | (_| \__ \ < # \_____/\__,_|_| |_| |_|_\_| |_/\__,_|___/_|\_\ # if options.useLumi: lumis = LumiList.LumiList( filename=options.useLumi).getCMSSWString().split(',') # print lumis process.source.lumisToProcess = cms.untracked(cms.VLuminosityBlockRange()) # print process.source.lumisToProcess process.source.lumisToProcess.extend(lumis) print process.source.lumisToProcess #------------------------------------------------------------------------------- process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32( options.maxEvents), ) process.pLep = cms.Path() #-------------------------------------------------------------------- # _ _ _ _ _ # | | | | (_) | | | |
def customise(process): process._Process__name="HLT2" process.TFileService = cms.Service("TFileService", fileName = cms.string("histo_simulation.root") ) # Add the production filter sequence to all paths so that the empty event # filter is actually applied and events with no HepMC product are skipped. # Also add process.pgen for the generation_step which is not inserted by # cmsDriver for some reason. for path in process.paths: if path != 'generation_step': getattr(process,path)._seq = process.ProductionFilterSequence*getattr(process,path)._seq else: getattr(process,path)._seq = getattr(process,path)._seq*cms.Sequence(process.pgen) try: outputModule = process.output except: pass try: outputModule = getattr(process,str(getattr(process,list(process.endpaths)[-1]))) except: pass print "Changing eventcontent to RAW+AODSIM + misc. " outputModule.outputCommands = cms.untracked.vstring("drop *") outputModule.outputCommands.extend(process.RAWEventContent.outputCommands ) outputModule.outputCommands.extend(process.AODSIMEventContent.outputCommands ) keepMC = cms.untracked.vstring("keep *_*_zMusExtracted_*", "keep *_*_zmmCands_*", "keep *_removedInputMuons_*_*", "keep *_generator_*_*", "keep *_PhotonIDProd_*_*", "keep *_photons_*_*", "keep *_photonCore_*_*", "keep *_genParticles_*_*", "keep *_particleFlow_*_*", ) outputModule.outputCommands.extend(keepMC) # getRid of second "drop *" index = 0 for item in outputModule.outputCommands[:]: if item == "drop *" and index != 0: #print index," ",outputModule.outputCommands[index] del outputModule.outputCommands[index] index -= 1 index += 1 hltProcessName = "HLT" #"REDIGI38X" # the following block can be used for more efficient processing by replacing the HLT variable below automatically try: hltProcessName = __HLT__ except: pass try: process.dimuonsHLTFilter.TriggerResultsTag.processName = hltProcessName process.goodZToMuMuAtLeast1HLT.TrigTag.processName = hltProcessName process.goodZToMuMuAtLeast1HLT.triggerEvent.processName = hltProcessName process.hltTrigReport,HLTriggerResults.processName = hltProcessName except: pass process.VtxSmeared = cms.EDProducer("FlatEvtVtxGenerator", MaxZ = cms.double(0.0), MaxX = cms.double(0.0), MaxY = cms.double(0.0), MinX = cms.double(0.0), MinY = cms.double(0.0), MinZ = cms.double(0.0), TimeOffset = cms.double(0.0), src = cms.InputTag("generator","unsmeared") ) import FWCore.ParameterSet.VarParsing as VarParsing options = VarParsing.VarParsing ('analysis') options.register ('mdtau', 0, # default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "mdtau value for tauola") options.register ('useJson', 0, # default value, false VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "should I enable json usage?") options.register ('overrideBeamSpot', 0, # default value, false VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "should I override beamspot in globaltag?") # Set this to REDIGI311X for Spring11 MC: # (not actually used in this step but we define it so that both config files # can be called with the same arguments): options.register ('primaryProcess', 'RECO', # default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "original processName") # Workaround so that edmConfigHash does not fail with this config file. # cf. https://hypernews.cern.ch/HyperNews/CMS/get/crabFeedback/3852/1/1/1/1/1.html import sys if hasattr(sys, "argv") == True: options.parseArguments() print "Setting mdtau to ", options.mdtau process.generator.ZTauTau.TauolaOptions.InputCards.mdtau = options.mdtau process.newSource.ZTauTau.TauolaOptions.InputCards.mdtau = options.mdtau process.generator.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = options.mdtau process.newSource.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = options.mdtau print "options.overrideBeamSpot", options.overrideBeamSpot if options.overrideBeamSpot != 0: bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v18_offline") # 41x data PR gt #bs = cms.string("BeamSpotObjects_2009_LumiBased_v17_offline") # 38x data gt #bs = cms.string("BeamSpotObjects_2009_v14_offline") # 36x data gt # tag = cms.string("Early10TeVCollision_3p8cm_31X_v1_mc_START"), # 35 default # tag = cms.string("Realistic900GeVCollisions_10cm_STARTUP_v1_mc"), # 36 default process.GlobalTag.toGet = cms.VPSet( cms.PSet(record = cms.string("BeamSpotObjectsRcd"), tag = bs, connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_31X_BEAMSPOT") ) ) print "BeamSpot in globaltag set to ", bs else: print "BeamSpot in globaltag not changed" if options.useJson != 0: print "Enabling json usage" import PhysicsTools.PythonAnalysis.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes myLumis = LumiList.LumiList(filename = 'my.json').getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) try: process.newSource.ZTauTau.minVisibleTransverseMomentum = cms.untracked.double(__MINVISPT__) process.generator.ZTauTau.minVisibleTransverseMomentum = cms.untracked.double(__MINVISPT__) except: pass try: process.generator.ZTauTau.TauolaOptions.InputCards.mdtau = __MDTAU__ process.generator.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = __MDTAU__ process.newSource.ZTauTau.TauolaOptions.InputCards.mdtau = __MDTAU__ process.newSource.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = __MDTAU__ except: pass try: process.generator.ZTauTau.transformationMode = cms.untracked.int32(__TRANSFORMATIONMODE__) process.generator.ZTauTau.transformationMode = cms.untracked.int32(__TRANSFORMATIONMODE__) except: pass return(process)
import FWCore.ParameterSet.Config as cms process = cms.Process("AnalysisProc") process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr.FwkReport.reportEvery = 10000 import PhysicsTools.PythonAnalysis.LumiList as LumiList LumiList.LumiList().getVLuminosityBlockRange() process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring('')) runProcess = cms.PSet( input=cms.string( "/eos/cms/store/user/georgia/ZeroBias/crab_ZeroBias_run302472/170926_142640/0000/analyze_tps_11.root" ), outdir=cms.string( "/afs/cern.ch/work/g/georgia/HCALTrigger/CMSSW_9_2_7/src/UserCode/HcalTPAnalyzer/macros/" ), tag=cms.string("ZeroBias"), dirName=cms.string("mainTPAnalyzer/tpdata"), isMC=cms.bool(False), verbose=cms.bool(False), xsec=cms.double(1.0), suffix=cms.string(""), evStart=cms.int32(0), evEnd=cms.int32(-1))
## "hltMu5TkMuJpsiTkMuMassFiltered", ## "hltMu0TkMuJpsiTkMuMassFiltered", ## "hltMu3TkMuJpsiTkMuMassFiltered", ## "hltMu5TkMuJpsiTkMuMassFiltered", ## "hltMu0TkMuJpsiTkMuMassFilteredTight", ## "hltMu3TkMuJpsiTkMuMassFilteredTight", ## "hltMu5TkMuJpsiTkMuMassFilteredTight", ## "hltMu0TkMuJpsiTkMuMassFilteredTight", ## "hltMu3TkMuJpsiTkMuMassFilteredTight", ## "hltMu5TkMuJpsiTkMuMassFilteredTight", ## "hltMu0TkMuJpsiTkMuMassFilteredTight", ## "hltMu3TkMuJpsiTkMuMassFilteredTight", ## "hltMu5TkMuJpsiTkMuMassFilteredTight"), ) ## no filter # process.p = cms.Path(process.demo) ## filter on vertex process.p = cms.Path(process.primaryVertexFilter*process.demo) import PhysicsTools.PythonAnalysis.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes #myLumis = LumiList.LumiList(filename = 'Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_MuonPhys.txt').getCMSSWString().split(',') myLumis = LumiList.LumiList(filename = 'Cert_160404-167913_7TeV_PromptReco_Collisions11_JSON_MuonPhys.txt').getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) ## filter on vertex and HLT # process.p = cms.Path(process.primaryVertexFilter*process.hltMuF*process.demo)
def customise(process): process._Process__name = "EmbeddedRECO" process.TFileService = cms.Service( "TFileService", fileName=cms.string("histo_embedded.root")) try: outputModule = process.output except: pass try: outputModule = getattr( process, str(getattr(process, list(process.endpaths)[-1]))) except: pass print "Changing eventcontent to RAW+AODSIM + misc. " outputModule.outputCommands = cms.untracked.vstring("drop *") outputModule.outputCommands.extend(process.RAWEventContent.outputCommands) outputModule.outputCommands.extend( process.AODSIMEventContent.outputCommands) keepMC = cms.untracked.vstring( "keep *_*_zMusExtracted_*", "keep *_*_zmmCands_*", "keep *_removedInputMuons_*_*", "keep *_generator_*_*", "keep *_PhotonIDProd_*_*", "keep *_photons_*_*", "keep *_photonCore_*_*", "keep *_genParticles_*_*", "keep *_particleFlow_*_*", "keep *_generator_*_*", "keep *_tmfTracks_*_EmbeddedRECO", "keep *_offlinePrimaryVertices_*_EmbeddedRECO", "keep *_offlinePrimaryVerticesWithBS_*_EmbeddedRECO", "keep *_PhotonIDProd_*_*", "keep *_photons_*_*", "keep *_photonCore_*_*", "keep *_genParticles_*_*", "keep *_particleFlow_*_*", ) outputModule.outputCommands.extend(keepMC) # getRid of second "drop *" index = 0 for item in outputModule.outputCommands[:]: if item == "drop *" and index != 0: #print index," ",outputModule.outputCommands[index] del outputModule.outputCommands[index] index -= 1 index += 1 hltProcessName = "HLT" #"REDIGI38X" RECOproc = "RECO" # the following block can be used for more efficient processing by replacing the HLT variable below automatically try: hltProcessName = __HLT__ except: pass try: process.dimuonsHLTFilter.TriggerResultsTag.processName = hltProcessName process.goodZToMuMuAtLeast1HLT.TrigTag.processName = hltProcessName process.goodZToMuMuAtLeast1HLT.triggerEvent.processName = hltProcessName process.hltTrigReport, HLTriggerResults.processName = hltProcessName except: pass process.VtxSmeared = cms.EDProducer("FlatEvtVtxGenerator", MaxZ=cms.double(0.0), MaxX=cms.double(0.0), MaxY=cms.double(0.0), MinX=cms.double(0.0), MinY=cms.double(0.0), MinZ=cms.double(0.0), TimeOffset=cms.double(0.0), src=cms.InputTag( "generator", "unsmeared")) import FWCore.ParameterSet.VarParsing as VarParsing options = VarParsing.VarParsing('analysis') options.register( 'mdtau', 0, # default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "mdtau value for tauola") options.register( 'transformationMode', 1, #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "transformation mode. 0=mumu->mumu, 1=mumu->tautau") options.register( 'minVisibleTransverseMomentum', "", #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "generator level cut on visible transverse momentum (typeN:pT,[...];[...])" ) options.register( 'useJson', 0, # default value, false VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "should I enable json usage?") options.register( 'overrideBeamSpot', 0, # default value, false VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "should I override beamspot in globaltag?") options.register( 'skimEnabled', 0, # default value, true VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "should I apply Zmumu event selection cuts?") # options.register ('primaryProcess', # 'RECO', # default value # VarParsing.VarParsing.multiplicity.singleton, # VarParsing.VarParsing.varType.string, # "original processName") setFromCL = False if not hasattr(process, "doNotParse"): import sys if hasattr(sys, "argv") == True: if not sys.argv[0].endswith('cmsDriver.py'): options.parseArguments() setFromCL = True else: print "CL parsing disabled!" if setFromCL: print "Setting mdtau to ", options.mdtau process.generator.ZTauTau.TauolaOptions.InputCards.mdtau = options.mdtau process.newSource.ZTauTau.TauolaOptions.InputCards.mdtau = options.mdtau process.generator.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = options.mdtau process.newSource.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = options.mdtau print "Setting minVisibleTransverseMomentum to ", options.minVisibleTransverseMomentum process.newSource.ZTauTau.minVisibleTransverseMomentum = cms.untracked.string( options.minVisibleTransverseMomentum) process.generator.ZTauTau.minVisibleTransverseMomentum = cms.untracked.string( options.minVisibleTransverseMomentum) print "Setting transformationMode to ", options.transformationMode process.generator.ZTauTau.transformationMode = cms.untracked.int32( options.transformationMode) process.newSource.ZTauTau.transformationMode = cms.untracked.int32( options.transformationMode) print "options.overrideBeamSpot", options.overrideBeamSpot if options.overrideBeamSpot != 0: bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v26_offline" ) # 52x data PR gt # bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v21_offline") # 42x data PR gt # bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v18_offline") # 41x data PR gt # bs = cms.string("BeamSpotObjects_2009_LumiBased_v17_offline") # 38x data gt #bs = cms.string("BeamSpotObjects_2009_v14_offline") # 36x data gt # tag = cms.string("Early10TeVCollision_3p8cm_31X_v1_mc_START"), # 35 default # tag = cms.string("Realistic900GeVCollisions_10cm_STARTUP_v1_mc"), # 36 default process.GlobalTag.toGet = cms.VPSet( cms.PSet(record=cms.string("BeamSpotObjectsRcd"), tag=bs, connect=cms.untracked.string( "frontier://FrontierProd/CMS_COND_31X_BEAMSPOT"))) print "BeamSpot in globaltag set to ", bs else: print "BeamSpot in globaltag not changed" if options.useJson != 0: print "Enabling json usage" import PhysicsTools.PythonAnalysis.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes myLumis = LumiList.LumiList( filename='my.json').getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked( CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) # -*- coding: utf-8 -*- process.tmfTracks = cms.EDProducer( "RecoTracksMixer", trackCol1=cms.InputTag("removedInputMuons", "tracks"), trackCol2=cms.InputTag("generalTracks", "", "EmbeddedRECO")) process.offlinePrimaryVerticesWithBS.TrackLabel = cms.InputTag("tmfTracks") process.offlinePrimaryVertices.TrackLabel = cms.InputTag("tmfTracks") if hasattr(process.muons, "TrackExtractorPSet"): process.muons.TrackExtractorPSet.inputTrackCollection = cms.InputTag( "tmfTracks") elif hasattr(process, "muons1stStep") and hasattr(process.muons1stStep, "TrackExtractorPSet"): process.muons1stStep.TrackExtractorPSet.inputTrackCollection = cms.InputTag( "tmfTracks") else: raise "Problem with muons" # it should be the best solution to take the original beam spot for the # reconstruction of the new primary vertex # use the one produced earlier, do not produce your own for s in process.sequences: seq = getattr(process, s) seq.remove(process.offlineBeamSpot) try: process.metreco.remove(process.BeamHaloId) except: pass try: outputModule = process.output except: pass try: outputModule = getattr( process, str(getattr(process, list(process.endpaths)[-1]))) except: pass for p in process.paths: pth = getattr(process, p) if "generalTracks" in pth.moduleNames(): pth.replace(process.generalTracks, process.generalTracks * process.tmfTracks) #''' process.gsfElectronsORG = process.gsfElectrons.clone() #print dir(process) #for p in dir(process): for p in process.paths: pth = getattr(process, p) #if hasattr(pth,"gsfElectrons"): if "gsfElectrons" in pth.moduleNames(): pth.replace(process.gsfElectrons, process.gsfElectronsORG * process.gsfElectrons) #print p, dir(pth.moduleNames()) # xxx process.gsfElectrons = cms.EDProducer("GSFElectronsMixer", col1=cms.InputTag("gsfElectronsORG"), col2=cms.InputTag( "gsfElectrons", "", RECOproc)) #''' process.particleFlowORG = process.particleFlow.clone() # Since CMSSW 4_4 the particleFlow reco works a bit differently. The step is # twofold, first particleFlowTmp is created and then the final particleFlow # collection. What we do in this case is that we merge the final ParticleFlow # collection. For the muon reconstruction, we also merge particleFlowTmp in # order to get PF-based isolation right. if hasattr(process, 'particleFlowTmp'): process.particleFlowTmpMixed = cms.EDProducer( 'PFCandidateMixer', col1=cms.untracked.InputTag("removedInputMuons", "pfCands"), col2=cms.untracked.InputTag("particleFlowTmp", ""), trackCol=cms.untracked.InputTag("tmfTracks"), # Don't produce value maps: muons=cms.untracked.InputTag(""), gsfElectrons=cms.untracked.InputTag("")) process.muons.PFCandidates = cms.InputTag("particleFlowTmpMixed") for p in process.paths: if "particleFlow" in pth.moduleNames(): pth.replace(process.particleFlow, process.particleFlowORG * process.particleFlow) if "muons" in pth.moduleNames(): pth.replace(process.muons, process.particleFlowTmpMixed * process.muons) else: # CMSSW_4_2 if hasattr(process, "famosParticleFlowSequence"): process.famosParticleFlowSequence.remove( process.pfPhotonTranslatorSequence) process.famosParticleFlowSequence.remove( process.pfElectronTranslatorSequence) process.famosParticleFlowSequence.remove(process.particleFlow) process.famosParticleFlowSequence.__iadd__(process.particleFlowORG) process.famosParticleFlowSequence.__iadd__(process.particleFlow) process.famosParticleFlowSequence.__iadd__( process.pfElectronTranslatorSequence) process.famosParticleFlowSequence.__iadd__( process.pfPhotonTranslatorSequence) elif hasattr(process, "particleFlowReco"): process.particleFlowReco.remove(process.pfPhotonTranslatorSequence) process.particleFlowReco.remove( process.pfElectronTranslatorSequence) process.particleFlowReco.remove(process.particleFlow) process.particleFlowReco.__iadd__(process.particleFlowORG) process.particleFlowReco.__iadd__(process.particleFlow) process.particleFlowReco.__iadd__( process.pfElectronTranslatorSequence) process.particleFlowReco.__iadd__( process.pfPhotonTranslatorSequence) else: raise "Cannot find particleFlow sequence" process.pfSelectedElectrons.src = cms.InputTag("particleFlowORG") process.pfSelectedPhotons.src = cms.InputTag("particleFlowORG") process.particleFlow = cms.EDProducer( 'PFCandidateMixer', col1=cms.untracked.InputTag("removedInputMuons", "pfCands"), col2=cms.untracked.InputTag("particleFlowORG", ""), trackCol=cms.untracked.InputTag("tmfTracks"), muons=cms.untracked.InputTag("muons"), gsfElectrons=cms.untracked.InputTag("gsfElectrons") # TODO: photons??? ) process.filterEmptyEv.src = cms.untracked.InputTag("generatorSmeared", "", "EmbeddedRECO") from FWCore.ParameterSet.Types import InputTag for p in process.paths: i = getattr(process, p) target = process.particleFlow seqVis = SeqVisitor(target) seqVis.prepareSearch() seqVis.setLookFor(target) i.visit(seqVis) while (seqVis.catch != 1 and seqVis.found == 1): target = seqVis.giveNext() targetAttributes = dir(target) for targetAttribute in targetAttributes: attr = getattr(target, targetAttribute ) # get actual attribute, not just the name if isinstance( attr, InputTag) and attr.getModuleLabel() == "particleFlow": if (attr.getProductInstanceLabel() != ""): print "Changing: ", target, " ", targetAttribute, " ", attr, " to particleFlowORG" attr.setModuleLabel("particleFlowORG") #i.replace(target, source) seqVis.prepareSearch() seqVis.setLookFor(target) i.visit(seqVis) #if (seqVis.catch==1): #seqVis.catch=0 #i.__iadd__(source) # CV: mix L1Extra collections l1ExtraCollections = [["L1EmParticle", "Isolated"], ["L1EmParticle", "NonIsolated"], ["L1EtMissParticle", "MET"], ["L1EtMissParticle", "MHT"], ["L1JetParticle", "Central"], ["L1JetParticle", "Forward"], ["L1JetParticle", "Tau"], ["L1MuonParticle", ""]] l1extraParticleCollections = [] for l1ExtraCollection in l1ExtraCollections: inputType = l1ExtraCollection[0] pluginType = None if inputType == "L1EmParticle": pluginType = "L1ExtraEmParticleMixerPlugin" elif inputType == "L1EtMissParticle": pluginType = "L1ExtraMEtMixerPlugin" elif inputType == "L1JetParticle": pluginType = "L1ExtraJetParticleMixerPlugin" elif inputType == "L1MuonParticle": pluginType = "L1ExtraMuonParticleMixerPlugin" else: raise ValueError("Invalid L1Extra type = %s !!" % inputType) instanceLabel = l1ExtraCollection[1] l1extraParticleCollections.append( cms.PSet(pluginType=cms.string(pluginType), instanceLabel=cms.string(instanceLabel))) process.l1extraParticlesORG = process.l1extraParticles.clone() process.l1extraParticles = cms.EDProducer( 'L1ExtraMixer', src1=cms.InputTag('l1extraParticles::HLT'), src2=cms.InputTag('l1extraParticlesORG'), collections=cms.VPSet(l1extraParticleCollections)) for p in process.paths: pth = getattr(process, p) if "l1extraParticles" in pth.moduleNames(): pth.replace(process.l1extraParticles, process.l1extraParticlesORG * process.l1extraParticles) #if hasattr(process, "DQM_FEDIntegrity_v3"): # process.schedule.remove(process.DQM_FEDIntegrity_v3) fedIntRemoved = False for i in range(1, 30): attrName = "DQM_FEDIntegrity_v" + str(i) if hasattr(process, attrName): process.schedule.remove(process.DQM_FEDIntegrity_v11) del process.DTDataIntegrityTask fedIntRemoved = True break if fedIntRemoved: print "Removed", attrName else: print "DQM_FEDIntegrity_vXX not found, expect problems" skimEnabled = False if setFromCL: if options.skimEnabled != 0: skimEnabled = True else: if hasattr(process, "doZmumuSkim"): skimEnabled = True if skimEnabled: print "Enabling Zmumu skim" skimEnabled = True cmssw_ver = os.environ["CMSSW_VERSION"] if cmssw_ver.find("CMSSW_4_2") != -1: print print "Using legacy version of Zmumu skim. Note, that muon isolation is disabled" print process.load( "TauAnalysis/MCEmbeddingTools/ZmumuStandalonSelectionLegacy_cff" ) process.RandomNumberGeneratorService.dummy = cms.PSet( initialSeed=cms.untracked.uint32(123456789), engineName=cms.untracked.string('HepJamesRandom')) else: process.load( "TauAnalysis/MCEmbeddingTools/ZmumuStandalonSelection_cff") #process.load("TauAnalysis/Skimming/goldenZmmSelectionVBTFrelPFIsolation_cfi") process.load("TrackingTools/TransientTrack/TransientTrackBuilder_cfi") # we are allready selecting events from generation step, so following way is ok for path in process.paths: getattr( process, path)._seq = process.goldenZmumuSelectionSequence * getattr( process, path)._seq #process.options = cms.untracked.PSet( # wantSummary = cms.untracked.bool(True) #) else: print "Zmumu skim not enabled" # CV: add path for keeping track of skimming efficiency process.load( "TauAnalysis/MCEmbeddingTools/ZmumuStandalonSelection_cff") process.skimEffFlag = cms.EDProducer("DummyBoolEventSelFlagProducer") process.skimEffPath = cms.Path(process.goldenZmumuSelectionSequence * process.skimEffFlag) process.load("TrackingTools/TransientTrack/TransientTrackBuilder_cfi") print "# ######################################################################################" print " Following parameters can be added before customize function " print " call in order to controll process customization: " print " process.doNotParse = cms.PSet() # disables CL parsing for crab compat" print " process.doZmumuSkim = cms.PSet() # adds Zmumu skimming before embedding is run" print "# ######################################################################################" return (process)
) process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(-1)) # This might prove useful when running over lots of data import FWCore.Utilities.FileUtils as FileUtils mylist = FileUtils.loadListFromFile( 'files_SingleMuon_Run2015C-PromptReco-v1_RECO') process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(*mylist)) import PhysicsTools.PythonAnalysis.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList( filename='Cert_246908-260627_13TeV_PromptReco_Collisions15_25ns_JSON.txt' ).getVLuminosityBlockRange() process.options = cms.untracked.PSet() process.load("FWCore.MessageService.MessageLogger_cfi") #May need this in future processings process.MessageLogger.cerr.FwkReport.reportEvery = 1000 process.TFileService = cms.Service( "TFileService", fileName=cms.string('collisionDataRun2015CSingleMu.root'), ) # Production Info process.configurationMetadata = cms.untracked.PSet(
# ---------------------------------------------------------------------- # -- Input files process.source = cms.Source("PoolSource", skipEvents = cms.untracked.uint32(0), fileNames = cms.untracked.vstring( 'file:~jiansun/nobackup/2011reco_highpt.root' # 'file:/afs/cern.ch/work/j/jisun/public/2011recoHIminbias.root' ) ) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.source.lumisToProcess = LumiList.LumiList(filename = '/afs/cern.ch/work/j/jisun/public/Cert_181530-183126_HI7TeV_PromptReco_Collisions11_JSON.txt').getVLuminosityBlockRange() process.tree = cms.EDAnalyzer( "HFTree", verbose = cms.untracked.int32(1), printFrequency = cms.untracked.int32(10), requireCand = cms.untracked.bool(True) ) # ---------------------------------------------------------------------- process.load("Configuration.StandardSequences.Reconstruction_cff") process.load("UserCode.OpenHF.HFRecoStuff_cff") process.load("UserCode.OpenHF.HFCharm_cff") # ----------------------------------------------------------------------
def customise(process): # Define configuration parameter default values from TauAnalysis.MCEmbeddingTools.setDefaults import setDefaults setDefaults(process) inputProcess = process.customization_options.inputProcessRECO.value() print "Input process set to '%s'" % inputProcess process._Process__name = "EmbeddedRECO" # DQM store output for muon acceptance histograms process.DQMStore = cms.Service("DQMStore") if process.customization_options.isMC.value(): print "Input is MC" # select generator level muons process.genMuonsFromZs = cms.EDProducer( "GenParticlesFromZsSelectorForMCEmbedding", src=cms.InputTag( "genParticles", "", process.customization_options.inputProcessSIM.value()), pdgIdsMothers=cms.vint32(23, 22), pdgIdsDaughters=cms.vint32(13), maxDaughters=cms.int32(2), minDaughters=cms.int32(2), before_or_afterFSR=cms.string("afterFSR"), verbosity=cms.int32(0)) process.ProductionFilterSequence.replace( process.cleanedGeneralTracks, process.genMuonsFromZs * process.cleanedGeneralTracks) process.ProductionFilterSequence.replace( process.cleanedParticleFlow, process.genMuonsFromZs * process.cleanedParticleFlow) # produce generator level MET (= sum of neutrino momenta) # in case Embedding is run on Monte Carlo input process.genMetCalo = cms.EDProducer( "MixedGenMEtProducer", srcGenParticles1=cms.InputTag( "genParticles", "", process.customization_options.inputProcessSIM.value()), srcGenParticles2=cms.InputTag("genParticles"), srcRemovedMuons=cms.InputTag(process.customization_options. ZmumuCollection.getModuleLabel()), type=cms.string("calo"), isMC=cms.bool(True)) process.genMetTrue = process.genMetCalo.clone(type=cms.string("pf")) else: print "Input is Data" # produce generator level MET (= sum of neutrino momenta) # in case Embedding is run on real Data process.genMetCalo = cms.EDProducer( "MixedGenMEtProducer", srcGenParticles1=cms.InputTag(""), srcGenParticles2=cms.InputTag("genParticles"), srcRemovedMuons=cms.InputTag(process.customization_options. ZmumuCollection.getModuleLabel()), type=cms.string("calo"), isMC=cms.bool(False)) process.genMetTrue = process.genMetCalo.clone(type=cms.string("pf")) for p in process.paths: pth = getattr(process, p) if "genParticles" in pth.moduleNames(): pth.replace( process.genParticles, process.genParticles * process.genMetCalo * process.genMetTrue) # update InputTags defined in PFEmbeddingSource_cff.py print "Setting collection of Z->mumu candidates to '%s'" % process.customization_options.ZmumuCollection.getModuleLabel( ) if not (hasattr(process, "cleanedGeneralTracks") and hasattr(process, "cleanedParticleFlow")): process.load("TauAnalysis.MCEmbeddingTools.PFEmbeddingSource_cff") if process.customization_options.replaceGenOrRecMuonMomenta.value( ) == 'gen': print "Taking momenta of generated tau leptons from generator level muons" process.generator.src = cms.InputTag('genMuonsFromZs') elif process.customization_options.replaceGenOrRecMuonMomenta.value( ) == 'rec': print "Taking momenta of generated tau leptons from reconstructed muons" process.generator.src = process.customization_options.ZmumuCollection else: raise ValueError( "Invalid Configuration parameter 'replaceGenOrRecMuonMomenta' = %s !!" % process.customization_options.replaceGenOrRecMuonMomenta.value()) # update option for removing tracks/charged PFCandidates matched to reconstructed muon process.cleanedGeneralTracks.selectedMuons = process.customization_options.ZmumuCollection process.cleanedParticleFlow.selectedMuons = process.customization_options.ZmumuCollection if process.customization_options.muonTrackCleaningMode.value() == 1: process.cleanedGeneralTracks.removeDuplicates = cms.bool(False) process.cleanedParticleFlow.removeDuplicates = cms.bool(False) elif process.customization_options.muonTrackCleaningMode.value() == 2: process.cleanedGeneralTracks.removeDuplicates = cms.bool(True) process.cleanedParticleFlow.removeDuplicates = cms.bool(True) else: raise ValueError( "Invalid Configuration parameter 'muonTrackCleaningMode' = %i !!" % process.customization_options.muonTrackCleaningMode.value()) try: outputModule = process.output except: pass try: outputModule = getattr( process, str(getattr(process, list(process.endpaths)[-1]))) except: pass print "Changing event-content to AODSIM + Z->mumu candidates" outputModule.outputCommands = cms.untracked.vstring("drop *") outputModule.outputCommands.extend( process.AODSIMEventContent.outputCommands) # get rid of second "drop *" index = 0 for item in outputModule.outputCommands[:]: if item == "drop *" and index != 0: del outputModule.outputCommands[index] index -= 1 index += 1 # keep collections of generator level muons outputModule.outputCommands.extend(['keep *_genMuonsFromZs_*_*']) # keep collections of reconstructed muons outputModule.outputCommands.extend([ 'keep *_goodMuons_*_*', 'keep *_goodMuonsPFIso_*_*', 'keep *_highestPtMuPlus_*_*', 'keep *_highestPtMuMinus_*_*', 'keep *_highestPtMuPlusPFIso_*_*', 'keep *_highestPtMuMinusPFIso_*_*' ]) # keep collections of reconstructed Z -> mumu candidates # (with different muon isolation criteria applied) outputModule.outputCommands.extend([ 'keep *_goldenZmumuCandidatesGe0IsoMuons_*_*', 'keep *_goldenZmumuCandidatesGe1IsoMuons_*_*', 'keep *_goldenZmumuCandidatesGe2IsoMuons_*_*', 'keep TH2DMEtoEDM_MEtoEDMConverter_*_*' ]) # keep flag indicating whether event passes or fails # o Z -> mumu event selection # o muon -> muon + photon radiation filter outputModule.outputCommands.extend([ 'keep *_goldenZmumuFilterResult_*_*', 'keep *_muonRadiationFilterResult_*_*' ]) # CV: keep HepMCProduct for embedded event, # in order to run Validation/EventGenerator/python/TauValidation_cfi.py # for control plots of tau polarization and decay mode information outputModule.outputCommands.extend(['keep *HepMCProduct_generator_*_*']) # keep distance of muons traversed in ECAL and HCAL, # expected and removed muon energy deposits outputModule.outputCommands.extend([ 'keep *_muonCaloEnergyDepositsByDistance_totalDistanceMuPlus_*', 'keep *_muonCaloEnergyDepositsByDistance_totalEnergyDepositMuPlus_*', 'keep *_muonCaloEnergyDepositsByDistance_totalDistanceMuMinus_*', 'keep *_muonCaloEnergyDepositsByDistance_totalEnergyDepositMuMinus_*', 'keep *_castorreco_removedEnergyMuMinus*_*', 'keep *_castorreco_removedEnergyMuPlus*_*', 'keep *_hfreco_removedEnergyMuMinus*_*', 'keep *_hfreco_removedEnergyMuPlus*_*', 'keep *_ecalPreshowerRecHit_removedEnergyMuMinus*_*', 'keep *_ecalPreshowerRecHit_removedEnergyMuPlus*_*', 'keep *_ecalRecHit_removedEnergyMuMinus*_*', 'keep *_ecalRecHit_removedEnergyMuPlus*_*', 'keep *_hbhereco_removedEnergyMuMinus*_*', 'keep *_hbhereco_removedEnergyMuPlus*_*', 'keep *_horeco_removedEnergyMuMinus*_*', 'keep *_horeco_removedEnergyMuPlus*_*', ]) # replace HLT process name # (needed for certain reprocessed Monte Carlo samples) hltProcessName = "HLT" try: hltProcessName = __HLT__ except: pass try: process.dimuonsHLTFilter.TriggerResultsTag.processName = hltProcessName process.goodZToMuMuAtLeast1HLT.TrigTag.processName = hltProcessName process.goodZToMuMuAtLeast1HLT.triggerEvent.processName = hltProcessName process.hltTrigReport, HLTriggerResults.processName = hltProcessName except: pass # disable L1GtTrigReport module # (not used for anything yet, just prints error for every single event) if hasattr(process, 'HLTAnalyzerEndpath'): process.HLTAnalyzerEndpath.remove(process.hltL1GtTrigReport) # apply configuration parameters print "Setting mdtau to %i" % process.customization_options.mdtau.value() process.generator.Ztautau.TauolaOptions.InputCards.mdtau = process.customization_options.mdtau if hasattr(process.generator, "ParticleGun"): process.generator.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = process.customization_options.mdtau if process.customization_options.useTauolaPolarization.value(): print "Enabling tau polarization effects in TAUOLA" # NOTE: polarization effects are only approximate, # because Embedded events do not have proper parton history in HepMC::GenEvent # (cf. arXiv:hep-ph/0101311 and arXiv:1201.0117) process.generator.Ztautau.TauolaOptions.UseTauolaPolarization = cms.bool( True) else: print "Disabling tau polarization effects in TAUOLA" # NOTE: tau polarization effects need to be added by reweighting Embedded events # using weights computed by TauSpinner package process.generator.Ztautau.TauolaOptions.UseTauolaPolarization = cms.bool( False) print "Setting minVisibleTransverseMomentum to '%s'" % process.customization_options.minVisibleTransverseMomentum.value( ) process.generator.Ztautau.minVisibleTransverseMomentum = process.customization_options.minVisibleTransverseMomentum print "Setting transformationMode to %i" % process.customization_options.transformationMode.value( ) process.generator.Ztautau.transformationMode = process.customization_options.transformationMode print "Setting rfRotationAngle to %1.0f" % process.customization_options.rfRotationAngle.value( ) process.generator.Ztautau.rfRotationAngle = process.customization_options.rfRotationAngle if process.customization_options.overrideBeamSpot.value(): bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v28_offline") process.GlobalTag.toGet = cms.VPSet( cms.PSet(record=cms.string("BeamSpotObjectsRcd"), tag=bs, connect=cms.untracked.string( "frontier://FrontierProd/CMS_COND_31X_BEAMSPOT"))) print "BeamSpot in globaltag set to '%s'" % bs else: print "BeamSpot in globaltag not changed" # CV: disable gen. vertex smearing # (embed tau leptons exactly at Z->mumu event vertex) print "Disabling gen. vertex smearing" process.VtxSmeared = cms.EDProducer("FlatEvtVtxGenerator", MaxZ=cms.double(0.0), MaxX=cms.double(0.0), MaxY=cms.double(0.0), MinX=cms.double(0.0), MinY=cms.double(0.0), MinZ=cms.double(0.0), TimeOffset=cms.double(0.0), src=cms.InputTag( "generator", "unsmeared")) if process.customization_options.useJson.value(): print "Enabling event selection by JSON file" import PhysicsTools.PythonAnalysis.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes myLumis = LumiList.LumiList( filename='my.json').getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked( CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) #---------------------------------------------------------------------------------------------------------------------- # CV: need to rerun particle-flow algorithm in order to create links between PFMuon -> PFBlocks -> PFClusters -> PFRecHits # (configure particle-flow sequence before overwriting modules in order to mix collections # of objects reconstructed and Z -> mu+ mu- event with simulated tau decay products) if process.customization_options.embeddingMode.value( ) == "RH" and process.customization_options.cleaningMode == 'PF': rerunParticleFlow(process, inputProcess) process.ProductionFilterSequence += process.rerunParticleFlowSequenceForPFMuonCleaning #---------------------------------------------------------------------------------------------------------------------- # mix "general" Track collection process.generalTracksORG = process.generalTracks.clone() process.generalTracks = cms.EDProducer( "TrackMixer", todo=cms.VPSet( cms.PSet(collection1=cms.InputTag("generalTracksORG", "", "EmbeddedRECO"), collection2=cms.InputTag("cleanedGeneralTracks"))), verbosity=cms.int32(0)) for p in process.paths: pth = getattr(process, p) if "generalTracks" in pth.moduleNames(): pth.replace(process.generalTracks, process.generalTracksORG * process.generalTracks) #---------------------------------------------------------------------------------------------------------------------- # CV/TF: mixing of std::vector<Trajectory> from Zmumu event and embedded tau decay products does not work yet. # For the time-being, we need to use the Trajectory objects from the embedded event process.trackerDrivenElectronSeedsORG = process.trackerDrivenElectronSeeds.clone( ) process.trackerDrivenElectronSeedsORG.TkColList = cms.VInputTag( cms.InputTag("generalTracksORG")) process.trackerDrivenElectronSeeds = cms.EDProducer( "ElectronSeedTrackRefUpdater", PreIdLabel=process.trackerDrivenElectronSeedsORG.PreIdLabel, PreGsfLabel=process.trackerDrivenElectronSeedsORG.PreGsfLabel, targetTracks=cms.InputTag("generalTracks"), inSeeds=cms.InputTag( "trackerDrivenElectronSeedsORG", process.trackerDrivenElectronSeedsORG.PreGsfLabel.value()), inPreId=cms.InputTag( "trackerDrivenElectronSeedsORG", process.trackerDrivenElectronSeedsORG.PreIdLabel.value()), ) for p in process.paths: pth = getattr(process, p) if "trackerDrivenElectronSeeds" in pth.moduleNames(): pth.replace( process.trackerDrivenElectronSeeds, process.trackerDrivenElectronSeedsORG * process.trackerDrivenElectronSeeds) # CV: need to keep 'generalTracksORG' collection in event-content, # as (at least electron based) PFCandidates will refer to it, # causing exception in 'pfNoPileUp' module otherwise outputModule.outputCommands.extend( ['keep recoTracks_generalTracksORG_*_*']) #---------------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------------- # mix collections of GSF electron tracks process.electronGsfTracksORG = process.electronGsfTracks.clone() process.electronGsfTracks = cms.EDProducer( "GsfTrackMixer", collection1=cms.InputTag("electronGsfTracksORG", "", "EmbeddedRECO"), collection2=cms.InputTag("electronGsfTracks", "", inputProcess)) process.gsfConversionTrackProducer.TrackProducer = cms.string( 'electronGsfTracksORG') for p in process.paths: pth = getattr(process, p) if "electronGsfTracks" in pth.moduleNames(): pth.replace( process.electronGsfTracks, process.electronGsfTracksORG * process.electronGsfTracks) process.generalConversionTrackProducer.TrackProducer = cms.string( 'generalTracksORG') process.uncleanedOnlyGeneralConversionTrackProducer.TrackProducer = cms.string( 'generalTracksORG') process.gsfElectronsORG = process.gsfElectrons.clone() process.gsfElectrons = cms.EDProducer("GSFElectronsMixer", col1=cms.InputTag("gsfElectronsORG"), col2=cms.InputTag( "gsfElectrons", "", inputProcess)) for p in process.paths: pth = getattr(process, p) if "gsfElectrons" in pth.moduleNames(): pth.replace(process.gsfElectrons, process.gsfElectronsORG * process.gsfElectrons) #---------------------------------------------------------------------------------------------------------------------- # dE/dx information for mixed track collections not yet implemented in 'TracksMixer' module, # disable usage of dE/dx information in all event reconstruction modules for now for p in process.paths: pth = getattr(process, p) for mod in pth.moduleNames(): if mod.find("dedx") != -1 and mod.find("Zmumu") == -1: if mod.find("ForPFMuonCleaning") == -1: print "Removing %s" % mod module = getattr(process, mod) pth.remove(module) # CV: Compute expected energy deposits of muon in EB/EE, HB/HE and HO: # (1) compute distance traversed by muons produced in Z -> mu+ mu- decay # through individual calorimeter cells # (2) scale distances by expected energy loss dE/dx of muon from TrackingTools.TrackAssociator.default_cfi import TrackAssociatorParameterBlock process.muonCaloDistances = cms.EDProducer( 'MuonCaloDistanceProducer', trackAssociator=TrackAssociatorParameterBlock. TrackAssociatorParameters, selectedMuons=process.customization_options.ZmumuCollection) process.ProductionFilterSequence += process.muonCaloDistances # mix collections of L1Extra objects l1ExtraCollections = [["L1EmParticle", "Isolated"], ["L1EmParticle", "NonIsolated"], ["L1EtMissParticle", "MET"], ["L1EtMissParticle", "MHT"], ["L1JetParticle", "Central"], ["L1JetParticle", "Forward"], ["L1JetParticle", "Tau"], ["L1MuonParticle", ""]] l1extraParticleCollections = [] for l1ExtraCollection in l1ExtraCollections: inputType = l1ExtraCollection[0] pluginType = None srcVeto = cms.InputTag('') dRveto = 0. if inputType == "L1EmParticle": pluginType = "L1ExtraEmParticleMixerPlugin" srcSelectedMuons = process.customization_options.ZmumuCollection dRveto = 0.3 elif inputType == "L1EtMissParticle": pluginType = "L1ExtraMEtMixerPlugin" elif inputType == "L1JetParticle": pluginType = "L1ExtraJetParticleMixerPlugin" srcSelectedMuons = process.customization_options.ZmumuCollection dRveto = 0.3 elif inputType == "L1MuonParticle": pluginType = "L1ExtraMuonParticleMixerPlugin" srcSelectedMuons = process.customization_options.ZmumuCollection dRveto = 0.8 else: raise ValueError("Invalid L1Extra type = %s !!" % inputType) instanceLabel = l1ExtraCollection[1] l1extraParticleCollections.append( cms.PSet(pluginType=cms.string(pluginType), instanceLabel=cms.string(instanceLabel), srcSelectedMuons2=srcSelectedMuons, dRveto2=cms.double(dRveto))) if inputType == 'L1EtMissParticle': l1extraParticleCollections[-1].srcMuons = cms.InputTag( "muonCaloDistances", "muons") l1extraParticleCollections[-1].distanceMapMuPlus = cms.InputTag( "muonCaloDistances", "distancesMuPlus") l1extraParticleCollections[-1].distanceMapMuMinus = cms.InputTag( "muonCaloDistances", "distancesMuPlus") l1extraParticleCollections[-1].H_Calo_AbsEtaLt12 = cms.double( process.customization_options.muonCaloCleaningSF.value() * 0.75) l1extraParticleCollections[-1].H_Calo_AbsEta12to17 = cms.double( process.customization_options.muonCaloCleaningSF.value() * 0.6) l1extraParticleCollections[-1].H_Calo_AbsEtaGt17 = cms.double( process.customization_options.muonCaloCleaningSF.value() * 0.3) process.l1extraParticlesORG = process.l1extraParticles.clone() process.l1extraParticles = cms.EDProducer( 'L1ExtraMixer', src1=cms.InputTag("l1extraParticlesORG"), src2=cms.InputTag("l1extraParticles", "", inputProcess), collections=cms.VPSet(l1extraParticleCollections)) for p in process.paths: pth = getattr(process, p) if "l1extraParticles" in pth.moduleNames(): pth.replace(process.l1extraParticles, process.l1extraParticlesORG * process.l1extraParticles) if process.customization_options.embeddingMode.value() == "PF": print "Using PF-embedding" from TauAnalysis.MCEmbeddingTools.embeddingCustomizePF import customise as customisePF customisePF(process) elif process.customization_options.embeddingMode.value() == "RH": print "Using RH-embedding" from TauAnalysis.MCEmbeddingTools.embeddingCustomizeRH import customise as customiseRH customiseRH(process, inputProcess) else: raise ValueError( "Invalid Configuration parameter 'embeddingMode' = %s !!" % process.customization_options.embeddingMode.value()) # it should be the best solution to take the original beam spot for the # reconstruction of the new primary vertex # use the one produced earlier, do not produce your own for s in process.sequences: seq = getattr(process, s) seq.remove(process.offlineBeamSpot) try: process.metreco.remove(process.BeamHaloId) except: pass try: outputModule = process.output except: pass try: outputModule = getattr( process, str(getattr(process, list(process.endpaths)[-1]))) except: pass process.filterEmptyEv.src = cms.untracked.InputTag("generatorSmeared", "", "EmbeddedRECO") try: process.schedule.remove(process.DQM_FEDIntegrity_v3) except: pass process.load("TauAnalysis/MCEmbeddingTools/ZmumuStandaloneSelection_cff") process.goldenZmumuFilter.src = process.customization_options.ZmumuCollection if process.customization_options.applyZmumuSkim.value(): print "Enabling Zmumu skim" process.load("TrackingTools/TransientTrack/TransientTrackBuilder_cfi") for path in process.paths: if process.customization_options.isMC.value(): getattr( process, path)._seq = process.goldenZmumuFilterSequence * getattr( process, path)._seq else: getattr( process, path )._seq = process.goldenZmumuFilterSequenceData * getattr( process, path)._seq process.options = cms.untracked.PSet( wantSummary=cms.untracked.bool(True)) # CV: keep track of Z->mumu selection efficiency process.goldenZmumuFilterResult = cms.EDProducer( "CandViewCountEventSelFlagProducer", src=process.customization_options.ZmumuCollection, minNumber=cms.uint32(1)) process.goldenZmumuFilterEfficiencyPath = cms.Path( process.goldenZmumuSelectionSequence + process.goldenZmumuFilterResult + process.MEtoEDMConverter) process.schedule.append(process.goldenZmumuFilterEfficiencyPath) else: print "Zmumu skim disabled" process.load("TauAnalysis/MCEmbeddingTools/muonRadiationFilter_cfi") process.muonRadiationFilter.srcSelectedMuons = process.customization_options.ZmumuCollection if process.customization_options.applyMuonRadiationFilter.value(): print "Muon -> muon + photon radiation filter enabled" # CV: add filter at the end of reconstruction path # (filter needs mixed 'pfPileUp' and 'pfNoPileUp' collections) process.reconstruction_step += process.muonRadiationFilterSequence process.options = cms.untracked.PSet( wantSummary=cms.untracked.bool(True)) # CV: keep track of which events pass/fail muon -> muon + photon radiation filter process.muonRadiationFilterResult = cms.EDProducer( "DummyBoolEventSelFlagProducer") process.muonRadiationFilterEfficiencyPath = cms.Path( process.goldenZmumuSelectionSequence + process.muonRadiationFilterSequence + process.muonRadiationFilterResult) process.schedule.append(process.muonRadiationFilterEfficiencyPath) else: print "Muon -> muon + photon radiation filter disabled" # CV: disable ECAL/HCAL noise simulation if process.customization_options.disableCaloNoise.value(): print "Disabling ECAL/HCAL noise simulation" process.simEcalUnsuppressedDigis.doNoise = cms.bool(False) process.simEcalUnsuppressedDigis.doESNoise = cms.bool(False) process.simHcalUnsuppressedDigis.doNoise = cms.bool(False) process.simHcalUnsuppressedDigis.doThermalNoise = cms.bool(False) else: print "Keeping ECAL/HCAL noise simulation enabled" # CV: apply/do not apply muon momentum corrections determined by Rochester group if process.customization_options.replaceGenOrRecMuonMomenta.value( ) == "rec" and hasattr(process, "goldenZmumuSelectionSequence"): if process.customization_options.applyRochesterMuonCorr.value(): print "Enabling Rochester muon momentum corrections" process.patMuonsForZmumuSelectionRochesterMomentumCorr = cms.EDProducer( "RochesterCorrPATMuonProducer", src=cms.InputTag('patMuonsForZmumuSelection'), isMC=cms.bool(process.customization_options.isMC.value())) process.goldenZmumuSelectionSequence.replace( process.patMuonsForZmumuSelection, process.patMuonsForZmumuSelection * process.patMuonsForZmumuSelectionRochesterMomentumCorr) process.goodMuons.src = cms.InputTag( 'patMuonsForZmumuSelectionRochesterMomentumCorr') else: print "Rochester muon momentum corrections disabled" if process.customization_options.applyMuonRadiationCorrection.value( ) != "": print "Muon -> muon + photon radiation correction enabled" process.load( "TauAnalysis/MCEmbeddingTools/muonRadiationCorrWeightProducer_cfi") if process.customization_options.applyMuonRadiationCorrection.value( ) == "photos": process.muonRadiationCorrWeightProducer.lutDirectoryRef = cms.string( 'genMuonRadCorrAnalyzerPHOTOS') process.muonRadiationCorrWeightProducer.lutDirectoryOthers = cms.PSet( Summer12mcMadgraph=cms.string('genMuonRadCorrAnalyzer')) elif process.customization_options.applyMuonRadiationCorrection.value( ) == "pythia": process.muonRadiationCorrWeightProducer.lutDirectoryRef = cms.string( 'genMuonRadCorrAnalyzerPYTHIA') process.muonRadiationCorrWeightProducer.lutDirectoryOthers = cms.PSet( Summer12mcMadgraph=cms.string('genMuonRadCorrAnalyzer')) else: raise ValueError( "Invalid Configuration parameter 'applyMuonRadiationCorrection' = %s !!" % process.customization_options.applyMuonRadiationCorrection. value()) process.reconstruction_step += process.muonRadiationCorrWeightProducer outputModule.outputCommands.extend([ 'keep *_muonRadiationCorrWeightProducer_*_*', 'keep *_generator_muonsBeforeRad_*', 'keep *_generator_muonsAfterRad_*' ]) else: print "Muon -> muon + photon radiation correction disabled" # CV: compute reweighting factors to compensate for smearing of di-muon Pt and mass distributions caused by: # o (mis)reconstruction of muon momenta # o muon -> muon + photon radiation corrections process.load("TauAnalysis/MCEmbeddingTools/embeddingKineReweight_cff") if process.customization_options.applyMuonRadiationCorrection.value( ) != "": if process.customization_options.mdtau.value() == 116: process.embeddingKineReweightGENtoEmbedded.inputFileName = cms.FileInPath( "TauAnalysis/MCEmbeddingTools/data/makeEmbeddingKineReweightLUTs_GENtoEmbedded_mutau.root" ) process.reconstruction_step += process.embeddingKineReweightSequenceGENtoEmbedded elif process.customization_options.mdtau.value() == 115: process.embeddingKineReweightGENtoEmbedded.inputFileName = cms.FileInPath( "TauAnalysis/MCEmbeddingTools/data/makeEmbeddingKineReweightLUTs_GENtoEmbedded_etau.root" ) process.reconstruction_step += process.embeddingKineReweightSequenceGENtoEmbedded if process.customization_options.replaceGenOrRecMuonMomenta.value( ) == 'rec': process.reconstruction_step += process.embeddingKineReweightSequenceGENtoREC outputModule.outputCommands.extend(['keep *_embeddingKineReweight_*_*']) # CV: compute weights for correcting Embedded samples # for efficiency with which Zmumu events used as input for Embedding production were selected process.load( "TauAnalysis/MCEmbeddingTools/ZmumuEvtSelEffCorrWeightProducer_cfi") process.ZmumuEvtSelEffCorrWeightProducer.selectedMuons = process.customization_options.ZmumuCollection process.ZmumuEvtSelEffCorrWeightProducer.verbosity = cms.int32(0) process.reconstruction_step += process.ZmumuEvtSelEffCorrWeightProducer outputModule.outputCommands.extend( ['keep *_ZmumuEvtSelEffCorrWeightProducer_*_*']) return (process)
def customise(process): inputProcess = "HLT" # some automagic check possible? process._Process__name = "EmbeddedRECO" process.TFileService = cms.Service( "TFileService", fileName=cms.string("histo_embedded.root")) try: outputModule = process.output except: pass try: outputModule = getattr( process, str(getattr(process, list(process.endpaths)[-1]))) except: pass print "Changing eventcontent to RAW+AODSIM + misc. " outputModule.outputCommands = cms.untracked.vstring("drop *") outputModule.outputCommands.extend(process.RAWEventContent.outputCommands) outputModule.outputCommands.extend( process.AODSIMEventContent.outputCommands) keepMC = cms.untracked.vstring( "keep *_*_zMusExtracted_*", "keep *_*_zmmCands_*", "keep *_removedInputMuons_*_*", "keep *_generator_*_*", "keep *_PhotonIDProd_*_*", "keep *_photons_*_*", "keep *_photonCore_*_*", "keep *_genParticles_*_*", "keep *_particleFlow_*_*", "keep *_generator_*_*", "keep *_tmfTracks_*_EmbeddedRECO", "keep *_offlinePrimaryVertices_*_EmbeddedRECO", "keep *_offlinePrimaryVerticesWithBS_*_EmbeddedRECO", "keep *_PhotonIDProd_*_*", "keep *_photons_*_*", "keep *_photonCore_*_*", "keep *_genParticles_*_*", "keep *_particleFlow_*_*", ) outputModule.outputCommands.extend(keepMC) # getRid of second "drop *" index = 0 for item in outputModule.outputCommands[:]: if item == "drop *" and index != 0: #print index," ",outputModule.outputCommands[index] del outputModule.outputCommands[index] index -= 1 index += 1 hltProcessName = "HLT" #"REDIGI38X" # the following block can be used for more efficient processing by replacing the HLT variable below automatically try: hltProcessName = __HLT__ except: pass try: process.dimuonsHLTFilter.TriggerResultsTag.processName = hltProcessName process.goodZToMuMuAtLeast1HLT.TrigTag.processName = hltProcessName process.goodZToMuMuAtLeast1HLT.triggerEvent.processName = hltProcessName process.hltTrigReport, HLTriggerResults.processName = hltProcessName except: pass process.VtxSmeared = cms.EDProducer("FlatEvtVtxGenerator", MaxZ=cms.double(0.0), MaxX=cms.double(0.0), MaxY=cms.double(0.0), MinX=cms.double(0.0), MinY=cms.double(0.0), MinZ=cms.double(0.0), TimeOffset=cms.double(0.0), src=cms.InputTag("generator")) import FWCore.ParameterSet.VarParsing as VarParsing options = VarParsing.VarParsing('analysis') options.register( 'mdtau', 0, # default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "mdtau value for tauola") options.register( 'transformationMode', 1, #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "transformation mode. 0=mumu->mumu, 1=mumu->tautau") options.register( 'minVisibleTransverseMomentum', "", #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "generator level cut on visible transverse momentum (typeN:pT,[...];[...])" ) options.register( 'useJson', 0, # default value, false VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "should I enable json usage?") options.register( 'overrideBeamSpot', 0, # default value, false VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "should I override beamspot in globaltag?") # options.register ('primaryProcess', # 'RECO', # default value # VarParsing.VarParsing.multiplicity.singleton, # VarParsing.VarParsing.varType.string, # "original processName") setFromCL = False if not hasattr(process, "doNotParse"): import sys if hasattr(sys, "argv") == True: if not sys.argv[0].endswith('cmsDriver.py'): options.parseArguments() setFromCL = True else: print "CL parsing disabled!" if setFromCL: print "Setting mdtau to ", options.mdtau process.generator.ZTauTau.TauolaOptions.InputCards.mdtau = options.mdtau process.newSource.ZTauTau.TauolaOptions.InputCards.mdtau = options.mdtau process.generator.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = options.mdtau process.newSource.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = options.mdtau print "Setting minVisibleTransverseMomentum to ", options.minVisibleTransverseMomentum process.newSource.ZTauTau.minVisibleTransverseMomentum = cms.untracked.string( options.minVisibleTransverseMomentum) process.generator.ZTauTau.minVisibleTransverseMomentum = cms.untracked.string( options.minVisibleTransverseMomentum) print "Setting transformationMode to ", options.transformationMode process.generator.ZTauTau.transformationMode = cms.untracked.int32( options.transformationMode) process.newSource.ZTauTau.transformationMode = cms.untracked.int32( options.transformationMode) if setFromCL and options.overrideBeamSpot != 0: print "options.overrideBeamSpot", options.overrideBeamSpot # bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v26_offline") # 52x data PR gt bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v21_offline" ) # 42x data PR gt # bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v18_offline") # 41x data PR gt # bs = cms.string("BeamSpotObjects_2009_LumiBased_v17_offline") # 38x data gt #bs = cms.string("BeamSpotObjects_2009_v14_offline") # 36x data gt # tag = cms.string("Early10TeVCollision_3p8cm_31X_v1_mc_START"), # 35 default # tag = cms.string("Realistic900GeVCollisions_10cm_STARTUP_v1_mc"), # 36 default process.GlobalTag.toGet = cms.VPSet( cms.PSet(record=cms.string("BeamSpotObjectsRcd"), tag=bs, connect=cms.untracked.string( "frontier://FrontierProd/CMS_COND_31X_BEAMSPOT"))) print "BeamSpot in globaltag set to ", bs else: print "BeamSpot in globaltag not changed" if setFromCL and options.useJson != 0: print "Enabling json usage" import PhysicsTools.PythonAnalysis.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes myLumis = LumiList.LumiList( filename='my.json').getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked( CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) process.generalTracksORG = process.generalTracks.clone() process.generalTracks = cms.EDProducer( "RecoTracksMixer", trackCol1=cms.InputTag("generalTracksORG", "", "EmbeddedRECO"), trackCol2=cms.InputTag("removedInputMuons", "tracks")) for p in process.paths: pth = getattr(process, p) if "generalTracks" in pth.moduleNames(): pth.replace(process.generalTracks, process.generalTracksORG * process.generalTracks) # We can try mixing seeds or keep std::vector<Trajectory> from Zmumu event and # try mixing it. # note - later approach may have no sense. Different geometries... process.trackerDrivenElectronSeedsORG = process.trackerDrivenElectronSeeds.clone( ) process.trackerDrivenElectronSeedsORG.TkColList = cms.VInputTag( cms.InputTag("generalTracksORG")) process.trackerDrivenElectronSeeds = cms.EDProducer( "ElectronSeedTrackRefUpdater", PreIdLabel=process.trackerDrivenElectronSeedsORG.PreIdLabel, PreGsfLabel=process.trackerDrivenElectronSeedsORG.PreGsfLabel, targetTracks=cms.InputTag("generalTracks"), inSeeds=cms.InputTag( "trackerDrivenElectronSeedsORG", process.trackerDrivenElectronSeedsORG.PreGsfLabel.value()), inPreId=cms.InputTag( "trackerDrivenElectronSeedsORG", process.trackerDrivenElectronSeedsORG.PreIdLabel.value()), ) for p in process.paths: pth = getattr(process, p) if "trackerDrivenElectronSeeds" in pth.moduleNames(): pth.replace( process.trackerDrivenElectronSeeds, process.trackerDrivenElectronSeedsORG * process.trackerDrivenElectronSeeds) # hack photonCore: process.trackerDrivenElectronSeedsMerged = cms.EDProducer( "ElectronSeedTrackRefUpdaterAndMerger", PreIdLabel=process.trackerDrivenElectronSeedsORG.PreIdLabel, PreGsfLabel=process.trackerDrivenElectronSeedsORG.PreGsfLabel, targetTracks=cms.InputTag("generalTracks"), inSeeds1=cms.InputTag( "trackerDrivenElectronSeedsORG", process.trackerDrivenElectronSeeds.PreGsfLabel.value()), inPreId1=cms.InputTag( "trackerDrivenElectronSeedsORG", process.trackerDrivenElectronSeeds.PreIdLabel.value()), inSeeds2=cms.InputTag( "trackerDrivenElectronSeeds", process.trackerDrivenElectronSeeds.PreGsfLabel.value()), inPreId2=cms.InputTag( "trackerDrivenElectronSeeds", process.trackerDrivenElectronSeeds.PreIdLabel.value())) process.electronMergedSeedsPhotonCoreHack = cms.EDProducer( "ElectronSeedMerger", EcalBasedSeeds=cms.InputTag("ecalDrivenElectronSeeds"), TkBasedSeeds=cms.InputTag("trackerDrivenElectronSeedsMerged", "SeedsForGsf")) process.photonCore.pixelSeedProducer = cms.string( 'electronMergedSeedsPhotonCoreHack') for p in process.paths: pth = getattr(process, p) if "photonCore" in pth.moduleNames(): pth.replace( process.photonCore, process.trackerDrivenElectronSeedsMerged * process.electronMergedSeedsPhotonCoreHack * process.photonCore) # mix gsfTracks process.electronGsfTracksORG = process.electronGsfTracks.clone() process.electronGsfTracks = cms.EDProducer( "GsfTrackMixer", col1=cms.InputTag("electronGsfTracksORG", "", "EmbeddedRECO"), col2=cms.InputTag("electronGsfTracks", "", inputProcess), ) # TODO: in 42x conversions seem not be used anywhere during reco. What about ana? # what about 52X? process.gsfConversionTrackProducer.TrackProducer = cms.string( 'electronGsfTracksORG') for p in process.paths: pth = getattr(process, p) if "electronGsfTracks" in pth.moduleNames(): pth.replace( process.electronGsfTracks, process.electronGsfTracksORG * process.electronGsfTracks) ''' process.electronMergedSeedsORG = process.electronMergedSeeds.clone() process.electronMergedSeeds = cms.EDProducer("ElectronSeedsMixer", col1 = cms.InputTag("electronMergedSeeds","", inputProcess), col2 = cms.InputTag("electronMergedSeedsORG","","EmbeddedRECO") ) for p in process.paths: pth = getattr(process,p) if "electronMergedSeeds" in pth.moduleNames(): pth.replace(process.electronMergedSeeds, process.electronMergedSeedsORG*process.electronMergedSeeds) ''' process.generalConversionTrackProducer.TrackProducer = cms.string( 'generalTracksORG') process.gsfElectronsORG = process.gsfElectrons.clone() process.gsfElectrons = cms.EDProducer( "GSFElectronsMixer", col1=cms.InputTag("gsfElectronsORG"), col2=cms.InputTag("gsfElectrons", "", inputProcess), ) for p in process.paths: pth = getattr(process, p) if "gsfElectrons" in pth.moduleNames(): pth.replace(process.gsfElectrons, process.gsfElectronsORG * process.gsfElectrons) for p in process.paths: pth = getattr(process, p) #print dir(pth) #sys.exit(0) for mod in pth.moduleNames(): if mod.find("dedx") != -1: print "Removing", mod module = getattr(process, mod) pth.remove(module) clConfig = cms.PSet(depsPlus=cms.InputTag("anaDeposits", "plus"), depsMinus=cms.InputTag("anaDeposits", "minus")) process.castorrecoORG = process.castorreco.clone() process.castorreco = cms.EDProducer( "CastorRHMixer", cleaningAlgo=cms.string("CaloCleanerAllCrossed"), cleaningConfig=clConfig, todo=cms.VPSet( cms.PSet(colZmumu=cms.InputTag("castorreco", "", inputProcess), colTauTau=cms.InputTag("castorrecoORG")))) for p in process.paths: pth = getattr(process, p) if "castorreco" in pth.moduleNames(): pth.replace(process.castorreco, process.castorrecoORG * process.castorreco) process.ecalRecHitORG = process.ecalRecHit.clone() process.ecalRecHit = cms.EDProducer( "EcalRHMixer", cleaningAlgo=cms.string("CaloCleanerAllCrossed"), # CaloCleanerMVA #cleaningAlgo = cms.string("CaloCleanerMVA"), cleaningConfig=clConfig, todo=cms.VPSet( cms.PSet(colZmumu=cms.InputTag("ecalRecHit", "EcalRecHitsEB", inputProcess), colTauTau=cms.InputTag("ecalRecHitORG", "EcalRecHitsEB")), cms.PSet(colZmumu=cms.InputTag("ecalRecHit", "EcalRecHitsEE", inputProcess), colTauTau=cms.InputTag("ecalRecHitORG", "EcalRecHitsEE")))) for p in process.paths: pth = getattr(process, p) if "ecalRecHit" in pth.moduleNames(): pth.replace(process.ecalRecHit, process.ecalRecHitORG * process.ecalRecHit) process.hbherecoORG = process.hbhereco.clone() process.hbhereco = cms.EDProducer( "HBHERHMixer", cleaningAlgo=cms.string("CaloCleanerAllCrossed"), cleaningConfig=clConfig, todo=cms.VPSet( cms.PSet(colZmumu=cms.InputTag("hbhereco", "", inputProcess), colTauTau=cms.InputTag("hbherecoORG", "")))) for p in process.paths: pth = getattr(process, p) if "hbhereco" in pth.moduleNames(): pth.replace(process.hbhereco, process.hbherecoORG * process.hbhereco) # typedef CaloRecHitMixer< HFRecHit > HFRHMixer; process.hfrecoORG = process.hfreco.clone() process.hfreco = cms.EDProducer( "HFRHMixer", cleaningAlgo=cms.string("CaloCleanerAllCrossed"), cleaningConfig=clConfig, todo=cms.VPSet( cms.PSet(colZmumu=cms.InputTag("hfreco", "", inputProcess), colTauTau=cms.InputTag("hfrecoORG", "")))) for p in process.paths: pth = getattr(process, p) if "hfreco" in pth.moduleNames(): pth.replace(process.hfreco, process.hfrecoORG * process.hfreco) # typedef CaloRecHitMixer< HORecHit > HORHMixer; process.horecoORG = process.horeco.clone() process.horeco = cms.EDProducer( "HORHMixer", cleaningAlgo=cms.string("CaloCleanerAllCrossed"), cleaningConfig=clConfig, todo=cms.VPSet( cms.PSet(colZmumu=cms.InputTag("horeco", "", inputProcess), colTauTau=cms.InputTag("horecoORG", "")))) for p in process.paths: pth = getattr(process, p) if "horeco" in pth.moduleNames(): pth.replace(process.horeco, process.horecoORG * process.horeco) # it should be the best solution to take the original beam spot for the # reconstruction of the new primary vertex # use the one produced earlier, do not produce your own for s in process.sequences: seq = getattr(process, s) seq.remove(process.offlineBeamSpot) try: process.metreco.remove(process.BeamHaloId) except: pass try: outputModule = process.output except: pass try: outputModule = getattr( process, str(getattr(process, list(process.endpaths)[-1]))) except: pass process.filterEmptyEv.src = cms.untracked.InputTag("generator", "", "EmbeddedRECO") try: process.schedule.remove(process.DQM_FEDIntegrity_v3) except: pass process.RECOSIMoutput.outputCommands.extend( ['keep *_*_*_skimGoldenZmumu2']) # keep orginal collections, needed for PF2PAT - generalTracksORG, not sure for others process.RECOSIMoutput.outputCommands.extend(['keep *_*ORG_*_*']) #xxx process.globalMuons.TrackerCollectionLabel = cms.InputTag("generalTracksORG") #xxx process.globalSETMuons.TrackerCollectionLabel = cms.InputTag("generalTracksORG") #print "TODO: add xcheck, that this is not changed" #process.muons.inputCollectionLabels = cms.VInputTag(cms.InputTag("generalTracksORG"), # cms.InputTag("globalMuons"), # cms.InputTag("standAloneMuons","UpdatedAtVtx")) skimEnabled = False if hasattr(process, "doZmumuSkim"): print "Enabling Zmumu skim" skimEnabled = True #process.load("TauAnalysis/Skimming/goldenZmmSelectionVBTFrelPFIsolation_cfi") cmssw_ver = os.environ["CMSSW_VERSION"] if cmssw_ver.find("CMSSW_4_2") != -1: print print "Using legacy version of Zmumu skim. Note, that muon isolation is disabled" print process.load( "TauAnalysis/MCEmbeddingTools/ZmumuStandalonSelectionLegacy_cff" ) else: process.load( "TauAnalysis/MCEmbeddingTools/ZmumuStandalonSelection_cff") process.load("TrackingTools/TransientTrack/TransientTrackBuilder_cfi") # we are allready selecting events from generation step, so following way is ok for path in process.paths: getattr( process, path)._seq = process.goldenZmumuSelectionSequence * getattr( process, path)._seq #process.options = cms.untracked.PSet( # wantSummary = cms.untracked.bool(True) #) if not skimEnabled: print "Zmumu skim not enabled" print "# ######################################################################################" print " Following parameters can be added before customize function " print " call in order to controll process customization: " print " process.doNotParse = cms.PSet() # disables CL parsing for crab compat" print " process.doZmumuSkim = cms.PSet() # adds Zmumu skimming before embedding is run" print "# ######################################################################################" return (process)
########### # Output # ########### process.load('ExoDiBosonResonances.EDBRCommon.outputModules_cff') process.out.fileName = options.outlabel process.outpath = cms.EndPath(process.out) ################### # JSON Filtering # ################### ### #only do this for data if "DATA" in options.mcordata and options.json != "": import PhysicsTools.PythonAnalysis.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes myLumis = LumiList.LumiList( filename=options.json).getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked( CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) ############ # Event filter # ############ process.rndmEventBlinding = cms.EDFilter( "EDBREventSampler", RandomGenSeed=cms.int32(87654), SamplingFactor=cms.double(0.2) # 1/5 events pass the filter ) process.badEventFilter = cms.EDFilter(
import FWCore.ParameterSet.Config as cms process = cms.Process("AnalysisProc") process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr.FwkReport.reportEvery = 10000 import PhysicsTools.PythonAnalysis.LumiList as LumiList LumiList.LumiList().getVLuminosityBlockRange() process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring('')) from RecoJets.JetProducers.PileupJetIDParams_cfi import cutbased as pu_jetid ###### Electron VID from RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Spring15_25ns_V1_cff import * if hasattr(cutBasedElectronID_Spring15_25ns_V1_standalone_loose, 'isPOGApproved'): del cutBasedElectronID_Spring15_25ns_V1_standalone_loose.isPOGApproved if hasattr(cutBasedElectronID_Spring15_25ns_V1_standalone_medium, 'isPOGApproved'): del cutBasedElectronID_Spring15_25ns_V1_standalone_medium.isPOGApproved if hasattr(cutBasedElectronID_Spring15_25ns_V1_standalone_tight, 'isPOGApproved'): del cutBasedElectronID_Spring15_25ns_V1_standalone_tight.isPOGApproved myVidElectronId = cms.PSet( loose=cutBasedElectronID_Spring15_25ns_V1_standalone_loose, medium=cutBasedElectronID_Spring15_25ns_V1_standalone_medium, tight=cutBasedElectronID_Spring15_25ns_V1_standalone_tight) #######