https://github.com/alefisico/coffea4bees

https://github.com/alefisico/coffea4bees

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: alefisico
  • Language: C
  • Default Branch: master
  • Size: 99 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed 10 months ago
Metadata Files
Readme

README.md

Coffea4bees

pipeline status

Coffea4bees is a toolkit for performing physics analyses at Carnegie Mellon University (CMU), built on top of the Coffea framework.

It streamlines data processing, analysis workflows, and reproducibility for CMS experiments.

Table of Contents

Directory Structure

text coffea4bees/ ├── python/ # Code for the 4b analyses. It will be splitted soon. ├── src/ # Core utilities and modules ├── docs/ # Documentation and website files ├── software/ # Container, conda, and environment setup ├── dask_run.py # Dask runner script ├── runner.py # Main analysis runner script ├── README.md # Project overview and instructions └── ... # Additional scripts, configs, and data

To get started quickly:

  1. Clone the repository

bash git clone ssh://git@gitlab.cern.ch:7999/cms-cmu/coffea4bees.git cd coffea4bees

  1. Initialize your proxy (for remote file access)

bash voms-proxy-init -rfc -voms cms --valid 168:00

  1. Run the analysis container

bash ./run_container

  1. Start an analysis (example)

bash ./run_container python runner.py --help

For more details, see the sections below.

Installation

How to run the python files

This repository assumes that you are running in a machine that has access to cvmfs. Then you can clone this repository as:

bash git clone ssh://git@gitlab.cern.ch:7999/cms-cmu/coffea4bees.git

The software required to run this package is encapsulated within a container. Additional information about the container can be found in the Dockerfile.

In addition, dont forget to run your voms-proxy to have access to remote files:

bash voms-proxy-init -rfc -voms cms --valid 168:00

Conda environment

In case you want to run the package using a conda environmnent, you can use the environment.yml file. Notice however that there are some libraries missing in case you want to run the full framework.

How to contribute

If you want to submit your changes to the code to the main repository (aka cms-cmu gitlab user), you can create a new branch in your local machine and then push to the main repository. For example:

bash git checkout -b my_branch git add file1 file2 git commit -m 'new changes' git push origin my_branch

The master branch is protected, ensuring that users cannot accidentally modify its content. Once you are satisfied with your changes, push them to your branch. After your branch successfully passes the pipeline tests, you can create a merge request on the GitLab website to merge your changes into the main repository.

How to run the container for the code

This project uses containers to simplify environment setup and ensure reproducibility. There are three main containers/environments, each for a specific purpose:

  • Analysis Container: Coffea-based, for skimming, analysis, jet clustering, and histogram generation.
  • Combine Container: Official CMS Combine, for statistical analysis.
  • Snakemake Environment: For running workflows and automation.

You can run the required software interactively or as a job using the run_container script:

  • Interactive Mode: Container stays open for manual commands.
  • Job Mode: Container runs a specific job and exits automatically.

```bash Usage: ./run_container [command] [options]

Commands: [command...] Run commands inside the analysis container. Opens an interactive shell if no commands are given. (Interactive shell is the only option to run on LPC HTCondor). combine [command...] Run commands inside the combine container. Opens an interactive shell if no commands are given. snakemake [options] Run snakemake with the specified options. Requires --snakefile argument. --help Show this help message.

Examples: source runcontainer # Open an interactive shell in the analysis container (HTCondor jobs) ./runcontainer ./runcontainer combine # Open an interactive shell in the combine container ./runcontainer combine combine -M AsymptoticLimits # Run snakemake with the specified Snakefile ./run_container snakemake --snakefile python/workflows/Snakefile --cores 4 ```

How to run the coffea part of the code

The main entry point for analysis and skimming is runner.py, which should be run inside the Coffea container using the run_container script.

Usage

bash ./run_container python runner.py [OPTIONS]

Main options

  • -p, --processor: Path to the processor Python file (default: python/analysis/processors/processor_HH4b.py)
  • -c, --configs: Path to the main configuration YAML file (default: python/analysis/metadata/HH4b.yml)
  • -m, --metadata: Path to the datasets metadata YAML file (default: python/metadata/datasets_HH4b.yml)
  • -o, --output: Name of the output file (default: hists.coffea)
  • -op, --output-path: Directory path for output files (default: hists/)
  • -y, --years: Year(s) of data to process (e.g., --years UL17 UL18)
  • -d, --datasets: Dataset name(s) to process (e.g., --datasets HH4b ZZ4b)
  • -e, --eras: Data era(s) to process (data only, e.g., --eras A B C)
  • -s, --skimming: Run in skimming mode instead of analysis mode
  • -t, --test: Run in test mode with limited number of files
  • --systematics: List of systematics to apply (e.g., --systematics jes all)
  • --dask: Use Dask for distributed processing
  • --condor: Submit jobs to HTCondor cluster
  • --debug: Enable debug mode with verbose logging
  • --check-input-files: Check input files for corruption before processing
  • --githash: Override git hash for reproducibility tracking
  • --gitdiff: Override git diff for reproducibility tracking

