Skip to content
Snippets Groups Projects

Simplify the monitoring and enable the creation of multidimensional histograms

Merged Miguel Ramos Pernas requested to merge mramospe-monitoring into 2024-patches

Modify the main monitoring class to allow for making multiple histograms using a single algorithm. This massively simplifies the monitoring in HLT2, where there is currently one algorithm being created per histogram made. The new monitoring object allows to create both 1D and 2D histograms using the same instance, and its configuration can be easily defined from python using three helper classes histogram_axis, histogram_1d and histogram_2d. These classes are defined in a dedicated python module, incorporated to SelAlgorithms. The monitoring class can also handle cases where the functors act on global information of the event, integrating the algorithm that was previously defined in VoidMonitor.cpp, which has been removed. The monitoring can now be defined on a very pythonic way, like

import Functors
from GaudiKernel.SystemOfUnits import GeV
from SelAlgorithms import monitoring

particles = ... # data handle referring to the particles

# a 1D histogram of the mass
histogram_configuration_mass = monitoring.histogram_1d('monitor_mass', 'monitor mass', Functors.MASS, bins=100, range=(2 * GeV, 4 * GeV), label='MASS')

# a 2D histogram of the transverse momentum versus the pseudorapidity
axis_pt = monitoring.histogram_axis(Functors.PT, bins=100, range=(0., 10. * GeV), label='PT')
axis_eta = monitoring.histogram_axis(Functors.ETA, bins=100, range=(1.5, 5.5), label='ETA')
histogram_configuration_pt_over_eta = monitoring.histogram_2d('monitor_pt_over_eta', 'pt over eta', xaxis=axis_eta, yaxis=axis_pt)

# a 1D histogram of the number of candidates
histogram_configuration_n_candidates = monitoring.histogram_1d('monitor_n_candidates', 'number of candidates', Functors.SIZE(particles), bins=100, range=(0, 100), 'CANDIDATES')

# make the monitor that works taking input particles as an input
particle_monitor = monitoring.monitor(histograms=[histogram_configuration_mass, histogram_configuration_mass], data=particles)

# make a monitor that works on global information
global_monitor = monitoring.monitor(histograms=[histogram_configuration_n_candidates])

In this code snippet, the instances in particle_monitor and global_monitor will refer to the Gaudi algorithms that will take care of producing the monitoring histograms.

Goes with Moore!3119 (merged).

Edited by Miguel Ramos Pernas

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • @mstahl @rmatev this MR, together with Moore!3119 (merged) should provide the machinery to make 1D, 2D histograms and to condense all the histograms for a given input container in a single class. It also integrates the machinery to create histograms based on global (event) information.

  • Miguel Ramos Pernas changed the description

    changed the description

  • Miguel Ramos Pernas resolved all threads

    resolved all threads

  • Sascha Stahl
  • added 19 commits

    • 4c2f71ca...8d16a08e - 9 commits from branch master
    • 44607c42 - Modify the monitoring algorithm to process several histograms that can be of one or two dimensions
    • b8761eec - Extend monitoring class and add python bindings to configure histograms
    • 35cef56b - Extend the monitor to global variables
    • 70ffea31 - lb-format
    • f9d7f6da - Fix dictionaries and allow to build histograms with all the arguments inline
    • e3c79c27 - Make objects JSON serializable and add python wrappers to facilitate the syntax
    • 93023915 - Remove the reflex dictionary and rely on the string parsing
    • d0a38c75 - Fixes to the parsing of functors from python and implementation of the first fully working version
    • ecf6935f - Remove the VoidMonitor C++ file and related classes
    • 6a55a752 - Remove redundant constructors

    Compare with previous version

  • Gerhard Raven requested review from @sponce

    requested review from @sponce

  • added 1 commit

    Compare with previous version

  • Miguel Ramos Pernas marked this merge request as ready

    marked this merge request as ready

  • This is ready from my side. Are there any suggestions or comments? It would be interesting to have this ready for next week's code freeze.

  • mentioned in merge request MooreOnline!323 (merged)

  • Marian Stahl mentioned in merge request Moore!3227 (merged)

    mentioned in merge request Moore!3227 (merged)

  • @sponce could you take a look and approve if this looks ready to you?

  • added 67 commits

    • 17518b50...f0cbea82 - 56 commits from branch master
    • 6b62fc99 - 1 earlier commit
    • 8a701434 - Extend monitoring class and add python bindings to configure histograms
    • 0cb680b6 - Extend the monitor to global variables
    • feef8613 - lb-format
    • e4eca76e - Fix dictionaries and allow to build histograms with all the arguments inline
    • 1c4d781a - Make objects JSON serializable and add python wrappers to facilitate the syntax
    • 9a138def - Remove the reflex dictionary and rely on the string parsing
    • 0a2faf2c - Fixes to the parsing of functors from python and implementation of the first fully working version
    • 0e05082c - Remove the VoidMonitor C++ file and related classes
    • f4ca1872 - Remove redundant constructors
    • d44f7937 - Remove unused import

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading