CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
customiseForPremixingInput.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
4  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
5 
6  # Replace TrackingParticles and TrackingVertices globally
7  for s in process.paths_().keys():
8  massSearchReplaceAnyInputTag(getattr(process, s), cms.InputTag("mix", "MergedTrackTruth"), cms.InputTag("mixData", "MergedTrackTruth"), skipLabelTest=True)
9 
10  for s in process.endpaths_().keys():
11  massSearchReplaceAnyInputTag(getattr(process, s), cms.InputTag("mix", "MergedTrackTruth"), cms.InputTag("mixData", "MergedTrackTruth"), skipLabelTest=True)
12 
13 
14 
15 
16  # Replace Pixel/StripDigiSimLinks only for the known modules
17  def replaceInputTag(tag, old, new):
18  if tag.value() == old:
19  tag.setValue(new)
20 
21  def replacePixelDigiSimLink(tag):
22  replaceInputTag(tag, "simSiPixelDigis", "mixData:PixelDigiSimLink")
23  def replaceStripDigiSimLink(tag):
24  replaceInputTag(tag, "simSiStripDigis", "mixData:StripDigiSimLink")
25 
26  for label, producer in process.producers_().iteritems():
27  if producer.type_() == "ClusterTPAssociationProducer":
28  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
29  replaceStripDigiSimLink(producer.stripSimLinkSrc)
30  if producer.type_() == "QuickTrackAssociatorByHitsProducer":
31  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
32  replaceStripDigiSimLink(producer.stripSimLinkSrc)
33  if producer.type_() == "TrackAssociatorByHitsProducer":
34  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
35  replaceStripDigiSimLink(producer.stripSimLinkSrc)
36  if producer.type_() == "MuonAssociatorEDProducer":
37  producer.DTdigisimlinkTag = cms.InputTag("mixData","simMuonDTDigis")
38  producer.CSClinksTag = cms.InputTag("mixData","MuonCSCStripDigiSimLinks")
39  producer.CSCwireLinksTag = cms.InputTag("mixData","MuonCSCWireDigiSimLinks")
40  producer.RPCdigisimlinkTag = cms.InputTag("mixData","RPCDigiSimLink")
41  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
42  replaceStripDigiSimLink(producer.stripSimLinkSrc)
43  if producer.type_() == "MuonToTrackingParticleAssociatorEDProducer":
44  producer.DTdigisimlinkTag = cms.InputTag("mixData","simMuonDTDigis")
45  producer.CSClinksTag = cms.InputTag("mixData","MuonCSCStripDigiSimLinks")
46  producer.CSCwireLinksTag = cms.InputTag("mixData","MuonCSCWireDigiSimLinks")
47  producer.RPCdigisimlinkTag = cms.InputTag("mixData","RPCDigiSimLink")
48  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
49  replaceStripDigiSimLink(producer.stripSimLinkSrc)
50 
51  for label, analyzer in process.analyzers_().iteritems():
52  if analyzer.type_() == "GlobalRecHitsAnalyzer":
53  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
54  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
55  if analyzer.type_() == "SiPixelTrackingRecHitsValid":
56  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
57  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
58  if analyzer.type_() == "SiStripTrackingRecHitsValid":
59  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
60  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
61  if analyzer.type_() == "SiPixelRecHitsValid":
62  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
63  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
64  if analyzer.type_() == "SiStripRecHitsValid":
65  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
66  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
67 
68 
69 
70 
71  return process
def massSearchReplaceAnyInputTag
Definition: helpers.py:262