Refactor for maintainability and consistency #59
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Python programming language supports a feature called "variables". Using this feature, the program can store the result of a computation and reuse it, rather than repeating the computation every time it is needed. In this PR, I have employed this feature for the string concatenations used to create module names. This makes it less likely for future developers to forget which collection to use, or to apply the postfix, etc.
In the process, I found a few places where the postfix was not applied correctly. These have been fixed. I also added an option to print all the available module names in order (stored in a dictionary) so the user can see what is available (more easily than doing a full
edmConfigDump
).I tested this PR by creating a test config that exercised all the available options, dumping it, and comparing with a clean version. The only differences appear because of the aforementioned postfix fixes.
I noticed a few potential inconsistencies:
addJetCollection
is called with thepostFix
provided as a separate parameter. In other places, thepostFix
is included in thelabelName
parameter. I think the module names should be unique either way, but maybe there should be another look at this.BoostedJetMerger
forCMSTopTag
is givenpatJets
as thejetSrc
. In other places, it is given theselectedPatJets
.jetALGO+'PF'+PUMethod+postFix
while others are named asjetALGO+PUMethod+postFix
(without the'PF'
). I'm not sure why this is.Some other suggestions for future improvement (these are all fairly easy to implement, but I wanted to get agreement on this PR first):
bTagDiscriminators = None
behavior to avoid the default list (was proposed in Adding some tools and fixing bugs for next version #47 with other changes that proved controversial; the other changes should no longer be necessary, as the huge CPU usage I noticed in 80X was caused by prefetching inefficiencies that are no longer present in 94X).