Skip to content

Add HltEfficiencyChecker tool to mooreanalysis

Ross John Hunter requested to merge rjhunter-HltEfficiencyChecker into master

FYI @rmatev @sstahl @mvesteri

This MR introduces the HltEfficiencyChecker tool, which runs the trigger on MC from the testfileDB and then instances a MCDecayTreeTuple algorithm from the Analysis project, with the tools TupleToolTrigger, TupleToolEventInfo, MCTupleToolKinematic and MCTupleToolReconstructed to write out the trigger line decisions to a tuple, as well kinematic MC truth info about the candidates that were triggered on. From there, analysis is performed on the tuple to calculate and plot efficiencies.

The tool is packaged up by the wrapper script HltEfficiencyChecker/scripts/, to which you pass information such as the test file you wish to run, number of events, which efficiency denominators and which lines you wish to calculate efficiencies for. This then auto-generates an input file for you containing information for Moore, then calls, passing some decay-specific options to Moore using the --option flag and HltEfficiencyChecker/options/ This will generate the tuple for analysis as described above. Finally, then calls an analysis script, HltEfficiencyChecker/scripts/ to calculate and plot the efficiencies, as specified by the user.

An example usage (from the top-level stack/ directory) would be

mooreanalysis/run mooreanalysis/HltEfficiencyChecker/scripts/ --data upgrade_DC19_01_Bs2JPsiPhi_MD --events 100

which would run Moore on 100 B_s \rightarrow J/\psi \phi events and print efficiencies for all lines and denominators defined in the analysis script, as well as generating a variety of associated plots.

If you want to run commands (e.g. calls to the analysis script, or just run Moore) separately, use the --dump arg, which will print out the list of commands that HltEfficiencyChecker calls internally. Note that you still need to give the other arguments (e.g. --events, --data) for this to work.

Documentation will follow in the form of an internal note and a starter kit-style tutorial soon after this is merged.

Please see slides here for some plots.


  • Write & update doc string in the top level script.
  • Make first attempt at writing truth-level kinematic info from the test file using DaVinci to a tuple, in order to calculate the denominator as some number of analysis-agnostic heavy flavour decays that should be trigger-able by a subset of the Hlt1 lines.
  • Discuss/explore different options for denominator.
  • Code clean-up/re-format. Not super important.
  • Move my code out of
  • Test that --dump is robust. Can be done in future MRs.
  • Use subprocess.check to properly handle exit codes so that when tests fail, they go red in the nightlies.

Depends on Analysis!576 (merged), LHCb!2319 (merged), Moore!389 (merged), LHCb!2373 (merged), Phys!662 (merged)

Edited by Ross John Hunter

Merge request reports