Example commands

  • Show help:

bash ./run_container python runner.py --help

All arguments are documented in the help message (--help). For advanced configuration, see the processor and config YAML files.

Information for continuous integration (CI)

The CI workflow is defined in the gitlab-ci.yml file. When you push your code to the main repository, the pipeline is triggered automatically.

If you have forked the repository (NOT recommended), the GitLab CI pipeline requires your grid certificate to function. To run the GitLab CI workflow in your private fork, you must first configure specific variables to set up your voms-proxy. Follow these instructions (excluding the final section, "Using the grid proxy") to complete the setup.

To run the CI workflow locally

Within the python/scripts/ directory, there is a script named run_local_ci.sh that facilitates running a Snakemake workflow (Snakefile_testCI) locally, emulating the GitLab CI process. This script provides a convenient way to execute the CI workflow locally. To run it, navigate to the python/ directory and execute:

bash source scripts/run_local_ci.sh NAME_OF_CI_JOB

For those interested in Snakemake, the Snakefile_testCI defines "rules" (jobs) similar to those in the GitLab CI workflow. The inclusion of rules in the workflow depends on the inputs specified in rule all. Rules can be defined anywhere after rule all, but they will only execute if their output files are listed in rule all, or if you call directly the name of the rule.

Information about the container

This package uses its own container. It is based on coffeateam/coffea-base-almalinux8:0.7.23-py3.10 including some additional python packages. This container is created automatically in the GitLab CI step if the name of the branch (and the merging branch in the case of a pull request to the master) starts with container_. Additionally, you can review the file software/dockerfiles/Dockerfile_analysis, which is used to create the container.

Owner

  • Name: Alejandro Gomez Espinosa
  • Login: alefisico
  • Kind: user
  • Location: Quito, Ecuador
  • Company: ETH-Zurich

Experimental Particle Physicists working at the @CMSExperiment

GitHub Events

Total
  • Delete event: 13
  • Push event: 64
  • Pull request event: 6
  • Fork event: 2
  • Create event: 33
Last Year
  • Delete event: 13
  • Push event: 64
  • Pull request event: 6
  • Fork event: 2
  • Create event: 33

Dependencies

.github/workflows/mirror.yml actions
python/plots/plot_requirements.txt pypi
  • Pillow ==9.5.0
  • PyYAML ==6.0.1
  • Pygments ==2.17.2
  • awkward ==1.10.5
  • awkward0 ==0.15.5
  • boost-histogram ==1.4.0
  • cachetools ==5.3.2
  • click ==8.1.7
  • cloudpickle ==3.0.0
  • coffea ==0.7.22
  • contourpy ==1.1.0
  • correctionlib ==2.4.0
  • cycler ==0.11.0
  • fonttools ==4.40.0
  • fsspec ==2023.10.0
  • hist ==2.7.2
  • histoprint ==2.4.0
  • importlib-resources ==5.12.0
  • kiwisolver ==1.4.4
  • llvmlite ==0.41.1
  • lz4 ==4.3.2
  • markdown-it-py ==3.0.0
  • matplotlib ==3.7.1
  • mdurl ==0.1.2
  • mplhep ==0.3.31
  • mplhep-data ==0.0.3
  • numba ==0.58.1
  • numpy ==1.23.5
  • packaging ==23.1
  • pandas ==2.1.3
  • pep8 ==1.7.1
  • pyarrow ==14.0.1
  • pycodestyle ==2.11.1
  • pydantic ==1.10.13
  • pyparsing ==3.0.9
  • python-dateutil ==2.8.2
  • pytz ==2023.3.post1
  • rich ==13.7.0
  • scipy ==1.11.4
  • six ==1.16.0
  • toml ==0.10.2
  • tqdm ==4.66.1
  • typing_extensions ==4.8.0
  • tzdata ==2023.3
  • uhi ==0.4.0
  • uproot ==4.3.7
  • uproot3 ==3.14.4
  • uproot3-methods ==0.10.1
  • zipp ==3.15.0
python/analysis_dask/setup.py pypi
docs/requirements.txt pypi
  • mkdocs-git-revision-date-localized-plugin *
  • mkdocs-merge *
  • mkdocs-minify-plugin *
  • mkdocs-redirects *
  • mkdocs-video *
  • termynal *
software/conda/environment.yml pypi
  • awkward ==1.10.5
  • coffea ==0.7.23
  • dbs3-client ==4.0.19
  • fastjet ==3.4.0.1
  • fsspec_xrootd ==0.5.1
  • htcondor ==24.3.0
  • lpcjobqueue ==0.4.1
  • memory-profiler ==0.61.0
  • onnxruntime ==1.20.1
  • pip ==25.0.1
  • pybind11 ==2.13.5
  • pycodestyle ==2.13.0
  • setuptools ==70.3.0
  • tflite-runtime ==2.14.0
  • tritonclient ==2.53.0