-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36793 from fabiocos/fc-extender
MTD reconstruction: speed up TrackExtenderWithMTD
- Loading branch information
Showing
11 changed files
with
118 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
RecoTracker/Configuration/python/customiseEarlyDeleteForCKF.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
import collections | ||
|
||
def customiseEarlyDeleteForCKF(process, products): | ||
|
||
if "trackExtenderWithMTD" not in process.producerNames(): | ||
return products | ||
|
||
def _branchName(productType, moduleLabel, instanceLabel=""): | ||
return "%s_%s_%s_%s" % (productType, moduleLabel, instanceLabel, process.name_()) | ||
|
||
trajectoryLabels = [] | ||
trackListMergers = [] | ||
def _addProduct(name): | ||
products[name].append(_branchName("Trajectorys", name)) | ||
products[name].append(_branchName("TrajectorysToOnerecoTracksAssociation", name)) | ||
trajectoryLabels.append(name) | ||
|
||
for name, module in process.producers_().items(): | ||
cppType = module.type_() | ||
if cppType == "TrackProducer": | ||
if module.TrajectoryInEvent: | ||
_addProduct(name) | ||
elif cppType == "DuplicateListMerger": | ||
if module.copyTrajectories: | ||
_addProduct(name) | ||
elif cppType == "TrackListMerger": | ||
trackListMergers.append(module) | ||
|
||
# TrackListMerger copies Trajectory collections silently, so we | ||
# add its Trajectory products only if we know from above the input | ||
# has Trajectory collections. Note that this property is transitive. | ||
def _containsTrajectory(vinputtag): | ||
for t in vinputtag: | ||
t2 = t | ||
if not isinstance(t, cms.VInputTag): | ||
t2 = cms.InputTag(t) | ||
for label in trajectoryLabels: | ||
if t2.getModuleLabel() == label: | ||
return True | ||
return False | ||
|
||
changed = True | ||
while changed: | ||
changed = False | ||
noTrajectoryYet = [] | ||
for tlm in trackListMergers: | ||
if _containsTrajectory(tlm.TrackProducers): | ||
_addProduct(tlm.label()) | ||
changed = True | ||
else: | ||
noTrajectoryYet.append(tlm) | ||
trackListMergers = noTrajectoryYet | ||
|
||
return products |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters