Skip to content

Histogramming with multiple shifts (including JECR)#118

Draft
JulesVandenbroeck wants to merge 5 commits intoGhentAnalysis/masterfrom
GhentAnalysis/MergeHistograms_collection_shifts
Draft

Histogramming with multiple shifts (including JECR)#118
JulesVandenbroeck wants to merge 5 commits intoGhentAnalysis/masterfrom
GhentAnalysis/MergeHistograms_collection_shifts

Conversation

@JulesVandenbroeck
Copy link
Collaborator

@JulesVandenbroeck JulesVandenbroeck commented Feb 23, 2026

This is a pull request that will stay as a draft and is intended as a guide on how to modify columnflow to have the option to create histograms of multiple shifts in a single task

HOW TO USE:

  • add collection shifts that encapsulate multiple shifts you would like to bundle in the config:
    def add_shift_collection(config: od.Config, name, idx, shift_names):

        shifts = []
        for idr, direction in enumerate(shift_directions):
            col_name = f"{name}_{direction}"
            if config.has_shift(col_name):
                continue
            subshifts = [
                s for s in config.shifts
                if law.util.multi_match(s.name, shift_names)
                if s.name.endswith(direction)
            ]
            col_shift = config.add_shift(
                col_name,
                id=(idx := idx + 1),
                type="shape",
                tags=["is_collection"],
                aux=dict(subshifts=[s.name for s in subshifts]),
            )

            shifts.append(col_shift)

        return shifts
        
    base_collection_shifts = add_shift_collection(
        config,
        "base_shift",
        idx=10000,
        shift_names=base_shifts,
    )     
  • In the case that a shift that is part of the collection shift is selection dependent, that shift must have the tag selection_dependent
  • Use the hist-producer called shifts_hist with the relevant collection shift variation (eg.: base_shift_up). This will produce a histogram with all subshifts included.
  • To use these histograms in cf.CreateDatacards make sure to set all parameters that include shifts encapsulated by the collection shift to is_dynamic. A dummy parameter needs to be added using the collection shift in order for the task to require the relevant cf.MergeShiftedHistograms tasks.
  • These histograms can also be used for the cf.PlotShiftedVariables1D task without any issue. This is however currently not possible for the cf.PlotShiftedVariablesPerShift1D task.

If you have any questions don't hesitate to contact @maadcoen or myself (@JulesVandenbroeck)

@JulesVandenbroeck JulesVandenbroeck changed the title all changes to have multiple shifts in CreateHistograms all the way t… Histogramming with multiple shifts (including JECR) Feb 23, 2026
juvanden added 2 commits February 23, 2026 15:55
…oved possibility for collections with data. Instead it will take the subshifts where recognized.
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.

1 participant