A package to compare cutflow histograms from ROOT files.
Project description
cutflow_compare
Overview
cutflow_compare is a Python package designed to compare cutflow histograms from ROOT files. It provides a straightforward command-line interface for users to analyze and visualize differences in cutflow data across different regions and files.
Features
- Compare cutflow histograms from two or more ROOT files simultaneously.
- Custom labels for each file using the
--labelsargument. - Generate a CSV report of the comparison results.
- Calculate relative errors and standard deviations across all files for each selection and region.
- Easy to use with command-line arguments for file input and region selection.
Installation
You can install the package using pip:
pip install cutflow_compare
Usage
After installation, you can use the command-line tool directly:
cutflow_compare --files histoOut-compared.root histoOut-reference.root -r region1 region2 region3 --labels Compared Reference
Or, if running from source:
python cutflow_compare.py --files histoOut-compared.root histoOut-reference.root -r region1 region2 region3 --labels Compared Reference
Note:
Make sure the same regions are present in all files with the same name.
Arguments
--files: List of input ROOT files to compare. Required.--regions: List of regions to compare within the cutflow histograms. Required.--labels: Custom labels for each file, used in the output CSV. Optional.--separate-selections: Optional flag to keep selections separate instead of merging them.--relative-error: Optional flag to include relative error calculations in the output.
Output
The tool generates a CSV file named cutflow_comparison_result.csv containing the comparison results.
If multiple files are compared, the CSV will include columns for each file and region, as well as calculated relative errors and standard deviations for each selection and region.
For two files, the relative error column shows the usual comparison; for more files, the relative error is computed as the standard deviation divided by the mean across all files.
Example
cutflow_compare --files histoOut-compared.root histoOut-reference.root histoOut-third.root -r region1 region2 region3 --labels Compared Reference Third --relative-error
This command compares the specified regions (region1, region2, region3) in the three provided ROOT files (histoOut-compared.root, histoOut-reference.root, histoOut-third.root). It outputs the results to cutflow_comparison_result.csv, including relative error and standard deviation calculations for each selection and region.
Requirements
- Python 3.6+
- ROOT (must be installed separately, e.g., via conda:
conda install -c conda-forge root) - pandas (install via pip:
pip install pandas) - uncertainties (install via pip:
pip install uncertainties)
Make sure all dependencies are installed before running the tool.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes.
Acknowledgments
This package utilizes the ROOT framework for data analysis and visualization.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cutflow_compare-2.0.1.tar.gz.
File metadata
- Download URL: cutflow_compare-2.0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de8ede3f586ea86cc2ec21a4294c681a3fb7fc955c3a2dc76278bc563a6921e6
|
|
| MD5 |
d0131e23d394a0ea774a052e7c7f18be
|
|
| BLAKE2b-256 |
32a0fba0bd64cf4b03d7c96e8973f2745a8f3c23c551b493c593c51ea8b9be8a
|
File details
Details for the file cutflow_compare-2.0.1-py3-none-any.whl.
File metadata
- Download URL: cutflow_compare-2.0.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6aa3a115bbf22cec3580657656be902dd2051ce8837f13435e6708695e9be243
|
|
| MD5 |
8d42cf1a65b388092038009329feadba
|
|
| BLAKE2b-256 |
f4da79f7488510731e27fbcdb988d7acb26c6910ee6cf502f4c19705219bd945
|