diff --git a/doc/tutorials/developing.rst b/doc/tutorials/developing.rst index 834bcd525f8d2e1e64ceccb8dbe62464e500d084..5422d1128d13427b90f4175cdf2d92ca538ea7d6 100644 --- a/doc/tutorials/developing.rst +++ b/doc/tutorials/developing.rst @@ -223,7 +223,8 @@ The timing table prints the total and average time per event for every algorithm and it is advisable to compare the timing changes of your algorithm relative to some algorithm earlier in the reconstruction chain, like the Velo tracking. If you need more details and for example want to create a flamegraph, we recommend following the instructions in the `PRConfig`_ repository. -If you want to use valgrind tools (e.g. callgrind) to profile your code, see the docstring of the ``PyConf.application.make_callgrind_profile`` function and follow the instructions in the `CodeAnalysisTools`_ TWiki. +If you want to use valgrind tools (e.g. callgrind) to profile your code, see the docstring of the ``PyConf.application.make_callgrind_profile`` +function and follow the instructions in the "Job Options Driven Profiling" section of the `CodeAnalysisTools`_ Twiki page. .. _lb-stack-setup: https://gitlab.cern.ch/rmatev/lb-stack-setup @@ -241,7 +242,7 @@ If you want to use valgrind tools (e.g. callgrind) to profile your code, see the .. _CI pipeline: https://docs.gitlab.com/ee/ci/ .. _flake8 error codes: http://flake8.pycqa.org/en/2.5.5/warnings.html .. _PRConfig: https://gitlab.cern.ch/lhcb-datapkg/PRConfig/-/blob/master/scripts/benchmark-scripts/Readme.md -.. _CodeAnalysisTools: https://twiki.cern.ch/twiki/bin/view/LHCb/CodeAnalysisTools#Job_Options_Driven_Profiling +.. _CodeAnalysisTools: https://twiki.cern.ch/twiki/bin/view/LHCb/CodeAnalysisTools .. rubric:: Footnotes diff --git a/doc/tutorials/hltefficiencychecker.rst b/doc/tutorials/hltefficiencychecker.rst index 4ab14e79706686645d855fd80290aa2d7973096b..61b6b438b66077c8b3e9aded3122c2042e2b9280 100644 --- a/doc/tutorials/hltefficiencychecker.rst +++ b/doc/tutorials/hltefficiencychecker.rst @@ -112,13 +112,13 @@ say we are interested in measuring some HLT1 efficiencies on |PhiPhi-decay|. Her annotated_decay_descriptor: "[${B_s0}B_s0 => ( phi(1020) => ${Kplus0}K+ ${Kminus0}K-) ( phi(1020) => ${Kplus1}K+ ${Kminus1}K-) ]CC" - ntuple_path: &NTUPLE eff_ntuple.root + ntuple_path: &NTUPLE hlt1_eff_ntuple.root job: trigger_level: 1 evt_max: 100 - testfiledb_key: Upgrade_BsPhiPhi_MD_FTv4_DIGI + testfiledb_key: Upgrade_BsPhiPhi_MD_FTv4_DIGI_retinacluster debug_mode: False - hlt1_configuration: hlt1_pp_veloSP + hlt1_configuration: hlt1_pp_forward_then_matching_no_ut options: # - $HLTEFFICIENCYCHECKERROOT/options/hlt1_moore_lines_example.py # Allen lines are specified internally to Allen - $HLTEFFICIENCYCHECKERROOT/options/options_template.py.jinja # first rendered with jinja2 @@ -135,7 +135,7 @@ say we are interested in measuring some HLT1 efficiencies on |PhiPhi-decay|. Her The first options are needed globally. They are the ``ntuple_path``, which will be the name of the tuple that is written out, and the ``annotated_decay_descriptor``, which is an MC decay descriptor with an important difference. -``MCDecayTreeTuple`` - which writes the MC truth information to the tuple - needs a decay descriptor to find the signal decays in the MC. +``MCFunTuple`` - which writes the MC truth information to the tuple - needs a decay descriptor to find the signal decays in the MC. Given that, we'll get branches in the tuple of various kinematic properties of the different particles in the decay. In the same way that in ``DaVinci`` you need to put a `^` to the left of the particles you want to make branches for, here you must specify the branch prefix as ``${prefix}`` to the left of the particles of interest. For example, the tuple written from this config file will have branches for the @@ -165,10 +165,10 @@ of interest. We also specify an ``hlt1_configuration`` with the appropriate key; .. note:: - The ``hlt1_configuration`` (or ``Allen`` sequence) is a string that maps to the configured set of algorithms that will run in HLT1. The default one - -- ``hlt1_pp_default`` -- now expects `Retina Clusters`_, but most MC (as of May 2022) does not contain them, as they are quite a new development. - Although they `can be added to existing DIGI files <https://allen-doc.docs.cern.ch/setup/input_files.html#how-to-add-retinaclusters-to-existing-digi-files>`_, - you can also use the configuration that doesn't require them: ``hlt1_pp_veloSP``. + The ``hlt1_configuration`` (or ``Allen`` sequence) is a string that maps to the configured set of algorithms that will run in HLT1. The default ones + -- including ``hlt1_pp_forward_then_matching_no_ut``, which is the default for the beginning of 2024 -- now expect `Retina Clusters`_, but older MC + does not contain them. Although they `can be added to existing DIGI files <https://allen-doc.docs.cern.ch/setup/input_files.html#how-to-add-retinaclusters-to-existing-digi-files>`_, + you can also use a configuration that doesn't require them, e.g. ``hlt1_pp_veloSP``. If set to ``True``, the ``debug_mode`` key will make the trigger print **lots** more information to the console than is usual, which may be helpful to track down an error. To deal with the huge amounts of output you'll get, it may be wise to restrict to a handful of events and save the output to a @@ -382,23 +382,20 @@ We'll this time follow the example decay of |jpsiPhi-decay|, which has an exampl .. code-block:: yaml # HltEfficiencyChecker "wizard" example for Hlt2 rates - ntuple_path: &NTUPLE rate_ntuple.root + ntuple_path: &NTUPLE hlt2_rate_ntuple.root job: trigger_level: 2 evt_max: 200 - testfiledb_key: upgrade_minbias_hlt1_filtered - input_raw_format: 4.3 - lines_from: Hlt2Conf.lines.starterkit.bs_to_jpsiphi - hlt2_configuration: fastest - use_old_calo_raw_banks: True - muon_decoding_version: 2 + testfiledb_key: expected_2024_min_bias_hlt1_filtered + lines_from: Hlt2Conf.lines.topological_b + hlt2_configuration: current_without_UT options: - $HLTEFFICIENCYCHECKERROOT/options/options_template.py.jinja # first rendered with jinja2 analysis: script: $HLTEFFICIENCYCHECKERROOT/scripts/hlt_calculate_rates.py args: input: *NTUPLE - input_rate: 1650 # Hlt v30r0 VLoose HLT1 configuration for filtering. See MooreAnalysis#42 + input_rate: 1140 # See links in TestFileDB entry json: Hlt2_rates.json The first thing you might notice is the absence of the ``annotated_decay_descriptor``. We are interested in estimating the rate that a @@ -408,38 +405,35 @@ all of which could potentially be a different process, which would all need a di putting the MC truth information into a single tuple would be very difficult, and not very useful. Therefore, we don't try to save it and thus don't need a decay descriptor. -This time, we need to specify a non-default ``input_raw_format``, and instead of listing a script that configures the lines, we use the +This time, instead of listing a script that configures the lines, we use the ``lines_from`` key, which is only supported for HLT2 and does the same job. A HLT2 reconstruction configuration has been chosen -via the ``hlt2_configuration`` key, which is described more below. The ``upgrade_minbias_hlt1_filtered`` sample is quite old (made in 2018-19), -and the specification of ``use_old_calo_raw_banks`` and ``muon_decoding_version`` is needed to support this older sample - more on this below. -Finally, ``script`` now gives the path to the script +via the ``hlt2_configuration`` key, which is described more below. Finally, ``script`` now gives the path to the script that calculates rates, and we inform that script what the input rate of the sample is, which depends on if any filtering (e.g. by HLT1) was applied during the creation of the sample. The different input rates you can expect to put here is explained :ref:`below <rate_defns>`). ``json`` is the name of a ``.json`` to which the rate will be saved. -.. note:: - - ``input_raw_format`` needed to be set to ``4.3`` because the ``upgrade_minbias_hlt1_filtered`` files are in ``LDST`` format, which - means they store reconstruction-level information that we can make selections on. This stored reconstruction was provided by - running the samples through the offline reconstruction application ``Brunel`` when they were produced. There is further guidance on - raw formats :doc:`here <different_samples>`. - - In data-taking, we will make selections based on the real-time, full HLT2 reconstruction, and so we run this by default for HLT2 in - ``HltEfficiencyChecker``. The configuration of the reconstruction is provided by the ``hlt2_configuration`` key, which currently - supports the values ``fastest`` and ``light_without_UT``. The former (latter) is more representative of 2024 (2022-23) data-taking - conditions/expectations. If you wish, you could also use the (very old!) ``Brunel`` reconstruction stored in a ``LDST`` file by - providing the ``reco_from_file`` key as ``True``, in which case you should not provide the ``hlt2_configuration`` line in the above example. +There are a number of ``job`` options that we don't require by default, but which are required to run over older samples or samples with +different formats. These are: + +- ``input_raw_format`` \: a decimal version number telling the job how to read the input file. There is more guidance on raw formats :doc:`here <different_samples>`. +- ``use_old_calo_raw_banks``: accepts ``True`` or ``False`` - the former asks the HLT2 calorimeter reconstruction to use an old + format of the CALO raw banks. MC samples produced with the CondDB tag ``sim-20220614-vc-mu100`` or later (see date in the tag) + were produced with the new CALO raw banks. If you have such a sample, just omit the line ``use_old_calo_raw_banks: True`` entirely, + and the reconstruction will know to use the new banks by default. If your file has old CALO raw banks and you do not provide + ``use_old_calo_raw_banks: True``, the calorimeter reconstruction will not find the banks - therefore do no CALO reco - **but will not fail**. + It's therefore important to get this right if you are reconstructing signals reliant on the calorimeters, for example electrons. +- ``muon_decoding_version`` has been updated over the years, and is (as of December 2023) at version ``3`` by default. Most older samples + require version ``2``. If you provide the wrong version, the muon decoding will crash at runtime, so you will know to add this option. +- ``reco_from_file: True``: in some very old samples in ``LDST`` format (corresponding to an ``input_raw_format`` of ``4.3``), the file + contains reconstructed information based on a very-old ``Brunel`` reconstruction, which can be used instead of the state-of-the-art + reconstruction in Moore. This is not generally recommended - this reconstruction is deprecated. In this case, you should not + provide the ``hlt2_configuration`` key in addition. .. note:: - ``use_old_calo_raw_banks`` asks the HLT2 calorimeter reconstruction to use an old format of the CALO raw banks. MC samples - produced with the CondDB tag ``sim-20220614-vc-mu100`` or later (see date in the tag) were produced with the new CALO raw banks. - If you have such a sample, just omit the line ``use_old_calo_raw_banks: True`` entirely, and the reconstruction will know to use the - new banks by default. Similarly, the ``muon_decoding_version`` has been updated over the years, and is (as of December 2023) at - version ``3`` by default. Most older samples require version ``2``. If you provide the wrong version, the muon decoding will crash - at runtime, so you will know to add this option. On the other hand, if your file has old CALO raw banks and you do not provide - ``use_old_calo_raw_banks: True``, the calorimeter reconstruction will not find the banks - therefore do no CALO reco - **but will not fail**. - It's therefore important to get this right if you are reconstructing signals reliant on the calorimeters, for example electrons. + The configuration of the reconstruction is provided by the ``hlt2_configuration`` key, which currently + supports the values ``current_without_UT`` and ``future_with_UT``. The former is more representative of the start of 2024 data-taking + conditions/expectations, whilst the latter should correspond to more nominal conditions when the UT is installed. If the above code is put into a script with the path ``DaVinci/HltEfficiencyChecker/options/hlt2_rate_example.yaml``, we can run as before:: @@ -448,26 +442,28 @@ before:: we'll see the printout:: - ----------------------------------------------------------------------------------------------------- + -------------------------------------------------------------------------------------------------------------- INFO: Starting /home/user/stack/DaVinci/HltEfficiencyChecker/scripts/hlt_calculate_rates.py... - ----------------------------------------------------------------------------------------------------- + -------------------------------------------------------------------------------------------------------------- INFO: No lines specified. Defaulting to all... HLT rates: - ----------------------------------------------------------------------------------------------------- - Line: Hlt2Starterkit_Bs0ToJpsiPhi_PRDecision Incl: 8.25 +/- 8.2293 kHz, Excl: 0.0 +/- 0.0 kHz - Line: Hlt2Starterkit_Bs0ToKmKpMumMup_SPDecision Incl: 8.25 +/- 8.2293 kHz, Excl: 0.0 +/- 0.0 kHz - ----------------------------------------------------------------------------------------------------- - Hlt2 Total: Rate: 8 +/- 8.2 kHz - ----------------------------------------------------------------------------------------------------- + -------------------------------------------------------------------------------------------------------------- + Line: Hlt2Topo2BodyDecision Incl: 11.4 +/- 8.0206 kHz, Excl: 11.4 +/- 8.0206 kHz + Line: Hlt2Topo3BodyDecision Incl: 5.7 +/- 5.6857 kHz, Excl: 0.0 +/- 0.0 kHz + Line: Hlt2TopoMu2BodyDecision Incl: 11.4 +/- 8.0206 kHz, Excl: 5.7 +/- 5.6857 kHz + Line: Hlt2TopoMu3BodyDecision Incl: 5.7 +/- 5.6857 kHz, Excl: 0.0 +/- 0.0 kHz + -------------------------------------------------------------------------------------------------------------- + Hlt2 Total: Rate: 23 +/- 11.3 kHz + -------------------------------------------------------------------------------------------------------------- Finished printing HLT rates! Note that both the *inclusive* rate (rate of that line firing agnostic to other lines) is returned as well as the *exclusive* rate (rate of firing on events that **only** this line fired for). There is also the total rate (rate that one or more lines fired on an event). Because -the lines we've used are very similar, these three quantities are the same, but will generally differ for a set of lines. +the lines we've trigger on similar signals, the exclusive rates are sometimes smaller than the inclusive - this is typical for lines with overlapping selections. If we go into the temporary directory that has been auto-created (in this case it is called ``checker-20230427-141928``) we'll see:: - (LHCb Env) [user@users-computer checker-20230427-141928]$ ls - Hlt2_rates.json rate_ntuple_new.root rate_ntuple.root + [user@users-computer checker-20240314-151316]$ ls + Hlt2_rates.json hlt2_rate_ntuple.root lhcb-metainfo .. _denominators: @@ -599,8 +595,8 @@ analysis scripts will see more triggers, we have to tell it what the input rate the HLT1-filtering) to get the correct HLT2 output rate. This is achieved with the ``input_rate`` analysis key, which accepts a value in kHz. The default is therefore 30000. HLT1-filtered min. bias should have an input rate around `1000 kHz <https://indico.cern.ch/event/921771/contributions/3882467/attachments/2053448/3442508/ProjectOrg_ForLHCbWeek_09062020.pdf>`_, -but can differ between samples. For example, the ``upgrade_minbias_hlt1_filtered`` sample has a HLT1 output rate of 1.65 MHz, whilst -``UpgradeHLT1FilteredWithGEC`` featured a tighter HLT1 configuration and has an output rate of 0.5 MHz. +but can differ between samples. For example, the ``expected_2024_min_bias_hlt1_filtered`` sample has a HLT1 output rate of 1.14 MHz, whilst +the older ``upgrade_minbias_hlt1_filtered`` featured a looser HLT1 configuration and has an output rate of 1.65 MHz. Beyond the wizard: writing and running your own options file ------------------------------------------------------------ @@ -612,7 +608,7 @@ e.g. to test your new line, then you'll be happy to learn that with a few small .. code-block:: python from Moore import options - from Hlt2Conf.lines.starterkit.bs_to_jpsiphi import all_lines + from Hlt2Conf.lines.topological_b import all_lines def make_lines(): return [builder() for builder in all_lines.values()] @@ -625,12 +621,22 @@ and an options file defining the input: from Moore import options from HltEfficiencyChecker.config import run_moore_with_tuples - from RecoConf.reconstruction_objects import reconstruction - from RecoConf.hlt2_global_reco import reconstruction as hlt2_reconstruction, make_fastest_reconstruction - decay = ( - "${Bs}[B_s0 => ( J/psi(1S) => ${mup}mu+ ${mum}mu- ) ( phi(1020) => ${Kp}K+ ${Km}K- )]CC" + # Imports for 2024-like no-UT reconstruction scenario aligned with hlt2_pp_thor_without_UT + from RecoConf.global_tools import ( + stateProvider_with_simplified_geom, + trackMasterExtrapolator_with_simplified_geom, + ) + from RecoConf.reconstruction_objects import reconstruction + from RecoConf.hlt2_global_reco import ( + reconstruction as hlt2_reconstruction, + make_light_reco_pr_kf_without_UT, ) + from RecoConf.ttrack_selections_reco import make_ttrack_reco + from RecoConf.calorimeter_reconstruction import make_digits + from RecoConf.hlt1_muonid import make_muon_hits + + decay = "${Bs}[B_s0 => ( J/psi(1S) => ${mup}mu+ ${mum}mu- ) ( phi(1020) => ${Kp}K+ ${Km}K- )]CC" options.input_files = [ # HLT1-filtered # Bs -> J/psi Phi, 13144011 @@ -645,27 +651,31 @@ and an options file defining the input: "root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000064_1.ldst", "root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000068_1.ldst", ] - options.input_type = 'ROOT' + options.input_type = "ROOT" options.input_raw_format = 4.3 options.evt_max = 100 + options.data_type = "Upgrade" + options.dddb_tag = "dddb-20171126" + options.conddb_tag = "sim-20171127-vc-md100" + options.ntuple_file = "hlt2_eff_ntuple.root" + options.scheduler_legacy_mode = False options.simulation = True - options.data_type = 'Upgrade' - options.dddb_tag = 'dddb-20171126' - options.conddb_tag = 'sim-20171127-vc-md100' - options.ntuple_file = "eff_ntuple.root" - from RecoConf.calorimeter_reconstruction import make_digits make_digits.global_bind(calo_raw_bank=False) - - from RecoConf.hlt1_muonid import make_muon_hits make_muon_hits.global_bind(geometry_version=2) - from RecoConf.global_tools import stateProvider_with_simplified_geom - with reconstruction.bind(from_file=False), hlt2_reconstruction.bind( - make_fastest_reconstruction): - run_moore_with_tuples( - options, False, decay, public_tools=[stateProvider_with_simplified_geom()]) + public_tools = [ + trackMasterExtrapolator_with_simplified_geom(), + stateProvider_with_simplified_geom(), + ] + with reconstruction.bind(from_file=False), make_light_reco_pr_kf_without_UT.bind( + skipRich=False, skipCalo=False, skipMuon=False + ), make_ttrack_reco.bind(skipCalo=False), hlt2_reconstruction.bind( + make_reconstruction=make_light_reco_pr_kf_without_UT + ): + run_moore_with_tuples(options, False, decay, public_tools=public_tools) + These two scripts could be put together, but we keep them separate for modularity. @@ -675,9 +685,17 @@ most important difference is that, instead of calling ``run_moore()`` at the end which simply adds the tuple-creating tools into the control flow directly after ``Moore`` has run. The latter requires a flag that indicates whether HLT1 (``True``) or HLT2 (``False``) is running and the annotated decay descriptor, as was motivated earlier. To run the full HLT2 reconstruction, we wrap the ``run_moore_with_tuples`` call in ``with reconstruction.bind(from_file=False)``. Providing the -``reco_from_file`` key earlier amounts to putting ``from_file=True`` here. The ``hlt2_configuration`` key we provided earlier was ``fastest``, -which maps to the ``make_fastest_reconstruction`` function. Alternatively, ``light_without_UT`` would map to the -``make_light_reco_pr_kf_without_UT`` reconstruction function. +``reco_from_file`` key earlier amounts to putting ``from_file=True`` here. The ``hlt2_configuration`` key we provided earlier was ``current_without_UT``, +which maps to the ``make_light_reco_pr_kf_without_UT`` function and a series of binds. Alternatively, ``future_with_UT`` would map to the +``make_fastest_reconstruction`` reconstruction function. The lines: + +.. code-block:: python + + make_digits.global_bind(calo_raw_bank=False) + make_muon_hits.global_bind(geometry_version=2) + +correspond to the ``yaml`` keys ``use_old_calo_raw_banks`` and ``muon_decoding_version`` as detailed above - they are required here +because the signal simulation being used is relatively old. Assuming that the former of these scripts lives at ``DaVinci/HltEfficiencyChecker/options/hlt2_lines_example.py`` and the second at ``DaVinci/HltEfficiencyChecker/options/hlt2_eff_example.py``, we can then pass both of these options files to ``gaudirun.py``, @@ -689,7 +707,7 @@ which will produce the tuple ``eff_ntuple.root`` as before. Note that we haven't tuple will not appear in an auto-generated temporary directory as before - it will appear in your current directory. You can then run the analysis script on the tuple when it is produced:: - DaVinci/run DaVinci/HltEfficiencyChecker/scripts/hlt_line_efficiencies.py eff_ntuple.root --reconstructible-children=Kp,Km,mup,mum --true-signal-to-match-to Bs --legend-header="B_{s} #rightarrow J/#psi #phi" --make-plots + DaVinci/run DaVinci/HltEfficiencyChecker/scripts/hlt_line_efficiencies.py hlt2_eff_ntuple.root --reconstructible-children=Kp,Km,mup,mum --true-signal-to-match-to Bs --legend-header="B_{s} #rightarrow J/#psi #phi" --make-plots Where we see for the first time the difference between the ``yaml`` keys and the command line arguments. This example should yield a plot that looks like this: @@ -697,7 +715,7 @@ that looks like this: .. image:: hltefficiencychecker_plots/hlteffchecker_hlt2_example.png :width: 600 :align: center - :alt: Efficiency of the Hlt2Starterkit_Bs0ToJpsiPhi line for all denominators (just *CanRecoChildren* was asked for) plotted against + :alt: Efficiency of the Hlt2Topo2BodyDecision for all denominators (just *CanRecoChildren* was asked for) plotted against the parent's |pt|. where the ``--true-signal-to-match-to`` argument was used to filter out the ``TrueSim`` efficiencies of the four final-state particles of this decay, since @@ -709,32 +727,42 @@ The rate of this line can be calculated by first configuring a minimum bias run from Moore import options from HltEfficiencyChecker.config import run_moore_with_tuples + + # Imports for 2024-like no-UT reconstruction scenario aligned with hlt2_pp_thor_without_UT + from RecoConf.global_tools import ( + stateProvider_with_simplified_geom, + trackMasterExtrapolator_with_simplified_geom, + ) from RecoConf.reconstruction_objects import reconstruction - from RecoConf.hlt2_global_reco import reconstruction as hlt2_reconstruction, make_fastest_reconstruction + from RecoConf.hlt2_global_reco import ( + reconstruction as hlt2_reconstruction, + make_light_reco_pr_kf_without_UT, + ) + from RecoConf.ttrack_selections_reco import make_ttrack_reco - options.set_input_and_conds_from_testfiledb('upgrade_minbias_hlt1_filtered') - options.input_raw_format = 4.3 + # Expected HLT1 output rate of this sample is ~1.14 MHz. + options.set_input_and_conds_from_testfiledb("expected_2024_min_bias_hlt1_filtered") options.evt_max = 200 + options.ntuple_file = "hlt2_rate_ntuple.root" + options.scheduler_legacy_mode = False + options.simulation = True - options.ntuple_file = "rate_ntuple.root" - - from RecoConf.calorimeter_reconstruction import make_digits - make_digits.global_bind(calo_raw_bank=False) - - from RecoConf.hlt1_muonid import make_muon_hits - make_muon_hits.global_bind(geometry_version=2) - - from RecoConf.global_tools import stateProvider_with_simplified_geom - with reconstruction.bind(from_file=False), hlt2_reconstruction.bind( - make_fastest_reconstruction): - run_moore_with_tuples( - options, False, public_tools=[stateProvider_with_simplified_geom()]) + public_tools = [ + trackMasterExtrapolator_with_simplified_geom(), + stateProvider_with_simplified_geom(), + ] + with reconstruction.bind(from_file=False), make_light_reco_pr_kf_without_UT.bind( + skipRich=False, skipCalo=False, skipMuon=False + ), make_ttrack_reco.bind(skipCalo=False), hlt2_reconstruction.bind( + make_reconstruction=make_light_reco_pr_kf_without_UT + ): + run_moore_with_tuples(options, False, public_tools=public_tools) and then running these options (``DaVinci/HltEfficiencyChecker/options/hlt2_rate_example.py``) and then the rate-calculating script ``hlt_calculate_rates.py`` on ``rate_ntuple.root``:: DaVinci/run gaudirun.py DaVinci/HltEfficiencyChecker/options/hlt2_lines_example.py DaVinci/HltEfficiencyChecker/options/hlt2_rate_example.py - DaVinci/run DaVinci/HltEfficiencyChecker/scripts/hlt_calculate_rates.py rate_ntuple.root --input-rate 1650 --json Hlt2_rates.json + DaVinci/run DaVinci/HltEfficiencyChecker/scripts/hlt_calculate_rates.py hlt2_rate_ntuple.root --input-rate 1140 --json Hlt2_rates.json which gives the output:: @@ -744,10 +772,12 @@ which gives the output:: INFO: No lines specified. Defaulting to all... HLT rates: -------------------------------------------------------------------------------------------------------------- - Line: Hlt2Starterkit_Bs0ToJpsiPhi_PRDecision Incl: 8.25 +/- 8.2293 kHz, Excl: 0.0 +/- 0.0 kHz - Line: Hlt2Starterkit_Bs0ToKmKpMumMup_SPDecision Incl: 8.25 +/- 8.2293 kHz, Excl: 0.0 +/- 0.0 kHz + Line: Hlt2Topo2BodyDecision Incl: 11.4 +/- 8.0206 kHz, Excl: 11.4 +/- 8.0206 kHz + Line: Hlt2Topo3BodyDecision Incl: 5.7 +/- 5.6857 kHz, Excl: 0.0 +/- 0.0 kHz + Line: Hlt2TopoMu2BodyDecision Incl: 11.4 +/- 8.0206 kHz, Excl: 5.7 +/- 5.6857 kHz + Line: Hlt2TopoMu3BodyDecision Incl: 5.7 +/- 5.6857 kHz, Excl: 0.0 +/- 0.0 kHz -------------------------------------------------------------------------------------------------------------- - Hlt2 Total: Rate: 8 +/- 8.2 kHz + Hlt2 Total: Rate: 23 +/- 11.3 kHz -------------------------------------------------------------------------------------------------------------- Finished printing HLT rates! @@ -813,9 +843,9 @@ The ``.yaml`` configuration of the wizard for overlap calculation is much the sa ntuple_path: &NTUPLE hlt1_overlap_ntuple.root job: trigger_level: 1 - evt_max: 10000 - testfiledb_key: upgrade_DC19_01_MinBiasMD - hlt1_configuration: hlt1_pp_veloSP + evt_max: 100 + testfiledb_key: exp_24_minbias_Sim10c_magdown + hlt1_configuration: hlt1_pp_forward_then_matching_no_ut options: - $HLTEFFICIENCYCHECKERROOT/options/options_template.py.jinja # first rendered with jinja2 analysis: @@ -884,38 +914,29 @@ Just as for rates, the wizard can be used to calculate overlaps between selectio DaVinci/run DaVinci/HltEfficiencyChecker/scripts/hlt_eff_checker.py DaVinci/HltEfficiencyChecker/options/hlt1_overlap_example.yaml -The result of which is a number of directories within ``hlt1_overlap_example/``, one for each of the overlaps specified first. Looking at the +The result of which is (within the usual dated ``checker-YYYYMMDD-HHMMSS`` directory) a number of directories within ``hlt1_overlap_example/``, one for each of the overlaps specified first. Looking at the sub-directory ``exampleHlt1TrackMVAOverlaps/``, which examines any HLT1 line containing the keywords ``Track`` and ``MVA``. The overlap metrics are written out to the following table: .. code-block:: text - linesetA countA countA_err linesetB countB countB_err countAnB countAnB_err countAuB countAuB_err probA|B probA|B_err jaccardAB jaccardAB_err - 0 Hlt1TrackElectronMVADecision 108.0 10.392305 Hlt1TrackElectronMVADecision 108.0 10.392305 108.0 10.392305 108.0 10.392305 1.000000 0.136083 1.000000 0.136083 - 1 Hlt1TrackElectronMVADecision 108.0 10.392305 Hlt1TrackMVADecision 174.0 13.190906 14.0 3.741657 268.0 16.370706 0.080460 0.022352 0.052239 0.014321 - 2 Hlt1TrackElectronMVADecision 108.0 10.392305 Hlt1TrackMuonMVADecision 6.0 2.449490 1.0 1.000000 113.0 10.630146 0.166667 0.180021 0.008850 0.008889 - 3 Hlt1TrackElectronMVADecision 108.0 10.392305 Hlt1TwoTrackMVACharmXSecDecision 1878.0 43.335897 55.0 7.416198 1931.0 43.943145 0.029286 0.004006 0.028483 0.003895 - 4 Hlt1TrackElectronMVADecision 108.0 10.392305 Hlt1TwoTrackMVADecision 311.0 17.635192 21.0 4.582576 398.0 19.949937 0.067524 0.015224 0.052764 0.011814 - 5 Hlt1TrackMVADecision 174.0 13.190906 Hlt1TrackElectronMVADecision 108.0 10.392305 14.0 3.741657 268.0 16.370706 0.129630 0.036822 0.052239 0.014321 - 6 Hlt1TrackMVADecision 174.0 13.190906 Hlt1TrackMVADecision 174.0 13.190906 174.0 13.190906 174.0 13.190906 1.000000 0.107211 1.000000 0.107211 - 7 Hlt1TrackMVADecision 174.0 13.190906 Hlt1TrackMuonMVADecision 6.0 2.449490 4.0 2.000000 176.0 13.266499 0.666667 0.430331 0.022727 0.011492 - 8 Hlt1TrackMVADecision 174.0 13.190906 Hlt1TwoTrackMVACharmXSecDecision 1878.0 43.335897 96.0 9.797959 1956.0 44.226689 0.051118 0.005349 0.049080 0.005131 - 9 Hlt1TrackMVADecision 174.0 13.190906 Hlt1TwoTrackMVADecision 311.0 17.635192 69.0 8.306624 416.0 20.396078 0.221865 0.029524 0.165865 0.021560 - 10 Hlt1TrackMuonMVADecision 6.0 2.449490 Hlt1TrackElectronMVADecision 108.0 10.392305 1.0 1.000000 113.0 10.630146 0.009259 0.009302 0.008850 0.008889 - 11 Hlt1TrackMuonMVADecision 6.0 2.449490 Hlt1TrackMVADecision 174.0 13.190906 4.0 2.000000 176.0 13.266499 0.022989 0.011626 0.022727 0.011492 - 12 Hlt1TrackMuonMVADecision 6.0 2.449490 Hlt1TrackMuonMVADecision 6.0 2.449490 6.0 2.449490 6.0 2.449490 1.000000 0.577350 1.000000 0.577350 - 13 Hlt1TrackMuonMVADecision 6.0 2.449490 Hlt1TwoTrackMVACharmXSecDecision 1878.0 43.335897 2.0 1.414214 1882.0 43.382024 0.001065 0.000753 0.001063 0.000752 - 14 Hlt1TrackMuonMVADecision 6.0 2.449490 Hlt1TwoTrackMVADecision 311.0 17.635192 2.0 1.414214 315.0 17.748239 0.006431 0.004562 0.006349 0.004504 - 15 Hlt1TwoTrackMVACharmXSecDecision 1878.0 43.335897 Hlt1TrackElectronMVADecision 108.0 10.392305 55.0 7.416198 1931.0 43.943145 0.509259 0.084361 0.028483 0.003895 - 16 Hlt1TwoTrackMVACharmXSecDecision 1878.0 43.335897 Hlt1TrackMVADecision 174.0 13.190906 96.0 9.797959 1956.0 44.226689 0.551724 0.070145 0.049080 0.005131 - 17 Hlt1TwoTrackMVACharmXSecDecision 1878.0 43.335897 Hlt1TrackMuonMVADecision 6.0 2.449490 2.0 1.414214 1882.0 43.382024 0.333333 0.272166 0.001063 0.000752 - 18 Hlt1TwoTrackMVACharmXSecDecision 1878.0 43.335897 Hlt1TwoTrackMVACharmXSecDecision 1878.0 43.335897 1878.0 43.335897 1878.0 43.335897 1.000000 0.032634 1.000000 0.032634 - 19 Hlt1TwoTrackMVACharmXSecDecision 1878.0 43.335897 Hlt1TwoTrackMVADecision 311.0 17.635192 262.0 16.186414 1927.0 43.897608 0.842444 0.070646 0.135963 0.008953 - 20 Hlt1TwoTrackMVADecision 311.0 17.635192 Hlt1TrackElectronMVADecision 108.0 10.392305 21.0 4.582576 398.0 19.949937 0.194444 0.046373 0.052764 0.011814 - 21 Hlt1TwoTrackMVADecision 311.0 17.635192 Hlt1TrackMVADecision 174.0 13.190906 69.0 8.306624 416.0 20.396078 0.396552 0.056416 0.165865 0.021560 - 22 Hlt1TwoTrackMVADecision 311.0 17.635192 Hlt1TrackMuonMVADecision 6.0 2.449490 2.0 1.414214 315.0 17.748239 0.333333 0.272166 0.006349 0.004504 - 23 Hlt1TwoTrackMVADecision 311.0 17.635192 Hlt1TwoTrackMVACharmXSecDecision 1878.0 43.335897 262.0 16.186414 1927.0 43.897608 0.139510 0.009201 0.135963 0.008953 - 24 Hlt1TwoTrackMVADecision 311.0 17.635192 Hlt1TwoTrackMVADecision 311.0 17.635192 311.0 17.635192 311.0 17.635192 1.000000 0.080193 1.000000 0.080193 + linesetA countA countA_err linesetB countB countB_err countAnB countAnB_err countAuB countAuB_err probA|B probA|B_err jaccardAB jaccardAB_err + 0 Hlt1TrackElectronMVADecision 71 8.426150 Hlt1TrackElectronMVADecision 71 8.426150 71 8.426150 71 8.426150 1.000000 0.167836 1.000000 0.167836 + 1 Hlt1TrackElectronMVADecision 71 8.426150 Hlt1TrackMVADecision 107 10.344080 13 3.605551 165 12.845233 0.121495 0.035685 0.078788 0.022696 + 2 Hlt1TrackElectronMVADecision 71 8.426150 Hlt1TrackMuonMVADecision 3 1.732051 0 0.000000 74 8.602325 0.000000 NaN 0.000000 NaN + 3 Hlt1TrackElectronMVADecision 71 8.426150 Hlt1TwoTrackMVADecision 258 16.062378 20 4.472136 309 17.578396 0.077519 0.017993 0.064725 0.014934 + 4 Hlt1TrackMVADecision 107 10.344080 Hlt1TrackElectronMVADecision 71 8.426150 13 3.605551 165 12.845233 0.183099 0.055236 0.078788 0.022696 + 5 Hlt1TrackMVADecision 107 10.344080 Hlt1TrackMVADecision 107 10.344080 107 10.344080 107 10.344080 1.000000 0.136717 1.000000 0.136717 + 6 Hlt1TrackMVADecision 107 10.344080 Hlt1TrackMuonMVADecision 3 1.732051 3 1.732051 107 10.344080 1.000000 0.816497 0.028037 0.016413 + 7 Hlt1TrackMVADecision 107 10.344080 Hlt1TwoTrackMVADecision 258 16.062378 40 6.324555 325 18.027756 0.155039 0.026346 0.123077 0.020623 + 8 Hlt1TrackMuonMVADecision 3 1.732051 Hlt1TrackElectronMVADecision 71 8.426150 0 0.000000 74 8.602325 0.000000 NaN 0.000000 NaN + 9 Hlt1TrackMuonMVADecision 3 1.732051 Hlt1TrackMVADecision 107 10.344080 3 1.732051 107 10.344080 0.028037 0.016413 0.028037 0.016413 + 10 Hlt1TrackMuonMVADecision 3 1.732051 Hlt1TrackMuonMVADecision 3 1.732051 3 1.732051 3 1.732051 1.000000 0.816497 1.000000 0.816497 + 11 Hlt1TrackMuonMVADecision 3 1.732051 Hlt1TwoTrackMVADecision 258 16.062378 3 1.732051 258 16.062378 0.011628 0.006752 0.011628 0.006752 + 12 Hlt1TwoTrackMVADecision 258 16.062378 Hlt1TrackElectronMVADecision 71 8.426150 20 4.472136 309 17.578396 0.281690 0.071310 0.064725 0.014934 + 13 Hlt1TwoTrackMVADecision 258 16.062378 Hlt1TrackMVADecision 107 10.344080 40 6.324555 325 18.027756 0.373832 0.069281 0.123077 0.020623 + 14 Hlt1TwoTrackMVADecision 258 16.062378 Hlt1TrackMuonMVADecision 3 1.732051 3 1.732051 258 16.062378 1.000000 0.816497 0.011628 0.006752 + 15 Hlt1TwoTrackMVADecision 258 16.062378 Hlt1TwoTrackMVADecision 258 16.062378 258 16.062378 258 16.062378 1.000000 0.088045 1.000000 0.088045 .. note:: @@ -937,40 +958,22 @@ The inclusive and exclusive intersections between each of the lines here are als .. code-block:: text - Hlt1TrackElectronMVADecision Hlt1TrackMVADecision Hlt1TrackMuonMVADecision Hlt1TwoTrackMVACharmXSecDecision Hlt1TwoTrackMVADecision count - 0 True False False False False 47.0 - 1 False True False False False 59.0 - 2 False False True False False 1.0 - 3 False False False True False 1543.0 - 4 False False False False True 33.0 - 5 True True False False False 4.0 - 6 True False True False False 0.0 - 7 True False False True False 33.0 - 8 True False False False True 2.0 - 9 False True True False False 2.0 - 10 False True False True False 37.0 - 11 False True False False True 13.0 - 12 False False True True False 0.0 - 13 False False True False True 1.0 - 14 False False False True True 194.0 - 15 True True True False False 0.0 - 16 True True False True False 2.0 - 17 True True False False True 0.0 - 18 True False True True False 0.0 - 19 True False True False True 0.0 - 20 True False False True True 12.0 - 21 False True True True False 0.0 - 22 False True True False True 0.0 - 23 False True False True True 48.0 - 24 False False True True True 0.0 - 25 True True True True False 1.0 - 26 True True True False True 0.0 - 27 True True False True True 7.0 - 28 True False True True True 0.0 - 29 False True True True True 1.0 - 30 True True True True True 0.0 - - + Hlt1TrackElectronMVADecision Hlt1TrackMVADecision Hlt1TrackMuonMVADecision Hlt1TwoTrackMVADecision count + 0 True False False False 44 + 1 False True False False 60 + 2 False False True False 0 + 3 False False False True 204 + 4 True True False False 7 + 5 True False True False 0 + 6 True False False True 14 + 7 False True True False 0 + 8 False True False True 31 + 9 False False True True 0 + 10 True True True False 0 + 11 True True False True 6 + 12 True False True True 0 + 13 False True True True 3 + 14 True True True True 0 .. _chaining: @@ -1008,16 +1011,16 @@ script, you should get an output that includes::: ------------------------------------------------------------------------------------ Integrated HLT efficiencies for the lines with denominator: CanRecoChildren ------------------------------------------------------------------------------------ - Line: B_s0_Hlt2Topo2BodyDecisionTrueSim Efficiency: 0.231 +/- 0.117 - Line: Hlt2Topo2BodyDecision Efficiency: 0.231 +/- 0.117 + Line: B_s0_Hlt2Topo2BodyDecisionTrueSim Efficiency: 0.077 +/- 0.074 + Line: Hlt2Topo2BodyDecision Efficiency: 0.077 +/- 0.074 Line: Kplus0_Hlt2Topo2BodyDecisionTrueSim Efficiency: 0.000 +/- 0.000 ------------------------------------------------------------------------------------ Finished printing integrated HLT efficiencies for denominator: CanRecoChildren ------------------------------------------------------------------------------------ Integrated HLT efficiencies for the lines with denominator: CanRecoChildrenAndHlt1trackmvas ------------------------------------------------------------------------------------ - Line: B_s0_Hlt2Topo2BodyDecisionTrueSim Efficiency: 0.500 +/- 0.204 - Line: Hlt2Topo2BodyDecision Efficiency: 0.500 +/- 0.204 + Line: B_s0_Hlt2Topo2BodyDecisionTrueSim Efficiency: 0.167 +/- 0.152 + Line: Hlt2Topo2BodyDecision Efficiency: 0.167 +/- 0.152 Line: Kplus0_Hlt2Topo2BodyDecisionTrueSim Efficiency: 0.000 +/- 0.000 ------------------------------------------------------------------------------------ Finished printing integrated HLT efficiencies for denominator: CanRecoChildrenAndHlt1trackmvas @@ -1042,14 +1045,14 @@ pass the special (case-insensitive) key word ``AnyHlt1Line``: internally the scr fired in each event it considers. This is illustrated in the example ``DaVinci/HltEfficiencyChecker/options/hlt1_and_hlt2_rate_example.yaml``, which should have an output like:: - ---------------------------------------------------------------------------------------------------- + -------------------------------------------------------------------------------------------------------------- INFO: Starting /home/user/stack/DaVinci/HltEfficiencyChecker/scripts/hlt_calculate_rates.py... - ---------------------------------------------------------------------------------------------------- + -------------------------------------------------------------------------------------------------------------- HLT rates w.r.t. passing AnyHlt1Line: - ---------------------------------------------------------------------------------------------------- - Line: Hlt2Topo2BodyDecision Incl: 270.0 +/- 63.352 kHz, Excl: 0.0 +/- 0.0 kHz - ---------------------------------------------------------------------------------------------------- - Hlt2 Total: Rate: 270 +/- 63.4 kHz + -------------------------------------------------------------------------------------------------------------- + Line: Hlt2Topo2BodyDecision Incl: 15.0 +/- 14.99 kHz, Excl: 0.0 +/- 0.0 kHz + -------------------------------------------------------------------------------------------------------------- + Hlt2 Total: Rate: 15 +/- 15.0 kHz ---------------------------------------------------------------------------------------------------- where the ``evt_max`` was turned up to 2000 events to get an appreciable rate. diff --git a/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt1_cond_probs.png b/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt1_cond_probs.png index bf4bb3cc926ba06098c7632cfb5ff1b9628abac4..ec8aa47e55606d45cbff016ba8c7bb7f814e9361 100644 Binary files a/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt1_cond_probs.png and b/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt1_cond_probs.png differ diff --git a/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt1_jaccards.png b/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt1_jaccards.png index 337bf4a9cd400c820220bc081cd366a950bae69f..e908f9f5fb354c76a782f8349cb935d62caf8c7c 100644 Binary files a/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt1_jaccards.png and b/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt1_jaccards.png differ diff --git a/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt2_example.png b/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt2_example.png index 4c6ec8d3f9a62050bdbc1427cffd133e5d0a826c..d9d52f4a0eddc8d6452224a7084c13919a7d1701 100644 Binary files a/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt2_example.png and b/doc/tutorials/hltefficiencychecker_plots/hlteffchecker_hlt2_example.png differ