38 parser = argparse.ArgumentParser(
39 description=
"Validate AOD Output from FPGATrackSim."
43 help=
"Path to the input ROOT file"
49 help=
"Validate ITk cluster and track container names instead of the default FPGA names"
51 args = parser.parse_args()
53 input_root_file = args.input_root_file
54 rootFile = ROOT.TFile.Open(input_root_file)
55 if not rootFile
or rootFile.IsZombie():
56 print(f
"Error: Could not open file {input_root_file}")
59 tree = rootFile.Get(
"CollectionTree")
61 raise ValueError(
"could not find CollectionTree in input file")
69 cppyy.ll.cast[
"xAOD::PixelClusterContainer_v1"](0)
71 for branch
in clustersToCheck:
72 averageClustersPerEvent = np.mean([getattr(evt, branch).size()
for evt
in tree])
73 if np.isclose(averageClustersPerEvent, 0):
74 raise ValueError(f
"no recorded clusters in {branch}")
76 print(f
"there are on average {averageClustersPerEvent} clusters per event in {branch}")
78 averageNumberOfTracksPerEvent = np.mean([getattr(evt, trackBranchToCheck).size()
for evt
in tree])
79 if np.isclose(averageNumberOfTracksPerEvent, 0):
80 raise ValueError(f
"no recorded tracks in {trackBranchToCheck}")
82 print(f
"there are on average {averageNumberOfTracksPerEvent} tracks per event in {trackBranchToCheck}")