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 12 of file earlyDeleteSettings_cff.py.

Referenced by customiseEarlyDelete().

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

Definition at line 42 of file earlyDeleteSettings_cff.py.

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

Referenced by ConfigBuilder.ConfigBuilder.prepare().

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