CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
embeddingCustomizeAll_Old Namespace Reference

Functions

def customise
 

Function Documentation

def embeddingCustomizeAll_Old.customise (   process)

Definition at line 9 of file embeddingCustomizeAll_Old.py.

References list(), reco.return(), and split.

9 
10 def customise(process):
11 
12  # Define configuration parameter default values
13  from TauAnalysis.MCEmbeddingTools.setDefaults import setDefaults
14  setDefaults(process)
15 
16  inputProcess = process.customization_options.inputProcessRECO.value()
17  print "Input process set to '%s'" % inputProcess
18 
19  process._Process__name = "EmbeddedRECO"
20 
21  # DQM store output for muon acceptance histograms
22  process.DQMStore = cms.Service("DQMStore")
23 
24  if process.customization_options.isMC.value():
25  print "Input is MC"
26 
27  # select generator level muons
28  process.genMuonsFromZs = cms.EDProducer("GenParticlesFromZsSelectorForMCEmbedding",
29  src = cms.InputTag("genParticles", "", process.customization_options.inputProcessSIM.value()),
30  pdgIdsMothers = cms.vint32(23, 22),
31  pdgIdsDaughters = cms.vint32(13),
32  maxDaughters = cms.int32(2),
33  minDaughters = cms.int32(2),
34  before_or_afterFSR = cms.string("afterFSR"),
35  verbosity = cms.int32(0)
36  )
37  process.ProductionFilterSequence.replace(process.cleanedGeneralTracks, process.genMuonsFromZs*process.cleanedGeneralTracks)
38  process.ProductionFilterSequence.replace(process.cleanedParticleFlow, process.genMuonsFromZs*process.cleanedParticleFlow)
39 
40  # produce generator level MET (= sum of neutrino momenta)
41  # in case Embedding is run on Monte Carlo input
42  process.genMetCalo = cms.EDProducer("MixedGenMEtProducer",
43  srcGenParticles1 = cms.InputTag("genParticles", "", process.customization_options.inputProcessSIM.value()),
44  srcGenParticles2 = cms.InputTag("genParticles"),
45  srcRemovedMuons = cms.InputTag(process.customization_options.ZmumuCollection.getModuleLabel()),
46  type = cms.string("calo"),
47  isMC = cms.bool(True)
48  )
49  process.genMetTrue = process.genMetCalo.clone(
50  type = cms.string("pf")
51  )
52  else:
53  print "Input is Data"
54 
55  # produce generator level MET (= sum of neutrino momenta)
56  # in case Embedding is run on real Data
57  process.genMetCalo = cms.EDProducer("MixedGenMEtProducer",
58  srcGenParticles1 = cms.InputTag(""),
59  srcGenParticles2 = cms.InputTag("genParticles"),
60  srcRemovedMuons = cms.InputTag(process.customization_options.ZmumuCollection.getModuleLabel()),
61  type = cms.string("calo"),
62  isMC = cms.bool(False)
63  )
64  process.genMetTrue = process.genMetCalo.clone(
65  type = cms.string("pf")
66  )
67  for p in process.paths:
68  pth = getattr(process, p)
69  if "genParticles" in pth.moduleNames():
70  pth.replace(process.genParticles, process.genParticles*process.genMetCalo*process.genMetTrue)
71 
72  # update InputTags defined in PFEmbeddingSource_cff.py
73  print "Setting collection of Z->mumu candidates to '%s'" % process.customization_options.ZmumuCollection.getModuleLabel()
74  if not (hasattr(process, "cleanedGeneralTracks") and hasattr(process, "cleanedParticleFlow")):
75  process.load("TauAnalysis.MCEmbeddingTools.PFEmbeddingSource_cff")
76  if process.customization_options.replaceGenOrRecMuonMomenta.value() == 'gen':
77  print "Taking momenta of generated tau leptons from generator level muons"
78  process.generator.src = cms.InputTag('genMuonsFromZs')
79  elif process.customization_options.replaceGenOrRecMuonMomenta.value() == 'rec':
80  print "Taking momenta of generated tau leptons from reconstructed muons"
81  process.generator.src = process.customization_options.ZmumuCollection
82  else:
83  raise ValueError("Invalid Configuration parameter 'replaceGenOrRecMuonMomenta' = %s !!" % process.customization_options.replaceGenOrRecMuonMomenta.value())
84  # update option for removing tracks/charged PFCandidates matched to reconstructed muon
85  process.cleanedGeneralTracks.selectedMuons = process.customization_options.ZmumuCollection
86  process.cleanedParticleFlow.selectedMuons = process.customization_options.ZmumuCollection
87  if process.customization_options.muonTrackCleaningMode.value() == 1:
88  process.cleanedGeneralTracks.removeDuplicates = cms.bool(False)
89  process.cleanedParticleFlow.removeDuplicates = cms.bool(False)
90  elif process.customization_options.muonTrackCleaningMode.value() == 2:
91  process.cleanedGeneralTracks.removeDuplicates = cms.bool(True)
92  process.cleanedParticleFlow.removeDuplicates = cms.bool(True)
93  else:
94  raise ValueError("Invalid Configuration parameter 'muonTrackCleaningMode' = %i !!" % process.customization_options.muonTrackCleaningMode.value())
95 
96  try:
97  outputModule = process.output
98  except:
99  pass
100  try:
101  outputModule = getattr(process, str(getattr(process, list(process.endpaths)[-1])))
102  except:
103  pass
104 
105  print "Changing event-content to AODSIM + Z->mumu candidates"
106  outputModule.outputCommands = cms.untracked.vstring("drop *")
107  outputModule.outputCommands.extend(process.AODSIMEventContent.outputCommands)
108 
109  # get rid of second "drop *"
110  index = 0
111  for item in outputModule.outputCommands[:]:
112  if item == "drop *" and index != 0:
113  del outputModule.outputCommands[index]
114  index -= 1
115  index += 1
116 
117  # keep collections of generator level muons
118  outputModule.outputCommands.extend([
119  'keep *_genMuonsFromZs_*_*'
120  ])
121 
122  # keep collections of reconstructed muons
123  outputModule.outputCommands.extend([
124  'keep *_goodMuons_*_*',
125  'keep *_goodMuonsPFIso_*_*',
126  'keep *_highestPtMuPlus_*_*',
127  'keep *_highestPtMuMinus_*_*',
128  'keep *_highestPtMuPlusPFIso_*_*',
129  'keep *_highestPtMuMinusPFIso_*_*'
130  ])
131 
132  # keep collections of reconstructed Z -> mumu candidates
133  # (with different muon isolation criteria applied)
134  outputModule.outputCommands.extend([
135  'keep *_goldenZmumuCandidatesGe0IsoMuons_*_*',
136  'keep *_goldenZmumuCandidatesGe1IsoMuons_*_*',
137  'keep *_goldenZmumuCandidatesGe2IsoMuons_*_*',
138  'keep TH2DMEtoEDM_MEtoEDMConverter_*_*'
139  ])
140 
141  # keep flag indicating whether event passes or fails
142  # o Z -> mumu event selection
143  # o muon -> muon + photon radiation filter
144  outputModule.outputCommands.extend([
145  'keep *_goldenZmumuFilterResult_*_*',
146  'keep *_muonRadiationFilterResult_*_*'
147  ])
148 
149  # CV: keep HepMCProduct for embedded event,
150  # in order to run Validation/EventGenerator/python/TauValidation_cfi.py
151  # for control plots of tau polarization and decay mode information
152  outputModule.outputCommands.extend([
153  'keep *HepMCProduct_generator_*_*'
154  ])
155 
156  # keep distance of muons traversed in ECAL and HCAL,
157  # expected and removed muon energy deposits
158  outputModule.outputCommands.extend([
159  'keep *_muonCaloEnergyDepositsByDistance_totalDistanceMuPlus_*',
160  'keep *_muonCaloEnergyDepositsByDistance_totalEnergyDepositMuPlus_*',
161  'keep *_muonCaloEnergyDepositsByDistance_totalDistanceMuMinus_*',
162  'keep *_muonCaloEnergyDepositsByDistance_totalEnergyDepositMuMinus_*',
163  'keep *_castorreco_removedEnergyMuMinus*_*',
164  'keep *_castorreco_removedEnergyMuPlus*_*',
165  'keep *_hfreco_removedEnergyMuMinus*_*',
166  'keep *_hfreco_removedEnergyMuPlus*_*',
167  'keep *_ecalPreshowerRecHit_removedEnergyMuMinus*_*',
168  'keep *_ecalPreshowerRecHit_removedEnergyMuPlus*_*',
169  'keep *_ecalRecHit_removedEnergyMuMinus*_*',
170  'keep *_ecalRecHit_removedEnergyMuPlus*_*',
171  'keep *_hbhereco_removedEnergyMuMinus*_*',
172  'keep *_hbhereco_removedEnergyMuPlus*_*',
173  'keep *_horeco_removedEnergyMuMinus*_*',
174  'keep *_horeco_removedEnergyMuPlus*_*',
175  ])
176 
177  # replace HLT process name
178  # (needed for certain reprocessed Monte Carlo samples)
179  hltProcessName = "HLT"
180  try:
181  hltProcessName = __HLT__
182  except:
183  pass
184  try:
185  process.dimuonsHLTFilter.TriggerResultsTag.processName = hltProcessName
186  process.goodZToMuMuAtLeast1HLT.TrigTag.processName = hltProcessName
187  process.goodZToMuMuAtLeast1HLT.triggerEvent.processName = hltProcessName
188  process.hltTrigReport,HLTriggerResults.processName = hltProcessName
189  except:
190  pass
191 
192  # disable L1GtTrigReport module
193  # (not used for anything yet, just prints error for every single event)
194  if hasattr(process, 'HLTAnalyzerEndpath'):
195  process.HLTAnalyzerEndpath.remove(process.hltL1GtTrigReport)
196 
197  # apply configuration parameters
198  print "Setting mdtau to %i" % process.customization_options.mdtau.value()
199  process.generator.Ztautau.TauolaOptions.InputCards.mdtau = process.customization_options.mdtau
200  if hasattr(process.generator, "ParticleGun"):
201  process.generator.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = process.customization_options.mdtau
202  if process.customization_options.useTauolaPolarization.value():
203  print "Enabling tau polarization effects in TAUOLA"
204  # NOTE: polarization effects are only approximate,
205  # because Embedded events do not have proper parton history in HepMC::GenEvent
206  # (cf. arXiv:hep-ph/0101311 and arXiv:1201.0117)
207  process.generator.Ztautau.TauolaOptions.UseTauolaPolarization = cms.bool(True)
208  else:
209  print "Disabling tau polarization effects in TAUOLA"
210  # NOTE: tau polarization effects need to be added by reweighting Embedded events
211  # using weights computed by TauSpinner package
212  process.generator.Ztautau.TauolaOptions.UseTauolaPolarization = cms.bool(False)
213 
214  print "Setting minVisibleTransverseMomentum to '%s'" % process.customization_options.minVisibleTransverseMomentum.value()
215  process.generator.Ztautau.minVisibleTransverseMomentum = process.customization_options.minVisibleTransverseMomentum
216 
217  print "Setting transformationMode to %i" % process.customization_options.transformationMode.value()
218  process.generator.Ztautau.transformationMode = process.customization_options.transformationMode
219 
220  print "Setting rfRotationAngle to %1.0f" % process.customization_options.rfRotationAngle.value()
221  process.generator.Ztautau.rfRotationAngle = process.customization_options.rfRotationAngle
222 
223  if process.customization_options.overrideBeamSpot.value():
224  bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v28_offline")
225  process.GlobalTag.toGet = cms.VPSet(
226  cms.PSet(
227  record = cms.string("BeamSpotObjectsRcd"),
228  tag = bs,
229  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_31X_BEAMSPOT")
230  )
231  )
232  print "BeamSpot in globaltag set to '%s'" % bs
233  else:
234  print "BeamSpot in globaltag not changed"
235 
236  # CV: disable gen. vertex smearing
237  # (embed tau leptons exactly at Z->mumu event vertex)
238  print "Disabling gen. vertex smearing"
239  process.VtxSmeared = cms.EDProducer("FlatEvtVtxGenerator",
240  MaxZ = cms.double(0.0),
241  MaxX = cms.double(0.0),
242  MaxY = cms.double(0.0),
243  MinX = cms.double(0.0),
244  MinY = cms.double(0.0),
245  MinZ = cms.double(0.0),
246  TimeOffset = cms.double(0.0),
247  src = cms.InputTag("generator","unsmeared")
248  )
249 
250  if process.customization_options.useJson.value():
251  print "Enabling event selection by JSON file"
252  import PhysicsTools.PythonAnalysis.LumiList as LumiList
253  import FWCore.ParameterSet.Types as CfgTypes
254  myLumis = LumiList.LumiList(filename = 'my.json').getCMSSWString().split(',')
255  process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange())
256  process.source.lumisToProcess.extend(myLumis)
257 
258  #----------------------------------------------------------------------------------------------------------------------
259  # CV: need to rerun particle-flow algorithm in order to create links between PFMuon -> PFBlocks -> PFClusters -> PFRecHits
260  # (configure particle-flow sequence before overwriting modules in order to mix collections
261  # of objects reconstructed and Z -> mu+ mu- event with simulated tau decay products)
262  if process.customization_options.embeddingMode.value() == "RH" and process.customization_options.cleaningMode == 'PF':
263  rerunParticleFlow(process, inputProcess)
264  process.ProductionFilterSequence += process.rerunParticleFlowSequenceForPFMuonCleaning
265  #----------------------------------------------------------------------------------------------------------------------
266 
267  # mix "general" Track collection
268  process.generalTracksORG = process.generalTracks.clone()
269  process.generalTracks = cms.EDProducer("TrackMixer",
270  todo = cms.VPSet(
271  cms.PSet(
272  collection1 = cms.InputTag("generalTracksORG", "", "EmbeddedRECO"),
273  collection2 = cms.InputTag("cleanedGeneralTracks")
274  )
275  ),
276  verbosity = cms.int32(0)
277  )
278 
279  for p in process.paths:
280  pth = getattr(process,p)
281  if "generalTracks" in pth.moduleNames():
282  pth.replace(process.generalTracks, process.generalTracksORG*process.generalTracks)
283 
284  #----------------------------------------------------------------------------------------------------------------------
285  # CV/TF: mixing of std::vector<Trajectory> from Zmumu event and embedded tau decay products does not work yet.
286  # For the time-being, we need to use the Trajectory objects from the embedded event
287  process.trackerDrivenElectronSeedsORG = process.trackerDrivenElectronSeeds.clone()
288  process.trackerDrivenElectronSeedsORG.TkColList = cms.VInputTag(
289  cms.InputTag("generalTracksORG")
290  )
291 
292  process.trackerDrivenElectronSeeds = cms.EDProducer("ElectronSeedTrackRefUpdater",
293  PreIdLabel = process.trackerDrivenElectronSeedsORG.PreIdLabel,
294  PreGsfLabel = process.trackerDrivenElectronSeedsORG.PreGsfLabel,
295  targetTracks = cms.InputTag("generalTracks"),
296  inSeeds = cms.InputTag("trackerDrivenElectronSeedsORG", process.trackerDrivenElectronSeedsORG.PreGsfLabel.value()),
297  inPreId = cms.InputTag("trackerDrivenElectronSeedsORG", process.trackerDrivenElectronSeedsORG.PreIdLabel.value()),
298  )
299 
300  for p in process.paths:
301  pth = getattr(process,p)
302  if "trackerDrivenElectronSeeds" in pth.moduleNames():
303  pth.replace(process.trackerDrivenElectronSeeds, process.trackerDrivenElectronSeedsORG*process.trackerDrivenElectronSeeds)
304 
305  # CV: need to keep 'generalTracksORG' collection in event-content,
306  # as (at least electron based) PFCandidates will refer to it,
307  # causing exception in 'pfNoPileUp' module otherwise
308  outputModule.outputCommands.extend(['keep recoTracks_generalTracksORG_*_*'])
309  #----------------------------------------------------------------------------------------------------------------------
310 
311  #----------------------------------------------------------------------------------------------------------------------
312  # mix collections of GSF electron tracks
313  process.electronGsfTracksORG = process.electronGsfTracks.clone()
314  process.electronGsfTracks = cms.EDProducer("GsfTrackMixer",
315  collection1 = cms.InputTag("electronGsfTracksORG", "", "EmbeddedRECO"),
316  collection2 = cms.InputTag("electronGsfTracks", "", inputProcess)
317  )
318 
319  process.gsfConversionTrackProducer.TrackProducer = cms.string('electronGsfTracksORG')
320 
321  for p in process.paths:
322  pth = getattr(process,p)
323  if "electronGsfTracks" in pth.moduleNames():
324  pth.replace(process.electronGsfTracks, process.electronGsfTracksORG*process.electronGsfTracks)
325 
326  process.generalConversionTrackProducer.TrackProducer = cms.string('generalTracksORG')
327  process.uncleanedOnlyGeneralConversionTrackProducer.TrackProducer = cms.string('generalTracksORG')
328 
329  process.gsfElectronsORG = process.gsfElectrons.clone()
330  process.gsfElectrons = cms.EDProducer("GSFElectronsMixer",
331  col1 = cms.InputTag("gsfElectronsORG"),
332  col2 = cms.InputTag("gsfElectrons", "", inputProcess)
333  )
334  for p in process.paths:
335  pth = getattr(process,p)
336  if "gsfElectrons" in pth.moduleNames():
337  pth.replace(process.gsfElectrons, process.gsfElectronsORG*process.gsfElectrons)
338  #----------------------------------------------------------------------------------------------------------------------
339 
340  # dE/dx information for mixed track collections not yet implemented in 'TracksMixer' module,
341  # disable usage of dE/dx information in all event reconstruction modules for now
342  for p in process.paths:
343  pth = getattr(process,p)
344  for mod in pth.moduleNames():
345  if mod.find("dedx") != -1 and mod.find("Zmumu") == -1:
346  if mod.find("ForPFMuonCleaning") == -1:
347  print "Removing %s" % mod
348  module = getattr(process, mod)
349  pth.remove(module)
350 
351  # CV: Compute expected energy deposits of muon in EB/EE, HB/HE and HO:
352  # (1) compute distance traversed by muons produced in Z -> mu+ mu- decay
353  # through individual calorimeter cells
354  # (2) scale distances by expected energy loss dE/dx of muon
355  from TrackingTools.TrackAssociator.default_cfi import TrackAssociatorParameterBlock
356  process.muonCaloDistances = cms.EDProducer('MuonCaloDistanceProducer',
357  trackAssociator = TrackAssociatorParameterBlock.TrackAssociatorParameters,
358  selectedMuons = process.customization_options.ZmumuCollection)
359  process.ProductionFilterSequence += process.muonCaloDistances
360 
361  # mix collections of L1Extra objects
362  l1ExtraCollections = [
363  [ "L1EmParticle", "Isolated" ],
364  [ "L1EmParticle", "NonIsolated" ],
365  [ "L1EtMissParticle", "MET" ],
366  [ "L1EtMissParticle", "MHT" ],
367  [ "L1JetParticle", "Central" ],
368  [ "L1JetParticle", "Forward" ],
369  [ "L1JetParticle", "Tau" ],
370  [ "L1MuonParticle", "" ]
371  ]
372  l1extraParticleCollections = []
373  for l1ExtraCollection in l1ExtraCollections:
374  inputType = l1ExtraCollection[0]
375  pluginType = None
376  srcVeto = cms.InputTag('')
377  dRveto = 0.
378  if inputType == "L1EmParticle":
379  pluginType = "L1ExtraEmParticleMixerPlugin"
380  srcSelectedMuons = process.customization_options.ZmumuCollection
381  dRveto = 0.3
382  elif inputType == "L1EtMissParticle":
383  pluginType = "L1ExtraMEtMixerPlugin"
384  elif inputType == "L1JetParticle":
385  pluginType = "L1ExtraJetParticleMixerPlugin"
386  srcSelectedMuons = process.customization_options.ZmumuCollection
387  dRveto = 0.3
388  elif inputType == "L1MuonParticle":
389  pluginType = "L1ExtraMuonParticleMixerPlugin"
390  srcSelectedMuons = process.customization_options.ZmumuCollection
391  dRveto = 0.8
392  else:
393  raise ValueError("Invalid L1Extra type = %s !!" % inputType)
394  instanceLabel = l1ExtraCollection[1]
395  l1extraParticleCollections.append(cms.PSet(
396  pluginType = cms.string(pluginType),
397  instanceLabel = cms.string(instanceLabel),
398  srcSelectedMuons2 = srcSelectedMuons,
399  dRveto2 = cms.double(dRveto)))
400  if inputType == 'L1EtMissParticle':
401  l1extraParticleCollections[-1].srcMuons = cms.InputTag("muonCaloDistances", "muons")
402  l1extraParticleCollections[-1].distanceMapMuPlus = cms.InputTag("muonCaloDistances", "distancesMuPlus")
403  l1extraParticleCollections[-1].distanceMapMuMinus = cms.InputTag("muonCaloDistances", "distancesMuPlus")
404  l1extraParticleCollections[-1].H_Calo_AbsEtaLt12 = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.75)
405  l1extraParticleCollections[-1].H_Calo_AbsEta12to17 = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.6)
406  l1extraParticleCollections[-1].H_Calo_AbsEtaGt17 = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.3)
407 
408  process.l1extraParticlesORG = process.l1extraParticles.clone()
409  process.l1extraParticles = cms.EDProducer('L1ExtraMixer',
410  src1 = cms.InputTag("l1extraParticlesORG"),
411  src2 = cms.InputTag("l1extraParticles", "", inputProcess),
412  collections = cms.VPSet(l1extraParticleCollections)
413  )
414  for p in process.paths:
415  pth = getattr(process,p)
416  if "l1extraParticles" in pth.moduleNames():
417  pth.replace(process.l1extraParticles, process.l1extraParticlesORG*process.l1extraParticles)
418 
419  if process.customization_options.embeddingMode.value() == "PF":
420  print "Using PF-embedding"
421  from TauAnalysis.MCEmbeddingTools.embeddingCustomizePF import customise as customisePF
422  customisePF(process)
423  elif process.customization_options.embeddingMode.value() == "RH":
424  print "Using RH-embedding"
425  from TauAnalysis.MCEmbeddingTools.embeddingCustomizeRH import customise as customiseRH
426  customiseRH(process, inputProcess)
427  else:
428  raise ValueError("Invalid Configuration parameter 'embeddingMode' = %s !!" % process.customization_options.embeddingMode.value())
429 
430  # it should be the best solution to take the original beam spot for the
431  # reconstruction of the new primary vertex
432  # use the one produced earlier, do not produce your own
433  for s in process.sequences:
434  seq = getattr(process,s)
435  seq.remove(process.offlineBeamSpot)
436 
437  try:
438  process.metreco.remove(process.BeamHaloId)
439  except:
440  pass
441 
442  try:
443  outputModule = process.output
444  except:
445  pass
446  try:
447  outputModule = getattr(process, str(getattr(process, list(process.endpaths)[-1])))
448  except:
449  pass
450 
451  process.filterEmptyEv.src = cms.untracked.InputTag("generatorSmeared", "", "EmbeddedRECO")
452 
453  try:
454  process.schedule.remove(process.DQM_FEDIntegrity_v3)
455  except:
456  pass
457 
458  process.load("TauAnalysis/MCEmbeddingTools/ZmumuStandaloneSelection_cff")
459  process.goldenZmumuFilter.src = process.customization_options.ZmumuCollection
460  if process.customization_options.applyZmumuSkim.value():
461  print "Enabling Zmumu skim"
462  process.load("TrackingTools/TransientTrack/TransientTrackBuilder_cfi")
463  for path in process.paths:
464  if process.customization_options.isMC.value():
465  getattr(process,path)._seq = process.goldenZmumuFilterSequence * getattr(process,path)._seq
466  else:
467  getattr(process,path)._seq = process.goldenZmumuFilterSequenceData * getattr(process,path)._seq
468  process.options = cms.untracked.PSet(
469  wantSummary = cms.untracked.bool(True)
470  )
471  # CV: keep track of Z->mumu selection efficiency
472  process.goldenZmumuFilterResult = cms.EDProducer("CandViewCountEventSelFlagProducer",
473  src = process.customization_options.ZmumuCollection,
474  minNumber = cms.uint32(1)
475  )
476  process.goldenZmumuFilterEfficiencyPath = cms.Path(process.goldenZmumuSelectionSequence + process.goldenZmumuFilterResult + process.MEtoEDMConverter)
477  process.schedule.append(process.goldenZmumuFilterEfficiencyPath)
478  else:
479  print "Zmumu skim disabled"
480 
481  process.load("TauAnalysis/MCEmbeddingTools/muonRadiationFilter_cfi")
482  process.muonRadiationFilter.srcSelectedMuons = process.customization_options.ZmumuCollection
483  if process.customization_options.applyMuonRadiationFilter.value():
484  print "Muon -> muon + photon radiation filter enabled"
485  # CV: add filter at the end of reconstruction path
486  # (filter needs mixed 'pfPileUp' and 'pfNoPileUp' collections)
487  process.reconstruction_step += process.muonRadiationFilterSequence
488  process.options = cms.untracked.PSet(
489  wantSummary = cms.untracked.bool(True)
490  )
491  # CV: keep track of which events pass/fail muon -> muon + photon radiation filter
492  process.muonRadiationFilterResult = cms.EDProducer("DummyBoolEventSelFlagProducer")
493  process.muonRadiationFilterEfficiencyPath = cms.Path(process.goldenZmumuSelectionSequence + process.muonRadiationFilterSequence + process.muonRadiationFilterResult)
494  process.schedule.append(process.muonRadiationFilterEfficiencyPath)
495  else:
496  print "Muon -> muon + photon radiation filter disabled"
497 
498  # CV: disable ECAL/HCAL noise simulation
499  if process.customization_options.disableCaloNoise.value():
500  print "Disabling ECAL/HCAL noise simulation"
501  process.simEcalUnsuppressedDigis.doNoise = cms.bool(False)
502  process.simEcalUnsuppressedDigis.doESNoise = cms.bool(False)
503  process.simHcalUnsuppressedDigis.doNoise = cms.bool(False)
504  process.simHcalUnsuppressedDigis.doThermalNoise = cms.bool(False)
505  else:
506  print "Keeping ECAL/HCAL noise simulation enabled"
507 
508  # CV: apply/do not apply muon momentum corrections determined by Rochester group
509  if process.customization_options.replaceGenOrRecMuonMomenta.value() == "rec" and hasattr(process, "goldenZmumuSelectionSequence"):
510  if process.customization_options.applyRochesterMuonCorr.value():
511  print "Enabling Rochester muon momentum corrections"
512  process.patMuonsForZmumuSelectionRochesterMomentumCorr = cms.EDProducer("RochesterCorrPATMuonProducer",
513  src = cms.InputTag('patMuonsForZmumuSelection'),
514  isMC = cms.bool(process.customization_options.isMC.value())
515  )
516  process.goldenZmumuSelectionSequence.replace(process.patMuonsForZmumuSelection, process.patMuonsForZmumuSelection*process.patMuonsForZmumuSelectionRochesterMomentumCorr)
517  process.goodMuons.src = cms.InputTag('patMuonsForZmumuSelectionRochesterMomentumCorr')
518  else:
519  print "Rochester muon momentum corrections disabled"
520 
521  if process.customization_options.applyMuonRadiationCorrection.value() != "":
522  print "Muon -> muon + photon radiation correction enabled"
523  process.load("TauAnalysis/MCEmbeddingTools/muonRadiationCorrWeightProducer_cfi")
524  if process.customization_options.applyMuonRadiationCorrection.value() == "photos":
525  process.muonRadiationCorrWeightProducer.lutDirectoryRef = cms.string('genMuonRadCorrAnalyzerPHOTOS')
526  process.muonRadiationCorrWeightProducer.lutDirectoryOthers = cms.PSet(
527  Summer12mcMadgraph = cms.string('genMuonRadCorrAnalyzer')
528  )
529  elif process.customization_options.applyMuonRadiationCorrection.value() == "pythia":
530  process.muonRadiationCorrWeightProducer.lutDirectoryRef = cms.string('genMuonRadCorrAnalyzerPYTHIA')
531  process.muonRadiationCorrWeightProducer.lutDirectoryOthers = cms.PSet(
532  Summer12mcMadgraph = cms.string('genMuonRadCorrAnalyzer')
533  )
534  else:
535  raise ValueError("Invalid Configuration parameter 'applyMuonRadiationCorrection' = %s !!" % process.customization_options.applyMuonRadiationCorrection.value())
536  process.reconstruction_step += process.muonRadiationCorrWeightProducer
537  outputModule.outputCommands.extend([
538  'keep *_muonRadiationCorrWeightProducer_*_*',
539  'keep *_generator_muonsBeforeRad_*',
540  'keep *_generator_muonsAfterRad_*'
541  ])
542  else:
543  print "Muon -> muon + photon radiation correction disabled"
544 
545  # CV: compute reweighting factors to compensate for smearing of di-muon Pt and mass distributions caused by:
546  # o (mis)reconstruction of muon momenta
547  # o muon -> muon + photon radiation corrections
548  process.load("TauAnalysis/MCEmbeddingTools/embeddingKineReweight_cff")
549  if process.customization_options.applyMuonRadiationCorrection.value() != "":
550  if process.customization_options.mdtau.value() == 116:
551  process.embeddingKineReweightGENtoEmbedded.inputFileName = cms.FileInPath("TauAnalysis/MCEmbeddingTools/data/makeEmbeddingKineReweightLUTs_GENtoEmbedded_mutau.root")
552  process.reconstruction_step += process.embeddingKineReweightSequenceGENtoEmbedded
553  elif process.customization_options.mdtau.value() == 115:
554  process.embeddingKineReweightGENtoEmbedded.inputFileName = cms.FileInPath("TauAnalysis/MCEmbeddingTools/data/makeEmbeddingKineReweightLUTs_GENtoEmbedded_etau.root")
555  process.reconstruction_step += process.embeddingKineReweightSequenceGENtoEmbedded
556  if process.customization_options.replaceGenOrRecMuonMomenta.value() == 'rec':
557  process.reconstruction_step += process.embeddingKineReweightSequenceGENtoREC
558  outputModule.outputCommands.extend([
559  'keep *_embeddingKineReweight_*_*'
560  ])
561 
562  # CV: compute weights for correcting Embedded samples
563  # for efficiency with which Zmumu events used as input for Embedding production were selected
564  process.load("TauAnalysis/MCEmbeddingTools/ZmumuEvtSelEffCorrWeightProducer_cfi")
565  process.ZmumuEvtSelEffCorrWeightProducer.selectedMuons = process.customization_options.ZmumuCollection
566  process.ZmumuEvtSelEffCorrWeightProducer.verbosity = cms.int32(0)
567  process.reconstruction_step += process.ZmumuEvtSelEffCorrWeightProducer
568  outputModule.outputCommands.extend([
569  'keep *_ZmumuEvtSelEffCorrWeightProducer_*_*'
570  ])
571 
572  return(process)
return(e1-e2)*(e1-e2)+dp *dp
double split
Definition: MVATrainer.cc:139
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