cw_coal is a modern C++20 library and command-line tool suite for simulating parton-to-hadron coalescence in high-energy nuclear physics. It implements multiple coalescence algorithms (brute-force, greedy, KD-tree accelerated), event I/O (AMPT/ROOT), particle ID inference, QA and correlation analysis, and Python-based visualization. Batch execution via Condor is also supported.
- Coalescence Algorithms:
- Brute-Force:
BruteForceGlobal,BruteForceGreedy,BruteForceDualGreedy - KD-Tree Accelerated:
KDTreeGlobal,KDTreeGreedy,KDTreeDualGreedy(powered by nanoflann)
- Brute-Force:
- Event Model:
Event,Parton,Hadronclasses with random generation, momentum/position handling, and constituent tracking
- PID Inference & Assignment:
- Flavor-based meson/diquark identification and heavy-quarkonium inference
- I/O Support:
EventReaderAMPT,EventRandomGen,EventWriterfor ROOT file formats
- Analysis Tools:
analysisCLI for QA histograms and two-particle correlations
- Python Scripts:
scripts/visualize_event.py,investigate_baryon-pref_ratio.py,draw.py
- Batch Scheduling:
- Condor scripts under
condor/with customizable job lists
- Condor scripts under
The primary CLI tool, cwcoal, orchestrates event reading/generation, parton shuffling, coalescence, PID assignment, and output writing—all via simple options.
cwcoal [OPTIONS]| Option | Description |
|---|---|
-h, --help |
Show help message and exit |
-i, --data-input <file> |
Input ROOT file with events (AMPT/previous output). If omitted, use --toymode to generate events |
-o, --data-output <file> |
Output ROOT file path for hadronized events |
-a, --algorithm <string> |
Coalescence algorithm: KDTreeGlobal, KDTreeGreedy, BruteForceGlobal, BruteForceGreedy (default: KDTreeGlobal) |
-n, --events <N> |
Number of events to process or generate (default: 10) |
-p, --partons <N> |
Partons per event (default: sample from histogram if unset) |
-b, --bn <int> |
Net baryon number sum (default: 0) |
-s, --savedir <dir> |
Directory for all output files (default: .) |
-r, --baryon-preference <dbl> |
Scale factor for baryon vs. meson preference (default: 1.0) |
-F, --shuffle-fraction <dbl> |
Fraction of partons to shuffle across events (0–1) |
-T, --toymode |
Enable toy-mode: generate random events instead of reading input |
- Event Source: read from
--data-inputor generate with--toymode. - Shuffle: optionally mix partons across events via
--shuffle-fraction. - Coalescence: choose an algorithm (
--algorithm) to form hadrons. - PID Assignment: infer PDG codes and assign to hadrons.
- Output: write hadronized events to
--data-outputand produce QA/CVE histograms in--savedir.
Generate 100 toy events with 50 partons each using KDTreeGreedy:
cwcoal --toymode --events 100 --partons 50 \
--algorithm KDTreeGreedy \
--data-output toy_hadrons.root \
--savedir resultsProcess 500 AMPT events with brute-force global coalescence and 20% shuffling:
cwcoal --data-input ampt_events.root \
--events 500 \
--algorithm BruteForceGlobal \
--shuffle-fraction 0.2 \
--data-output ampt_hadrons.root \
--savedir resultsAfterwards, run QA and CVE analysis:
analysis --input results/ampt_hadrons.root \
--output results/qa_cve.rootcw_coal/
├── CMakeLists.txt # Build configuration
├── include/ # Public headers
│ ├── core/ # Event, Parton, Hadron, PID, CombinerBase
│ ├── io/ # I/O interfaces
│ └── ana/ # Analyzer interfaces (QA, CVE)
├── src/ # Source implementation
│ ├── core/ # Core classes
│ ├── combiner/ # Algorithm implementations
│ ├── io/ # Readers, writers, random generator
│ └── app/ # CLI tools (`cwcoal`, `analysis`)
├── test/ # Unit tests (Google Test)
├── scripts/ # Python visualization and analysis
├── refdata/ # Reference data (ZPC lists)
└── condor/ # Condor batch scripts and lists
- CMake ≥ 3.10
- C++20 compiler (e.g. GCC 9+, Clang 10+)
- nanoflann for KD-tree accelerated combiners
- ROOT for I/O and data structures
- Python 3 (optional, for scripts)
git clone <repo_url>
cd cw_coal
mkdir build && cd build
cmake ..
make -j$(nproc)
make install # optional: install into system or custom prefixMIT License