Skip to content

Commit

Permalink
make type fully consistent, avoid magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
kpedro88 committed Aug 15, 2021
1 parent 306ad3d commit 57911e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Configuration/Geometry/python/generateGeometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ 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!=self.detectorVersionType(0):
if args.v_detector!=self.detectorVersionNull:
detectorVersion = self.detectorPrefix+str(args.v_detector)
if detectorVersion in self.detectorVersionDict.values():
detectorTuple = list(self.detectorVersionDict.keys())[list(self.detectorVersionDict.values()).index(detectorVersion)]
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

0 comments on commit 57911e2

Please sign in to comment.