diff --git a/Control/AthenaConfiguration/python/AllConfigFlags.py b/Control/AthenaConfiguration/python/AllConfigFlags.py index 780d5f6b8882129d307205439e1a61cab1f59475..eb3bc9014c704de6d033cb647c5179afea188925 100644 --- a/Control/AthenaConfiguration/python/AllConfigFlags.py +++ b/Control/AthenaConfiguration/python/AllConfigFlags.py @@ -78,10 +78,10 @@ def initConfigFlags(): acf.addFlag('Input.ProjectName', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("project_name", "")) # former global.ProjectName acf.addFlag('Input.DataYear', _dataYearFromFlags) - acf.addFlag('Input.MCCampaign', lambda prevFlags : Campaign(GetFileMD(prevFlags.Input.Files).get("mc_campaign", "")), enum=Campaign) + acf.addFlag('Input.MCCampaign', lambda prevFlags : Campaign(GetFileMD(prevFlags.Input.Files).get("mc_campaign", "")), type=Campaign) acf.addFlag('Input.TriggerStream', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("stream", "") if prevFlags.Input.Format == Format.BS else GetFileMD(prevFlags.Input.Files).get("triggerStreamOfFile", "")) # former global.TriggerStream - acf.addFlag('Input.Format', lambda prevFlags : Format.BS if GetFileMD(prevFlags.Input.Files).get("file_type", "BS") == "BS" else Format.POOL, enum=Format) # former global.InputFormat + acf.addFlag('Input.Format', lambda prevFlags : Format.BS if GetFileMD(prevFlags.Input.Files).get("file_type", "BS") == "BS" else Format.POOL, type=Format) # former global.InputFormat acf.addFlag('Input.ProcessingTags', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("processingTags", []) ) # list of names of streams written to this file from GeneratorConfig.Versioning import generatorsGetFromMetadata acf.addFlag('Input.GeneratorsInfo', lambda prevFlags : generatorsGetFromMetadata( GetFileMD(prevFlags.Input.Files).get("generators", "") )) @@ -153,12 +153,12 @@ def initConfigFlags(): (prevFlags.Common.ProductionStep == ProductionStep.FastChain and prevFlags.Overlay.FastChain))) # Enable Overlay acf.addFlag('Common.doExpressProcessing', False) - acf.addFlag('Common.ProductionStep', ProductionStep.Default, enum=ProductionStep) - acf.addFlag('Common.Project', Project.determine(), enum=Project) + acf.addFlag('Common.ProductionStep', ProductionStep.Default, type=ProductionStep) + acf.addFlag('Common.Project', Project.determine(), type=Project) # replace global.Beam* acf.addFlag('Beam.BunchSpacing', 25) # former global.BunchSpacing - acf.addFlag('Beam.Type', lambda prevFlags : BeamType(GetFileMD(prevFlags.Input.Files).get('beam_type', 'collisions')), enum=BeamType)# former global.BeamType + acf.addFlag('Beam.Type', lambda prevFlags : BeamType(GetFileMD(prevFlags.Input.Files).get('beam_type', 'collisions')), type=BeamType)# former global.BeamType acf.addFlag("Beam.NumberOfCollisions", lambda prevFlags : 2. if prevFlags.Beam.Type is BeamType.Collisions else 0.) # former global.NumberOfCollisions def _configureBeamEnergy(prevFlags): diff --git a/Control/AthenaConfiguration/python/AnalysisApp.py b/Control/AthenaConfiguration/python/AnalysisApp.py index b20859b54671b7f9d95289117e8a456483f403b9..4aa1e36bccdea05e752c6981b16429eb54de6331 100644 --- a/Control/AthenaConfiguration/python/AnalysisApp.py +++ b/Control/AthenaConfiguration/python/AnalysisApp.py @@ -50,7 +50,7 @@ def initFlags(): acf.addFlag('Common.MsgSuppression',True) # Enable suppression of printout in MessageSvc acf.addFlag('Common.MsgSourceLength',50) #Length of the source-field in the format str of MessageSvc - acf.addFlag('Common.ProductionStep', ProductionStep.Default, enum=ProductionStep, help=argparse.SUPPRESS) + acf.addFlag('Common.ProductionStep', ProductionStep.Default, type=ProductionStep, help=argparse.SUPPRESS) acf.addFlag('Common.isOverlay', False, help=argparse.SUPPRESS) #Flags describing the input data @@ -59,7 +59,7 @@ def initFlags(): acf.addFlag('Input.SecondaryFiles', [], help=argparse.SUPPRESS) # secondary input files for DoubleEventSelector acf.addFlag('Input.ProcessingTags', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("processingTags", []), help="expert flag, do not override" ) # list of names of streams written to this file acf.addFlag('Input.ProjectName', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("project_name", "data17_13TeV"), help="expert flag, do not override") # former global.ProjectName - acf.addFlag('Input.MCCampaign', lambda prevFlags : Campaign(GetFileMD(prevFlags.Input.Files).get("mc_campaign", "")), enum=Campaign, help="expert flag, do not override") + acf.addFlag('Input.MCCampaign', lambda prevFlags : Campaign(GetFileMD(prevFlags.Input.Files).get("mc_campaign", "")), type=Campaign, help="expert flag, do not override") acf.addFlag('Concurrency.NumProcs', 0, help="0 = disables MP, otherwise is # of processes to use in MP mode") diff --git a/Control/AthenaConfiguration/python/AthConfigFlags.py b/Control/AthenaConfiguration/python/AthConfigFlags.py index 1954b1649a4920b6dc7f36ecb1ac6d65b8222627..24b261f6d2c91ddead637541ca14365852aa62d5 100644 --- a/Control/AthenaConfiguration/python/AthConfigFlags.py +++ b/Control/AthenaConfiguration/python/AthConfigFlags.py @@ -2,6 +2,7 @@ from copy import copy, deepcopy from difflib import get_close_matches +from enum import EnumMeta import importlib from AthenaCommon.Logging import logging from PyUtils.moduleExists import moduleExists @@ -20,18 +21,15 @@ class CfgFlag(object): the value based on other flags. """ - __slots__ = ['_value', '_setDef', '_enum', '_type', '_help'] + __slots__ = ['_value', '_setDef', '_type', '_help'] - def __init__(self, default, enum=None, type=None, help=None): + def __init__(self, default, type=None, help=None): """Initialise the flag with the default value. - Optionally set an enum of allowed values or the type of the flag value. + Optionally set the type of the flag value and the help string. """ if default is None: raise ValueError("Default value of a flag must not be None") - if enum is not None and type is not None: - raise ValueError("Flags can not have both enum and type set") - self._enum = enum self._type = type self._help = help self.set(default) @@ -49,8 +47,6 @@ class CfgFlag(object): self._value=value self._setDef=None - if not self._validateEnum(self._value): - raise TypeError("Flag is of type '{}', but '{}' set.".format(self._enum, type(self._value))) if not self._validateType(self._value): raise TypeError("Flag is of type '{}', but '{}' set.".format(self._type, type(self._value))) return @@ -83,9 +79,6 @@ class CfgFlag(object): # use function for as long as the flags are not locked value = self._setDef(flagdict) - if not self._validateEnum(value): - raise TypeError("Flag is of type '{}', but '{}' set.".format(self._enum, type(value))) - if not self._validateType(value): raise TypeError("Flag is of type '{}', but '{}' set.".format(self._type, type(value))) @@ -97,16 +90,6 @@ class CfgFlag(object): else: return "[function]" - def _validateEnum(self, value): - if self._enum is None: - return True - - if value is not None: - try: - return value in self._enum - except TypeError: - return False - def _validateType(self, value): if self._type is None: return True @@ -333,11 +316,11 @@ class AthConfigFlags(object): _msg.debug(f'missing module: {err}') pass - def addFlag(self, name, setDef, enum=None, type=None, help=None): + def addFlag(self, name, setDef, type=None, help=None): self._tryModify() if name in self._flagdict: raise KeyError("Duplicated flag name: {}".format( name )) - self._flagdict[name]=CfgFlag(setDef, enum, type, help) + self._flagdict[name]=CfgFlag(setDef, type, help) return def addFlagsCategory(self, path, generator, prefix=False): @@ -639,18 +622,24 @@ class AthConfigFlags(object): if not self.hasFlag(key): raise KeyError(f"{key} is not a known configuration flag") - enum = self._flagdict[key]._enum - # Regular flag - if enum is None: + flag_type = self._flagdict[key]._type + if flag_type is None: + # Regular flag try: exec(f"type({value})") except (NameError, SyntaxError): # Can't determine type, assume we got an un-quoted string value=f"\"{value}\"" - # FlagEnum else: - # import the module containing the FlagEnum class - ENUM = importlib.import_module(enum.__module__) # noqa: F841 (used in exec) - value=f"ENUM.{value}" + # typed flag + if isinstance(flag_type, EnumMeta): + # Flag is an enum, so we need to import the module containing the enum + + # import the module containing the FlagEnum class + ENUM = importlib.import_module(flag_type.__module__) # noqa: F841 (used in exec) + value=f"ENUM.{value}" + else: + # Flag is not an enum, so we can just use the type + value=f"{flag_type.__name__}({value})" # Set the value exec(f"self.{key}{oper}{value}") diff --git a/Control/AthenaConfiguration/python/GeoModelConfigFlags.py b/Control/AthenaConfiguration/python/GeoModelConfigFlags.py index 1885ffacaa5eca5a325ec2b3c068381bd472b6cd..bdafd426ee9967fea5110c28b3756d1d919d6755 100644 --- a/Control/AthenaConfiguration/python/GeoModelConfigFlags.py +++ b/Control/AthenaConfiguration/python/GeoModelConfigFlags.py @@ -36,12 +36,12 @@ def createGeoModelConfigFlags(analysis=False): return period gcf.addFlag("GeoModel.Run", # Run deducted from other metadata - _deduct_LHCPeriod, enum=LHCPeriod) + _deduct_LHCPeriod, type=LHCPeriod) return gcf gcf.addFlag("GeoModel.Run", # Run from the geometry database lambda prevFlags : LHCPeriod(DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Common']['Run']), - enum=LHCPeriod) + type=LHCPeriod) gcf.addFlag('GeoModel.Layout', 'atlas') # replaces global.GeoLayout diff --git a/Control/AthenaConfiguration/test/testAthConfigFlags.py b/Control/AthenaConfiguration/test/testAthConfigFlags.py index bd2070fa7eee142e2358e969cfda9870902e308f..3a7e1a97fadd25590ba8ac2ecd555bc83e5a865e 100755 --- a/Control/AthenaConfiguration/test/testAthConfigFlags.py +++ b/Control/AthenaConfiguration/test/testAthConfigFlags.py @@ -117,15 +117,15 @@ class BasicTests(FlagsSetup): def test_enums(self): """Test that enums are properly validated""" - self.flags.addFlag("Format", Format.BS, enum=Format) - self.flags.addFlag("FormatFun", lambda flags : Format.POOL if flags.Atest else Format.BS, enum=Format) - self.flags.addFlag("FormatPOOL", Format.BS, enum=Format) + self.flags.addFlag("Format", Format.BS, type=Format) + self.flags.addFlag("FormatFun", lambda flags : Format.POOL if flags.Atest else Format.BS, type=Format) + self.flags.addFlag("FormatPOOL", Format.BS, type=Format) self.flags.FormatPOOL = Format.POOL self.flags.lock() def test_enums_incorrect_assign(self): """Test that enums are properly validated (incorrect flags)""" - self.flags.addFlag("FormatWrong", Format.BS, enum=Format) + self.flags.addFlag("FormatWrong", Format.BS, type=Format) with self.assertRaises(TypeError) as _: self.flags.FormatWrong = "BS" @@ -134,7 +134,7 @@ class BasicTests(FlagsSetup): def test_enums_incorrect_lambda(self): """Test that enums are properly validated (incorrect flags)""" - self.flags.addFlag("FormatWrong", lambda flags : "ABC", enum=Format) + self.flags.addFlag("FormatWrong", lambda flags : "ABC", type=Format) with self.assertRaises(TypeError) as _: x = self.flags.FormatWrong # noqa: F841 @@ -320,11 +320,13 @@ class FlagsFromArgsTest(unittest.TestCase): self.flags.addFlag('Input.Files',[]) self.flags.addFlag('detA.flagB',0) self.flags.addFlag("detA.flagC","") - self.flags.addFlag("detA.flagD",[]) - self.flags.addFlag("Format", Format.BS, enum=Format) + self.flags.addFlag("detA.flagD", [], type=list) + self.flags.addFlag("intE", 123, type=int) + self.flags.addFlag("floatF", 123.45, type=float) + self.flags.addFlag("Format", Format.BS, type=Format) def test(self): - argline="-l VERBOSE --evtMax=10 --skipEvents=3 --filesInput=bla1.data,bla2.data detA.flagB=7 Format=Format.BS detA.flagC=a.2 detA.flagD+=['val']" + argline="-l VERBOSE --evtMax=10 --skipEvents=3 --filesInput=bla1.data,bla2.data detA.flagB=7 Format=Format.BS detA.flagC=a.2 detA.flagD+=['val'] intE=42 floatF=42.42" if isGaudiEnv(): argline += " --debug exec" print (f"Interpreting arguments: '{argline}'") @@ -337,6 +339,8 @@ class FlagsFromArgsTest(unittest.TestCase): self.assertEqual(self.flags.detA.flagB,7,"Failed to set arbitrary from args") self.assertEqual(self.flags.detA.flagC,"a.2","Failed to set arbitrary unquoted string from args") self.assertEqual(self.flags.detA.flagD,["val"],"Failed to append to list flag") + self.assertEqual(self.flags.intE, 42, "Failed to set integer flag") + self.assertEqual(self.flags.floatF, 42.42, "Failed to set floating point value flag") self.assertEqual(self.flags.Format, Format.BS,"Failed to set FlagEnum") diff --git a/Control/AthenaMonitoring/python/DQConfigFlags.py b/Control/AthenaMonitoring/python/DQConfigFlags.py index ddc3bb74f79a98fd0b25a5577ad4462e1ff29fe2..0a3997a0f770cd773c0a006cdf6e124fe11da292 100644 --- a/Control/AthenaMonitoring/python/DQConfigFlags.py +++ b/Control/AthenaMonitoring/python/DQConfigFlags.py @@ -51,7 +51,7 @@ def createDQConfigFlags(): # computed acf.addFlag('DQ.Environment', getEnvironment ) - acf.addFlag('DQ.DataType', getDataType, enum=DQDataType ) + acf.addFlag('DQ.DataType', getDataType, type=DQDataType ) # for in-Athena histogram postprocessing acf.addFlag('DQ.doPostProcessing', False) diff --git a/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py b/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py index 270250d7e596c25141eff2f13c33dac769d3cf0d..1c515500d4b5c9fdbe3ed5af1751dfd640d1ccbc 100644 --- a/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py +++ b/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py @@ -17,7 +17,7 @@ def createLArConfigFlags(): lcf.addFlag("LAr.doHVCorr",lambda prevFlags : not prevFlags.Input.isMC) lcf.addFlag("LAr.doCellEmMisCalib",lambda prevFlags : prevFlags.Input.isMC) - lcf.addFlag("LAr.RawChannelSource",_determineRawChannelSource,enum=RawChannelSource) + lcf.addFlag("LAr.RawChannelSource", _determineRawChannelSource, type=RawChannelSource) lcf.addFlag("LAr.doCellNoiseMasking",True) lcf.addFlag("LAr.doCellSporadicNoiseMasking",True) diff --git a/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py b/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py index 18c8cac79223bd2f4a7aed547ce3951c6584cef1..33918fa1c12cc7294becfdf6b6d752ef0f4ebdc6 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py +++ b/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py @@ -147,7 +147,7 @@ def createMuonConfigFlags(): mcf.addFlag("Muon.writeSDOs", lambda prevFlags : prevFlags.Output.doWriteESD and prevFlags.Input.isMC) # configure the MM cluster reco method that is used in the cluster calibration step - mcf.addFlag("Muon.MMClusterCalibRecoTool", lambda prevFlags : MMClusterBuilderEnum.ClusterTimeProjection if prevFlags.Input.isMC else MMClusterBuilderEnum.Centroid, enum = MMClusterBuilderEnum) + mcf.addFlag("Muon.MMClusterCalibRecoTool", lambda prevFlags : MMClusterBuilderEnum.ClusterTimeProjection if prevFlags.Input.isMC else MMClusterBuilderEnum.Centroid, type=MMClusterBuilderEnum) diff --git a/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py b/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py index 942f7db8b5032bd1b7475545cafd731c3c5db604..e3350322ce0389290a9c5119194d8c505a84dadf 100644 --- a/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py +++ b/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py @@ -115,7 +115,7 @@ def createRecoConfigFlags(): flags.addFlag("Reco.EnableHI", lambda prevFlags: prevFlags.Reco.HIMode is not HIMode.pp) - flags.addFlag("Reco.HIMode", _hiModeChoice, enum=HIMode) + flags.addFlag("Reco.HIMode", _hiModeChoice, type=HIMode) # Enable alg for decorating EventInfo with BeamSpot info # (maybe not always available for calibration runs, etc) diff --git a/Simulation/Digitization/python/DigitizationConfigFlags.py b/Simulation/Digitization/python/DigitizationConfigFlags.py index 18bd88a8bb9324521916bb51f5ceb24f65d4fc68..1cd19f365a7ce29c7cbd459d69e524551c925ef0 100644 --- a/Simulation/Digitization/python/DigitizationConfigFlags.py +++ b/Simulation/Digitization/python/DigitizationConfigFlags.py @@ -73,9 +73,11 @@ def createDigitizationCfgFlags(): flags.addFlag("Digitization.InputBeamSigmaZ", -1) # Set the type of the radiation damage simulation type for pixel planar sensors - flags.addFlag("Digitization.PixelPlanarRadiationDamageSimulationType", PixelRadiationDamageSimulationType.NoRadiationDamage, enum=PixelRadiationDamageSimulationType) + flags.addFlag("Digitization.PixelPlanarRadiationDamageSimulationType", + PixelRadiationDamageSimulationType.NoRadiationDamage, type=PixelRadiationDamageSimulationType) # Set the type of the radiation damage simulation type for 3D planar sensors - flags.addFlag("Digitization.Pixel3DRadiationDamageSimulationType", PixelRadiationDamageSimulationType.NoRadiationDamage, enum=PixelRadiationDamageSimulationType) + flags.addFlag("Digitization.Pixel3DRadiationDamageSimulationType", + PixelRadiationDamageSimulationType.NoRadiationDamage, type=PixelRadiationDamageSimulationType) # for PileUp digitization # Bunch structure configuration diff --git a/Simulation/SimulationConfig/python/SimConfigFlags.py b/Simulation/SimulationConfig/python/SimConfigFlags.py index 2d4f1101cdbe33e2ee0d07413416489928053b41..da2576284c5fe18879ecf61835837fb005267f5e 100644 --- a/Simulation/SimulationConfig/python/SimConfigFlags.py +++ b/Simulation/SimulationConfig/python/SimConfigFlags.py @@ -19,9 +19,9 @@ def createSimConfigFlags(): return CalibrationRun.Off return CalibrationRun.DeadLAr - scf.addFlag("Sim.CalibrationRun", _checkCalibrationRun, enum=CalibrationRun) + scf.addFlag("Sim.CalibrationRun", _checkCalibrationRun, type=CalibrationRun) - scf.addFlag("Sim.CavernBackground", CavernBackground.Off, enum=CavernBackground) + scf.addFlag("Sim.CavernBackground", CavernBackground.Off, type=CavernBackground) scf.addFlag("Sim.ReadTR", False) scf.addFlag("Sim.WorldRRange", False) # 12500. / int or float scf.addFlag("Sim.WorldZRange", False) # 22031. / int or float @@ -71,7 +71,7 @@ def createSimConfigFlags(): scf.addFlag("Sim.ReleaseGeoModel", False) scf.addFlag("Sim.RecordFlux", False) scf.addFlag("Sim.TruthStrategy", lambda prevFlags : TruthStrategy.Validation if prevFlags.Sim.ISF.ValidationMode else TruthStrategy.MC12, - enum=TruthStrategy) + type=TruthStrategy) scf.addFlag("Sim.UseShadowEvent", False) scf.addFlag("Sim.G4Commands", ["/run/verbose 2"]) scf.addFlag("Sim.FlagAbortedEvents", False) @@ -121,14 +121,14 @@ def createSimConfigFlags(): # G4AtlasToolsConfig scf.addFlag("Sim.RecordStepInfo", False) scf.addFlag("Sim.StoppedParticleFile", "") - scf.addFlag("Sim.BeamPipeSimMode", BeamPipeSimMode.Normal, enum=BeamPipeSimMode) - scf.addFlag("Sim.LArParameterization", LArParameterization.NoFrozenShowers, enum=LArParameterization) + scf.addFlag("Sim.BeamPipeSimMode", BeamPipeSimMode.Normal, type=BeamPipeSimMode) + scf.addFlag("Sim.LArParameterization", LArParameterization.NoFrozenShowers, type=LArParameterization) # TRT Range cut used in simulation in mm. Should be 0.05 or 30. scf.addFlag("Sim.TRTRangeCut", lambda prevFlags: float(GetFileMD(prevFlags.Input.Files).get('TRTRangeCut', 30.0))) # BeameffectsAlg - scf.addFlag("Sim.VertexSource", VertexSource.CondDB, enum=VertexSource) + scf.addFlag("Sim.VertexSource", VertexSource.CondDB, type=VertexSource) scf.addFlag("Sim.VertexTimeSmearing", lambda prevFlags: prevFlags.Beam.Type == BeamType.Collisions and prevFlags.GeoModel.Run >= LHCPeriod.Run4) @@ -196,7 +196,7 @@ def createSimConfigFlags(): simulator = SimulationFlavour.Unknown return simulator - scf.addFlag("Sim.ISF.Simulator", _checkSimulationFlavour, enum=SimulationFlavour) + scf.addFlag("Sim.ISF.Simulator", _checkSimulationFlavour, type=SimulationFlavour) scf.addFlag("Sim.ISF.DoTimeMonitoring", True) # bool: run time monitoring scf.addFlag("Sim.ISF.DoMemoryMonitoring", True) # bool: run time monitoring scf.addFlag("Sim.ISF.ValidationMode", False) # bool: run ISF internal validation checks diff --git a/Tracking/Acts/ActsConfig/python/ActsConfigFlags.py b/Tracking/Acts/ActsConfig/python/ActsConfigFlags.py index 4758b61b2e2204cf3900e6b014670fead7bff8b2..96fa24105da039e8d2999d9adb031f9da87f63f4 100644 --- a/Tracking/Acts/ActsConfig/python/ActsConfigFlags.py +++ b/Tracking/Acts/ActsConfig/python/ActsConfigFlags.py @@ -37,10 +37,10 @@ def createActsConfigFlags(): actscf.addFlag('Acts.doAnalysis', False) # SpacePoint - actscf.addFlag("Acts.SpacePointStrategy", SpacePointStrategy.ActsTrk, enum=SpacePointStrategy) # Define SpacePoint Strategy + actscf.addFlag("Acts.SpacePointStrategy", SpacePointStrategy.ActsTrk, type=SpacePointStrategy) # Define SpacePoint Strategy # Seeding - actscf.addFlag("Acts.SeedingStrategy", SeedingStrategy.Default, enum=SeedingStrategy) # Define Seeding Strategy + actscf.addFlag("Acts.SeedingStrategy", SeedingStrategy.Default, type=SeedingStrategy) # Define Seeding Strategy # Track finding actscf.addFlag('Acts.doRotCorrection', True) @@ -55,7 +55,7 @@ def createActsConfigFlags(): # Track fitting actscf.addFlag('Acts.writeTrackCollection', False) # save to file (ESD, AOD) the Resolved and Refitted track collections actscf.addFlag('Acts.fitFromPRD', False) # Acts.writeTrackCollection needs to be True for either cases. If Acts.fitFromPRD is False, fit from ROT; else, fit from PRD - actscf.addFlag('Acts.trackFitterType', TrackFitterType.KalmanFitter, enum=TrackFitterType) # Define Tracking algorithm for refitting + actscf.addFlag('Acts.trackFitterType', TrackFitterType.KalmanFitter, type=TrackFitterType) # Define Tracking algorithm for refitting actscf.addFlag("Acts.useActsGsfInEgamma", False) diff --git a/Tracking/TrkConfig/python/TrkConfigFlags.py b/Tracking/TrkConfig/python/TrkConfigFlags.py index c39fa592efcb83ae7c8c535e0831b67f39061616..c258f7f5f91934f964dc812eebc73a60adfa3155 100644 --- a/Tracking/TrkConfig/python/TrkConfigFlags.py +++ b/Tracking/TrkConfig/python/TrkConfigFlags.py @@ -63,10 +63,10 @@ def createTrackingConfigFlags(): # control which fitter to be used icf.addFlag("Tracking.trackFitterType", - TrackFitterType.GlobalChi2Fitter, enum=TrackFitterType) + TrackFitterType.GlobalChi2Fitter, type=TrackFitterType) # control which measurement updator to load as InDetUpdator icf.addFlag("Tracking.kalmanUpdator", - KalmanUpdatorType.KalmanUpdatorSMatrix, enum=KalmanUpdatorType) + KalmanUpdatorType.KalmanUpdatorSMatrix, type=KalmanUpdatorType) icf.addFlag("Tracking.materialInteractions", lambda prevFlags: prevFlags.Beam.Type is not BeamType.SingleBeam) @@ -107,7 +107,7 @@ def createTrackingConfigFlags(): PixelClusterSplittingType.NeuralNet if prevFlags.GeoModel.Run <= LHCPeriod.Run3 else PixelClusterSplittingType.Truth, - enum=PixelClusterSplittingType) + type=PixelClusterSplittingType) # Cut value for splitting clusters into two parts icf.addFlag("Tracking.pixelClusterSplitProb1", lambda prevFlags: ( @@ -347,7 +347,7 @@ def createTrackingConfigFlags(): return PrimaryPassConfig.Default icf.addFlag("Tracking.PrimaryPassConfig", lambda prevFlags: - primaryPass(prevFlags), enum=PrimaryPassConfig) + primaryPass(prevFlags), type=PrimaryPassConfig) # Set up for first tracking pass, updated for second passes icf.addFlagsCategory("Tracking.MainPass", @@ -414,7 +414,7 @@ def createTrackingConfigFlags(): return ITkPrimaryPassConfig.Default icf.addFlag("Tracking.ITkPrimaryPassConfig", lambda prevFlags: - itkPrimaryPass(prevFlags), enum=ITkPrimaryPassConfig) + itkPrimaryPass(prevFlags), type=ITkPrimaryPassConfig) icf.addFlagsCategory ("Tracking.ITkMainPass", createITkTrackingPassFlags, prefix=True) diff --git a/Tracking/TrkConfig/python/VertexFindingFlags.py b/Tracking/TrkConfig/python/VertexFindingFlags.py index 91f1ca9f30c6852ccbb36ccead3312a3e67ba8da..a04b480dd624e83707829d121b68e600e435083d 100644 --- a/Tracking/TrkConfig/python/VertexFindingFlags.py +++ b/Tracking/TrkConfig/python/VertexFindingFlags.py @@ -55,10 +55,10 @@ def createPriVertexingFlags(): else: # Default return VertexSetup.ActsGaussAMVF - flags.addFlag("setup", vertexSetup, enum=VertexSetup) + flags.addFlag("setup", vertexSetup, type=VertexSetup) # string to store the type of sorting algorithm to separate signal and pile-up vertices. - flags.addFlag("sortingSetup", VertexSortingSetup.SumPt2Sorting, enum=VertexSortingSetup) + flags.addFlag("sortingSetup", VertexSortingSetup.SumPt2Sorting, type=VertexSortingSetup) flags.addFlag("useBeamConstraint", lambda pcf: not(pcf.Tracking.PrimaryPassConfig in [ PrimaryPassConfig.VtxLumi,