4"""Apply CaloScoringPlanePID to the CaloScoringPlanePoints of a simulation file.
6python examples/calo_scoring_plane_pid_example.py -f sim.root -p $FAIRSHIP/geometry/caloScoringPlane_pid_provided.yaml
10from collections
import Counter
13from caloScoringPlanePID
import load_pid
15parser = argparse.ArgumentParser()
16parser.add_argument(
"-f",
"--sim", required=
True, help=
"simulation file")
17parser.add_argument(
"-p",
"--pid", default=
"", help=
"PID YAML file (default: perfect PID)")
18args = parser.parse_args()
20pid = load_pid(args.pid)
21rng = ROOT.TRandom3(4357)
24f = ROOT.TFile.Open(args.sim)
28 for point
in event.CaloScoringPlanePoint:
29 true_species = pid.TrueSpecies(point.PdgCode())
30 table[(true_species, pid.Identify(point, rng))] += 1
32name = ROOT.CaloScoringPlanePID.SpeciesName
33print(
"true -> identified: count")
34for (t, r), n
in sorted(table.items()):
35 print(f
" {name(t):>8} -> {name(r):<8}: {n}")