CMS 3D CMS Logo

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

Functions

def customise
 

Function Documentation

def embeddingCustomizeAll.customise (   process)

Definition at line 9 of file embeddingCustomizeAll.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 *_genMuonRadiationFilter_*_*',
147  'keep *_muonRadiationFilter_*_*'
148  ])
149 
150  # CV: keep HepMCProduct for embedded event,
151  # in order to run Validation/EventGenerator/python/TauValidation_cfi.py
152  # for control plots of tau polarization and decay mode information
153  outputModule.outputCommands.extend([
154  'keep *HepMCProduct_generator_*_*'
155  ])
156 
157  # keep distance of muons traversed in ECAL and HCAL,
158  # expected and removed muon energy deposits
159  outputModule.outputCommands.extend([
160  'keep *_muonCaloEnergyDepositsByDistance_totalDistanceMuPlus_*',
161  'keep *_muonCaloEnergyDepositsByDistance_totalEnergyDepositMuPlus_*',
162  'keep *_muonCaloEnergyDepositsByDistance_totalDistanceMuMinus_*',
163  'keep *_muonCaloEnergyDepositsByDistance_totalEnergyDepositMuMinus_*',
164  'keep *_castorreco_removedEnergyMuMinus*_*',
165  'keep *_castorreco_removedEnergyMuPlus*_*',
166  'keep *_hfreco_removedEnergyMuMinus*_*',
167  'keep *_hfreco_removedEnergyMuPlus*_*',
168  'keep *_ecalPreshowerRecHit_removedEnergyMuMinus*_*',
169  'keep *_ecalPreshowerRecHit_removedEnergyMuPlus*_*',
170  'keep *_ecalRecHit_removedEnergyMuMinus*_*',
171  'keep *_ecalRecHit_removedEnergyMuPlus*_*',
172  'keep *_hbhereco_removedEnergyMuMinus*_*',
173  'keep *_hbhereco_removedEnergyMuPlus*_*',
174  'keep *_horeco_removedEnergyMuMinus*_*',
175  'keep *_horeco_removedEnergyMuPlus*_*',
176  ])
177 
178  # replace HLT process name
179  # (needed for certain reprocessed Monte Carlo samples)
180  hltProcessName = "HLT"
181  try:
182  hltProcessName = __HLT__
183  except:
184  pass
185  try:
186  process.dimuonsHLTFilter.TriggerResultsTag.processName = hltProcessName
187  process.goodZToMuMuAtLeast1HLT.TrigTag.processName = hltProcessName
188  process.goodZToMuMuAtLeast1HLT.triggerEvent.processName = hltProcessName
189  process.hltTrigReport,HLTriggerResults.processName = hltProcessName
190  except:
191  pass
192 
193  # disable L1GtTrigReport module
194  # (not used for anything yet, just prints error for every single event)
195  if hasattr(process, 'HLTAnalyzerEndpath'):
196  process.HLTAnalyzerEndpath.remove(process.hltL1GtTrigReport)
197 
198  # apply configuration parameters
199  print "Setting mdtau to %i" % process.customization_options.mdtau.value()
200  process.generator.Ztautau.TauolaOptions.InputCards.mdtau = process.customization_options.mdtau
201  if hasattr(process.generator, "ParticleGun"):
202  process.generator.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = process.customization_options.mdtau
203  if process.customization_options.useTauolaPolarization.value():
204  print "Enabling tau polarization effects in TAUOLA"
205  # NOTE: polarization effects are only approximate,
206  # because Embedded events do not have proper parton history in HepMC::GenEvent
207  # (cf. arXiv:hep-ph/0101311 and arXiv:1201.0117)
208  process.generator.Ztautau.TauolaOptions.UseTauolaPolarization = cms.bool(True)
209  else:
210  print "Disabling tau polarization effects in TAUOLA"
211  # NOTE: tau polarization effects need to be added by reweighting Embedded events
212  # using weights computed by TauSpinner package
213  process.generator.Ztautau.TauolaOptions.UseTauolaPolarization = cms.bool(False)
214 
215  print "Setting minVisibleTransverseMomentum to '%s'" % process.customization_options.minVisibleTransverseMomentum.value()
216  process.generator.Ztautau.minVisibleTransverseMomentum = process.customization_options.minVisibleTransverseMomentum
217 
218  print "Setting transformationMode to %i" % process.customization_options.transformationMode.value()
219  process.generator.Ztautau.transformationMode = process.customization_options.transformationMode
220 
221  print "Setting rfRotationAngle to %1.0f" % process.customization_options.rfRotationAngle.value()
222  process.generator.Ztautau.rfRotationAngle = process.customization_options.rfRotationAngle
223 
224  if process.customization_options.overrideBeamSpot.value():
225  bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v28_offline")
226  process.GlobalTag.toGet = cms.VPSet(
227  cms.PSet(
228  record = cms.string("BeamSpotObjectsRcd"),
229  tag = bs,
230  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_31X_BEAMSPOT")
231  )
232  )
233  print "BeamSpot in globaltag set to '%s'" % bs
234  else:
235  print "BeamSpot in globaltag not changed"
236 
237  # CV: disable gen. vertex smearing
238  # (embed tau leptons exactly at Z->mumu event vertex)
239  print "Disabling gen. vertex smearing"
240  process.VtxSmeared = cms.EDProducer("FlatEvtVtxGenerator",
241  MaxZ = cms.double(0.0),
242  MaxX = cms.double(0.0),
243  MaxY = cms.double(0.0),
244  MinX = cms.double(0.0),
245  MinY = cms.double(0.0),
246  MinZ = cms.double(0.0),
247  TimeOffset = cms.double(0.0),
248  src = cms.InputTag("generator")
249  )
250 
251  if process.customization_options.useJson.value():
252  print "Enabling event selection by JSON file"
253  import PhysicsTools.PythonAnalysis.LumiList as LumiList
254  import FWCore.ParameterSet.Types as CfgTypes
255  myLumis = LumiList.LumiList(filename = 'my.json').getCMSSWString().split(',')
256  process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange())
257  process.source.lumisToProcess.extend(myLumis)
258 
259  #----------------------------------------------------------------------------------------------------------------------
260  # CV: need to rerun particle-flow algorithm in order to create links between PFMuon -> PFBlocks -> PFClusters -> PFRecHits
261  # (configure particle-flow sequence before overwriting modules in order to mix collections
262  # of objects reconstructed and Z -> mu+ mu- event with simulated tau decay products)
263  if process.customization_options.embeddingMode.value() == "RH" and process.customization_options.cleaningMode == 'PF':
264  rerunParticleFlow(process, inputProcess)
265  process.ProductionFilterSequence += process.rerunParticleFlowSequenceForPFMuonCleaning
266  #----------------------------------------------------------------------------------------------------------------------
267 
268  # mix "general" Track collection
269  process.generalTracksORG = process.generalTracks.clone()
270  process.generalTracks = cms.EDProducer("TrackMixer",
271  todo = cms.VPSet(
272  cms.PSet(
273  collection1 = cms.InputTag("generalTracksORG", "", "EmbeddedRECO"),
274  collection2 = cms.InputTag("cleanedGeneralTracks")
275  )
276  ),
277  verbosity = cms.int32(0)
278  )
279 
280  for p in process.paths:
281  pth = getattr(process,p)
282  if "generalTracks" in pth.moduleNames():
283  pth.replace(process.generalTracks, process.generalTracksORG*process.generalTracks)
284 
285  #----------------------------------------------------------------------------------------------------------------------
286  # CV/TF: mixing of std::vector<Trajectory> from Zmumu event and embedded tau decay products does not work yet.
287  # For the time-being, we need to use the Trajectory objects from the embedded event
288  process.trackerDrivenElectronSeedsORG = process.trackerDrivenElectronSeeds.clone()
289  process.trackerDrivenElectronSeedsORG.TkColList = cms.VInputTag(
290  cms.InputTag("generalTracksORG")
291  )
292 
293  process.trackerDrivenElectronSeeds = cms.EDProducer("ElectronSeedTrackRefUpdater",
294  PreIdLabel = process.trackerDrivenElectronSeedsORG.PreIdLabel,
295  PreGsfLabel = process.trackerDrivenElectronSeedsORG.PreGsfLabel,
296  targetTracks = cms.InputTag("generalTracks"),
297  inSeeds = cms.InputTag("trackerDrivenElectronSeedsORG", process.trackerDrivenElectronSeedsORG.PreGsfLabel.value()),
298  inPreId = cms.InputTag("trackerDrivenElectronSeedsORG", process.trackerDrivenElectronSeedsORG.PreIdLabel.value()),
299  )
300 
301  for p in process.paths:
302  pth = getattr(process,p)
303  if "trackerDrivenElectronSeeds" in pth.moduleNames():
304  pth.replace(process.trackerDrivenElectronSeeds, process.trackerDrivenElectronSeedsORG*process.trackerDrivenElectronSeeds)
305 
306  # CV: need to keep 'generalTracksORG' collection in event-content,
307  # as (at least electron based) PFCandidates will refer to it,
308  # causing exception in 'pfNoPileUp' module otherwise
309  outputModule.outputCommands.extend(['keep recoTracks_generalTracksORG_*_*'])
310  #----------------------------------------------------------------------------------------------------------------------
311 
312  #----------------------------------------------------------------------------------------------------------------------
313  # mix collections of GSF electron tracks
314  process.electronGsfTracksORG = process.electronGsfTracks.clone()
315  process.electronGsfTracks = cms.EDProducer("GsfTrackMixer",
316  collection1 = cms.InputTag("electronGsfTracksORG", "", "EmbeddedRECO"),
317  collection2 = cms.InputTag("electronGsfTracks", "", inputProcess)
318  )
319 
320  process.gsfConversionTrackProducer.TrackProducer = cms.string('electronGsfTracksORG')
321 
322  for p in process.paths:
323  pth = getattr(process,p)
324  if "electronGsfTracks" in pth.moduleNames():
325  pth.replace(process.electronGsfTracks, process.electronGsfTracksORG*process.electronGsfTracks)
326 
327  process.generalConversionTrackProducer.TrackProducer = cms.string('generalTracksORG')
328  process.uncleanedOnlyGeneralConversionTrackProducer.TrackProducer = cms.string('generalTracksORG')
329 
330  process.gsfElectronsORG = process.gsfElectrons.clone()
331  process.gsfElectrons = cms.EDProducer("GSFElectronsMixer",
332  col1 = cms.InputTag("gsfElectronsORG"),
333  col2 = cms.InputTag("gsfElectrons", "", inputProcess)
334  )
335  for p in process.paths:
336  pth = getattr(process,p)
337  if "gsfElectrons" in pth.moduleNames():
338  pth.replace(process.gsfElectrons, process.gsfElectronsORG*process.gsfElectrons)
339  #----------------------------------------------------------------------------------------------------------------------
340 
341  # dE/dx information for mixed track collections not yet implemented in 'TracksMixer' module,
342  # disable usage of dE/dx information in all event reconstruction modules for now
343  for p in process.paths:
344  pth = getattr(process,p)
345  for mod in pth.moduleNames():
346  if mod.find("dedx") != -1 and mod.find("Zmumu") == -1:
347  if mod.find("ForPFMuonCleaning") == -1:
348  print "Removing %s" % mod
349  module = getattr(process, mod)
350  pth.remove(module)
351 
352  # CV: Compute expected energy deposits of muon in EB/EE, HB/HE and HO:
353  # (1) compute distance traversed by muons produced in Z -> mu+ mu- decay
354  # through individual calorimeter cells
355  # (2) scale distances by expected energy loss dE/dx of muon
356  from TrackingTools.TrackAssociator.default_cfi import TrackAssociatorParameterBlock
357  process.muonCaloDistances = cms.EDProducer('MuonCaloDistanceProducer',
358  trackAssociator = TrackAssociatorParameterBlock.TrackAssociatorParameters,
359  selectedMuons = process.customization_options.ZmumuCollection)
360  process.ProductionFilterSequence += process.muonCaloDistances
361 
362  # mix collections of L1Extra objects
363  l1ExtraCollections = [
364  [ "L1EmParticle", "Isolated" ],
365  [ "L1EmParticle", "NonIsolated" ],
366  [ "L1EtMissParticle", "MET" ],
367  [ "L1EtMissParticle", "MHT" ],
368  [ "L1JetParticle", "Central" ],
369  [ "L1JetParticle", "Forward" ],
370  [ "L1JetParticle", "Tau" ],
371  [ "L1MuonParticle", "" ]
372  ]
373  l1extraParticleCollections = []
374  for l1ExtraCollection in l1ExtraCollections:
375  inputType = l1ExtraCollection[0]
376  pluginType = None
377  srcVeto = cms.InputTag('')
378  dRveto = 0.
379  if inputType == "L1EmParticle":
380  pluginType = "L1ExtraEmParticleMixerPlugin"
381  srcSelectedMuons = process.customization_options.ZmumuCollection
382  dRveto = 0.3
383  elif inputType == "L1EtMissParticle":
384  pluginType = "L1ExtraMEtMixerPlugin"
385  elif inputType == "L1JetParticle":
386  pluginType = "L1ExtraJetParticleMixerPlugin"
387  srcSelectedMuons = process.customization_options.ZmumuCollection
388  dRveto = 0.3
389  elif inputType == "L1MuonParticle":
390  pluginType = "L1ExtraMuonParticleMixerPlugin"
391  srcSelectedMuons = process.customization_options.ZmumuCollection
392  dRveto = 0.8
393  else:
394  raise ValueError("Invalid L1Extra type = %s !!" % inputType)
395  instanceLabel = l1ExtraCollection[1]
396  l1extraParticleCollections.append(cms.PSet(
397  pluginType = cms.string(pluginType),
398  instanceLabel = cms.string(instanceLabel),
399  srcSelectedMuons2 = srcSelectedMuons,
400  dRveto2 = cms.double(dRveto)))
401  if inputType == 'L1EtMissParticle':
402  l1extraParticleCollections[-1].srcMuons = cms.InputTag("muonCaloDistances", "muons")
403  l1extraParticleCollections[-1].distanceMapMuPlus = cms.InputTag("muonCaloDistances", "distancesMuPlus")
404  l1extraParticleCollections[-1].distanceMapMuMinus = cms.InputTag("muonCaloDistances", "distancesMuPlus")
405  l1extraParticleCollections[-1].H_Calo_AbsEtaLt12 = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.75)
406  l1extraParticleCollections[-1].H_Calo_AbsEta12to17 = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.6)
407  l1extraParticleCollections[-1].H_Calo_AbsEtaGt17 = cms.double(process.customization_options.muonCaloCleaningSF.value()*0.3)
408 
409  process.l1extraParticlesORG = process.l1extraParticles.clone()
410  process.l1extraParticles = cms.EDProducer('L1ExtraMixer',
411  src1 = cms.InputTag("l1extraParticlesORG"),
412  src2 = cms.InputTag("l1extraParticles", "", inputProcess),
413  collections = cms.VPSet(l1extraParticleCollections)
414  )
415  for p in process.paths:
416  pth = getattr(process,p)
417  if "l1extraParticles" in pth.moduleNames():
418  pth.replace(process.l1extraParticles, process.l1extraParticlesORG*process.l1extraParticles)
419 
420  if process.customization_options.embeddingMode.value() == "PF":
421  print "Using PF-embedding"
422  from TauAnalysis.MCEmbeddingTools.embeddingCustomizePF import customise as customisePF
423  customisePF(process, inputProcess)
424  elif process.customization_options.embeddingMode.value() == "RH":
425  print "Using RH-embedding"
426  from TauAnalysis.MCEmbeddingTools.embeddingCustomizeRH import customise as customiseRH
427  customiseRH(process, inputProcess)
428  else:
429  raise ValueError("Invalid Configuration parameter 'embeddingMode' = %s !!" % process.customization_options.embeddingMode.value())
430 
431  # it should be the best solution to take the original beam spot for the
432  # reconstruction of the new primary vertex
433  # use the one produced earlier, do not produce your own
434  for s in process.sequences:
435  seq = getattr(process,s)
436  seq.remove(process.offlineBeamSpot)
437 
438  try:
439  process.metreco.remove(process.BeamHaloId)
440  except:
441  pass
442 
443  try:
444  outputModule = process.output
445  except:
446  pass
447  try:
448  outputModule = getattr(process, str(getattr(process, list(process.endpaths)[-1])))
449  except:
450  pass
451 
452  process.filterEmptyEv.src = cms.untracked.InputTag("generator", "", "EmbeddedRECO")
453 
454  try:
455  process.schedule.remove(process.DQM_FEDIntegrity_v3)
456  except:
457  pass
458 
459  process.load("TauAnalysis/MCEmbeddingTools/ZmumuStandaloneSelection_cff")
460  process.goldenZmumuFilter.src = process.customization_options.ZmumuCollection
461  if process.customization_options.applyZmumuSkim.value():
462  print "Enabling Zmumu skim"
463  process.load("TrackingTools/TransientTrack/TransientTrackBuilder_cfi")
464  for path in process.paths:
465  if process.customization_options.isMC.value():
466  getattr(process,path)._seq = process.goldenZmumuFilterSequence * getattr(process,path)._seq
467  else:
468  getattr(process,path)._seq = process.goldenZmumuFilterSequenceData * getattr(process,path)._seq
469  process.options = cms.untracked.PSet(
470  wantSummary = cms.untracked.bool(True)
471  )
472  # CV: keep track of Z->mumu selection efficiency
473  process.goldenZmumuFilterResult = cms.EDProducer("CandViewCountEventSelFlagProducer",
474  src = process.customization_options.ZmumuCollection,
475  minNumber = cms.uint32(1)
476  )
477  process.goldenZmumuFilterEfficiencyPath = cms.Path(process.goldenZmumuSelectionSequence + process.goldenZmumuFilterResult + process.MEtoEDMConverter)
478  process.schedule.append(process.goldenZmumuFilterEfficiencyPath)
479  else:
480  print "Zmumu skim disabled"
481 
482  # CV: keep track of which events pass/fail muon -> muon + photon radiation filters
483  # on generator and reconstruction level, but do not actually reject any events
484  if process.customization_options.isMC.value():
485  process.load("TauAnalysis/MCEmbeddingTools/genMuonRadiationFilter_cfi")
486  process.genMuonRadiationFilter.srcGenParticles = cms.InputTag('genParticles::%s' % process.customization_options.inputProcessSIM.value())
487  process.genMuonRadiationFilter.invert = cms.bool(False)
488  process.genMuonRadiationFilter.filter = cms.bool(False)
489  process.reconstruction_step += process.genMuonRadiationFilter
490  # CV: keep track of which events pass/fail muon -> muon + photon radiation filter,
491  # but do not actually reject any events
492  process.load("TauAnalysis/MCEmbeddingTools/muonRadiationFilter_cfi")
493  process.particleFlowPtrsForMuonRadiationFilter.src = cms.InputTag('particleFlow', '', inputProcess)
494  process.muonRadiationFilter.srcSelectedMuons = process.customization_options.ZmumuCollection
495  process.muonRadiationFilter.invert = cms.bool(False)
496  process.muonRadiationFilter.filter = cms.bool(False)
497  process.reconstruction_step += process.muonRadiationFilterSequence
498 
499  # CV: disable ECAL/HCAL noise simulation
500  if process.customization_options.disableCaloNoise.value():
501  print "Disabling ECAL/HCAL noise simulation"
502  process.simEcalUnsuppressedDigis.doNoise = cms.bool(False)
503  process.simEcalUnsuppressedDigis.doESNoise = cms.bool(False)
504  process.simHcalUnsuppressedDigis.doNoise = cms.bool(False)
505  process.simHcalUnsuppressedDigis.doThermalNoise = cms.bool(False)
506  else:
507  print "Keeping ECAL/HCAL noise simulation enabled"
508 
509  # AB: The following producers are currently commented out. These mostly produce correction
510  # factors from input .root files. Such binary files are not desirable to have in a CMSSW
511  # release, so they are not included at the moment. A possible solution is to store and look
512  # up the correction factors via the Frontier DB.
513  """
514  # CV: apply/do not apply muon momentum corrections determined by Rochester group
515  if process.customization_options.replaceGenOrRecMuonMomenta.value() == "rec" and hasattr(process, "goldenZmumuSelectionSequence"):
516  if process.customization_options.applyRochesterMuonCorr.value():
517  print "Enabling Rochester muon momentum corrections"
518  process.patMuonsForZmumuSelectionRochesterMomentumCorr = cms.EDProducer("RochesterCorrPATMuonProducer",
519  src = cms.InputTag('patMuonsForZmumuSelection'),
520  isMC = cms.bool(process.customization_options.isMC.value())
521  )
522  process.goldenZmumuSelectionSequence.replace(process.patMuonsForZmumuSelection, process.patMuonsForZmumuSelection*process.patMuonsForZmumuSelectionRochesterMomentumCorr)
523  process.goodMuons.src = cms.InputTag('patMuonsForZmumuSelectionRochesterMomentumCorr')
524  else:
525  print "Rochester muon momentum corrections disabled"
526 
527  if process.customization_options.applyMuonRadiationCorrection.value() != "":
528  print "Muon -> muon + photon radiation correction enabled"
529  process.load("TauAnalysis/MCEmbeddingTools/muonRadiationCorrWeightProducer_cfi")
530  if process.customization_options.applyMuonRadiationCorrection.value() == "photos":
531  process.muonRadiationCorrWeightProducer.lutDirectoryRef = cms.string('genMuonRadCorrAnalyzerPHOTOS')
532  process.muonRadiationCorrWeightProducer.lutDirectoryOthers = cms.PSet(
533  Summer12mcMadgraph = cms.string('genMuonRadCorrAnalyzer')
534  )
535  elif process.customization_options.applyMuonRadiationCorrection.value() == "pythia":
536  process.muonRadiationCorrWeightProducer.lutDirectoryRef = cms.string('genMuonRadCorrAnalyzerPYTHIA')
537  process.muonRadiationCorrWeightProducer.lutDirectoryOthers = cms.PSet(
538  Summer12mcMadgraph = cms.string('genMuonRadCorrAnalyzer')
539  )
540  else:
541  raise ValueError("Invalid Configuration parameter 'applyMuonRadiationCorrection' = %s !!" % process.customization_options.applyMuonRadiationCorrection.value())
542  process.reconstruction_step += process.muonRadiationCorrWeightProducer
543  outputModule.outputCommands.extend([
544  'keep *_muonRadiationCorrWeightProducer_*_*',
545  'keep *_generator_muonsBeforeRad_*',
546  'keep *_generator_muonsAfterRad_*'
547  ])
548  else:
549  print "Muon -> muon + photon radiation correction disabled"
550 
551  # CV: compute reweighting factors to compensate for smearing of di-muon Pt and mass distributions caused by:
552  # o (mis)reconstruction of muon momenta
553  # o muon -> muon + photon radiation corrections
554  #
555  # mdtau values are defined in http:marpix1.in2p3.fr/Physics/biblio_top/mc_toprex_405.ps.gz
556  #
557  embeddingKineReweightTable = {
558  (115, 'elec1_9to30had1_15'): ('TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_ePt9to30tauPtGt18_genEmbedded.root', 'TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_ePt9to30tauPtGt18_recEmbedded.root'),
559  (115, 'elec1_20had1_18'): ('TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_ePtGt20tauPtGt18_genEmbedded.root', 'TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_ePtGt20tauPtGt18_recEmbedded.root'),
560  (116, 'mu1_7to25had1_15'): ('TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_muPt7to25tauPtGt18_genEmbedded.root', 'TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_muPt7to25tauPtGt18_recEmbedded.root'),
561  (116, 'mu1_16had1_18'): ('TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_muPtGt16tauPtGt18_genEmbedded.root', 'TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_muPtGt16tauPtGt18_recEmbedded.root'),
562  (121, 'elec1_17elec2_8'): ('TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_emu_genEmbedding.root', 'TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_emu_recEmbedding.root'),
563  (122, 'mu1_18mu2_8'): ('TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_emu_genEmbedding.root', 'TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_emu_recEmbedding.root'),
564  (123, 'tau1_18tau2_8'): ('TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_emu_genEmbedding.root', 'TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_emu_recEmbedding.root'),
565  (132, 'had1_30had2_30'): ('TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_tautau_genEmbedding.root', 'TauAnalysis/MCEmbeddingTools/data/embeddingKineReweight_tautau_recEmbedding.root')
566  }
567 
568  key = (process.customization_options.mdtau.value(), process.customization_options.minVisibleTransverseMomentum.value())
569  if key in embeddingKineReweightTable:
570  process.load("TauAnalysis/MCEmbeddingTools/embeddingKineReweight_cff")
571 
572  genEmbeddingReweightFile, recEmbeddingReweightFile = embeddingKineReweightTable[key]
573  process.embeddingKineReweightGENembedding.inputFileName = cms.FileInPath(genEmbeddingReweightFile)
574  process.embeddingKineReweightRECembedding.inputFileName = cms.FileInPath(recEmbeddingReweightFile)
575 
576  process.reconstruction_step += process.embeddingKineReweightSequence
577  outputModule.outputCommands.extend([
578  'keep *_embeddingKineReweight*_*_*'
579  ])
580  else:
581  print 'Do not produce embeddingKineWeights for mdtau=%d, minVisibleTransverseMomuntem=%s !!' % (key[0], key[1])
582 
583  # CV: compute weights for correcting Embedded samples
584  # for efficiency with which Zmumu events used as input for Embedding production were selected
585  process.load("TauAnalysis/MCEmbeddingTools/ZmumuEvtSelEffCorrWeightProducer_cfi")
586  process.ZmumuEvtSelEffCorrWeightProducer.selectedMuons = process.customization_options.ZmumuCollection
587  process.ZmumuEvtSelEffCorrWeightProducer.verbosity = cms.int32(0)
588  process.reconstruction_step += process.ZmumuEvtSelEffCorrWeightProducer
589  outputModule.outputCommands.extend([
590  'keep *_ZmumuEvtSelEffCorrWeightProducer_*_*'
591  ])
592  """
593 
594  # TauSpinner
595 # process.RandomNumberGeneratorService.TauSpinnerReco = cms.PSet(
596 # initialSeed = cms.untracked.uint32(123456789),
597 # engineName = cms.untracked.string('HepJamesRandom')
598 # )
599 
600 # process.load('GeneratorInterface.ExternalDecays.TauSpinner_cfi')
601 # #process.TauSpinnerReco.isTauolaConfigured = cms.bool(True)
602 # process.reconstruction_step += process.TauSpinnerReco
603 # outputModule.outputCommands.extend([
604 # 'keep *_TauSpinnerReco_*_*'
605 # ])
606 
607  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