5 import FWCore.ParameterSet.Config
as cms
7 from RecoTracker.Configuration.customiseEarlyDeleteForSeeding
import customiseEarlyDeleteForSeeding
8 from RecoTracker.Configuration.customiseEarlyDeleteForMkFit
import customiseEarlyDeleteForMkFit
9 from RecoTracker.Configuration.customiseEarlyDeleteForCKF
import customiseEarlyDeleteForCKF
10 from CommonTools.ParticleFlow.Isolation.customiseEarlyDeleteForCandIsoDeposits
import customiseEarlyDeleteForCandIsoDeposits
13 for name
in pset.parameterNames_():
14 value = getattr(pset,name)
15 if isinstance(value, cms.PSet):
17 elif isinstance(value, cms.VPSet):
20 elif isinstance(value, cms.VInputTag):
23 if not isinstance(t, cms.InputTag):
25 for i,moduleLabel
in enumerate(moduleLabels):
26 if result[i]:
continue 27 if t2.getModuleLabel() == moduleLabel:
29 elif isinstance(value, cms.InputTag):
30 for i,moduleLabel
in enumerate(moduleLabels):
31 if result[i]:
continue 32 if value.getModuleLabel() == moduleLabel:
34 elif isinstance(value, cms.string)
and name ==
"refToPSet_":
36 ps = getattr(process, value.value())
37 except AttributeError:
38 raise RuntimeError(
"Module %s has a 'PSet(refToPSet_ = cms.string(\"%s\"))', but the referenced-to PSet does not exist in the Process." % (psetModLabel, value.value()))
45 products = collections.defaultdict(list)
54 if not hasattr(process.options,
"canDeleteEarly"):
55 process.options.canDeleteEarly = cms.untracked.vstring()
58 for branches
in products.values():
59 for branch
in branches:
61 branchList = sorted(branchSet)
62 process.options.canDeleteEarly.extend(branchList)
65 for prod
in process.producers_().
values():
66 if prod.type_() ==
"LogErrorHarvester":
67 if not hasattr(prod,
'excludeModules'):
68 prod.excludeModules = cms.untracked.vstring()
69 t = prod.excludeModules.value()
70 t.extend([b.split(
'_')[1]
for b
in branchList])
71 prod.excludeModules = t
76 for producer, branches
in products.items():
77 producers.append(producer)
78 branchesList.append(branches)
80 for moduleType
in [process.producers_(), process.filters_(), process.analyzers_()]:
81 for name, module
in moduleType.items():
83 for producer
in producers:
87 for i
in range(len(result)):
90 if hasattr(module,
"mightGet")
and module.mightGet:
91 module.mightGet.extend(branchesList[i])
93 module.mightGet = cms.untracked.vstring(branchesList[i])
97 if __name__==
"__main__":
106 p.pset = cms.PSet(a=cms.InputTag(
"a"),a2=cms.untracked.InputTag(
"a2"))
107 p.prod = cms.EDProducer(
"Producer",
108 foo = cms.InputTag(
"foo"),
109 foo2 = cms.InputTag(
"foo2",
"instance"),
110 foo3 = cms.InputTag(
"foo3",
"instance",
"PROCESS"),
111 foo4 = cms.untracked.InputTag(
"foo4"),
113 bar = cms.InputTag(
"bar"),
114 bar2 = cms.untracked.InputTag(
"bar2"),
116 nested2 = cms.untracked.PSet(
117 bar3 = cms.untracked.InputTag(
"bar3"),
119 flintstones = cms.VPSet(
120 cms.PSet(fred=cms.InputTag(
"fred")),
121 cms.PSet(wilma=cms.InputTag(
"wilma"))
123 flintstones2 = cms.VPSet(
124 cms.PSet(fred2=cms.untracked.InputTag(
"fred2")),
125 cms.PSet(wilma2=cms.InputTag(
"wilma2"))
128 refToPSet_ = cms.string(
"pset")
130 ref2 = cms.untracked.PSet(
131 refToPSet_ = cms.string(
"pset")
134 p.prod2 = cms.EDProducer(
"Producer2",
136 refToPSet_ = cms.string(
"nonexistent")
140 result=[
False,
False,
False,
False,
False,
False,
False,
False,
False,
False,
False,
False,
False,
False]
141 _hasInputTagModuleLabel(p, p.prod,
"prod", [
"foo",
"foo2",
"foo3",
"bar",
"fred",
"wilma",
"a",
"foo4",
"bar2",
"bar3",
"fred2",
"wilma2",
"a2",
"joe"], result)
142 for i
in range (0,13):
143 self.assert_(result[i])
144 self.assert_(
not result[13])
147 self.assertRaises(RuntimeError, _hasInputTagModuleLabel, p, p.prod2,
"prod2", [
"foo"], result)
def customiseEarlyDelete(process)
def _hasInputTagModuleLabel(process, pset, psetModLabel, moduleLabels, result)