CMS 3D CMS Logo

Functions
customiseForPremixingInput Namespace Reference

Functions

def customiseForPreMixingInput (process)
 

Function Documentation

def customiseForPremixingInput.customiseForPreMixingInput (   process)

Definition at line 3 of file customiseForPremixingInput.py.

References spr.find(), relativeConstraints.keys, and MassReplace.massSearchReplaceAnyInputTag().

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  def replaceAnalyzer(label, analyzer):
25  if analyzer.type_() == "GlobalRecHitsAnalyzer":
26  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
27  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
28  if analyzer.type_() == "SiPixelTrackingRecHitsValid":
29  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
30  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
31  if analyzer.type_() == "SiStripTrackingRecHitsValid":
32  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
33  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
34  if analyzer.type_() == "SiPixelRecHitsValid":
35  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
36  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
37  if analyzer.type_() == "SiStripRecHitsValid":
38  replacePixelDigiSimLink(analyzer.pixelSimLinkSrc)
39  replaceStripDigiSimLink(analyzer.stripSimLinkSrc)
40  if analyzer.type_() == "HcalDigisValidation":
41  replaceHcalTp(analyzer.dataTPs)
42 
43  for label, producer in process.producers_().iteritems():
44  if producer.type_() == "ClusterTPAssociationProducer":
45  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
46  replaceStripDigiSimLink(producer.stripSimLinkSrc)
47  if producer.type_() == "QuickTrackAssociatorByHitsProducer":
48  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
49  replaceStripDigiSimLink(producer.stripSimLinkSrc)
50  if producer.type_() == "TrackAssociatorByHitsProducer":
51  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
52  replaceStripDigiSimLink(producer.stripSimLinkSrc)
53  if producer.type_() == "MuonAssociatorEDProducer":
54  producer.DTdigisimlinkTag = cms.InputTag("mixData","simMuonDTDigis")
55  producer.CSClinksTag = cms.InputTag("mixData","MuonCSCStripDigiSimLinks")
56  producer.CSCwireLinksTag = cms.InputTag("mixData","MuonCSCWireDigiSimLinks")
57  producer.RPCdigisimlinkTag = cms.InputTag("mixData","RPCDigiSimLink")
58  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
59  replaceStripDigiSimLink(producer.stripSimLinkSrc)
60  if producer.type_() == "MuonToTrackingParticleAssociatorEDProducer":
61  producer.DTdigisimlinkTag = cms.InputTag("mixData","simMuonDTDigis")
62  producer.CSClinksTag = cms.InputTag("mixData","MuonCSCStripDigiSimLinks")
63  producer.CSCwireLinksTag = cms.InputTag("mixData","MuonCSCWireDigiSimLinks")
64  producer.RPCdigisimlinkTag = cms.InputTag("mixData","RPCDigiSimLink")
65  replacePixelDigiSimLink(producer.pixelSimLinkSrc)
66  replaceStripDigiSimLink(producer.stripSimLinkSrc)
67  # Most of DQM analyzers are nowadays EDProducers
68  replaceAnalyzer(label, producer)
69 
70  for label, analyzer in process.analyzers_().iteritems():
71  replaceAnalyzer(label, analyzer)
72 
73 
74  return process
75 
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