-
Notifications
You must be signed in to change notification settings - Fork 24
Comulative sample type flags #352
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR introduces cumulative sample type flags to complement existing individual subtype flags. The change allows for broader categorization of samples (e.g., is_data, is_dyjets, is_wjets) while maintaining granular subtype flags.
Changes:
- Added cumulative flags for data, dyjets, and wjets sample types based on substring matching
- Updated subproject commit reference for jsonpog-integration
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| data/jsonpog-integration | Updated subproject commit reference |
| code_generation/configuration.py | Added cumulative sample type flags (is_data, is_dyjets, is_wjets) with substring-based detection |
Comments suppressed due to low confidence (2)
code_generation/configuration.py:1
- Line 173 sets
is_dyjetsinstead ofis_wjetsin the else block for the wjets check. This should besample_parameters['is_wjets'] = False.
from __future__ import annotations # needed for type annotations in > python 3.7
code_generation/configuration.py:1
- The if-else blocks can be simplified to directly assign the boolean result of the substring check, reducing code duplication. For example:
sample_parameters['is_data'] = 'data' in self.sample.
from __future__ import annotations # needed for type annotations in > python 3.7
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
moritzmolch
left a 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'm fine with the changes, my only comment is just a stylistic proposal.
| sample_parameters["is_{}".format(sampletype)] = True | ||
| else: | ||
| sample_parameters["is_{}".format(sampletype)] = False | ||
| if "data" in self.sample: |
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.
You can save some lines of code by shortening the if-else statements to:
sample_parameters["is_data"] = "data" in self.sampleThe same can be done for the "is_dyjets" and "is_wjets" flags.
|
I suggest to make it more general by looking at how the sample name starts with. This should also work if later other similar cases would be introduced to an analysis. The splitting is then set to always be an underscore. for sampletype in self.available_sample_types:
if self.sample == sampletype or self.sample.startswith(sampletype + "_"):
sample_parameters["is_{}".format(sampletype)] = True
else:
sample_parameters["is_{}".format(sampletype)] = False |
New flags are introduced for the cases where multiple subtypes of samples are used, but a flag for the overall type is also needed. For now,
is_data,is_dyjets, andis_wjetsare supported. Individual subtype flags are maintained alongside them.