2 import FWCore.ParameterSet.Config
as cms
5 from FWCore.ParameterSet.Modules
import _Module
10 self.nextInChain=
"NONE"
11 self.prevInChain=
"NONE"
12 self.prevInChainCandidate=
"NONE"
20 self.lookFor = lookFor
23 return self.nextInChain
25 return self.prevInChain
28 if isinstance(visitee, _Module):
31 self.nextInChain=visitee
33 if visitee == self.lookFor:
35 self.prevInChain=self.prevInChainCandidate
37 self.prevInChainCandidate=visitee
44 process._Process__name=
"EmbeddedRECO"
45 process.TFileService = cms.Service(
"TFileService", fileName = cms.string(
"histo_embedded.root") )
48 outputModule = process.output
52 outputModule = getattr(process,str(getattr(process,
list(process.endpaths)[-1])))
56 print "Changing eventcontent to RAW+AODSIM + misc. "
57 outputModule.outputCommands = cms.untracked.vstring(
"drop *")
58 outputModule.outputCommands.extend(process.RAWEventContent.outputCommands )
59 outputModule.outputCommands.extend(process.AODSIMEventContent.outputCommands )
61 keepMC = cms.untracked.vstring(
"keep *_*_zMusExtracted_*",
62 "keep *_*_zmmCands_*",
63 "keep *_removedInputMuons_*_*",
64 "keep *_generator_*_*",
65 "keep *_PhotonIDProd_*_*",
67 "keep *_photonCore_*_*",
68 "keep *_genParticles_*_*",
69 "keep *_particleFlow_*_*",
70 "keep *_generator_*_*",
71 "keep *_tmfTracks_*_EmbeddedRECO",
72 "keep *_offlinePrimaryVertices_*_EmbeddedRECO",
73 "keep *_offlinePrimaryVerticesWithBS_*_EmbeddedRECO",
74 "keep *_PhotonIDProd_*_*",
76 "keep *_photonCore_*_*",
77 "keep *_genParticles_*_*",
78 "keep *_particleFlow_*_*",
80 outputModule.outputCommands.extend(keepMC)
84 for item
in outputModule.outputCommands[:]:
85 if item ==
"drop *" and index != 0:
87 del outputModule.outputCommands[index]
92 hltProcessName =
"HLT"
96 hltProcessName = __HLT__
101 process.dimuonsHLTFilter.TriggerResultsTag.processName = hltProcessName
102 process.goodZToMuMuAtLeast1HLT.TrigTag.processName = hltProcessName
103 process.goodZToMuMuAtLeast1HLT.triggerEvent.processName = hltProcessName
104 process.hltTrigReport,HLTriggerResults.processName = hltProcessName
108 process.VtxSmeared = cms.EDProducer(
"FlatEvtVtxGenerator",
109 MaxZ = cms.double(0.0),
110 MaxX = cms.double(0.0),
111 MaxY = cms.double(0.0),
112 MinX = cms.double(0.0),
113 MinY = cms.double(0.0),
114 MinZ = cms.double(0.0),
115 TimeOffset = cms.double(0.0),
116 src = cms.InputTag(
"generator",
"unsmeared")
119 import FWCore.ParameterSet.VarParsing
as VarParsing
121 options.register (
'mdtau',
123 VarParsing.VarParsing.multiplicity.singleton,
124 VarParsing.VarParsing.varType.int,
125 "mdtau value for tauola")
127 options.register (
'transformationMode',
129 VarParsing.VarParsing.multiplicity.singleton,
130 VarParsing.VarParsing.varType.int,
131 "transformation mode. 0=mumu->mumu, 1=mumu->tautau")
133 options.register (
'minVisibleTransverseMomentum',
135 VarParsing.VarParsing.multiplicity.singleton,
136 VarParsing.VarParsing.varType.string,
137 "generator level cut on visible transverse momentum (typeN:pT,[...];[...])")
139 options.register (
'useJson',
141 VarParsing.VarParsing.multiplicity.singleton,
142 VarParsing.VarParsing.varType.int,
143 "should I enable json usage?")
145 options.register (
'overrideBeamSpot',
147 VarParsing.VarParsing.multiplicity.singleton,
148 VarParsing.VarParsing.varType.int,
149 "should I override beamspot in globaltag?")
151 options.register (
'skimEnabled',
153 VarParsing.VarParsing.multiplicity.singleton,
154 VarParsing.VarParsing.varType.int,
155 "should I apply Zmumu event selection cuts?")
165 if not hasattr(process,
"doNotParse"):
167 if hasattr(sys,
"argv") ==
True:
168 if not sys.argv[0].endswith(
'cmsDriver.py'):
169 options.parseArguments()
172 print "CL parsing disabled!"
174 print "Setting mdtau to ", options.mdtau
175 process.generator.ZTauTau.TauolaOptions.InputCards.mdtau = options.mdtau
176 process.newSource.ZTauTau.TauolaOptions.InputCards.mdtau = options.mdtau
177 process.generator.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = options.mdtau
178 process.newSource.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = options.mdtau
180 print "Setting minVisibleTransverseMomentum to ", options.minVisibleTransverseMomentum
181 process.newSource.ZTauTau.minVisibleTransverseMomentum = cms.untracked.string(options.minVisibleTransverseMomentum)
182 process.generator.ZTauTau.minVisibleTransverseMomentum = cms.untracked.string(options.minVisibleTransverseMomentum)
184 print "Setting transformationMode to ", options.transformationMode
185 process.generator.ZTauTau.transformationMode = cms.untracked.int32(options.transformationMode)
186 process.newSource.ZTauTau.transformationMode = cms.untracked.int32(options.transformationMode)
188 print "options.overrideBeamSpot", options.overrideBeamSpot
189 if options.overrideBeamSpot != 0:
190 bs = cms.string(
"BeamSpotObjects_2009_LumiBased_SigmaZ_v26_offline")
197 process.GlobalTag.toGet = cms.VPSet(
198 cms.PSet(record = cms.string(
"BeamSpotObjectsRcd"),
200 connect = cms.untracked.string(
"frontier://FrontierProd/CMS_COND_31X_BEAMSPOT")
203 print "BeamSpot in globaltag set to ", bs
205 print "BeamSpot in globaltag not changed"
207 if options.useJson != 0:
208 print "Enabling json usage"
209 import PhysicsTools.PythonAnalysis.LumiList
as LumiList
210 import FWCore.ParameterSet.Types
as CfgTypes
212 process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange())
213 process.source.lumisToProcess.extend(myLumis)
217 process.tmfTracks = cms.EDProducer(
"RecoTracksMixer",
218 trackCol1 = cms.InputTag(
"removedInputMuons",
"tracks"),
219 trackCol2 = cms.InputTag(
"generalTracks",
"",
"EmbeddedRECO")
222 process.offlinePrimaryVerticesWithBS.TrackLabel = cms.InputTag(
"tmfTracks")
223 process.offlinePrimaryVertices.TrackLabel = cms.InputTag(
"tmfTracks")
225 if hasattr(process.muons,
"TrackExtractorPSet"):
226 process.muons.TrackExtractorPSet.inputTrackCollection = cms.InputTag(
"tmfTracks")
227 elif hasattr(process,
"muons1stStep")
and hasattr(process.muons1stStep,
"TrackExtractorPSet"):
228 process.muons1stStep.TrackExtractorPSet.inputTrackCollection = cms.InputTag(
"tmfTracks")
230 raise "Problem with muons"
234 for s
in process.sequences:
235 seq = getattr(process,s)
236 seq.remove(process.offlineBeamSpot)
239 process.metreco.remove(process.BeamHaloId)
244 outputModule = process.output
248 outputModule = getattr(process,str(getattr(process,
list(process.endpaths)[-1])))
252 for p
in process.paths:
253 pth = getattr(process,p)
254 if "generalTracks" in pth.moduleNames():
255 pth.replace(process.generalTracks, process.generalTracks*process.tmfTracks)
258 process.gsfElectronsORG = process.gsfElectrons.clone()
262 for p
in process.paths:
263 pth = getattr(process,p)
265 if "gsfElectrons" in pth.moduleNames():
266 pth.replace(process.gsfElectrons, process.gsfElectronsORG*process.gsfElectrons)
270 process.gsfElectrons = cms.EDProducer(
"GSFElectronsMixer",
271 col1 = cms.InputTag(
"gsfElectronsORG"),
272 col2 = cms.InputTag(
"gsfElectrons",
"", RECOproc )
276 process.particleFlowORG = process.particleFlow.clone()
283 if hasattr(process,
'particleFlowTmp'):
284 process.particleFlowTmpMixed = cms.EDProducer(
'PFCandidateMixer',
285 col1 = cms.untracked.InputTag(
"removedInputMuons",
"pfCands"),
286 col2 = cms.untracked.InputTag(
"particleFlowTmp",
""),
287 trackCol = cms.untracked.InputTag(
"tmfTracks"),
290 muons = cms.untracked.InputTag(
""),
291 gsfElectrons = cms.untracked.InputTag(
"")
293 process.muons.PFCandidates = cms.InputTag(
"particleFlowTmpMixed")
295 for p
in process.paths:
296 if "particleFlow" in pth.moduleNames():
297 pth.replace(process.particleFlow, process.particleFlowORG*process.particleFlow)
298 if "muons" in pth.moduleNames():
299 pth.replace(process.muons, process.particleFlowTmpMixed*process.muons)
302 if hasattr(process,
"famosParticleFlowSequence"):
303 process.famosParticleFlowSequence.remove(process.pfPhotonTranslatorSequence)
304 process.famosParticleFlowSequence.remove(process.pfElectronTranslatorSequence)
305 process.famosParticleFlowSequence.remove(process.particleFlow)
306 process.famosParticleFlowSequence.__iadd__(process.particleFlowORG)
307 process.famosParticleFlowSequence.__iadd__(process.particleFlow)
308 process.famosParticleFlowSequence.__iadd__(process.pfElectronTranslatorSequence)
309 process.famosParticleFlowSequence.__iadd__(process.pfPhotonTranslatorSequence)
310 elif hasattr(process,
"particleFlowReco"):
311 process.particleFlowReco.remove(process.pfPhotonTranslatorSequence)
312 process.particleFlowReco.remove(process.pfElectronTranslatorSequence)
313 process.particleFlowReco.remove(process.particleFlow)
314 process.particleFlowReco.__iadd__(process.particleFlowORG)
315 process.particleFlowReco.__iadd__(process.particleFlow)
316 process.particleFlowReco.__iadd__(process.pfElectronTranslatorSequence)
317 process.particleFlowReco.__iadd__(process.pfPhotonTranslatorSequence)
319 raise "Cannot find particleFlow sequence"
321 process.pfSelectedElectrons.src = cms.InputTag(
"particleFlowORG")
322 process.pfSelectedPhotons.src = cms.InputTag(
"particleFlowORG")
324 process.particleFlow = cms.EDProducer(
'PFCandidateMixer',
325 col1 = cms.untracked.InputTag(
"removedInputMuons",
"pfCands"),
326 col2 = cms.untracked.InputTag(
"particleFlowORG",
""),
327 trackCol = cms.untracked.InputTag(
"tmfTracks"),
329 muons = cms.untracked.InputTag(
"muons"),
330 gsfElectrons = cms.untracked.InputTag(
"gsfElectrons")
334 process.filterEmptyEv.src = cms.untracked.InputTag(
"generatorSmeared",
"",
"EmbeddedRECO")
336 from FWCore.ParameterSet.Types
import InputTag
337 for p
in process.paths:
338 i = getattr(process,p)
339 target = process.particleFlow
341 seqVis = SeqVisitor(target)
342 seqVis.prepareSearch()
343 seqVis.setLookFor(target)
345 while ( seqVis.catch != 1
and seqVis.found == 1 ):
347 target = seqVis.giveNext()
349 targetAttributes =
dir(target)
350 for targetAttribute
in targetAttributes:
351 attr=getattr(target,targetAttribute)
352 if isinstance(attr, InputTag)
and attr.getModuleLabel()==
"particleFlow":
353 if ( attr.getProductInstanceLabel()!=
"" ):
354 print "Changing: ", target,
" ", targetAttribute,
" ", attr,
" to particleFlowORG"
355 attr.setModuleLabel(
"particleFlowORG")
358 seqVis.prepareSearch()
359 seqVis.setLookFor(target)
367 l1ExtraCollections = [
368 [
"L1EmParticle",
"Isolated" ],
369 [
"L1EmParticle",
"NonIsolated" ],
370 [
"L1EtMissParticle",
"MET" ],
371 [
"L1EtMissParticle",
"MHT" ],
372 [
"L1JetParticle",
"Central" ],
373 [
"L1JetParticle",
"Forward" ],
374 [
"L1JetParticle",
"Tau" ],
375 [
"L1MuonParticle",
"" ]
377 l1extraParticleCollections = []
378 for l1ExtraCollection
in l1ExtraCollections:
379 inputType = l1ExtraCollection[0]
381 if inputType ==
"L1EmParticle":
382 pluginType =
"L1ExtraEmParticleMixerPlugin"
383 elif inputType ==
"L1EtMissParticle":
384 pluginType =
"L1ExtraMEtMixerPlugin"
385 elif inputType ==
"L1JetParticle":
386 pluginType =
"L1ExtraJetParticleMixerPlugin"
387 elif inputType ==
"L1MuonParticle":
388 pluginType =
"L1ExtraMuonParticleMixerPlugin"
390 raise ValueError(
"Invalid L1Extra type = %s !!" % inputType)
391 instanceLabel = l1ExtraCollection[1]
392 l1extraParticleCollections.append(cms.PSet(
393 pluginType = cms.string(pluginType),
394 instanceLabel = cms.string(instanceLabel)))
395 process.l1extraParticlesORG = process.l1extraParticles.clone()
396 process.l1extraParticles = cms.EDProducer(
'L1ExtraMixer',
397 src1 = cms.InputTag(
'l1extraParticles::HLT'),
398 src2 = cms.InputTag(
'l1extraParticlesORG'),
399 collections = cms.VPSet(l1extraParticleCollections)
401 for p
in process.paths:
402 pth = getattr(process,p)
403 if "l1extraParticles" in pth.moduleNames():
404 pth.replace(process.l1extraParticles, process.l1extraParticlesORG*process.l1extraParticles)
408 fedIntRemoved =
False
409 for i
in range(1,30):
410 attrName =
"DQM_FEDIntegrity_v"+str(i)
411 if hasattr(process, attrName ):
412 process.schedule.remove(process.DQM_FEDIntegrity_v11)
413 del process.DTDataIntegrityTask
418 print "Removed", attrName
420 print "DQM_FEDIntegrity_vXX not found, expect problems"
424 if options.skimEnabled != 0:
427 if hasattr(process,
"doZmumuSkim"):
430 print "Enabling Zmumu skim"
433 cmssw_ver = os.environ[
"CMSSW_VERSION"]
434 if cmssw_ver.find(
"CMSSW_4_2") != -1:
436 print "Using legacy version of Zmumu skim. Note, that muon isolation is disabled"
438 process.load(
"TauAnalysis/MCEmbeddingTools/ZmumuStandalonSelectionLegacy_cff")
439 process.RandomNumberGeneratorService.dummy = cms.PSet(
440 initialSeed = cms.untracked.uint32(123456789),
441 engineName = cms.untracked.string(
'HepJamesRandom')
445 process.load(
"TauAnalysis/MCEmbeddingTools/ZmumuStandalonSelection_cff")
448 process.load(
"TrackingTools/TransientTrack/TransientTrackBuilder_cfi")
451 for path
in process.paths:
452 getattr(process,path)._seq = process.goldenZmumuSelectionSequence * getattr(process,path)._seq
458 print "Zmumu skim not enabled"
460 process.load(
"TauAnalysis/MCEmbeddingTools/ZmumuStandalonSelection_cff")
461 process.skimEffFlag = cms.EDProducer(
"DummyBoolEventSelFlagProducer")
462 process.skimEffPath = cms.Path(process.goldenZmumuSelectionSequence * process.skimEffFlag)
464 process.load(
"TrackingTools/TransientTrack/TransientTrackBuilder_cfi")
466 print "# ######################################################################################"
467 print " Following parameters can be added before customize function "
468 print " call in order to controll process customization: "
469 print " process.doNotParse = cms.PSet() # disables CL parsing for crab compat"
470 print " process.doZmumuSkim = cms.PSet() # adds Zmumu skimming before embedding is run"
471 print "# ######################################################################################"
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run