CMS 3D CMS Logo

customiseEarlyDeleteForSeeding.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 import collections
4 
5 def customiseEarlyDeleteForSeeding(process, products):
6  # Find the producers
7  depends = collections.defaultdict(list)
8 
9  def _branchName(productType, moduleLabel, instanceLabel=""):
10  return "%s_%s_%s_%s" % (productType, moduleLabel, instanceLabel, process.name_())
11 
12  for name, module in process.producers_().items():
13  cppType = module._TypedParameterizable__type
14  if cppType == "HitPairEDProducer":
15  if module.produceSeedingHitSets:
16  products[name].append(_branchName("RegionsSeedingHitSets", name))
17  if module.produceIntermediateHitDoublets:
18  products[name].append(_branchName("IntermediateHitDoublets", name))
19  elif cppType in ["PixelTripletHLTEDProducer", "PixelTripletLargeTipEDProducer"]:
20  if module.produceSeedingHitSets:
21  products[name].append(_branchName("RegionsSeedingHitSets", name))
22  if module.produceIntermediateHitTriplets:
23  products[name].append(_branchName("IntermediateHitTriplets", name))
24  # LayerHitMapCache of the doublets is forwarded to both
25  # products, hence the dependency
26  depends[name].append(module.doublets.getModuleLabel())
27  elif cppType in ["MultiHitFromChi2EDProducer"]:
28  products[name].extend([
29  _branchName("RegionsSeedingHitSets", name),
30  _branchName("BaseTrackerRecHitsOwned", name)
31  ])
32  elif cppType in ["CAHitQuadrupletEDProducer", "CAHitTripletEDProducer"]:
33  products[name].append(_branchName("RegionsSeedingHitSets", name))
34 
35  if len(products) == 0:
36  return products
37 
38  # Resolve data dependencies
39  #
40  # If a productB depends on productA (e.g. by ref or pointer), then
41  # everybody that mightGet's producB, must also mightGet productA
42  def _resolve(keys, name):
43  for dependsOn in depends[name]:
44  if dependsOn in keys:
45  _resolve(keys, dependsOn)
46  keys.remove(dependsOn)
47  products[name].extend(products[dependsOn])
48 
49  keys = set(depends.keys())
50  while len(keys) > 0:
51  name = keys.pop()
52  _resolve(keys, name)
53 
54  return products
def customiseEarlyDeleteForSeeding(process, products)