Repository navigation
Plot the shapes of a datacard bin from where the maker reads them (input_categories) - #31
Merged
Merged
Conversation
Author
|
@cms-flaf-bot please test |
|
pipeline#16086077 started |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes cms-flaf/FLAF#351.
CreateDatacardsTaskdrew its shape plots from each datacard category's own name, while the datacard maker reads a category listed ininput_categoriesfrom the mapped directory (SR/res2bfromSR_SL_M${MX}/res2b). As a result:no shapes to plotwarning per variable, and a_summed_*.rootfile was left inplots/.The plots now look each category up where the maker does. While mapping the multi-era change set C, a second defect turned up: the plotter did not get the task's
--user-custom, which FLAF'sHistPlotTaskdoes pass. It is fixed here too.Changes
law/StatInferenceTask.py:get_variable_points()returns {variable: [model points]}, andget_required_variables()is its sorted keys (the same list as before).law/CreateDatacardsTask.py:_present_keys(shape_file, cfg, points)resolves each category withInputCategories.path(the maker's rule,dc_make/maker.pyhistDir).--user-customis passed to HistPlotter when the task has one.test/test_shape_plots.py(7 tests), added tounit-tests.yaml, the README and the copilot-instructions Tests row.A configuration without
input_categoriesis unaffected: the lookup paths, keys, file names and grid panels are the same as before.Known and not changed here:
SR_SL_M300), which has nocustomregion_textentry in the plot config.hist_binsand has nopreprocess:step (CI_card_SL.yaml) is plotted at the input binning, as unmapped categories already were.Testing
test_law_chain.py(14) andtest_shape_plots.py(7): 21 passed. The environment was a Python 3.13 venv holding only pyyaml, numpy, luigi 3.8.1, law 0.1.21 and pytest (env -i), with FLAF 4d9602c next to this branch, as in theunit-testsworkflow.origin/main'slaw/).input_categories;--user-custom;HistPlotter.pyand pypdf, no mocks:plot_rebinned_shapesran on the four summed single-lepton shape files from the HH_bbWW integration job 84505422 (Run3_2022 … Run3_2023BPix). Each file holds{e,mu}/SR_SL_M300/{res2b,recovery}and noSR/....ci_custom.yamlwith a localfs_default.TESTER VERDICT: PASSfor 281e5c9. In every era: the 4 per-bin PDFs and the 2 grid PDFs (1 page each), HistPlotter keyse:res2b:SR_SL_M300…,--user-custompassed, no summed file left, and nono shapes to plotorshape plotting failedline.no shapes to plot, no PDF, and_summed_TwoStageDNN_M300_binary.rootleft in every era. This is FLAF#351.REVIEWER OKfor 0fa40aa + 6b6f36d, after the rebase onto StatInference#30 (the first round's blocker was the test wiring).REVIEWER OKfor 5010c4e + 281e5c9: the delta (the exact warning reasons and the hardened unreadable-file test).CI_card_SL.yaml).no shapes to plot(the baseline job 84505422 had 4), 0 ×shape plotting failedand 8 ×Wrote grid._summed_*.root(the baseline left 13 MB per era).--user-custom(flaf_integration copies its configuration toconfig/user_custom.yaml), so it exercises only the empty case. The non-empty case is covered by the unit test and the real run above.No docs change: the analysis and FLAF docs describe neither the datacard shape plots nor
input_categories; the plots now appear as the code always intended.