root_mcp.extended.analysis.operations module
High-level analysis operations.
- class root_mcp.extended.analysis.operations.AnalysisOperations(config, file_manager)[source]
Bases:
objectHigh-level physics analysis operations.
Provides histogramming, selection, projections, and derived quantities.
- Parameters:
config (Config)
file_manager (FileManager)
- __init__(config, file_manager)[source]
Initialize analysis operations.
- Parameters:
config (Config) – Server configuration
file_manager (FileManager) – File manager instance
- apply_selection(path, tree_name, selection, defines=None)[source]
Count entries passing a selection.
- compute_histogram(path, tree_name, branch, bins, range=None, selection=None, weights=None, defines=None, flatten=True)[source]
Compute a 1D histogram.
- Parameters:
tree_name (str) – Tree name
branch (str) – Branch to histogram
bins (int) – Number of bins
range (tuple[float, float] | None) – (min, max) for histogram range (auto if None, based on first file)
selection (str | None) – Optional cut expression
weights (str | None) – Optional branch for weights
defines (dict[str, str] | None) – Optional derived variable definitions
flatten (bool) – Flatten jagged arrays before histogramming
- Returns:
Histogram data and metadata
- Return type:
- compute_histogram_2d(path, tree_name, x_branch, y_branch, x_bins, y_bins, x_range=None, y_range=None, selection=None, defines=None, flatten=True)[source]
Compute a 2D histogram.
- Parameters:
tree_name (str) – Tree name
x_branch (str) – Branch for x-axis
y_branch (str) – Branch for y-axis
x_bins (int) – Number of bins in x
y_bins (int) – Number of bins in y
x_range (tuple[float, float] | None) – (min, max) for x-axis
y_range (tuple[float, float] | None) – (min, max) for y-axis
selection (str | None) – Optional cut expression
defines (dict[str, str] | None) – Optional derived variable definitions
flatten (bool) – Flatten jagged arrays
- Returns:
2D histogram data and metadata
- Return type:
- compute_histogram_arithmetic(operation, data1, data2)[source]
Perform arithmetic on two histograms.
- compute_kinematics(path, tree_name, computations, selection=None, limit=None)[source]
Compute kinematic quantities from four-momenta.
- Parameters:
path (str) – File path
tree_name (str) – Tree name
computations (list[dict[str, Any]]) – List of kinematic calculations. Each entry is a dict with keys
name(output variable name),type(one ofinvariant_mass,invariant_mass_squared,transverse_mass,delta_r,delta_phi),particles(list of branch prefixes), and optionallycomponents(component suffixes; defaults vary by type).selection (str | None) – Optional cut expression
limit (int | None) – Maximum entries to process
- Returns:
Dictionary with computed kinematic quantities
- Return type: