CMS 3D CMS Logo

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  # only apply on validation and dqm: we don't want to apply this in the mixing and digitization sequences
8  for s in process.paths_().keys() + process.endpaths_().keys():
9  if s.lower().find("validation")>= 0 or s.lower().find("dqm") >= 0:
10  massSearchReplaceAnyInputTag(getattr(process, s), cms.InputTag("mix", "MergedTrackTruth"), cms.InputTag("mixData", "MergedTrackTruth"), skipLabelTest=True)
11 
12  # Replace Pixel/StripDigiSimLinks only for the known modules
13  def replaceInputTag(tag, old, new):
14  if tag.value() == old:
15  tag.setValue(new)
16 
17  def replacePixelDigiSimLink(tag):
18  replaceInputTag(tag, "simSiPixelDigis", "mixData:PixelDigiSimLink")
19  def replaceStripDigiSimLink(tag):
20  replaceInputTag(tag, "simSiStripDigis", "mixData:StripDigiSimLink")
21  def replaceHcalTp(tag):
22  replaceInputTag(tag, "simHcalTriggerPrimitiveDigis", "DMHcalTriggerPrimitiveDigis")
23 
24  for label, producer in process.producers_().iteritems():
25  if producer.type_() == "ClusterTPAssociationProducer":
26  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
27  replaceStripDigiSimLink(producer.stripSimLinkSrc)
28  if producer.type_() == "QuickTrackAssociatorByHitsProducer":
29  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
30  replaceStripDigiSimLink(producer.stripSimLinkSrc)
31  if producer.type_() == "TrackAssociatorByHitsProducer":
32  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
33  replaceStripDigiSimLink(producer.stripSimLinkSrc)
34  if producer.type_() == "MuonAssociatorEDProducer":
35  producer.DTdigisimlinkTag = cms.InputTag("mixData","simMuonDTDigis")
36  producer.CSClinksTag = cms.InputTag("mixData","MuonCSCStripDigiSimLinks")
37  producer.CSCwireLinksTag = cms.InputTag("mixData","MuonCSCWireDigiSimLinks")
38  producer.RPCdigisimlinkTag = cms.InputTag("mixData","RPCDigiSimLink")
39  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
40  replaceStripDigiSimLink(producer.stripSimLinkSrc)
41  if producer.type_() == "MuonToTrackingParticleAssociatorEDProducer":
42  producer.DTdigisimlinkTag = cms.InputTag("mixData","simMuonDTDigis")
43  producer.CSClinksTag = cms.InputTag("mixData","MuonCSCStripDigiSimLinks")
44  producer.CSCwireLinksTag = cms.InputTag("mixData","MuonCSCWireDigiSimLinks")
45  producer.RPCdigisimlinkTag = cms.InputTag("mixData","RPCDigiSimLink")
46  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
47  replaceStripDigiSimLink(producer.stripSimLinkSrc)
48 
49  for label, analyzer in process.analyzers_().iteritems():
50  if analyzer.type_() == "GlobalRecHitsAnalyzer":
51  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
52  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
53  if analyzer.type_() == "SiPixelTrackingRecHitsValid":
54  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
55  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
56  if analyzer.type_() == "SiStripTrackingRecHitsValid":
57  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
58  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
59  if analyzer.type_() == "SiPixelRecHitsValid":
60  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
61  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
62  if analyzer.type_() == "SiStripRecHitsValid":
63  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
64  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
65  if analyzer.type_() == "HcalDigisValidation":
66  replaceHcalTp(analyzer.dataTPs)
67 
68 
69 
70  return process
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:72
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20