def Q5FwdG4FieldSvcCfg(ConfigFlags, name='Q5FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() result.addService(MagField__ForwardRegionFieldSvc( "Q5", Magnet=6)) # FIXME find a better way to do this. kwargs.setdefault("MagneticFieldSvc", result.getService("Q5")) result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) return result
def RenameHLTaggerCfg(JetCollection, Tagger, suffix): acc = ComponentAccumulator() AddressRemappingSvc, ProxyProviderSvc = CompFactory.getComps( "AddressRemappingSvc", "ProxyProviderSvc", ) AddressRemappingSvc = AddressRemappingSvc("AddressRemappingSvc") AddressRemappingSvc.TypeKeyRenameMaps += [ 'xAOD::BTaggingAuxContainer#BTagging_' + JetCollection + '.' + Tagger + '_pu->BTagging_' + JetCollection + '.' + Tagger + '_pu' + suffix ] AddressRemappingSvc.TypeKeyRenameMaps += [ 'xAOD::BTaggingAuxContainer#BTagging_' + JetCollection + '.' + Tagger + '_pc->BTagging_' + JetCollection + '.' + Tagger + '_pc' + suffix ] AddressRemappingSvc.TypeKeyRenameMaps += [ 'xAOD::BTaggingAuxContainer#BTagging_' + JetCollection + '.' + Tagger + '_pb->BTagging_' + JetCollection + '.' + Tagger + '_pb' + suffix ] AddressRemappingSvc.TypeKeyRenameMaps += [ 'xAOD::BTaggingAuxContainer#BTagging_' + JetCollection + '.' + Tagger + '_ptau->BTagging_' + JetCollection + '.' + Tagger + '_ptau' + suffix ] acc.addService(AddressRemappingSvc) acc.addService(ProxyProviderSvc(ProviderNames=["AddressRemappingSvc"])) return acc
def CTBUserActionSvcCfg(ConfigFlags, name="G4UA::CTBUserActionSvc", **kwargs): result = ComponentAccumulator() # FIXME migrate an alternative to this generalActions = result.popToolsAndMerge(getDefaultActions(ConfigFlags)) generalActions += [ result.popToolsAndMerge(LooperKillerToolCfg(ConfigFlags)) ] # This comment carried over from old style: # FIXME: ADS these actions are not yet migrated to Hive #if simFlags.SimLayout.get_Value()=="tb_LArH6_2004": # eoe=["LArHitsH6EventAction"]+eoe # eoe+=["LArGeoH62004EventAction"] # if simFlags.LArTB_H6Step.statusOn: # if simFlags.LArTB_H6Step.get_Value(): # stepping+=["LArGeoH62004SteppingAction"] # event+=["RadLenNtuple"] # eoe+=["RadLenNtuple"] # stepping+=["RadLenNtuple"] # New user action tools kwargs.setdefault("UserActionTools", generalActions) # placeholder for more advanced config, if needed result.addService(CompFactory.G4UA.UserActionSvc(name, **kwargs)) return result
def FCAL3CalibCalculatorCfg(ConfigFlags, name="FCAL3CalibCalculator", **kwargs): result = ComponentAccumulator() kwargs.setdefault("FCALdeltaX",9.0*mm) kwargs.setdefault("FCALdeltaY",9.0*mm*math.sin(60*deg)) kwargs.setdefault("FCALSampling",3) result.addService(LArG4__FCAL__LArFCALCalibCalculatorBase(name, **kwargs)) return result
def Ranecu(seed, name="AtRndmGenSvc"): """Return a ComponentAccumulator containing an AtRndmGenSvc with seed""" acc = ComponentAccumulator() service = AtRndmGenSvc(name) service.Seeds.append(seed) acc.addService(service) return acc
def egammaMVASvcCfg(flags, name="egammaMVASvc"): mlog = logging.getLogger(name) mlog.debug('Start configuration') acc = ComponentAccumulator() if flags.Egamma.Calib.MVAVersion is not None: folder = flags.Egamma.Calib.MVAVersion mlog.debug('MVA version: %s', folder) else: raise KeyError("Egamma.Calib.MVAVersion is not set") electronMVATool = egammaMVACalibTool(name="electronMVATool", ParticleType=xAOD.EgammaParameters.electron, folder=folder) unconvertedPhotonMVATool = egammaMVACalibTool(name="unconvertedPhotonMVATool", ParticleType=xAOD.EgammaParameters.unconvertedPhoton, folder=folder) convertedPhotonMVATool = egammaMVACalibTool(name="convertedPhotonMVATool", ParticleType=xAOD.EgammaParameters.convertedPhoton, folder=folder) egMVASvc = egammaMVASvc(name=name, ElectronTool=electronMVATool, UnconvertedPhotonTool=unconvertedPhotonMVATool, ConvertedPhotonTool=convertedPhotonMVATool) acc.addService(egMVASvc) return acc
def RNG(engine="dSFMT", name="AthRNGSvc"): """Return a ComponentAccumulator containing an AthRNGSvc""" acc = ComponentAccumulator() service = AthRNGSvc(name) service.EngineType = engine acc.addService(service) return acc
def getDQTHistSvc(inputFlags): ''' This function creates a THistSvc - used for the new-style job configuration Returns: (result, histsvc) -- a tuple of (ComponentAccumulator, THistSvc Configurable object) ''' from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory THistSvc = CompFactory.THistSvc result = ComponentAccumulator() if inputFlags.DQ.isReallyOldStyle: from AthenaCommon.AppMgr import ServiceMgr result.addService(ServiceMgr.THistSvc) return result histsvc = THistSvc() histsvc.Output += [ "%s DATAFILE='%s' OPT='RECREATE'" % (inputFlags.DQ.FileKey, inputFlags.Output.HISTFileName) ] result.addService(histsvc) return result
def FastCaloSimV2SvcCfg(flags, name="ISF_FastCaloSimSvcV2", **kwargs): acc = ComponentAccumulator() kwargs.setdefault("SimulatorTool", acc.popToolsAndMerge(FastCaloSimV2ToolCfg(flags))) kwargs.setdefault("Identifier", "FastCaloSim") acc.addService(CompFactory.ISF.LegacySimSvc(name, **kwargs)) return acc
def MuonTrackBuildingCfg(flags, name="MuPatTrackBuilder"): MuPatTrackBuilder = CompFactory.MuPatTrackBuilder # This is based on https://gitlab.cern.ch/atlas/athena/blob/release/22.0.3/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py#L162 result = ComponentAccumulator() #Arguably this should be somewhere deeper - not quite sure where yet though. FIXME from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg result.merge(MuonGeoModelCfg(flags)) Muon__MuonEDMHelperSvc = CompFactory.Muon.MuonEDMHelperSvc muon_edm_helper_svc = Muon__MuonEDMHelperSvc("MuonEDMHelperSvc") result.addService(muon_edm_helper_svc) acc = MuonTrackSteeringCfg(flags) track_steering = acc.getPrimary() result.merge(acc) track_builder = MuPatTrackBuilder( name=name, TrackSteering=track_steering, MuonSegmentCollection="MuonSegments", SpectrometerTrackOutputLocation="MuonSpectrometerTracks") result.addEventAlgo(track_builder, primary=True) return result
def ISFUserActionSvcCfg(ConfigFlags, name="G4UA::ISFUserActionSvc", **kwargs): result = ComponentAccumulator() TrackProcessorUserAction = kwargs.pop("TrackProcessorUserAction", []) PhysicsValidationUserAction = [] if ConfigFlags.Sim.ISF.ValidationMode: PhysicsValidationUserAction = [ result.popPrivateTools( PhysicsValidationUserActionToolCfg(ConfigFlags)) ] MCTruthUserAction = kwargs.pop( "MCTruthUserAction", [result.popToolsAndMerge(MCTruthUserActionToolCfg(ConfigFlags))]) # FIXME migrate an alternative to this #from G4AtlasApps.SimFlags import simFlags #optActions = simFlags.OptionalUserActionList.get_Value() generalActions = ( TrackProcessorUserAction + MCTruthUserAction + result.popToolsAndMerge(getDefaultActions(ConfigFlags)) + [result.popToolsAndMerge(LooperKillerToolCfg(ConfigFlags))] + PhysicsValidationUserAction) # New user action tools kwargs.setdefault("UserActionTools", generalActions) result.addService(CompFactory.G4UA.UserActionSvc(name, **kwargs)) return result
def GeoModelCfg(configFlags): version = configFlags.GeoModel.AtlasVersion from AthenaCommon.AppMgr import release_metadata rel_metadata = release_metadata() relversion = rel_metadata['release'].split('.') if len(relversion) < 3: relversion = rel_metadata['base release'].split('.') result = ComponentAccumulator() GeoModelSvc = CompFactory.GeoModelSvc gms = GeoModelSvc(AtlasVersion=version, SupportedGeometry=int(relversion[0])) if configFlags.Detector.Simulate: ## Protects GeoModelSvc in the simulation from the AlignCallbacks gms.AlignCallbacks = False result.addService(gms, primary=True) #Get DetDescrCnvSvc (for identifier dictionaries (identifier helpers) from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg result.merge(DetDescrCnvSvcCfg(configFlags)) from EventInfoMgt.TagInfoMgrConfig import TagInfoMgrCfg tim_ca, tagInfoMgr = TagInfoMgrCfg(configFlags) result.addService(tagInfoMgr) result.merge(tim_ca) #TagInfoMgr used by GeoModelSvc but no ServiceHandle. Relies on string-name return result
def ParticleKillerSvcCfg(ConfigFlags, name="ISF_ParticleKillerSvc", **kwargs): result = ComponentAccumulator() kwargs.setdefault("Identifier", "ParticleKiller") tool = result.popToolsAndMerge(ParticleKillerToolCfg(ConfigFlags)) kwargs.setdefault("SimulatorTool", tool) svc = CompFactory.ISF.LegacySimSvc(name, **kwargs) result.addService(svc) return result
def getCavernInfraGeoDetectorTool(ConfigFlags, name='CavernInfra', **kwargs): result = ComponentAccumulator() #needs geometry setting up! kwargs.setdefault("DetectorName", "CavernInfra") #add the GeometryNotifierSvc result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result
def FastCaloSimSvcCfg(flags, name="ISF_FastCaloSimSvc", **kwargs): acc = ComponentAccumulator() if "SimulatorTool" not in kwargs: tool = acc.popToolsAndMerge(FastCaloToolBaseCfg(flags)) kwargs.setdefault("SimulatorTool", tool) kwargs.setdefault("Identifier", "FastCaloSim") acc.addService(CompFactory.ISF.LegacySimSvc(name, **kwargs)) return acc
def MuonIdHelperSvcCfg(flags): acc = ComponentAccumulator() acc.addService( Muon__MuonIdHelperSvc("MuonIdHelperSvc", HasCSC=flags.Detector.GeometryCSC, HasSTgc=flags.Detector.GeometrysTGC, HasMM=flags.Detector.GeometryMM)) return acc
def PixelCablingSvcCfg(flags, name="PixelCablingSvc", **kwargs): """Return a ComponentAccumulator with configured PixelCablingSvc""" acc = ComponentAccumulator() acc.merge(PixelHitDiscCnfgAlgCfg(flags)) acc.merge(PixelReadoutSpeedAlgCfg(flags)) acc.merge(PixelCablingCondAlgCfg(flags)) acc.addService(CompFactory.PixelCablingSvc(name, **kwargs)) return acc
def TileHitVecToCntToolCfg(flags, **kwargs): """Return component accumulator with configured private Tile hit vector to container tool Arguments: flags -- Athena configuration flags (ConfigFlags) """ kwargs.setdefault('name', 'TileHitVecToCntTool') kwargs.setdefault('RndmEvtOverlay', flags.Detector.OverlayTile) kwargs.setdefault('OnlyUseContainerName', not flags.Detector.OverlayTile) acc = ComponentAccumulator() from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg acc.merge(TileInfoLoaderCfg(flags)) from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg acc.merge(TileCablingSvcCfg(flags)) kwargs.setdefault('TileHitVectors', ['TileHitVec', 'MBTSHits']) kwargs.setdefault('TileHitContainer', 'TileHitCnt') kwargs.setdefault('DoHSTruthReconstruction', flags.Digitization.DoDigiTruth) if kwargs['DoHSTruthReconstruction']: kwargs.setdefault('TileHitContainer_DigiHSTruth', 'TileHitCnt_DigiHSTruth') else: kwargs.setdefault('TileHitContainer_DigiHSTruth', '') if 'RndmSvc' not in kwargs: from RngComps.RandomServices import RNG acc.merge(RNG(flags.Random.Engine)) kwargs['RndmSvc'] = acc.getService('AthRNGSvc') if kwargs['RndmEvtOverlay']: kwargs.setdefault('PileUp', False) else: kwargs.setdefault('PileUp', flags.Digitization.Pileup) if kwargs['PileUp']: PileUpMergeSvc = CompFactory.PileUpMergeSvc acc.addService(PileUpMergeSvc()) if flags.Beam.Type == 'cosmics': CosmicTriggerTimeTool = CompFactory.CosmicTriggerTimeTool kwargs.setdefault('TriggerTimeTool', CosmicTriggerTimeTool()) kwargs.setdefault('HitTimeFlag', 2) kwargs.setdefault('UseTriggerTime', True) if flags.Digitization.DoXingByXingPileUp: # PileUpTool approach kwargs.setdefault("FirstXing", getTileFirstXing()) kwargs.setdefault("LastXing", getTileLastXing()) TileHitVecToCntTool = CompFactory.TileHitVecToCntTool acc.setPrivateTools(TileHitVecToCntTool(**kwargs)) return acc
def TileCTBGeoG4SDCalcCfg(ConfigFlags, name="TileCTBGeoG4SDCalc", **kwargs): result = ComponentAccumulator() kwargs.setdefault("TileTB", True) if ConfigFlags.Sim.ParticleID: kwargs.setdefault("DoCalibHitParticleID", ConfigFlags.Sim.ParticleID) result.addService(TileGeoG4SDCalc(name, **kwargs)) return result
def MuonStationIntersectSvcCfg(flags, name='MuonStationIntersectSvc', **kwargs): MuonStationIntersectSvc = CompFactory.MuonStationIntersectSvc # Has dependency IdHelperTool (which we ignore for now) result = ComponentAccumulator() muon_station_intersect_svc = MuonStationIntersectSvc(name=name, **kwargs) result.addService(muon_station_intersect_svc, primary=True) return result
def EndcapCryostatCalibrationMixedCalculatorCfg( ConfigFlags, name="EndcapCryostatCalibrationMixedCalculator", **kwargs): result = ComponentAccumulator() result.addService( CompFactory.LArG4.EndcapCryostat.CalibrationMixedCalculator( name, **kwargs)) return result
def ForwardFieldSvcCfg(ConfigFlags, name="ForwardField", **kwargs): result = ComponentAccumulator() # #FIXME Once it exists this version should use the new MagField Service defined in ForwardRegionMgField # kwargs.setdefault("MagneticFieldSvc", result.getService("AtlasFieldSvc")) # #kwargs.setdefault("FieldOn", True) kwargs.setdefault("UseMagFieldSvc", True) result.addService(StandardFieldSvc(name, **kwargs)) return result
def PtBarrelLUTSvcCfg_MC(flags): acc = ComponentAccumulator() ptBarrelLUTSvc_MC = CompFactory.getComp("TrigL2MuonSA::PtBarrelLUTSvc")( name='PtBarrelLUTSvc_MC') ptBarrelLUTSvc_MC.LUTfile = "pt_barrel.mc10.lut" acc.addService(ptBarrelLUTSvc_MC) return acc, ptBarrelLUTSvc_MC
def AlignmentBarrelLUTSvcCfg(flags): acc = ComponentAccumulator() alignmentBarrelLUTSvc = CompFactory.getComp( "TrigL2MuonSA::AlignmentBarrelLUTSvc")(name='AlignmentBarrelLUTSvc') alignmentBarrelLUTSvc.LUTfile = "dZ_barrel.lut" acc.addService(alignmentBarrelLUTSvc) return acc, alignmentBarrelLUTSvc
def FastCaloSimV2ParamSvcCfg(flags, name="ISF_FastCaloSimV2ParamSvc", **kwargs): acc = ComponentAccumulator() kwargs.setdefault("ParamsInputFilename", flags.Sim.FastCalo.ParamsInputFilename) kwargs.setdefault("ParamsInputObject", "SelPDGID") acc.addService(CompFactory.ISF.FastCaloSimV2ParamSvc(name, **kwargs)) return acc
def MC12BarcodeSvcCfg(ConfigFlags, name="Barcode_MC12BarcodeSvc", **kwargs): result = ComponentAccumulator() kwargs.setdefault("FirstSecondaryVertexBarcode", -200001) kwargs.setdefault("VertexIncrement", -1) kwargs.setdefault("FirstSecondaryBarcode", 200001) kwargs.setdefault("SecondaryIncrement", 1) kwargs.setdefault("ParticleGenerationIncrement", 1000000) svc = CompFactory.Barcode.LegacyBarcodeSvc(name, **kwargs) result.addService(svc, primary=True) return result
def PropResultRootWriterSvcCfg(configFlags, name="PropResultRootWriterSvc", **kwargs): result = ComponentAccumulator() Trk__PropResultRootWriterSvc = CompFactory.Trk.PropResultRootWriterSvc propResultRootWriterSvc = Trk__PropResultRootWriterSvc(name, **kwargs) result.addService(propResultRootWriterSvc) return result, propResultRootWriterSvc
def Q1VKickFwdG4FieldSvcCfg( ConfigFlags, name='Q1VKickFwdG4FieldSvc', **kwargs): #note is lower case "v" in ForwardRegionMgFieldConfig.py result = ComponentAccumulator() result.addService(MagField__ForwardRegionFieldSvc( "Q1VKick", Magnet=10)) # FIXME find a better way to do this. kwargs.setdefault("MagneticFieldSvc", result.getService("Q1VKick")) result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) return result
def Q3FwdG4FieldSvcCfg(ConfigFlags, name='Q3FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() result.addService( MagField__ForwardRegionFieldSvc( "Q3", Magnet=2, # FIXME find a better way to do this. MQXA_DataFile="MQXA_NOMINAL.dat")) kwargs.setdefault("MagneticFieldSvc", result.getService("Q3")) result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) return result
def EMECPresamplerCalculatorCfg(ConfigFlags, name="EMECPresamplerCalculator", **kwargs): result = ComponentAccumulator() result.addService(EMECPresamplerGeometryCfg(ConfigFlags)) kwargs.setdefault("GeometryCalculator", result.getService("EMECPresamplerGeometry")) result.addService(CompFactory.LArEndcapPresamplerCalculator( name, **kwargs)) return result