Skip to content

Refactor HltEfficiencyChecker and support HLT2

Rosen Matev requested to merge rmatev-refactor into master
  • Factorise the efficiency/rate tuple makers control flow in add_efficiency_tuples, requires Moore!486 (merged)
    • some metadata (annotated decay descriptor) is automatically written in options.ntuple + ".metadata.json" (ideally should be in ROOT file)
  • Create simple, complete examples
    • options for gaudirun.py ntuple-making jobs (e.g. hlt1_lines_example.py and hlt1_eff_example.py)
    • bash scripts that run ntuple-making jobs and rate/efficiency analysis (e.g. run_hlt1_examples.sh)
    • run with MooreAnalyss
  • Add a simple replacement of the HltEfficiencyChecker.py "wizard" script (hlt_eff_checker.py)
    • configuration is read from a yaml file (hlt1_eff_example.yaml) rather than passed via command line options
    • the configuration can contain (jinja2) templates for gaudirun options, which allows for a fully self-contained definition of gaudi options and analysis job (e.g. the name of the ntuple file is present only in that file
    • option templates are rendered and written out to a file
    • the gaudirun and analysis commands are printed, and unless --dry-run is passed, they are also executed
  • Minimal cleanup of analysis scripts hlt_line_efficiencies.py and hlt_calculate_rates.py
  • In general, "constant" output names are used for simplicity (e.g. independent from the input sample). Namespacing of outputs can be achieved by running in a different directory as seen in the examples below.
  • Removed obsolete code.

Example of "standalone" efficiency and rate jobs and analyses.

MooreAnalysis/run MooreAnalysis/HltEfficiencyChecker/options/run_hlt1_examples.sh
# output goes into a new directory checker-hlt1-examples-20200506-093835
MooreAnalysis/run MooreAnalysis/HltEfficiencyChecker/options/run_hlt1_examples.sh test1
# output goes into checker-hlt1-examples-test1 (overwriting existing files)

Example of using yaml configuration and hlt_eff_checker.py.

MooreAnalysis/run MooreAnalysis/HltEfficiencyChecker/scripts/hlt_eff_checker.py MooreAnalysis/HltEfficiencyChecker/options/hlt1_eff_example.yaml -o checker-hlt1
# output goes into a new directory checker-hlt1-20200506-093835
MooreAnalysis/run MooreAnalysis/HltEfficiencyChecker/scripts/hlt_eff_checker.py MooreAnalysis/HltEfficiencyChecker/options/hlt1_eff_example.yaml -o checker-hlt1 -s test1 --force
# output goes into checker-hlt1-test1 (overwriting existing files)

the command above will print (and execute) something like this

cd 'checker-hlt1test1'
'gaudirun.py' '$HLTEFFICIENCYCHECKERROOT/options/hlt1_lines_example.py' '.hlt_eff_checker_options_04518208.py'
'/home/rmatev/stack/MooreAnalysis/HltEfficiencyChecker/scripts/hlt_line_efficiencies.py' 'eff_ntuple.root' '--legend-header=B^{0}_{s} #rightarrow #phi#phi' '--make-histos' '--children=muplus,muminus,Kplus,Kminus' '--level=Hlt1'

You can also just print the commands using the --dry-run arg, e.g.

MooreAnalysis/run MooreAnalysis/HltEfficiencyChecker/scripts/hlt_eff_checker.py MooreAnalysis/HltEfficiencyChecker/options/hlt1_eff_example.yaml -o checker-hlt1 --dry-run

TODO

  • Go over TODO/FIXME in removed code and transfer them if needed
  • Test HLT2 using Analysis!618 (merged)
  • Adapt (or create new) tests for the new examples
  • Cleanup remaining dead code

Depends on Moore!486 (merged) and Analysis!618 (merged)

Closes #1 (closed) #9 (closed) #11 (closed)

Edited by Rosen Matev

Merge request reports