-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate module configuration in RecoTracker{SpecialSeedGenerators} to use default cfipython #34009
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-34009/23134
|
A new Pull Request was created by @jeongeun (JeongEun Lee) for master. It involves the following packages: RecoTracker/SpecialSeedGenerators @perrotta, @jpata, @cmsbuild, @slava77 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
@@ -29,8 +27,34 @@ def makeSimpleCosmicSeedLayers(*layers): | |||
#print "SEEDING LAYER LIST = ", layerList | |||
return layerList | |||
|
|||
layerInfo = RecoTracker.SpecialSeedGenerators.CombinatorialSeedGeneratorForCosmics_cfi.layerInfo.clone( | |||
TEC = dict(useSimpleRphiHitsCleaner = False) | |||
layerInfo = dict( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not keeping cloning from RecoTracker.SpecialSeedGenerators.CombinatorialSeedGeneratorForCosmics_cfi, instead of all this copy/paste?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@perrotta : I got an error when I keep L32-33 as below, so I did simply copy/paste the layerInfo in this SimpleCosmicVONSeeder_cfi.py file.
Please let me know if there's the most suitable way you suggest here.
File "/afs/cern.ch/work/j/jelee/ServiceWork/NewTask/0607/CMSSW_12_0_X_2021-06-06-2300/python/RecoTracker/SpecialSeedGenerators/SimpleCosmicBONSeeder_cfi.py", line 30, in <module>
layerInfo = RecoTracker.SpecialSeedGenerators.CombinatorialSeedGeneratorForCosmics_cfi.layerInfo.clone(
AttributeError: 'dict' object has no attribute 'clone'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then probably the simplest solution is to revert the change in https://github.com/cms-sw/cmssw/pull/34009/files#diff-0dbbc624124b7539ebca54a0a8940ad7ca30d06b687c5bbb825c30a51e16dd7eR9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@makortel , perhaps you can help here...
I would like to avoid copy/pasting all the PSet's below, which were already defined in RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForCosmics_cfi.py. This would be inconvenient in case of modifications in the source config, that couldn't be automatically propagated to the copy/pasted ones.
After investigating a bit how do dictionaries and unpacking operatoris work in python, I came to the conclusion that the simplest way to avoid it is to simply revert the changes for layerInfo
here and in https://github.com/cms-sw/cmssw/pull/34009/files#diff-0dbbc624124b7539ebca54a0a8940ad7ca30d06b687c5bbb825c30a51e16dd7eR9
But perhaps python allows some more elegant and correct solution, that allows keep defining layerInfo
as a dict in the source file, and propagate to the derived config with the possibility to modify a parameter (which is what causes the issue here). Do you have any suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With dict
you can use copy
module, i.e. along
import copy
dict_copy = copy.deepcopy(dict_orig)
For this specific case I'd like to remind that we recently allowed passing PSet
as the first argument(s) for clone()
. I think you could keep the layerInfo
definition here as it is, and change SimpleCosmicBONSeeder_cff.py
to something along
simpleCosmicBONSeedingLayers = _mod.seedingLayersEDProducer.clone(
layerInfo,
layerList = layerList
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @makortel
And what about modifying a parameter in an included PSet, as it was done originally in https://github.com/cms-sw/cmssw/pull/34009/files#diff-f633f65b880b125f9f08753ab0640fef555f76d83ce539433c8bcfeb3baecdc5L33 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow your question. The original code has
layerInfo = RecoTracker.SpecialSeedGenerators.CombinatorialSeedGeneratorForCosmics_cfi.layerInfo.clone(
TEC = dict(useSimpleRphiHitsCleaner = False)
)
that could stay as it is (the modification is in a clone()
call after all).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, Matti, thank you!
Then, if I understand it correctly, the suggestion for @jeongeun is:
- Revert the change in RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForCosmics_cfi.py and let the
layerInfo
as a PSet - Modify
simpleCosmicBONSeedingLayers
as you write above - Revert also the definition of
layerInfo
here in SimpleCosmicBONSeeder_cfi.py, with a clone and only the modified parameter replaced in it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you all!
To be consistent, I will revert (dict
-> cms.PSet
)all the changes in these 3 cfi.py files RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForBeamHalo_cfi.py,
RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForCosmics_cfi.py, RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForCosmicsRegionalReconstruction_cfi.py
Then, I will revert **layerInfo
-> layerInfo
as it is.
@@ -6,7 +6,7 @@ | |||
from RecoTracker.TkTrackingRegions.GlobalTrackingRegion_cfi import * | |||
from RecoLocalTracker.SiStripClusterizer.SiStripClusterChargeCut_cfi import * | |||
|
|||
layerInfo = cms.PSet( | |||
layerInfo = dict( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are cleaning, you could further align inside the PSet's in layerInfo
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-34009/23258 ERROR: Build errors found during clang-tidy run.
|
rphiRecHits = cms.InputTag("siStripMatchedRecHits","rphiRecHit"), | ||
maxRing = cms.int32(7) | ||
), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the Build errors, and the log does'nt help me (@smuzaffar ?)
In any case, this parenthesis has to be brought back to the previous position to remain aligned. Maybe one can try to fix, and see if the Build error disappears...
Moreover @jeongeun could you please further:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the Build errors, and the log does'nt help me (@smuzaffar ?)
You can find comment from @smuzaffar here: #33863 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the Build errors, and the log does'nt help me (@smuzaffar ?)
You can find comment from @smuzaffar here: #33863 (comment)
Thank you @qliphy !
code-checks |
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-34009/23263 ERROR: Build errors found during clang-tidy run.
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-34009/23270
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-34009/23301
|
please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-da5ecc/15931/summary.html Comparison SummarySummary:
|
+1
|
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @silviodonato, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description:
Optimization of the python configurations: Improve maintainability by cleaning up the duplicated and cloning from the default/reference configurations.
RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForBeamHalo_cff.py
RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForBeamHalo_cfi.py
RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForCosmics_cfi.py
RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForCosmicsP5_cff.py
RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForCosmicsRegionalReconstruction_cfi.py
RecoTracker/SpecialSeedGenerators/python/CombinatorialSeedGeneratorForCosmicsRegionalReconstruction_cff.py
RecoTracker/SpecialSeedGenerators/python/SimpleCosmicBONSeeder_cfi.py
RecoTracker/SpecialSeedGenerators/python/SimpleCosmicBONSeeder_cff.py
(The previous PRs were PR#33207, PR#33307, PR#33352, PR#33543, PR#33563, PR#33671, PR#33901, PR#34007)
PR validation:
Event Content comparison check was also done and there is no change with these updates.
Tested in CMSSW_12_0_X, the basic test all passed in the CMSSW PR instructions.