How jreyesv063/plotter works
Project Type and Purpose
• This is a domain-specific, Python-based data-analysis and plotting tool (called “Plotter”) geared toward high-energy physics studies.
• It provides a reusable core library (src/Plotter.py plus many utils_*.py modules), configuration files (jsons/*.json), and driver notebooks (*.ipynb) that orchestrate data ingestion, efficiency calculations, systematic-variation studies, and final plotting.
Top-Level Architecture
• Driver Layer (Jupyter Notebooks):
• Z_mumu.ipynb, eff_btag.ipynb, eff_studies.ipynb, etc.
• Core Library Layer (src/):
• Plotting engine (Plotter.py, plotter_eff.py)
• Domain logic (e.g., intervals.py)
• Utilities for data I/O, weighting, efficiencies, errors, metadata, systematics (utils_*.py)
• Configuration Layer (jsons/):
• Cross-section lookups (DAS_xsec.json)
• Luminosity settings (luminosity.json)
• External Data Layer (not explicitly in tree, but implied):
• ROOT files or other physics datasets loaded by utils_pkl.py or similar.
Interactions and Data Flows
• Notebooks → invoke Plotter API →
• Plotter core functions call relevant utility modules →
• Utility modules read/parse JSON configs and external data files →
• Processed data flows back up through Plotter →
• Final plots are rendered in the notebook or saved to disk.
Key Architectural Patterns
• Modular design with separation of concerns: plotting logic, domain computations, I/O/config, and driver scripts.
• Single-entry API (Plotter.py) that orchestrates sub-modules.
• Configuration-as-code via JSON files decouples parameters from logic.
• “Notebooks / Driver Scripts”
• “Plotter Core”
• “Domain Logic & Utilities” (group utils_*.py + intervals.py)
• “Configuration Files” (JSONs)
• “External Data Sources” (ROOT, CSV, or other physics data files)
• “Output” (PNG, PDF, or in-notebook plots)
c. Highlighted Patterns:
• “single-entry” façade of Plotter.py orchestrating everything.
• Similar modules (all utils_*.py) into one “Utilities” cluster.