/ElectroWeakAnalysis/ZEE/test/pat_ZeePlots_data.py

https://github.com/aivanov-cern/cmssw · Python · 189 lines · 103 code · 21 blank · 65 comment · 0 complexity · 1f1048b27d47893a2f63d5f89c3fdb97 MD5 · raw file

  1. import FWCore.ParameterSet.Config as cms
  2. process = cms.Process("PAT")
  3. process.MessageLogger = cms.Service(
  4. "MessageLogger",
  5. categories = cms.untracked.vstring('info', 'debug','cout')
  6. )
  7. process.options = cms.untracked.PSet(
  8. Rethrow = cms.untracked.vstring('ProductNotFound')
  9. )
  10. # source
  11. process.source = cms.Source("PoolSource",
  12. fileNames = cms.untracked.vstring(
  13. "dcap://gfe02:22128/pnfs/hep.ph.ic.ac.uk/data/cms/store/data/Commissioning10/MinimumBias/RECO/May6thPDSkim2_SD_EG-v1/0135/FCC2FA5A-BB5D-DF11-8246-002618943978.root"
  14. )
  15. )
  16. process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(300) )
  17. ## Load additional processes
  18. process.load("Configuration.StandardSequences.Geometry_cff")
  19. process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
  20. ## global tags:
  21. process.GlobalTag.globaltag = cms.string('GR_R_35X_V8B::All')
  22. process.load("Configuration.StandardSequences.MagneticField_cff")
  23. ################################################################################################
  24. ### P r e p a r a t i o n o f t h e P A T O b j e c t s f r o m A O D ###
  25. ################################################################################################
  26. ## pat sequences to be loaded:
  27. #process.load("PhysicsTools.PFCandProducer.PF2PAT_cff")
  28. process.load("PhysicsTools.PatAlgos.patSequences_cff")
  29. #process.load("PhysicsTools.PatAlgos.triggerLayer1.triggerProducer_cff")
  30. ##
  31. ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  32. ## MET creation <=== WARNING: YOU MAY WANT TO MODIFY THIS PART OF THE CODE %%%%%%%%%%%%%
  33. ## specify the names of the MET collections that you need here %%%%
  34. ## #%%
  35. ## if you don't specify anything the default MET is the raw Calo MET #%%
  36. process.layer1RawCaloMETs = process.patMETs.clone( #%%
  37. metSource = cms.InputTag("met","","RECO"),
  38. addTrigMatch = cms.bool(False),
  39. addMuonCorrections = cms.bool(False),
  40. addGenMET = cms.bool(False),
  41. )
  42. ## specify here what you want to have on the plots! <===== MET THAT YOU WANT ON THE PLOTS %%%%%%%
  43. myDesiredMetCollection = 'layer1RawCaloMETs'
  44. ## modify the sequence of the MET creation: #%%
  45. process.makePatMETs = cms.Sequence(process.layer1RawCaloMETs)
  46. ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  47. ## modify the final pat sequence: keep only electrons + METS (muons are needed for met corrections)
  48. process.load("RecoEgamma.EgammaIsolationAlgos.egammaIsolationSequence_cff")
  49. #process.patElectronIsolation = cms.Sequence(process.egammaIsolationSequence)
  50. #
  51. process.patElectrons.isoDeposits = cms.PSet()
  52. process.patElectrons.userIsolation = cms.PSet(
  53. # tracker = cms.PSet(
  54. # src = cms.InputTag("electronTrackIsolationScone"),
  55. # ),
  56. # ecal = cms.PSet(
  57. # src = cms.InputTag("electronEcalRecHitIsolationLcone"),
  58. # ),
  59. # hcal = cms.PSet(
  60. # src = cms.InputTag("electronHcalTowerIsolationLcone"),
  61. # ),
  62. # user = cms.VPSet(),
  63. )
  64. ##
  65. ## Pre-calculated electron identification selections
  66. ##
  67. ## set the variable false if you don't need them, or if you use your own PSet
  68. ##
  69. ## any input tag you set corresponds to a valuemap that either it is stored in the event
  70. ## or you create it yourself
  71. process.patElectrons.addElectronID = cms.bool(True)
  72. process.patElectrons.electronIDSources = cms.PSet(
  73. simpleEleId95relIso= cms.InputTag("simpleEleId95relIso"),
  74. simpleEleId90relIso= cms.InputTag("simpleEleId90relIso"),
  75. simpleEleId85relIso= cms.InputTag("simpleEleId85relIso"),
  76. simpleEleId80relIso= cms.InputTag("simpleEleId80relIso"),
  77. simpleEleId70relIso= cms.InputTag("simpleEleId70relIso"),
  78. simpleEleId60relIso= cms.InputTag("simpleEleId60relIso"),
  79. simpleEleId95cIso= cms.InputTag("simpleEleId95cIso"),
  80. simpleEleId90cIso= cms.InputTag("simpleEleId90cIso"),
  81. simpleEleId85cIso= cms.InputTag("simpleEleId85cIso"),
  82. simpleEleId80cIso= cms.InputTag("simpleEleId80cIso"),
  83. simpleEleId70cIso= cms.InputTag("simpleEleId70cIso"),
  84. simpleEleId60cIso= cms.InputTag("simpleEleId60cIso"),
  85. )
  86. ##
  87. process.patElectrons.addGenMatch = cms.bool(False)
  88. process.patElectrons.embedGenMatch = cms.bool(False)
  89. ##
  90. process.patElectrons.addGenMatch = cms.bool(False)
  91. process.patElectrons.embedGenMatch = cms.bool(False)
  92. ##
  93. process.load("ElectroWeakAnalysis.ZEE.simpleEleIdSequence_cff")
  94. process.patElectronIDs = cms.Sequence(process.simpleEleIdSequence)
  95. process.makePatElectrons = cms.Sequence(process.patElectronIDs*process.patElectrons)
  96. # process.makePatMuons may be needed depending on how you calculate the MET
  97. process.makePatCandidates = cms.Sequence(process.makePatElectrons+process.makePatMETs)
  98. process.patDefaultSequence = cms.Sequence(process.makePatCandidates)
  99. ## ################################################################################
  100. ##
  101. ## the filter to select the candidates from the data samples
  102. ##
  103. ## WARNING: you may want to modify this item: T R I G G E R S E L E C T I O N
  104. HLT_process_name = "HLT" #
  105. # trigger path selection
  106. HLT_path_name = "HLT_Photon10_L1R" #= "HLT_Ele15_LW_L1R" #
  107. # trigger filter name
  108. HLT_filter_name = "hltL1NonIsoHLTNonIsoSinglePhotonEt10HcalIsolFilter"
  109. #
  110. process.zeeFilter = cms.EDFilter('ZeeCandidateFilter',
  111. # cfg for data
  112. dataMagneticFieldSetUp = cms.untracked.bool(True),
  113. dcsTag = cms.untracked.InputTag("scalersRawToDigi"),
  114. # cuts
  115. ETCut = cms.untracked.double(20.),
  116. METCut = cms.untracked.double(0.),
  117. useTriggerInfo = cms.untracked.bool(True),
  118. # trigger
  119. triggerCollectionTag = cms.untracked.InputTag("TriggerResults","",HLT_process_name),
  120. triggerEventTag = cms.untracked.InputTag("hltTriggerSummaryAOD","",HLT_process_name),
  121. hltpath = cms.untracked.string(HLT_path_name),
  122. hltpathFilter = cms.untracked.InputTag(HLT_filter_name,"",HLT_process_name),
  123. electronMatched2HLT = cms.untracked.bool(True),
  124. electronMatched2HLT_DR = cms.untracked.double(0.2),
  125. # exra variable calculation
  126. calculateConversionRejection = cms.untracked.bool(True),
  127. calculateValidFirstPXBHit = cms.untracked.bool(True),
  128. calculateExpectedMissingHits = cms.untracked.bool(True),
  129. # electrons and MET
  130. electronCollectionTag = cms.untracked.InputTag("patElectrons","","PAT"),
  131. metCollectionTag = cms.untracked.InputTag(myDesiredMetCollection,"","PAT")
  132. )
  133. ####################################################################################
  134. ##
  135. ## the Z selection that you prefer
  136. from ElectroWeakAnalysis.ZEE.simpleCutBasedSpring10SelectionBlocks_cfi import *
  137. selection_inverse = cms.PSet (
  138. deta_EB_inv = cms.untracked.bool(True),
  139. deta_EE_inv = cms.untracked.bool(True)
  140. )
  141. selection_secondLeg = cms.PSet (
  142. ## set this to true if you want to switch on diff 2nd leg selection
  143. useDifferentSecondLegSelection = cms.untracked.bool(False),
  144. ## preselection criteria are independent of useDifferentSecondLegSelection
  145. # set them to False if you don't want them
  146. useConversionRejection2 = cms.untracked.bool(False),
  147. useValidFirstPXBHit2 = cms.untracked.bool(False),
  148. useExpectedMissingHits2 =cms.untracked.bool(False),
  149. maxNumberOfExpectedMissingHits2 = cms.untracked.int32(1),
  150. ##
  151. usePrecalcID2 = cms.untracked.bool(False),
  152. usePrecalcIDType2 = cms.untracked.string('simpleEleId95cIso'),
  153. usePrecalcIDSign2 = cms.untracked.string('='),
  154. usePrecalcIDValue2 = cms.untracked.double(7),
  155. )
  156. ####################################################################################
  157. ##
  158. ## and the plot creator
  159. process.plotter = cms.EDAnalyzer('ZeePlots',
  160. selection_95relIso,
  161. selection_secondLeg,
  162. usePrecalcID = cms.untracked.bool(False),
  163. usePrecalcIDType = cms.untracked.string('simpleEleId95cIso'),
  164. usePrecalcIDSign = cms.untracked.string('='),
  165. usePrecalcIDValue = cms.untracked.double(7),
  166. zeeCollectionTag = cms.untracked.InputTag("zeeFilter","selectedZeeCandidates","PAT")
  167. )
  168. process.p = cms.Path(process.patDefaultSequence +process.zeeFilter + process.plotter)