CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
earlyDeleteSettings_cff Namespace Reference

Classes

class  TestHasInputTagModuleLabel
 

Functions

def _hasInputTagModuleLabel
 
def customiseEarlyDelete
 

Function Documentation

def earlyDeleteSettings_cff._hasInputTagModuleLabel (   process,
  pset,
  psetModLabel,
  moduleLabels,
  result 
)
private

Definition at line 10 of file earlyDeleteSettings_cff.py.

Referenced by customiseEarlyDelete().

10 
11 def _hasInputTagModuleLabel(process, pset, psetModLabel, moduleLabels, result):
12  for name in pset.parameterNames_():
13  value = getattr(pset,name)
14  if isinstance(value, cms.PSet):
15  _hasInputTagModuleLabel(process, value, psetModLabel, moduleLabels, result)
16  elif isinstance(value, cms.VPSet):
17  for ps in value:
18  _hasInputTagModuleLabel(process, ps, psetModLabel, moduleLabels, result)
19  elif isinstance(value, cms.VInputTag):
20  for t in value:
21  t2 = t
22  if not isinstance(t, cms.InputTag):
23  t2 = cms.InputTag(t2)
24  for i,moduleLabel in enumerate(moduleLabels):
25  if result[i]: continue #no need
26  if t2.getModuleLabel() == moduleLabel:
27  result[i]=True
28  elif isinstance(value, cms.InputTag):
29  for i,moduleLabel in enumerate(moduleLabels):
30  if result[i]: continue #no need
31  if value.getModuleLabel() == moduleLabel:
32  result[i]=True
33  elif isinstance(value, cms.string) and name == "refToPSet_":
34  try:
35  ps = getattr(process, value.value())
36  except AttributeError:
37  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()))
38  _hasInputTagModuleLabel(process, ps, psetModLabel, moduleLabels, result)
39 
def earlyDeleteSettings_cff.customiseEarlyDelete (   process)

Definition at line 40 of file earlyDeleteSettings_cff.py.

References _hasInputTagModuleLabel(), sistrip::SpyUtilities.range(), and makeHLTPrescaleTable.values.

Referenced by ConfigBuilder.ConfigBuilder.prepare().

40 
41 def customiseEarlyDelete(process):
42  # Mapping label -> [branches]
43  # for the producers whose products are to be deleted early
44  products = collections.defaultdict(list)
45 
46  products = customiseEarlyDeleteForSeeding(process, products)
47 
48  products = customiseEarlyDeleteForCandIsoDeposits(process, products)
49 
50  # Set process.options.canDeleteEarly
51  if not hasattr(process.options, "canDeleteEarly"):
52  process.options.canDeleteEarly = cms.untracked.vstring()
53 
54  branchSet = set()
55  for branches in products.values():
56  for branch in branches:
57  branchSet.add(branch)
58  branchList = sorted(branchSet)
59  process.options.canDeleteEarly.extend(branchList)
60 
61  # LogErrorHarvester should not wait for deleted items
62  for prod in process.producers_().values():
63  if prod.type_() == "LogErrorHarvester":
64  if not hasattr(prod,'excludeModules'):
65  prod.excludeModules = cms.untracked.vstring()
66  t = prod.excludeModules.value()
67  t.extend([b.split('_')[1] for b in branchList])
68  prod.excludeModules = t
69 
70  # Find the consumers
71  producers=[]
72  branchesList=[]
73  for producer, branches in products.items():
74  producers.append(producer)
75  branchesList.append(branches)
76 
77  for moduleType in [process.producers_(), process.filters_(), process.analyzers_()]:
78  for name, module in moduleType.items():
79  result=[]
80  for producer in producers:
81  result.append(False)
82 
83  _hasInputTagModuleLabel(process, module, name, producers, result)
84  for i in range(len(result)):
85  if result[i]:
86  #if it exists it might be optional or empty, both evaluate to False
87  if hasattr(module, "mightGet") and module.mightGet:
88  module.mightGet.extend(branchesList[i])
89  else:
90  module.mightGet = cms.untracked.vstring(branchesList[i])
91  return process
92 
const uint16_t range(const Frame &aFrame)