Skip to content

Refactor analysis scripts

Rosen Matev requested to merge hlteffchecker-release into master

(work by @rjhunter, thanks to @rmatev for opening the MR!)

During the writing of the documentation for the HltEfficiencyChecker package, it became apparent that the analysis scripts scripts/hlt_line_efficiencies.py and scripts/hlt_calculate_rates.py needed a refactor to remove confusion, be more user-friendly and add some valuable features. The most important changes are:

  • Small helper functions and the definitions of the denominators that were cluttering up the analysis scripts have been moved to python/HltEfficiencyChecker/utils.py.
  • help has been added/reviewed for all the args that you can parse to either analysis script.
  • Prefer the usage of comma-separated lists as inputs rather than nargs = '+', whitespace-spaced lists because the yaml syntax is simpler.

hlt_calculate_rates.py:

  • Now has the ability for you to define a group of lines at the command line/yaml, and it will calculate an inclusive rate for that group. This was available previously only for Hlt1 via some hard-coded groups. The hard-coded Hlt1 groups now exist as a set of defaults.

hlt_line_efficiencies.py:

  • Default to CanRecoChildren denominator rather than all that are defined.
  • Add ability to choose the denominator that will be applied to the shape distribution that is shown in the efficiency plots with --shape-distr-with-denom. In cases where there is only 1 denominator on the plot, that denominator is used, so this is only relevant when you want to see efficiencies for >1 denom on 1 plot.
  • Choose the particle who's kinematics you're interested in more simply e.g. --vars PT,Kminus:PT will plot efficiency versus parent PT and versus the PT of the Kminus.
  • --children -> --reconstructible-children to be more clear on what purpose that argument serves in terms of defining denominators.
  • Add ability to specify binning for efficiencies and the shape histogram (--nbins, --shape-nbins).
  • Refactored all the logic so that you get a sensible set of plots for any combination of --lines, --denoms.

The example scripts were slightly modified to take account of these changes and use some new features.

TODO:

  • Address #12 (closed)? Note that in the yaml we specify trigger_level as an integer to the job options, but we specify level as Hlt1 or Hlt2 to the analysis scripts. This is a place where an easy mistake could be made, the possibility of which could be eradicated if we address #12 (closed). ADDRESS LATER - see issue discussion.

See tutorial at Moore!542 (merged). This is WIP until we're happy with all the tutorials.

FYI @rmatev @sstahl @mvesteri

Edited by Ross John Hunter

Merge request reports