Skip to content

Move histTupleFlavor handling to Setup#282

Merged
kandrosov merged 18 commits into
cms-flaf:mainfrom
aebid:Update_HistTupleFlavor
Jul 21, 2026
Merged

Move histTupleFlavor handling to Setup#282
kandrosov merged 18 commits into
cms-flaf:mainfrom
aebid:Update_HistTupleFlavor

Conversation

@aebid

@aebid aebid commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Moving the histTuple_flavor logic into the Setup class.

histTuple_flavor was a key used in the global.yaml that can point to different histTuple setups. This contains 2 parts:
"variables" -- list of variables to plot into histograms
"fullResolution_variables" -- list of variables to save at full resolution (NOT PLOT)

Previously, through some quirks, law tasks were created using the default variables list always, even when histTuple_flavor was set to something else (DNN_training in bbWW example). This created weird dependency and branch creation.

This new method is set to instead handle both variable lists through Setup, creating setup.histTuple_plot_vars and setup.histTuple_fullres_vars. Through these and the union setup.histTuple_vars, the law tasks are correctly created now.

The side effect is now all global.yaml need to move their default variables and old named histTuple_fullResolution_variables into a default key of their histTuple_flavors dict.

@aebid

aebid commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@cms-flaf-bot please test

  • HH_bbWW_version=PR_100

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282022 started

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282022 failed

aebid added 3 commits July 14, 2026 12:35
Refactor logic for handling histogram tuple variables to improve readability.
Refactor access to histTuple flavor variables for better readability.
@aebid

aebid commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@cms-flaf-bot please test

  • HH_bbWW_version=PR_100

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282141 started

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282141 failed

@aebid

aebid commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@cms-flaf-bot please test

  • HH_bbWW_version=PR_100

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282331 started

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282331 failed

aebid added 4 commits July 14, 2026 13:57
@aebid

aebid commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@cms-flaf-bot please test

  • HH_bbWW_version=PR_100
  • HH_bbtautau_version=PR_75
  • H_mumu_version=PR_65

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282512 started

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282512 failed

@aebid

aebid commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@cms-flaf-bot please test

  • HH_bbWW_version=PR_100
  • HH_bbtautau_version=PR_75
  • H_mumu_version=PR_65

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282562 started

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282562 failed

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282751 failed

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15282817 passed

@aebid

aebid commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@kandrosov CI passed with robin_cache option to fix Hmm analysis. Ready for review

Comment thread Analysis/HistTupleProducer.py Outdated
variables = setup.global_params["variables"]
elif type(setup.global_params["variables"]) == dict:
variables = setup.global_params["variables"].keys()
variables = setup.histTuple_plot_vars

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is it that HistTupleProducer uses histTuple_plot_vars but not histTuple_fullres_vars?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the stupidest way in the world -- the original fullres vars were a patch done on top of existing histTupleProducer. Meaning the Analysis/HistTupleProducer.py "variables" is only things that need to be binned.

The "fullres" vars are actually used in HH_bbWW/Analysis/histTupleDef.py like here:
https://github.com/cms-flaf/HH_bbWW/pull/100/changes#diff-0be58a80ddb2156d834672742929e8b5d6188c495528150fcc3ce49660014f82

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, can you move it to HistTupleProducer for consistency?

Comment thread Common/Setup.py Outdated
Comment on lines +370 to +381
unique_list = []
seen_hashable = set()
seen_unhashable = []
for var in self.histTuple_plot_vars + self.histTuple_fullres_vars:
if isinstance(var, dict):
if var not in seen_unhashable:
seen_unhashable.append(var)
unique_list.append(var)
else:
if var not in seen_hashable:
seen_hashable.add(var)
unique_list.append(var)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a good place to check the unique names of the variables (and raise an error if they are not). So I propose something like this:

var_dict = {}
for var in self.histTuple_plot_vars + self.histTuple_fullres_vars:
    var_name = var["name"] if isinstance(var, dict) else var
    if var_name in var_dict:
        raise RuntimeError(f"Duplicated variable name {var_name}")
    var_dict[var_name] = var
self.histTuple_vars = list(var_dict.values())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After going back through this, I disagree about the duplicated variables thing.

I don't have a 100% clear reason for it, but I can imagine we will sometimes want both a plot and a fullres version of a variable. I think the duplicate business would need to happen on plot vars and fullres vars separately.

Refactored variable uniqueness check to use a dictionary for improved efficiency and clarity.
@aebid

aebid commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@cms-flaf-bot please test (Cache rebuild magic?)

  • HH_bbWW_version=PR_100
  • HH_bbtautau_version=PR_75
  • H_mumu_version=PR_65
  • rebuild_cache=1

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15303956 started

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15303956 passed

Comment thread Analysis/HistTupleProducer.py Outdated
variables = setup.global_params["variables"]
elif type(setup.global_params["variables"]) == dict:
variables = setup.global_params["variables"].keys()
variables = setup.histTuple_plot_vars

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, can you move it to HistTupleProducer for consistency?

@aebid

aebid commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

@cms-flaf-bot please test (Cache rebuild magic?)

  • HH_bbWW_version=PR_100
  • HH_bbtautau_version=PR_75
  • H_mumu_version=PR_65
  • rebuild_cache=1

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15314824 started

@aebid

aebid commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

@cms-flaf-bot please test

  • HH_bbWW_version=PR_100
  • HH_bbtautau_version=PR_75
  • H_mumu_version=PR_65
  • rebuild_cache=1

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15314861 started

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15314824 failed

@aebid

aebid commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

@cms-flaf-bot please test

  • HH_bbWW_version=PR_100
  • HH_bbtautau_version=PR_75
  • H_mumu_version=PR_65
  • rebuild_cache=1

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15314861 failed

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15315060 started

@aebid

aebid commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

@cms-flaf-bot please test

  • HH_bbWW_version=PR_100
  • HH_bbtautau_version=PR_75
  • H_mumu_version=PR_65
  • rebuild_cache=1

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15315207 started

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15315060 failed

@cms-flaf-bot

Copy link
Copy Markdown
Collaborator

pipeline#15315207 passed

@aebid

aebid commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

@kandrosov ready for review again. Everything looks good. bbWW has a new default histTupleFlavors that includes lep1_pt as both a binned and a fullres variable that is correctly handled in the final artifact from the test.

Full resolution has also been moved from HH_bbWW/Analysis/histTupleDef to the standard FLAF/Analysis/histTupleProducer
cms-flaf/HH_bbWW#100

@kandrosov
kandrosov merged commit c1ca07d into cms-flaf:main Jul 21, 2026
5 checks passed
@aebid
aebid deleted the Update_HistTupleFlavor branch July 23, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants