root_mcp.extended.analysis.histograms module

Advanced histogram operations for extended mode.

class root_mcp.extended.analysis.histograms.HistogramOperations(config, file_manager)[source]

Bases: object

Advanced histogram operations with scipy-based fitting.

Extends core histogram capabilities with: - 2D and 3D histograms - Profile histograms - Weighted histograms with proper error propagation - Histogram arithmetic

Parameters:
__init__(config, file_manager)[source]

Initialize histogram operations.

Parameters:
  • config (Config) – Server configuration

  • file_manager (FileManager) – File manager instance

compute_histogram_1d(path, tree_name, branch, bins, range=None, selection=None, weights=None)[source]

Compute a 1D histogram with advanced features.

Parameters:
  • path (str) – File path

  • tree_name (str) – Tree name

  • branch (str) – Branch to histogram

  • bins (int) – Number of bins

  • range (tuple[float, float] | None) – (min, max) for histogram

  • selection (str | None) – Optional cut expression

  • weights (str | None) – Optional weight branch

Returns:

Histogram data with metadata

Return type:

dict[str, Any]

compute_histogram_2d(path, tree_name, branch_x, branch_y, bins_x, bins_y, range_x=None, range_y=None, selection=None, weights=None)[source]

Compute a 2D histogram.

Parameters:
  • path (str) – File path

  • tree_name (str) – Tree name

  • branch_x (str) – X-axis branch

  • branch_y (str) – Y-axis branch

  • bins_x (int) – Number of bins in X

  • bins_y (int) – Number of bins in Y

  • range_x (tuple[float, float] | None) – (min, max) for X axis

  • range_y (tuple[float, float] | None) – (min, max) for Y axis

  • selection (str | None) – Optional cut expression

  • weights (str | None) – Optional weight branch

Returns:

2D histogram data

Return type:

dict[str, Any]

compute_profile(path, tree_name, branch_x, branch_y, bins, range_x=None, selection=None)[source]

Compute a profile histogram (mean of Y vs X).

Parameters:
  • path (str) – File path

  • tree_name (str) – Tree name

  • branch_x (str) – X-axis branch

  • branch_y (str) – Y-axis branch (to be averaged)

  • bins (int) – Number of bins in X

  • range_x (tuple[float, float] | None) – (min, max) for X axis

  • selection (str | None) – Optional cut expression

Returns:

Profile histogram data

Return type:

dict[str, Any]