File indexing completed on 2026-07-26 08:22:18
0001 import argparse
0002 import pathlib
0003 import tempfile
0004 import logging
0005 import os
0006 import traccc_physics_plots.run
0007
0008 log = logging.getLogger("traccc_physics_plots.run_seeding_example")
0009
0010
0011 def main():
0012 logging.basicConfig(
0013 level=logging.INFO,
0014 format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
0015 )
0016
0017 log.info("Starting data gathering for traccc physics performance plots")
0018
0019 parser = argparse.ArgumentParser()
0020
0021 parser.add_argument(
0022 "exec",
0023 type=pathlib.Path,
0024 help="the traccc CUDA seeding example executable",
0025 )
0026
0027 parser.add_argument(
0028 "outdir",
0029 type=pathlib.Path,
0030 help="the directory in which to write output files",
0031 )
0032
0033 parser.add_argument(
0034 "--root-to-csv",
0035 help="the ROOT-to-CSV executable",
0036 type=pathlib.Path,
0037 default=None,
0038 dest="root_to_csv",
0039 )
0040
0041 args = parser.parse_args()
0042
0043 if args.root_to_csv is not None:
0044 log.info("Using provided ROOT-to-CSV converter at %s", str(args.root_to_csv))
0045 root_to_csv = args.root_to_csv
0046 else:
0047 root_to_csv = (
0048 pathlib.Path(os.path.abspath(__file__)).parent.parent
0049 / "root_to_csv"
0050 / "root_to_csv"
0051 )
0052 log.info("No ROOT-to-CSV converter provided; assuming %s", str(root_to_csv))
0053
0054 assert root_to_csv.is_file()
0055
0056 with tempfile.TemporaryDirectory() as tmpdirname:
0057 log.info("Running seeding example in %s", tmpdirname)
0058 traccc_physics_plots.run.run_convert_seeding_example(
0059 args.exec,
0060 traccc_physics_plots.run.SEEDING_EXAMPLE_ARGS,
0061 tmpdirname,
0062 args.outdir,
0063 root_to_csv,
0064 )
0065
0066 log.info("Data gathering complete")
0067
0068
0069 if __name__ == "__main__":
0070 main()