FairShip
Loading...
Searching...
No Matches
run_tracking_benchmark Namespace Reference

Functions

None run_phase (str description, list[str] cmd, str|None cwd=None)

Variables

 parser = ArgumentParser(description="Tracking performance benchmark for straw tube spectrometer")
 type
 int
 default
 help
 float
 action
 choices
 None
 options = parser.parse_args()
 outputDir
 tag = options.tag
 sim_file = os.path.join(options.outputDir, f"sim_{tag}.root")
 geo_file = os.path.join(options.outputDir, f"geo_{tag}.root")
 reco_file = os.path.join(options.outputDir, f"sim_{tag}_rec.root")
tuple json_file
 histo_file = os.path.join(options.outputDir, "tracking_benchmark_histos.root")
 fairship = os.environ.get("FAIRSHIP", "")
str sim_script = os.path.join(fairship, "macro", "run_simScript.py") if fairship else "macro/run_simScript.py"
list sim_cmd
str reco_script = os.path.join(fairship, "macro", "ShipReco.py") if fairship else "macro/ShipReco.py"
list reco_cmd
 cwd
 bench

Detailed Description

Run a full tracking benchmark: simulation -> reconstruction -> metrics.

Fires a particle gun upstream of the straw tube spectrometer (T1-T4),
runs digitisation and reconstruction (AR pattern recognition and GenFit by
default), then computes tracking and vertexing performance metrics.

Each phase (sim, reco) runs as a subprocess because FairRoot singletons
prevent creating multiple FairRunSim instances in the same process.

Example usage:
    python macro/run_tracking_benchmark.py -n 200 --seed 42 --tag test
    python macro/run_tracking_benchmark.py -n 1000 --nTracks 5 --tag multi

Function Documentation

◆ run_phase()

None run_tracking_benchmark.run_phase ( str description,
list[str] cmd,
str | None cwd = None )
Run a subprocess phase, raising on failure.

Definition at line 100 of file run_tracking_benchmark.py.

100def run_phase(description: str, cmd: list[str], cwd: str | None = None) -> None:
101 """Run a subprocess phase, raising on failure."""
102 print("=" * 60)
103 print(f"{description}")
104 print("=" * 60)
105 result = subprocess.run(cmd, check=False, cwd=cwd)
106 if result.returncode != 0:
107 print(f"FAILED: {description} (exit code {result.returncode})")
108 sys.exit(result.returncode)
109
110
111# ============================================================
112# Phase 1: Simulation via run_simScript.py
113# ============================================================

Variable Documentation

◆ action

run_tracking_benchmark.action

Definition at line 37 of file run_tracking_benchmark.py.

◆ bench

run_tracking_benchmark.bench
Initial value:
2 sim_file, reco_file, geo_file, primary_only=not options.allTracks, straw_purity=options.strawPurity
3)

Definition at line 208 of file run_tracking_benchmark.py.

◆ choices

run_tracking_benchmark.choices

Definition at line 46 of file run_tracking_benchmark.py.

◆ cwd

run_tracking_benchmark.cwd

Definition at line 193 of file run_tracking_benchmark.py.

◆ default

run_tracking_benchmark.default

Definition at line 27 of file run_tracking_benchmark.py.

◆ fairship

run_tracking_benchmark.fairship = os.environ.get("FAIRSHIP", "")

Definition at line 97 of file run_tracking_benchmark.py.

◆ float

run_tracking_benchmark.float

Definition at line 29 of file run_tracking_benchmark.py.

◆ geo_file

run_tracking_benchmark.geo_file = os.path.join(options.outputDir, f"geo_{tag}.root")

Definition at line 88 of file run_tracking_benchmark.py.

◆ help

run_tracking_benchmark.help

Definition at line 27 of file run_tracking_benchmark.py.

◆ histo_file

run_tracking_benchmark.histo_file = os.path.join(options.outputDir, "tracking_benchmark_histos.root")

Definition at line 95 of file run_tracking_benchmark.py.

◆ int

run_tracking_benchmark.int

Definition at line 27 of file run_tracking_benchmark.py.

◆ json_file

tuple run_tracking_benchmark.json_file
Initial value:
1= (
2 os.path.abspath(options.output_json)
3 if options.output_json
4 else os.path.join(options.outputDir, "tracking_metrics.json")
5)

Definition at line 90 of file run_tracking_benchmark.py.

◆ None

run_tracking_benchmark.None

Definition at line 69 of file run_tracking_benchmark.py.

◆ options

run_tracking_benchmark.options = parser.parse_args()

Definition at line 80 of file run_tracking_benchmark.py.

◆ outputDir

run_tracking_benchmark.outputDir

Definition at line 84 of file run_tracking_benchmark.py.

◆ parser

run_tracking_benchmark.parser = ArgumentParser(description="Tracking performance benchmark for straw tube spectrometer")

Definition at line 26 of file run_tracking_benchmark.py.

◆ reco_cmd

run_tracking_benchmark.reco_cmd
Initial value:
1= [
2 sys.executable,
3 reco_script,
4 "-f",
5 sim_file,
6 "-g",
7 geo_file,
8 "-n",
9 str(options.nEvents),
10 "--trackFitter",
11 options.trackFitter,
12]

Definition at line 175 of file run_tracking_benchmark.py.

◆ reco_file

run_tracking_benchmark.reco_file = os.path.join(options.outputDir, f"sim_{tag}_rec.root")

Definition at line 89 of file run_tracking_benchmark.py.

◆ reco_script

str run_tracking_benchmark.reco_script = os.path.join(fairship, "macro", "ShipReco.py") if fairship else "macro/ShipReco.py"

Definition at line 174 of file run_tracking_benchmark.py.

◆ sim_cmd

list run_tracking_benchmark.sim_cmd

Definition at line 115 of file run_tracking_benchmark.py.

◆ sim_file

run_tracking_benchmark.sim_file = os.path.join(options.outputDir, f"sim_{tag}.root")

Definition at line 87 of file run_tracking_benchmark.py.

◆ sim_script

str run_tracking_benchmark.sim_script = os.path.join(fairship, "macro", "run_simScript.py") if fairship else "macro/run_simScript.py"

Definition at line 114 of file run_tracking_benchmark.py.

◆ tag

run_tracking_benchmark.tag = options.tag

Definition at line 86 of file run_tracking_benchmark.py.

◆ type

run_tracking_benchmark.type

Definition at line 27 of file run_tracking_benchmark.py.