Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more Python3 fixes for geometry script #34875

Merged
merged 2 commits into from
Aug 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions Configuration/Geometry/python/generateGeometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ def __init__(self, scriptName, detectorVersionDefault, detectorPrefix, detectorY
self.deprecatedDets = deprecatedDets
self.deprecatedSubdets = deprecatedSubdets
self.detectorVersionType = detectorVersionType
self.detectorVersionNull = self.detectorVersionType(0)

def generateGeom(self, detectorTuple, args):
detectorVersion = self.detectorPrefix+str(args.detectorVersionManual)
# reverse dict search if overall D# specified
if args.v_detector>0:
if args.v_detector!=self.detectorVersionNull:
detectorVersion = self.detectorPrefix+str(args.v_detector)
if detectorVersion in self.detectorVersionDict.values():
detectorTuple = self.detectorVersionDict.keys()[self.detectorVersionDict.values().index(detectorVersion)]
detectorTuple = list(self.detectorVersionDict.keys())[list(self.detectorVersionDict.values()).index(detectorVersion)]
else:
print("Unknown detector "+detectorVersion)
sys.exit(1)
Expand Down Expand Up @@ -249,7 +250,7 @@ def run(self):
for aDict in self.allDicts:
parser.add_argument("-"+aDict["abbrev"], "--"+aDict["name"], dest="v_"+aDict["name"], default=aDict["default"], type=int, help="version for "+aDict["name"])
parser.add_argument("-V", "--version", dest="detectorVersionManual", default=self.detectorVersionDefault, type=int, help="manual detector version number")
parser.add_argument("-D", "--detector", dest="v_detector", default=0, type=self.detectorVersionType, help="version for whole detector, ignored if 0, overrides subdet versions otherwise")
parser.add_argument("-D", "--detector", dest="v_detector", default=self.detectorVersionNull, type=self.detectorVersionType, help="version for whole detector, ignored if 0, overrides subdet versions otherwise")
parser.add_argument("-l", "--list", dest="doList", default=False, action="store_true", help="list known detector versions and exit")
parser.add_argument("-t", "--test", dest="doTest", default=False, action="store_true", help="enable unit test mode")
args = parser.parse_args()
Expand Down