/ElectroWeakAnalysis/Utilities/test/distortedMuons.py

https://github.com/aivanov-cern/cmssw · Python · 79 lines · 51 code · 13 blank · 15 comment · 0 complexity · 3a18dd17cc3679add539dbc2c1bc86de MD5 · raw file

  1. import FWCore.ParameterSet.Config as cms
  2. # Process, how many events, inout files, ...
  3. process = cms.Process("distortMuons")
  4. process.maxEvents = cms.untracked.PSet(
  5. input = cms.untracked.int32(-1)
  6. #input = cms.untracked.int32(100)
  7. )
  8. process.source = cms.Source("PoolSource",
  9. #fileNames = cms.untracked.vstring("file:/data4/Wmunu_Summer09-MC_31X_V3-v1_GEN-SIM-RECO/0009/76E35258-507F-DE11-9A21-0022192311C5.root")
  10. fileNames = cms.untracked.vstring("file:/data4/Wmunu_Summer09-MC_31X_V3_AODSIM-v1/0009/F82D4260-507F-DE11-B5D6-00093D128828.root")
  11. )
  12. # Debug/info printouts
  13. process.MessageLogger = cms.Service("MessageLogger",
  14. debugModules = cms.untracked.vstring('distortedMuons'),
  15. cout = cms.untracked.PSet(
  16. default = cms.untracked.PSet( limit = cms.untracked.int32(1000) ),
  17. #threshold = cms.untracked.string('INFO')
  18. threshold = cms.untracked.string('DEBUG')
  19. ),
  20. destinations = cms.untracked.vstring('cout')
  21. )
  22. # GEN-REC muon matching
  23. process.genMatchMap = cms.EDFilter("MCTruthDeltaRMatcherNew",
  24. src = cms.InputTag("muons"),
  25. matched = cms.InputTag("genParticles"),
  26. distMin = cms.double(0.15),
  27. matchPDGId = cms.vint32(13)
  28. )
  29. # Create a new "distorted" Muon collection
  30. process.distortedMuons = cms.EDFilter("DistortedMuonProducer",
  31. MuonTag = cms.untracked.InputTag("muons"),
  32. GenMatchTag = cms.untracked.InputTag("genMatchMap"),
  33. EtaBinEdges = cms.untracked.vdouble(-2.1,2.1), # one more entry than next vectors
  34. ShiftOnOneOverPt = cms.untracked.vdouble(1.e-3), #in [1/GeV] units
  35. RelativeShiftOnPt = cms.untracked.vdouble(0.), # relative
  36. UncertaintyOnOneOverPt = cms.untracked.vdouble(2.e-3), #in [1/GeV] units
  37. RelativeUncertaintyOnPt = cms.untracked.vdouble(5.e-3), # relative
  38. EfficiencyRatioOverMC = cms.untracked.vdouble(0.90)
  39. )
  40. ### NOTE: the following WMN selectors require the presence of
  41. ### the libraries and plugins fron the ElectroWeakAnalysis/WMuNu package
  42. ### So you need to process the ElectroWeakAnalysis/WMuNu package with
  43. ### some old CMSSW versions (at least <=3_1_2, <=3_3_0_pre4)
  44. #
  45. # WMN fast selector (use W candidates in this example)
  46. process.load("ElectroWeakAnalysis.WMuNu.WMuNuSelection_cff")
  47. process.corMetWMuNus.MuonTag = cms.untracked.InputTag("distortedMuons")
  48. process.selcorMet.MuonTag = cms.untracked.InputTag("distortedMuons")
  49. # Output
  50. process.load("Configuration.EventContent.EventContent_cff")
  51. process.AODSIMEventContent.outputCommands.append('keep *_distortedMuons_*_*')
  52. process.myEventContent = process.AODSIMEventContent
  53. process.wmnOutput = cms.OutputModule("PoolOutputModule",
  54. process.myEventContent,
  55. SelectEvents = cms.untracked.PSet(
  56. SelectEvents = cms.vstring('distortMuons')
  57. ),
  58. fileName = cms.untracked.string('selectedEvents.root')
  59. )
  60. # Steering the process
  61. process.distortMuons = cms.Path(
  62. process.genMatchMap
  63. *process.distortedMuons
  64. *process.selectCaloMetWMuNus
  65. )
  66. process.end = cms.EndPath(process.wmnOutput)