-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
14 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ it in future. | |
|
||
### Changed | ||
|
||
* shipStrawTracking: Move to argparse | ||
|
||
### Removed | ||
|
||
## 24.10 - Freiburg | ||
|
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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
# Mikhail Hushchyn, [email protected] | ||
"""Script to run and test tracking in the straw tubes""" | ||
|
||
from builtins import range | ||
import ROOT | ||
import numpy | ||
|
||
import getopt | ||
import sys | ||
from argparse import ArgumentParser | ||
|
||
# For ShipGeo | ||
from ShipGeoConfig import ConfigRegistry | ||
|
@@ -1018,52 +1016,13 @@ def init_book_hist(): | |
################################################################################################################################ | ||
|
||
|
||
#if __name__ == "__main__": | ||
|
||
input_file = None | ||
geo_file = None | ||
output_file = 'hists.root' | ||
method = 'Baseline' | ||
|
||
|
||
argv = sys.argv[1:] | ||
|
||
msg = '''Runs ship track pattern recognition.\n\ | ||
Usage:\n\ | ||
python RunPR.py [options] \n\ | ||
Example: \n\ | ||
python RunPR.py -f "ship.conical.Pythia8-TGeant4.root" -g "geofile_full.conical.Pythia8-TGeant4.root" | ||
Options: | ||
-f --input : Input file path | ||
-g --geo : Path to geo file | ||
-o --output : Output .root file path. Default is hists.root | ||
-m --method : Name of a track pattern recognition method: 'Baseline', 'FH', 'AR', 'R' | ||
: Default is 'Baseline' | ||
-h --help : Shows this help | ||
''' | ||
|
||
try: | ||
opts, args = getopt.getopt(argv, "hm:f:g:o:", | ||
["help", "method=", "input=", "geo=", "output="]) | ||
except getopt.GetoptError: | ||
print("Wrong options were used. Please, read the following help:\n") | ||
print(msg) | ||
sys.exit(2) | ||
if len(argv) == 0: | ||
print(msg) | ||
sys.exit(2) | ||
for opt, arg in opts: | ||
if opt in ('-h', "--help"): | ||
print(msg) | ||
sys.exit() | ||
elif opt in ("-m", "--method"): | ||
method = arg | ||
elif opt in ("-f", "--input"): | ||
input_file = arg | ||
elif opt in ("-g", "--geo"): | ||
geo_file = arg | ||
elif opt in ("-o", "--output"): | ||
output_file = arg | ||
|
||
|
||
metrics = run_track_pattern_recognition(input_file, geo_file, output_file, method) | ||
if __name__ == "__main__": | ||
|
||
parser = ArgumentParser(description=__doc__) | ||
parser.add_argument("-f", "--input", help="Input file", required=True) | ||
parser.add_argument("-g", "--geo", help="Geometry file", required=True) | ||
parser.add_argument("-o", "--output", help="Output file", default='hists.root') | ||
parser.add_argument("-m", "--method", help="Track pattern recognition method", choices=["Baseline", "FH", "AR", "R"], default="Baseline") | ||
options = parser.parse_args() | ||
|
||
metrics = run_track_pattern_recognition(options.input, options.geo, options.output, options.method) |