Warning, /snippets/Tracking/PerformanceStudy/SinglePion/pTDR/README.md is written in an unsupported language. File is not indexed.
0001 # Single Particle Performance Workflow
0002
0003 `ShujieLi lbl gov. March 2026`
0004
0005 This module provides a workflow to scan single pion simulation files to produce the __pTDR style__ tracking resolution v.s. momentum summary plot (7 eta bins).
0006 The tracking efficiency, resolution, and pull summaries are extracted using the same logic as `plot_single_resol.py` and the deprecated __7-eta-bin__ folder.
0007
0008
0009 ## Requirements
0010
0011 - Python environment with `uproot`, `awkward`, `pandas`, `matplotlib`, `numpy`, `lmfit`.
0012
0013 ## Inputs and naming
0014
0015 Each input simulation file is expected to cover a combination of:
0016 * Default momentum: 0.5, 1, 2, 5, 10, 15 GeV
0017 * Default eta range: ("-3.5 -3.0" "-3.0 -2.5" "-2.5 -1" "-1 1" "1 2.5" "2.5 3.0" "3.0 3.5")
0018
0019 Example rootfile generation scripts: `submit_batch.sh`, `run_sim_nohup.sh`
0020
0021 The analysis scripts read eta and momentum from the filename tag. Files should start with `rec_` and include:
0022 - `eta_<eta_lo>_<eta_hi>`
0023 - `mom_<mom>GeV` (or `<mom>GeV` / `<mom>MeV`)
0024
0025 Example:
0026
0027 ```
0028 rec_GoldCoating5um_eta_-1_1_mom_5GeV_n10000.root
0029 ```
0030
0031
0032
0033 ## Run the study
0034
0035 `run_study.py` extracts tracking efficiency, resolution, and pull distribution for each rootfile using the same logic as `plot_single_resol.py`. Results are appended as one row to the CSV table `performance_table.csv`. Corresponding plots are saved under `./plots`:
0036
0037 ```bash
0038
0039 python run_study.py \
0040 /path/to/rec_*.root \
0041 --plots-dir plots \
0042 ```
0043
0044 Batch run with skip-existing:
0045
0046 ```bash
0047 python run_study.py \
0048 --pattern "*GoldCoating*.root" \
0049 --skip-existing \
0050 ```
0051
0052 ## Make summary plots
0053
0054 `run_plot.py` reads the `performance_table.csv` table and produces a single multi-page PDF with the summary efficiency + dp/theta/phi/dca plots in pTDR format:
0055
0056 ```bash
0057 python run_plot.py \
0058 --setting GoldCoating5um
0059 ```
0060
0061 Compare two settings:
0062
0063 ```bash
0064 python run_plot.py \
0065 --setting GoldCoating5um \
0066 --setting2 GoldCoating10um
0067 ```
0068
0069 ## Outputs
0070
0071 - `performance_table.csv`: append-only summary table with per-file stats and binned efficiency arrays.
0072 - `plots/`: per-file PDFs from `run_study.py` and combined multi-page PDF from `run_plot.py`.
0073
0074 ## Notes
0075
0076 - `pwg_requirements.txt` is loaded from the current working directory, the module folder, or the legacy snippets path.
0077 - Theta/phi resolutions are converted from mrad to rad in plotting.
0078 - Files not starting with `rec_` are skipped.