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