Refactor analysis scripts
(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 theyaml
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 theKminus
. -
--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 specifytrigger_level
as an integer to thejob
options, but we specifylevel
asHlt1
orHlt2
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.