-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
g4gps: add simple cli, fix energy ordering
- Loading branch information
Showing
6 changed files
with
89 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from __future__ import annotations | ||
|
||
import argparse | ||
|
||
|
||
def optics_cli() -> None: | ||
parser = argparse.ArgumentParser( | ||
prog="legend-pygeom-optics", | ||
description="%(prog)s command line interface", | ||
) | ||
|
||
subparsers = parser.add_subparsers(dest="command", required=True) | ||
|
||
g4gps_parser = subparsers.add_parser( | ||
"g4gps", help="build evt file from remage hit file" | ||
) | ||
g4gps_parser.add_argument( | ||
"--type", | ||
choices=("arb_file", "macro"), | ||
help="file that contains a list of detector ids that are part of the input file. default: %(default)e", | ||
default="macro", | ||
) | ||
g4gps_parser.add_argument("spectrum", choices=("lar_emission", "pen_emission")) | ||
g4gps_parser.add_argument("output", help="output file") | ||
|
||
args = parser.parse_args() | ||
|
||
if args.command == "g4gps": | ||
if args.spectrum == "lar_emission": | ||
from legendoptics.lar import g4gps_lar_emissions_spectrum as g4gps_spectrum | ||
elif args.spectrum == "pen_emission": | ||
from legendoptics.pen import g4gps_pen_emissions_spectrum as g4gps_spectrum | ||
|
||
g4gps_spectrum(args.output, args.type == "macro") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters