CMS 3D CMS Logo

customizeOldEGReco.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 import FWCore.ParameterSet.Utilities as psu
3 from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag as _replaceTags
4 
5 def customizeOldEGReco(process):
6  for path in process.paths:
7  sequences = getattr(process,path)
8  #for seq in path:
9  _replaceTags(sequences,
10  cms.InputTag('gedGsfElectrons'),
11  cms.InputTag('gsfElectrons'),
12  skipLabelTest=True)
13  _replaceTags(sequences,
14  cms.InputTag('gedGsfElectronCores'),
15  cms.InputTag('gsfElectronCores'),
16  skipLabelTest=True)
17  #for seq in path:
18  _replaceTags(sequences,
19  cms.InputTag('gedPhotons'),
20  cms.InputTag('photons'),
21  skipLabelTest=True)
22  _replaceTags(sequences,
23  cms.InputTag('gedPhotonCore'),
24  cms.InputTag('photonCore'),
25  skipLabelTest=True)
26 
27  # all the rest:
28  if hasattr(process,'DigiToRaw'):
29  process=_customize_DigiToRaw(process)
30  if hasattr(process,'RawToDigi'):
31  process=_customize_RawToDigi(process)
32  if hasattr(process,'reconstruction'):
33  process=_customize_Reco(process)
34  if hasattr(process,'reconstructionWithFamos'):
35  process=_customize_FastSim(process)
36  if hasattr(process,'digitisation_step'):
37  process=_customize_Digi(process)
38  if hasattr(process,'HLTSchedule'):
39  process=_customize_HLT(process)
40  if hasattr(process,'L1simulation_step'):
41  process=_customize_L1Emulator(process)
42  if hasattr(process,'dqmoffline_step'):
43  process=_customize_DQM(process)
44  if hasattr(process,'dqmHarvesting'):
45  process=_customize_harvesting(process)
46  if hasattr(process,'validation_step'):
47  process=_customize_Validation(process)
48 
49 
50  return process
51 
53  #fix a few things in the GED from the mass-replace
54  process.gedGsfElectronsTmp.gsfElectronCoresTag = cms.InputTag('gedGsfElectronCores')
55  process.particleBasedIsolation.electronProducer = cms.InputTag("gedGsfElectrons")
56  process.gedPhotonsTmp.photonProducer = cms.InputTag('gedPhotonCore')
57  process.particleBasedIsolation.photonProducer = cms.InputTag("gedPhotons")
58 
59  process.gedPhotonsTmp.candidateP4type = cms.string('fromEcalEnergy')
60  process.gedPhotons.candidateP4type = cms.string('fromEcalEnergy')
61 
62  process.gedGsfElectronsTmp.useEcalRegression = cms.bool(False)
63  process.gedGsfElectronsTmp.useCombinationRegression = cms.bool(False)
64 
65  #for later
66  process.particleFlowBlock.SCBarrel = cms.InputTag('correctedHybridSuperClusters')
67  process.particleFlowBlock.SCEndcap = cms.InputTag('correctedMulti5x5SuperClustersWithPreshower')
68  process.particleFlowBlock.SuperClusterMatchByRef = cms.bool(False)
69  #add in conversions
70  ## for PF
71 
72  process.allConversionSequence += process.allConversionOldEGSequence
73  process.pfConversions.conversionCollection = cms.InputTag('allConversionsOldEG')
74  process.photons.conversionProducer = cms.InputTag('oldegConversions')
75  #return to old EG-based conversions based reco::Photon
76  process.ckfTracksFromConversions += process.ckfTracksFromOldEGConversions
77  process.conversionTrackProducers += process.oldegConversionTrackProducers
78  process.conversionTrackMergers += process.oldegConversionTrackMergers
79  if hasattr(process,'conversionSequence'):
80  process.conversionSequence += process.oldegConversionSequence
81  process.photonSequence.remove(process.mustachePhotonSequence)
82  process.particleFlowBlock.EGPhotons = cms.InputTag('photons')
83  process.particleFlowBlock.PhotonSelectionCuts = cms.vdouble(1,10,2.0, 0.001, 4.2, 0.003, 2.2, 0.001, 0.05, 10.0, 0.10)
84  #tell PFProducer to use old PF electron / PF photon code
85  process.particleFlowTmp.useEGammaFilters = cms.bool(False)
86  process.particleFlowTmp.usePFPhotons = cms.bool(True)
87  process.particleFlowTmp.usePFElectrons = cms.bool(True)
88  process.particleFlowTmp.sumPtTrackIso = cms.double(2.0)
89  process.particleFlowTmp.photon_HoE = cms.double(0.10)
90 
91  #re-route PF linker to use old EG collections
92  process.particleFlow.GsfElectrons = cms.InputTag('gsfElectrons')
93  process.particleFlow.Photons = cms.InputTag('pfPhotonTranslator:pfphot')
94  return process
95 
96 
97 
98 def _customize_DQM(process):
99  try:
100  process.ecalBarrelClusterTask.SuperClusterCollection = cms.InputTag("correctedHybridSuperClusters")
101  process.ecalBarrelClusterTask.BasicClusterCollection = cms.InputTag("hybridSuperClusters","hybridBarrelBasicClusters")
102  process.ecalEndcapClusterTask.SuperClusterCollection = cms.InputTag("multi5x5SuperClusters","multi5x5EndcapSuperClusters")
103  process.ecalEndcapClusterTask.BasicClusterCollection = cms.InputTag("multi5x5SuperClusters","multi5x5EndcapBasicClusters")
104  except AttributeError:
105  pass
106  try:
107  process.ecalBarrelClusterTaskExtras.SuperClusterCollection = cms.InputTag("correctedHybridSuperClusters")
108  process.ecalEndcapClusterTaskExtras.SuperClusterCollection = cms.InputTag("multi5x5SuperClusters","multi5x5EndcapSuperClusters")
109  except AttributeError:
110  pass
111  try:
112  process.ecalBarrelRecoSummary.superClusterCollection_EB = cms.InputTag("correctedHybridSuperClusters")
113  process.ecalBarrelRecoSummary.basicClusterCollection_EB = cms.InputTag("hybridSuperClusters","hybridBarrelBasicClusters")
114  process.ecalEndcapRecoSummary.superClusterCollection_EE = cms.InputTag("correctedMulti5x5SuperClustersWithPreshower")
115  process.ecalEndcapRecoSummary.basicClusterCollection_EE = cms.InputTag("multi5x5SuperClusters","multi5x5EndcapBasicClusters")
116  except AttributeError:
117  pass
118 
119  return process
120 
121 
123  _replaceTags(process.validation_step,
124  cms.InputTag('gedGsfElectrons'),
125  cms.InputTag('gsfElectrons'),
126  skipLabelTest=True)
127  _replaceTags(process.validation_step,
128  cms.InputTag('gedGsfElectronCores'),
129  cms.InputTag('gsfElectronCores'),
130  skipLabelTest=True)
131  #don't ask... just don't ask
132  if hasattr(process,'HLTSusyExoValFastSim'):
133  process.HLTSusyExoValFastSim.PlotMakerRecoInput.electrons = \
134  cms.string('gsfElectrons')
135  for pset in process.HLTSusyExoValFastSim.reco_parametersets:
136  pset.electrons = cms.string('gsfElectrons')
137  if hasattr(process,'HLTSusyExoVal'):
138  process.HLTSusyExoVal.PlotMakerRecoInput.electrons = \
139  cms.string('gsfElectrons')
140  for pset in process.HLTSusyExoVal.reco_parametersets:
141  pset.electrons = cms.string('gsfElectrons')
142  if hasattr(process,'hltHiggsValidator'):
143  process.hltHiggsValidator.H2tau.recElecLabel = \
144  cms.string('gsfElectrons')
145  process.hltHiggsValidator.HZZ.recElecLabel = \
146  cms.string('gsfElectrons')
147  process.hltHiggsValidator.HWW.recElecLabel = \
148  cms.string('gsfElectrons')
149  if hasattr(process,'oldpfPhotonValidation'):
150  process.photonValidationSequence += process.oldpfPhotonValidation
151  process.oldpfPhotonValidation.conversionIOTrackProducer = cms.string('ckfInOutTracksFromOldEGConversions')
152  process.oldpfPhotonValidation.conversionOITrackProducer = cms.string('ckfOutInTracksFromOldEGConversions')
153  process.photonValidation.phoProducer = cms.string('photons')
154  process.photonValidation.conversionIOTrackProducer = cms.string('ckfInOutTracksFromOldEGConversions')
155  process.photonValidation.conversionOITrackProducer = cms.string('ckfOutInTracksFromOldEGConversions')
156  process.tkConversionValidation.convProducer = cms.string('allConversionsOldEG')
157  return process
158 
159 
160 def _customize_Digi(process):
161  return process
162 
163 
165  return process
166 
167 
168 def _customize_RawToDigi(process):
169  return process
170 
171 
172 def _customize_DigiToRaw(process):
173  return process
174 
175 
176 def _customize_HLT(process):
177  return process
178 
179 def _customize_FastSim(process):
180  process=_configurePFForGEDEGamma(process)
181  process.egammaHighLevelRecoPostPF.insert(0,process.gsfElectronMergingSequence)
182  process.famosParticleFlowSequence.insert(8,process.pfPhotonTranslatorSequence)
183  process.famosParticleFlowSequence.insert(8,process.pfElectronTranslatorSequence)
184 
185  process.reducedEcalRecHitsES.interestingDetIds = cms.VInputTag()
186  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdPFEB)
187  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdPFEE)
188  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdPFES)
189  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdRefinedEB)
190  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdRefinedEE)
191  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdRefinedES)
192 
193  process.interestingGedEleIsoDetIdEB.emObjectLabel = cms.InputTag('gsfElectrons')
194  process.interestingGedEleIsoDetIdEE.emObjectLabel = cms.InputTag('gsfElectrons')
195  process.interestingEgammaIsoDetIds.remove(process.interestingGedGamIsoDetIdEB)
196  process.interestingEgammaIsoDetIds.remove(process.interestingGedGamIsoDetIdEE)
197 
198  process.reducedEcalRecHitsEB.interestingDetIdCollections = cms.VInputTag(
199  # ecal
200  cms.InputTag("interestingEcalDetIdEB"),
201  cms.InputTag("interestingEcalDetIdEBU"),
202  # egamma
203  cms.InputTag("interestingGedEleIsoDetIdEB"),
204  cms.InputTag("interestingGamIsoDetIdEB"),
205  # tau
206  #cms.InputTag("caloRecoTauProducer"),
207  #pf
208  cms.InputTag("pfElectronInterestingEcalDetIdEB"),
209  cms.InputTag("pfPhotonInterestingEcalDetIdEB"),
210  # muons
211  cms.InputTag("muonEcalDetIds"),
212  # high pt tracks
213  cms.InputTag("interestingTrackEcalDetIds")
214  )
215  process.reducedEcalRecHitsEE.interestingDetIdCollections = cms.VInputTag(
216  # ecal
217  cms.InputTag("interestingEcalDetIdEE"),
218  # egamma
219  cms.InputTag("interestingGedEleIsoDetIdEE"),
220  cms.InputTag("interestingGamIsoDetIdEE"),
221  # tau
222  #cms.InputTag("caloRecoTauProducer"),
223  #pf
224  cms.InputTag("pfElectronInterestingEcalDetIdEE"),
225  cms.InputTag("pfPhotonInterestingEcalDetIdEE"),
226  # muons
227  cms.InputTag("muonEcalDetIds"),
228  # high pt tracks
229  cms.InputTag("interestingTrackEcalDetIds")
230  )
231  process.allConversionsOldEG.src = cms.InputTag('gsfGeneralConversionTrackMerger')
232 
233  if hasattr(process,'ecalDrivenElectronSeeds'):
234  process.ecalDrivenElectronSeeds.barrelSuperClusters = cms.InputTag('correctedHybridSuperClusters')
235  process.ecalDrivenElectronSeeds.endcapSuperClusters = cms.InputTag('correctedMulti5x5SuperClustersWithPreshower')
236  process.ecalDrivenElectronSeeds.SeedConfiguration.ecalDrivenElectronSeedsParameters.SCEtCut = 4.0
237  return process
238 
239 
240 def _customize_Reco(process):
241  process=_configurePFForGEDEGamma(process)
242  process.egammaHighLevelRecoPostPF.insert(0,process.gsfElectronMergingSequence)
243  process.particleFlowReco.insert(8,process.pfPhotonTranslatorSequence)
244  process.particleFlowReco.insert(8,process.pfElectronTranslatorSequence)
245 
246  process.reducedEcalRecHitsES.interestingDetIds = cms.VInputTag()
247  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdPFEB)
248  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdPFEE)
249  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdPFES)
250  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdRefinedEB)
251  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdRefinedEE)
252  process.reducedEcalRecHitsSequence.remove(process.interestingEcalDetIdRefinedES)
253 
254  process.interestingGedEleIsoDetIdEB.emObjectLabel = cms.InputTag('gsfElectrons')
255  process.interestingGedEleIsoDetIdEE.emObjectLabel = cms.InputTag('gsfElectrons')
256  process.interestingEgammaIsoDetIds.remove(process.interestingGedGamIsoDetIdEB)
257  process.interestingEgammaIsoDetIds.remove(process.interestingGedGamIsoDetIdEE)
258 
259  process.reducedEcalRecHitsEB.interestingDetIdCollections = cms.VInputTag(
260  # ecal
261  cms.InputTag("interestingEcalDetIdEB"),
262  cms.InputTag("interestingEcalDetIdEBU"),
263  # egamma
264  cms.InputTag("interestingGedEleIsoDetIdEB"),
265  cms.InputTag("interestingGamIsoDetIdEB"),
266  # tau
267  #cms.InputTag("caloRecoTauProducer"),
268  #pf
269  cms.InputTag("pfElectronInterestingEcalDetIdEB"),
270  cms.InputTag("pfPhotonInterestingEcalDetIdEB"),
271  # muons
272  cms.InputTag("muonEcalDetIds"),
273  # high pt tracks
274  cms.InputTag("interestingTrackEcalDetIds")
275  )
276  process.reducedEcalRecHitsEE.interestingDetIdCollections = cms.VInputTag(
277  # ecal
278  cms.InputTag("interestingEcalDetIdEE"),
279  # egamma
280  cms.InputTag("interestingGedEleIsoDetIdEE"),
281  cms.InputTag("interestingGamIsoDetIdEE"),
282  # tau
283  #cms.InputTag("caloRecoTauProducer"),
284  #pf
285  cms.InputTag("pfElectronInterestingEcalDetIdEE"),
286  cms.InputTag("pfPhotonInterestingEcalDetIdEE"),
287  # muons
288  cms.InputTag("muonEcalDetIds"),
289  # high pt tracks
290  cms.InputTag("interestingTrackEcalDetIds")
291  )
292 
293  if hasattr(process,'ecalDrivenElectronSeeds'):
294  process.ecalDrivenElectronSeeds.barrelSuperClusters = cms.InputTag('correctedHybridSuperClusters')
295  process.ecalDrivenElectronSeeds.endcapSuperClusters = cms.InputTag('correctedMulti5x5SuperClustersWithPreshower')
296  return process
297 
298 
300  if hasattr(process,'oldpfPhotonPostprocessing'):
301  process.photonPostProcessor += process.oldpfPhotonPostprocessing
302  return process
def _customize_Digi(process)
def _configurePFForGEDEGamma(process)
def _customize_DigiToRaw(process)
def _customize_RawToDigi(process)
def _customize_harvesting(process)
def _customize_DQM(process)
def _customize_Validation(process)
def _customize_HLT(process)
def customizeOldEGReco(process)
def _customize_L1Emulator(process)
def _customize_FastSim(process)
def _customize_Reco(process)