Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-23 02:25:59

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 import collections
0004 
0005 def customiseEarlyDeleteForSeeding(process, products):
0006     # Find the producers
0007     depends = collections.defaultdict(list)
0008 
0009     def _branchName(productType, moduleLabel, instanceLabel=""):
0010         return "%s_%s_%s_%s" % (productType, moduleLabel, instanceLabel, process.name_())
0011 
0012     for name, module in process.producers_().items():
0013         cppType = module._TypedParameterizable__type
0014         if cppType == "HitPairEDProducer":
0015             if module.produceSeedingHitSets:
0016                 products[name].append(_branchName("RegionsSeedingHitSets", name))
0017             if module.produceIntermediateHitDoublets:
0018                 products[name].append(_branchName("IntermediateHitDoublets", name))
0019         elif cppType in ["PixelTripletHLTEDProducer", "PixelTripletLargeTipEDProducer"]:
0020             if module.produceSeedingHitSets:
0021                 products[name].append(_branchName("RegionsSeedingHitSets", name))
0022             if module.produceIntermediateHitTriplets:
0023                 products[name].append(_branchName("IntermediateHitTriplets", name))
0024             # LayerHitMapCache of the doublets is forwarded to both
0025             # products, hence the dependency
0026             depends[name].append(module.doublets.getModuleLabel())
0027         elif cppType in ["MultiHitFromChi2EDProducer"]:
0028             products[name].extend([
0029                 _branchName("RegionsSeedingHitSets", name),
0030                 _branchName("BaseTrackerRecHitsOwned", name)
0031             ])
0032         elif cppType in ["CAHitQuadrupletEDProducer", "CAHitTripletEDProducer"]:
0033             products[name].append(_branchName("RegionsSeedingHitSets", name))
0034 
0035     if len(products) == 0:
0036         return products
0037 
0038     # Resolve data dependencies
0039     #
0040     # If a productB depends on productA (e.g. by ref or pointer), then
0041     # everybody that mightGet's producB, must also mightGet productA
0042     def _resolve(keys, name):
0043         for dependsOn in depends[name]:
0044             if dependsOn in keys:
0045                 _resolve(keys, dependsOn)
0046                 keys.remove(dependsOn)
0047             products[name].extend(products[dependsOn])
0048 
0049     keys = set(depends.keys())
0050     while len(keys) > 0:
0051         name = keys.pop()
0052         _resolve(keys, name)
0053 
0054     return products