Example #1
0
def fatrasExEngineCfg(flags, name="ISF_FatrasExEngine", **kwargs):
    # load the tracking geometry service
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    # assign the tools
    result.merge(fatrasStaticExtrapolatorCfg(flags))
    tool = result.getPublicTool("ISF_FatrasStaticExEngine")
    kwargs.setdefault("ExtrapolationEngines", [tool])
    acc = TrackingGeometrySvcCfg(flags)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary())
    result.merge(acc)
    result.merge(fatrasStaticPropagatorCfg(flags))
    kwargs.setdefault("PropagationEngine",
                      result.getPublicTool("ISF_FatrasStaticPropagator"))

    # configure output formatting
    kwargs.setdefault("OutputPrefix", "[ME] - ")
    kwargs.setdefault("OutputPostfix", " - ")
    kwargs.setdefault("OutputLevel", flags.Exec.OutputLevel)

    Trk__ExtrapolationEngine = CompFactory.Trk.ExtrapolationEngine
    result.setPrivateTools(Trk__ExtrapolationEngine(name, **kwargs))
    return result
Example #2
0
def fatrasStaticNavigationEngineCfg(flags,
                                    name="ISF_FatrasStaticNavigationEngine",
                                    **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(fatrasStaticPropagatorCfg(flags))
    kwargs.setdefault("PropagationEngine",
                      result.getPublicTool("ISF_FatrasStaticPropagator"))
    result.merge(fatrasMaterialEffectsEngineCfg(flags))
    kwargs.setdefault("MaterialEffectsEngine",
                      result.getPublicTool("ISF_FatrasMaterialEffectsEngine"))
    acc = TrackingGeometrySvcCfg(flags)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary())
    result.merge(acc)

    # configure output formatting
    kwargs.setdefault("OutputPrefix", "[SN] - ")
    kwargs.setdefault("OutputPostfix", " - ")
    kwargs.setdefault("OutputLevel", flags.Exec.OutputLevel)
    Trk__StaticNavigationEngine = CompFactory.Trk.StaticNavigationEngine
    acc.setPrivateTools(Trk__StaticNavigationEngine(name, **kwargs))
    return acc
Example #3
0
def CombinedMuonTagTestToolCfg(flags, name='CombinedMuonTagTestTool', **kwargs ):
    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    result = AtlasExtrapolatorCfg(flags)
    kwargs.setdefault("ExtrapolatorTool",result.getPrimary() )
    acc  = TrackingGeometrySvcCfg(flags)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary() )
    result.merge(acc)
    kwargs.setdefault("Chi2Cut",50000.)
    tool = CompFactory.MuonCombined.MuonTrackTagTestTool(name,**kwargs)
    result.setPrivateTools(tool)
    return result
Example #4
0
def MuonNavigatorCfg(flags, name="MuonNavigator", **kwargs):
    Trk__Navigator = CompFactory.Trk.Navigator

    result = ComponentAccumulator()

    acc = TrackingGeometrySvcCfg(flags)
    result.merge(acc)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary())

    navigator = Trk__Navigator(name=name, **kwargs)
    result.setPrivateTools(navigator)
    return result
Example #5
0
def InDetNavigatorCfg(flags, name='InDetNavigator', **kwargs):
    the_name = makeName(name, kwargs)
    result = ComponentAccumulator()
    if 'TrackingGeometrySvc' not in kwargs:
        from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
        tmpAcc = TrackingGeometrySvcCfg(flags)
        kwargs.setdefault("TrackingGeometrySvc", tmpAcc.getPrimary())
        result.merge(tmpAcc)

    tool = CompFactory.Trk.Navigator(name=the_name, **kwargs)
    result.addPublicTool(tool)
    result.setPrivateTools(tool)
    return result
Example #6
0
def MuidMaterialAllocatorCfg(flags, name='MuidMaterialAllocator', **kwargs): 
    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    kwargs.setdefault("AggregateMaterial",True)
    kwargs.setdefault("AllowReordering",False)

    result = AtlasExtrapolatorCfg(flags)
    kwargs.setdefault("Extrapolator", result.getPrimary() )
    acc  = TrackingGeometrySvcCfg(flags)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary() )
    result.merge(acc)
    tool = CompFactory.Trk.MaterialAllocator(name,**kwargs)
    result.setPrivateTools(tool)
    return result 
Example #7
0
def fatrasNavigatorCfg(flags, name="ISF_FatrasNavigator", **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    acc = TrackingGeometrySvcCfg(flags)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary())
    result.merge(acc)

    Trk__Navigator = CompFactory.Trk.Navigator
    result.addPublicTool(Trk__Navigator(name=name, **kwargs))

    return result
Example #8
0
def TrackingGeoCfg(inputFlags):
    result = ComponentAccumulator()

    from AtlasGeoModel.InDetGMConfig import InDetGeometryCfg
    result.merge(InDetGeometryCfg(inputFlags))

    # Something builds muon stations -- extrapolator?
    from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
    result.merge(MuonGeoModelCfg(inputFlags))

    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    result.merge(TrackingGeometrySvcCfg(inputFlags))

    from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg
    result.merge(MagneticFieldSvcCfg(inputFlags))

    return result
Example #9
0
def MuonCombinedTrackFitterCfg(flags, name="MuonCombinedTrackFitter", **kwargs ):
    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    from MuonConfig.MuonRecToolsConfig import MuonNavigatorCfg
    from MuonConfig.MuonRIO_OnTrackCreatorConfig import MuonRotCreatorCfg

    result = AtlasExtrapolatorCfg(flags)
    kwargs.setdefault("ExtrapolationTool", result.getPrimary() )
    
    acc = MuonNavigatorCfg(flags)
    kwargs.setdefault("NavigatorTool", acc.popPrivateTools())
    result.merge(acc)

    acc = MuonCombinedPropagatorCfg(flags)
    kwargs.setdefault("PropagatorTool"        , acc.popPrivateTools() )
    result.merge(acc)

    acc = MuonRotCreatorCfg(flags)
    kwargs.setdefault("RotCreatorTool"        , acc.popPrivateTools() )
    result.merge(acc)

    kwargs.setdefault("MeasurementUpdateTool" , CompFactory.Trk.KalmanUpdator() ) 
    #FIXME? Shouldn't this be configured? Was MuonMeasUpdator

    acc  = TrackingGeometrySvcCfg(flags)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary() )
    result.merge(acc)
    kwargs.setdefault("ExtrapolatorMaterial"  , True )
    acc = MuidMaterialEffectsOnTrackProviderCfg(flags)
    kwargs.setdefault("MuidTool"              , acc.getPrimary() )
    result.merge(acc)
    kwargs.setdefault("MuidToolParam"         , None )
    if flags.Beam.Type =='collisions':
        acc = MuidMaterialEffectsOnTrackProviderParamCfg(flags)
        kwargs.setdefault("MuidToolParam"     , acc.getPrimary() )
        result.merge(acc)
    kwargs.setdefault("MuidMat"               , True )
    kwargs.setdefault("StraightLine"          , flags.Beam.Type == "cosmics" ) 
    # ^ Was: not jobproperties.BField.solenoidOn() and not jobproperties.BField.allToroidOn()
    kwargs.setdefault("MaxIterations"         , 50 )
    kwargs.setdefault("GetMaterialFromTrack"  , flags.Beam.Type != "cosmics" )
    # ^ Was: jobproperties.BField.solenoidOn() and jobproperties.BField.allToroidOn()
    kwargs.setdefault("RecalculateDerivatives", False)
    kwargs.setdefault("UseCaloTG"             , True) #
    tool = CompFactory.Trk.GlobalChi2Fitter(name,**kwargs)
    result.setPrivateTools(tool)
    return result
Example #10
0
def PrepareStandAloneBTagCfg(inputFlags):
    result = ComponentAccumulator()

    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
    result.merge(PoolReadCfg(inputFlags))

    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    acc = TrackingGeometrySvcCfg(inputFlags)
    result.merge(acc)

    from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
    result.merge(MuonGeoModelCfg(inputFlags))

    GeometryDBSvc = CompFactory.GeometryDBSvc
    result.addService(GeometryDBSvc("InDetGeometryDBSvc"))

    from PixelGeoModel.PixelGeoModelConfig import PixelGeometryCfg
    result.merge(PixelGeometryCfg(inputFlags))

    # get standard config for magnetic field - map and cache
    from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg
    result.merge(MagneticFieldSvcCfg(inputFlags))

    from IOVDbSvc.IOVDbSvcConfig import addFolders, addFoldersSplitOnline

    #load folders needed for Run2 ID alignment
    result.merge(
        addFoldersSplitOnline(inputFlags,
                              "INDET",
                              "/Indet/Onl/Align",
                              "/Indet/Align",
                              className="AlignableTransformContainer"))
    result.merge(addFolders(inputFlags, ['/TRT/Align'], 'TRT_OFL'))

    #load folders needed for IBL
    result.merge(addFolders(inputFlags, ['/Indet/IBLDist'], 'INDET_OFL'))

    return result
Example #11
0
def MuonTrackSummaryHelperToolCfg(flags,
                                  name="MuonTrackSummaryHelperTool",
                                  **kwargs):

    result = ComponentAccumulator()
    acc = TrackingGeometrySvcCfg(flags)

    result.merge(acc)

    acc = MuonExtrapolatorCfg(flags)
    extrap = acc.getPrimary()
    acc.addPublicTool(extrap)
    result.merge(acc)
    kwargs.setdefault("Extrapolator", extrap)

    kwargs.setdefault("CalculateCloseHits", True)

    Muon__MuonTrackSummaryHelperTool = CompFactory.Muon.MuonTrackSummaryHelperTool
    result.setPrivateTools(
        Muon__MuonTrackSummaryHelperTool(name=name, **kwargs))
    return result
Example #12
0
def TrackSummaryToolWorkaround(flags):
    from AthenaConfiguration.ComponentFactory import CompFactory
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()
    ############################## WORKAROUND (START) ##########################
    ############################## TO RUN TRACKSUMMARYTOOL #####################

    # Taken from InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfigNew.py
    from PixelConditionsAlgorithms.PixelConditionsConfig import PixelConfigCondAlgCfg
    result.merge(
        PixelConfigCondAlgCfg(flags,
                              UseCalibConditions=True,
                              UseDeadmapConditions=True,
                              UseDCSStateConditions=False,
                              UseDCSStatusConditions=False,
                              UseDCSHVConditions=True,
                              UseDCSTemperatureConditions=True,
                              UseTDAQConditions=False))

    from PixelConditionsTools.PixelConditionsSummaryConfig import PixelConditionsSummaryCfg
    InDetPixelConditionsSummaryTool = result.popToolsAndMerge(
        PixelConditionsSummaryCfg(flags))

    # Taken from Tracking/TrkConfig/python/AtlasExtrapolatorConfig.py
    # AtlasExtrapolatorConfig can give only private extrapolator. We need public extrapolator.
    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    trackGeomCfg = TrackingGeometrySvcCfg(flags)
    geom_svc = trackGeomCfg.getPrimary()
    geom_svc.GeometryBuilder.Compactify = False  ######## To avoid crash ########
    result.merge(trackGeomCfg)
    from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg
    result.merge(MagneticFieldSvcCfg(flags))
    AtlasNavigator = CompFactory.Trk.Navigator(name='AtlasNavigator')
    AtlasNavigator.TrackingGeometrySvc = geom_svc
    result.addPublicTool(AtlasNavigator)

    # Taken from InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py
    InDetPropagator = CompFactory.Trk.RungeKuttaPropagator(
        name='InDetPropagator')
    InDetPropagator.AccuracyParameter = 0.0001
    InDetPropagator.MaxStraightLineStep = .004
    result.addPublicTool(InDetPropagator)
    InDetMaterialUpdator = CompFactory.Trk.MaterialEffectsUpdator(
        name="InDetMaterialEffectsUpdator")
    result.addPublicTool(InDetMaterialUpdator)
    InDetSubPropagators = []
    InDetSubUpdators = []
    # -------------------- set it depending on the geometry ----------------------------------------------------
    # default for ID is (Rk,Mat)
    InDetSubPropagators += [InDetPropagator.name]
    InDetSubUpdators += [InDetMaterialUpdator.name]
    # default for Calo is (Rk,MatLandau)
    InDetSubPropagators += [InDetPropagator.name]
    InDetSubUpdators += [InDetMaterialUpdator.name]
    # default for MS is (STEP,Mat)
    #InDetSubPropagators += [ InDetStepPropagator.name ]
    InDetSubUpdators += [InDetMaterialUpdator.name]
    #from TrkExTools.TrkExToolsConf import Trk__Extrapolator
    InDetExtrapolator = CompFactory.Trk.Extrapolator(
        name='InDetExtrapolator',
        Propagators=[InDetPropagator],
        MaterialEffectsUpdators=[InDetMaterialUpdator],
        Navigator=AtlasNavigator,
        SubPropagators=InDetSubPropagators,
        SubMEUpdators=InDetSubUpdators)
    result.addPublicTool(InDetExtrapolator)
    InDetTestPixelLayerTool = CompFactory.InDet.InDetTestPixelLayerTool(
        name="InDetTestPixelLayerTool",
        PixelSummaryTool=InDetPixelConditionsSummaryTool,
        CheckActiveAreas=True,
        CheckDeadRegions=True,
        CheckDisabledFEs=True)
    result.addPublicTool(InDetTestPixelLayerTool)
    InDetBoundaryCheckTool = CompFactory.InDet.InDetBoundaryCheckTool(
        name="InDetBoundaryCheckTool",
        UsePixel=flags.Detector.GeometryPixel,
        UseSCT=flags.Detector.GeometrySCT,
        PixelLayerTool=InDetTestPixelLayerTool)
    result.addPublicTool(InDetBoundaryCheckTool)
    InDetHoleSearchTool = CompFactory.InDet.InDetTrackHoleSearchTool(
        name="InDetHoleSearchTool",
        Extrapolator=InDetExtrapolator,
        CountDeadModulesAfterLastHit=True,
        BoundaryCheckTool=InDetBoundaryCheckTool)
    result.addPublicTool(InDetHoleSearchTool)
    InDetPrdAssociationTool = CompFactory.InDet.InDetPRD_AssociationToolGangedPixels(
        name="InDetPrdAssociationTool",
        PixelClusterAmbiguitiesMapName="PixelClusterAmbiguitiesMap",
        SetupCorrect=True,
        addTRToutliers=True)
    result.addPublicTool(InDetPrdAssociationTool)
    InDetTrackSummaryHelperTool = CompFactory.InDet.InDetTrackSummaryHelperTool(
        name="InDetSummaryHelper",
        AssoTool=InDetPrdAssociationTool,
        PixelToTPIDTool=None,
        TestBLayerTool=None,
        RunningTIDE_Ambi=True,
        DoSharedHits=False,
        HoleSearch=InDetHoleSearchTool,
        usePixel=flags.Detector.GeometryPixel,
        useSCT=flags.Detector.GeometrySCT,
        useTRT=flags.Detector.GeometryTRT)
    InDetTrackSummaryTool = CompFactory.Trk.TrackSummaryTool(
        name="InDetTrackSummaryTool",
        InDetSummaryHelperTool=InDetTrackSummaryHelperTool,
        doSharedHits=False,
        doHolesInDet=True,
        TRT_ElectronPidTool=None,
        TRT_ToT_dEdxTool=None,
        PixelToTPIDTool=None)
    result.setPrivateTools(InDetTrackSummaryTool)
    ############################## WORKAROUND (END) ############################

    # To run job only with ID
    if hasattr(flags, "Detector") and hasattr(
            flags.Detector, "GeometryMuon") and hasattr(
                flags.Detector, "GeometryID"):
        TrkEventCnvSuperTool = CompFactory.Trk.EventCnvSuperTool(
            name="EventCnvSuperTool",
            DoMuons=flags.Detector.GeometryMuon,
            DoID=flags.Detector.GeometryID)
        result.addPublicTool(TrkEventCnvSuperTool)

    return result
Example #13
0
def AtlasExtrapolatorCfg(flags, name='AtlasExtrapolator'):
    result = ComponentAccumulator()

    acc = MagneticFieldSvcCfg(flags)
    result.merge(acc)

    # get the correct TrackingGeometry setup
    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    acc = TrackingGeometrySvcCfg(flags)
    geom_svc = acc.getPrimary()
    result.merge(acc)

    # PROPAGATOR DEFAULTS --------------------------------------------------------------------------------------

    AtlasPropagators = []

    RkPropagator = CompFactory.Trk.RungeKuttaPropagator
    AtlasRungeKuttaPropagator = RkPropagator(name='AtlasRungeKuttaPropagator')
    result.addPublicTool(AtlasRungeKuttaPropagator)  #TODO remove one day

    AtlasPropagators += [AtlasRungeKuttaPropagator]

    STEP_Propagator = CompFactory.Trk.STEP_Propagator
    AtlasSTEP_Propagator = STEP_Propagator(name='AtlasSTEP_Propagator')
    result.addPublicTool(AtlasSTEP_Propagator)  #TODO remove one day

    AtlasPropagators += [AtlasSTEP_Propagator]

    # UPDATOR DEFAULTS -----------------------------------------------------------------------------------------

    AtlasUpdators = []

    MaterialEffectsUpdator = CompFactory.Trk.MaterialEffectsUpdator
    AtlasMaterialEffectsUpdator = MaterialEffectsUpdator(
        name='AtlasMaterialEffectsUpdator')
    result.addPublicTool(AtlasMaterialEffectsUpdator)  #TODO remove one day

    AtlasUpdators += [AtlasMaterialEffectsUpdator]

    AtlasMaterialEffectsUpdatorLandau = MaterialEffectsUpdator(
        name='AtlasMaterialEffectsUpdatorLandau')
    AtlasMaterialEffectsUpdatorLandau.LandauMode = True
    result.addPublicTool(
        AtlasMaterialEffectsUpdatorLandau)  #TODO remove one day

    AtlasUpdators += [AtlasMaterialEffectsUpdatorLandau]

    # the UNIQUE NAVIGATOR ( === UNIQUE GEOMETRY) --------------------------------------------------------------
    Trk__Navigator = CompFactory.Trk.Navigator
    AtlasNavigator = Trk__Navigator(name='AtlasNavigator')
    AtlasNavigator.TrackingGeometrySvc = geom_svc
    result.addPublicTool(AtlasNavigator)  #TODO remove one day

    # CONFIGURE PROPAGATORS/UPDATORS ACCORDING TO GEOMETRY SIGNATURE

    AtlasSubPropagators = []
    AtlasSubUpdators = []

    # -------------------- set it depending on the geometry ----------------------------------------------------
    # default for Global is (Rk,Mat)
    AtlasSubPropagators += [AtlasRungeKuttaPropagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # default for ID is (Rk,Mat)
    AtlasSubPropagators += [AtlasRungeKuttaPropagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # default for BeamPipe is (STEP,Mat)
    AtlasSubPropagators += [AtlasSTEP_Propagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # default for Calo is (STEP,Mat)
    AtlasSubPropagators += [AtlasSTEP_Propagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # default for MS is (STEP,Mat)
    AtlasSubPropagators += [AtlasSTEP_Propagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # default for Cavern is (Rk,Mat)
    AtlasSubPropagators += [AtlasRungeKuttaPropagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # ----------------------------------------------------------------------------------------------------------

    # call the base class constructor
    Extrapolator = Trk__Extrapolator(name,\
                               Navigator = AtlasNavigator,\
                               MaterialEffectsUpdators = AtlasUpdators,\
                               Propagators = AtlasPropagators,\
                               SubPropagators = AtlasSubPropagators,\
                               SubMEUpdators = AtlasSubUpdators
                               )

    result.setPrivateTools(Extrapolator)

    return result
Example #14
0
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaCommon import Logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory

if __name__=="__main__":
    # Setting needed for the ComponentAccumulator to do its thing
    from AthenaCommon.Configurable import Configurable
    Configurable.configurableRun3Behavior=True
    
    # Set message levels
    from AthenaCommon import Constants
    msgLvl = "WARNING"
    from AthenaCommon.Logging import log
    log.setLevel(msgLvl)
    
    # Config flags steer the job at various levels
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    ConfigFlags.Input.isMC  = True
    ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/ASG/mc16_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.AOD.e5458_s3126_r9364_r9315/AOD.11182705._000001.pool.root.1"]
    
    # Flags relating to multithreaded execution
    nthreads=0
    ConfigFlags.Concurrency.NumThreads =nthreads
    if nthreads>0:
    	ConfigFlags.Concurrency.NumThreads = 1
    	ConfigFlags.Concurrency.NumConcurrentEvents = 1
    ConfigFlags.MET.UseTracks = True
    ConfigFlags.MET.DoPFlow = True
    if ConfigFlags.Beam.Type == 'cosmics' or ConfigFlags.Beam.Type == 'singlebeam':# used to have " or not rec.doInDet()" on the end
Example #15
0
def fatrasMaterialUpdatorCfg(flags,
                             name="ISF_FatrasMaterialUpdator",
                             **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)

    # Geometry Svc
    acc = TrackingGeometrySvcCfg(flags)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary())
    result.merge(acc)

    # hadronic interactions
    kwargs.setdefault("HadronicInteraction", True)
    acc = fatrasG4HadIntProcessorCfg(flags)
    g4had_proc_cfg = acc.getPublicTool('ISF_FatrasG4HadIntProcessor')
    kwargs.setdefault("HadronicInteractionProcessor", g4had_proc_cfg)
    result.merge(acc)

    # energy loss
    kwargs.setdefault("EnergyLoss", True)
    acc = fatrasEnergyLossUpdatorCfg(flags)
    eloss_updator = acc.getPublicTool('ISF_FatrasEnergyLossUpdator')
    kwargs.setdefault("EnergyLossUpdator", eloss_updator)
    result.merge(acc)

    # mutiple scattering
    kwargs.setdefault("MultipleScattering", True)
    acc = fatrasMultipleScatteringUpdatorCfg(flags)
    multi_scattering_updator = acc.getPublicTool(
        'ISF_FatrasMultipleScatteringUpdator')
    kwargs.setdefault("MultipleScatteringUpdator", multi_scattering_updator)
    result.merge(acc)

    # photon conversion
    acc = fatrasConversionCreatorCfg(flags)
    ph_conv_cfg = acc.getPublicTool('ISF_FatrasConversionCreator')
    result.merge(acc)
    kwargs.setdefault("PhotonConversionTool", ph_conv_cfg)

    # the validation output
    kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)
    kwargs.setdefault("BremPhotonValidation", False)
    kwargs.setdefault("EnergyDepositValidation", False)

    kwargs.setdefault("MomentumCut", flags.Sim.Fatras.MomCutOffSec)
    kwargs.setdefault("MinimumBremPhotonMomentum",
                      flags.Sim.Fatras.MomCutOffSec)

    acc = fatrasPhysicsValidationToolCfg(flags)
    phys_val_cfg = acc.getPublicTool('ISF_FatrasPhysicsValidationTool')
    result.merge(acc)
    kwargs.setdefault("PhysicsValidationTool", phys_val_cfg)

    acc = fatrasProcessSamplingToolCfg(flags)
    proc_samp_cfg = acc.getPublicTool('ISF_FatrasProcessSamplingTool')
    result.merge(acc)
    kwargs.setdefault("ProcessSamplingTool", proc_samp_cfg)

    acc = fatrasParticleDecayHelperCfg(flags)
    pdhelper_cfg = acc.getPublicTool('ISF_FatrasParticleDecayHelper')
    result.merge(acc)
    kwargs.setdefault("ParticleDecayHelper", pdhelper_cfg)

    # MCTruth Process Code
    kwargs.setdefault("BremProcessCode",
                      3)  # TODO: to be taken from central definition
    acc = TrackingGeometrySvcCfg(flags)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary())
    result.merge(acc)

    iFatras__McMaterialEffectsUpdator = CompFactory.iFatras.McMaterialEffectsUpdator
    result.addPublicTool(iFatras__McMaterialEffectsUpdator(name=name,
                                                           **kwargs))

    return result
Example #16
0
def PFCfg(inputFlags, **kwargs):

    #This is monolithic for now.
    #Once a first complete example runs, this will be split into small modular chunks.
    #Some such items may be best placed elsewehere (e.g. put magnetic field setup in magnetic field git folder etc)
    result = ComponentAccumulator()

    StoreGateSvc = CompFactory.StoreGateSvc
    result.addService(StoreGateSvc("DetectorStore"))

    #Alias calibrated topoclusters, if they exist already, such that overwrite won't fial
    from SGComps.AddressRemappingConfig import InputRenameCfg
    result.merge(
        InputRenameCfg("xAOD::CaloClusterContainer", "CaloCalTopoClusters",
                       ""))

    #Setup up general geometry
    from AtlasGeoModel.InDetGMConfig import InDetGeometryCfg
    result.merge(InDetGeometryCfg(inputFlags))

    #Setup TRT conditions
    TRTAlignCondAlg = CompFactory.TRTAlignCondAlg
    result.addCondAlgo(
        TRTAlignCondAlg(name="TRTAlignCondAlg",
                        UseDynamicFolders=inputFlags.GeoModel.Align.Dynamic))

    #Setup Pixel conditions
    PixelAlignCondAlg = CompFactory.PixelAlignCondAlg
    result.addCondAlgo(
        PixelAlignCondAlg(
            name="PixelAlignCondAlg",
            UseDynamicAlignFolders=inputFlags.GeoModel.Align.Dynamic))

    PixelDetectorElementCondAlg = CompFactory.PixelDetectorElementCondAlg
    result.addCondAlgo(
        PixelDetectorElementCondAlg(name="PixelDetectorElementCondAlg"))

    #Setup SCT conditions
    SCT_AlignCondAlg = CompFactory.SCT_AlignCondAlg
    result.addCondAlgo(
        SCT_AlignCondAlg(
            name="SCT_AlignCondAlg",
            UseDynamicAlignFolders=inputFlags.GeoModel.Align.Dynamic))

    SCT_DetectorElementCondAlg = CompFactory.SCT_DetectorElementCondAlg
    result.addCondAlgo(
        SCT_DetectorElementCondAlg(name="SCT_DetectorElementCondAlg"))

    GeometryDBSvc = CompFactory.GeometryDBSvc
    result.addService(GeometryDBSvc("InDetGeometryDBSvc"))

    #from AthenaCommon import CfgGetter
    #result.getService("GeoModelSvc").DetectorTools += [ CfgGetter.getPrivateTool("PixelDetectorTool", checkType=True) ]
    #result.getService("GeoModelSvc").DetectorTools += [ CfgGetter.getPrivateTool("SCT_DetectorTool", checkType=True) ]

    #Setup TRT geometry
    TRT_DetectorTool = CompFactory.TRT_DetectorTool
    trtDetectorTool = TRT_DetectorTool()
    #These two lines fix ATLASRECTS-5053. I expect eventually we can remove them, once the underlying issue is fixed.
    trtDetectorTool.DoXenonArgonMixture = False
    trtDetectorTool.DoKryptonMixture = False
    result.getService("GeoModelSvc").DetectorTools += [trtDetectorTool]

    #Setup up material for inner detector
    InDetServMatTool = CompFactory.InDetServMatTool
    result.getService("GeoModelSvc").DetectorTools += [InDetServMatTool()]

    #Setup up tracking geometry
    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    acc = TrackingGeometrySvcCfg(inputFlags)
    result.merge(acc)

    #load folders needed for Run2 ID alignment
    from IOVDbSvc.IOVDbSvcConfig import addFolders
    result.merge(addFolders(inputFlags, ['/TRT/Align'], 'TRT_OFL'))

    #Setup up muon geometry
    from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
    result.merge(MuonGeoModelCfg(inputFlags))

    #setup magnetic field service
    from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg
    result.merge(MagneticFieldSvcCfg(inputFlags))

    #hard-code MC conditions tag needed for my ESD file - must be a better way? how to auto-configure?
    iovDbSvc = result.getService("IOVDbSvc")
    iovDbSvc.GlobalTag = "OFLCOND-MC16-SDR-20"

    #Configure topocluster algorithmsm, and associated conditions
    from CaloRec.CaloTopoClusterConfig import CaloTopoClusterCfg
    result.merge(CaloTopoClusterCfg(inputFlags, doLCCalib=True))

    from CaloRec.CaloTopoClusterConfig import caloTopoCoolFolderCfg
    result.merge(caloTopoCoolFolderCfg(inputFlags))

    from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
    result.merge(CaloNoiseCondAlgCfg(inputFlags, "totalNoise"))
    result.merge(CaloNoiseCondAlgCfg(inputFlags, "electronicNoise"))

    #Cache the track extrapolations
    from TrackToCalo.CaloExtensionBuilderAlgCfg import getCaloExtenstionBuilderAlgorithm
    result.addEventAlgo(getCaloExtenstionBuilderAlgorithm(inputFlags))

    #Configure the pflow algorithms
    PFLeptonSelector = CompFactory.PFLeptonSelector
    result.addEventAlgo(PFLeptonSelector("PFLeptonSelector"))

    from eflowRec.PFCfg import getPFTrackSelectorAlgorithm
    result.addEventAlgo(
        getPFTrackSelectorAlgorithm(inputFlags, "PFTrackSelector"))

    result.addEventAlgo(getOfflinePFAlgorithm(inputFlags))

    from eflowRec.PFCfg import getChargedPFOCreatorAlgorithm, getNeutralPFOCreatorAlgorithm
    result.addEventAlgo(getChargedPFOCreatorAlgorithm(inputFlags, ""))
    result.addEventAlgo(getNeutralPFOCreatorAlgorithm(inputFlags, ""))

    return result
Example #17
0
def MuonCombinedReconstructionCfg(flags):
    result = ComponentAccumulator()

    from AtlasGeoModel.GeoModelConfig import GeoModelCfg
    result.merge(GeoModelCfg(flags))

    from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
    result.merge(MuonGeoModelCfg(flags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    result.merge(LArGMCfg(flags))

    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(TileGMCfg(flags))

    from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg
    result.merge(BeamPipeGeometryCfg(flags))

    from PixelGeoModel.PixelGeoModelConfig import PixelGeometryCfg
    result.merge(PixelGeometryCfg(flags))

    from SCT_GeoModel.SCT_GeoModelConfig import SCT_GeometryCfg
    result.merge(SCT_GeometryCfg(flags))

    from TRT_GeoModel.TRT_GeoModelConfig import TRT_GeometryCfg
    result.merge(TRT_GeometryCfg(flags))

    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    result.merge(TrackingGeometrySvcCfg(flags))

    muon_edm_helper_svc = CompFactory.Muon.MuonEDMHelperSvc("MuonEDMHelperSvc")
    result.addService(muon_edm_helper_svc)

    # Set up to read Tracks.
    from TrkConfig.TrackCollectionReadConfig import TrackCollectionReadCfg
    result.merge(TrackCollectionReadCfg(flags, 'Tracks'))

    result.merge(MuonCombinedInDetCandidateAlg(flags))
    result.merge(MuonCombinedMuonCandidateAlgCfg(flags))

    if flags.MuonCombined.doStatisticalCombination or flags.MuonCombined.doCombinedFit:
        result.merge(MuonCombinedAlgCfg(flags))

    if flags.MuonCombined.doMuGirl:
        result.merge(
            MuonInsideOutRecoAlgCfg(flags, name="MuonInsideOutRecoAlg"))
        if flags.MuonCombined.doMuGirlLowBeta:
            result.merge(MuGirlStauAlgCfg)

    if flags.MuonCombined.doCaloTrkMuId:
        result.merge(MuonCaloTagAlgCfg(flags))

    if flags.MuonCombined.doMuonSegmentTagger:
        result.merge(MuonSegmentTagAlgCfg(flags))

    # runs over outputs and create xAODMuon collection
    acc = MuonCreatorAlgCfg(flags)
    result.merge(acc)

    if flags.MuonCombined.doMuGirl and flags.MuonCombined.doMuGirlLowBeta:
        # Has to be at end if not using sequencer. If we drop this requirement, can be moved above
        result.merge(StauCreatorAlgCfg(flags))

    return result
Example #18
0
def generateChains( flags, chainDict ):
    chainDict = splitChainDict(chainDict)[0]
    
    # Step 1 (L2MuonSA)
    stepName = getChainStepName('Muon', 1)
    stepReco, stepView = createStepView(stepName)

    acc = ComponentAccumulator()
    acc.addSequence(stepView)

    # Set EventViews for L2MuonSA step
    from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import InViewReco
    reco = InViewReco("L2MuFastReco")

    #external data loading to view
    reco.mergeReco( MuFastViewDataVerifier() )


    # decoding
    # Get RPC BS decoder 
    from MuonConfig.MuonBytestreamDecodeConfig import RpcBytestreamDecodeCfg
    rpcAcc = RpcBytestreamDecodeCfg( flags, forTrigger=True )
    rpcAcc.getEventAlgo("RpcRawDataProvider").RoIs = reco.name+"RoIs"
    reco.mergeReco( rpcAcc )

    # Get RPC BS->RDO convertor
    from MuonConfig.MuonRdoDecodeConfig import RpcRDODecodeCfg    
    rpcAcc = RpcRDODecodeCfg( flags, forTrigger=True )
    rpcAcc.getEventAlgo("RpcRdoToRpcPrepData").RoIs = reco.name+"RoIs"
    reco.mergeReco( rpcAcc )

    # Get TGC BS decoder 
    from MuonConfig.MuonBytestreamDecodeConfig import TgcBytestreamDecodeCfg
    tgcAcc = TgcBytestreamDecodeCfg( flags, forTrigger=True )
    tgcAcc.getEventAlgo("TgcRawDataProvider").RoIs = reco.name+"RoIs"
    reco.mergeReco( tgcAcc )

    # Get TGC BS->RDO convertor
    from MuonConfig.MuonRdoDecodeConfig import TgcRDODecodeCfg    
    tgcAcc = TgcRDODecodeCfg( flags, forTrigger=True )
    tgcAcc.getEventAlgo("TgcRdoToTgcPrepData").RoIs = reco.name+"RoIs"
    reco.mergeReco( tgcAcc )

    # Get MDT BS decoder 
    from MuonConfig.MuonBytestreamDecodeConfig import MdtBytestreamDecodeCfg
    mdtAcc = MdtBytestreamDecodeCfg( flags, forTrigger=True )
    mdtAcc.getEventAlgo("MdtRawDataProvider").RoIs = reco.name+"RoIs"
    reco.mergeReco( mdtAcc )

    # Get MDT BS->RDO convertor
    from MuonConfig.MuonRdoDecodeConfig import MdtRDODecodeCfg    
    mdtAcc = MdtRDODecodeCfg( flags, forTrigger=True )
    mdtAcc.getEventAlgo("MdtRdoToMdtPrepData").RoIs = reco.name+"RoIs"
    reco.mergeReco( mdtAcc )

    # Get CSC BS decoder 
    from MuonConfig.MuonBytestreamDecodeConfig import CscBytestreamDecodeCfg
    cscAcc = CscBytestreamDecodeCfg( flags, forTrigger=True )
    cscAcc.getEventAlgo("CscRawDataProvider").RoIs = reco.name+"RoIs"
    reco.mergeReco( cscAcc )

    # Get CSC BS->RDO convertor
    from MuonConfig.MuonRdoDecodeConfig import CscRDODecodeCfg    
    cscAcc = CscRDODecodeCfg( flags, forTrigger=True )
    cscAcc.getEventAlgo("CscRdoToCscPrepData").RoIs = reco.name+"RoIs"
    reco.mergeReco( cscAcc )

    # Get CSC cluster builder
    from MuonConfig.MuonRdoDecodeConfig import CscClusterBuildCfg
    cscAcc = CscClusterBuildCfg( flags, forTrigger=True )
    reco.mergeReco( cscAcc )



    # Get Reco alg of muFast Step in order to set into the view
    algAcc, alg = l2MuFastAlgCfg( flags, roisKey=reco.name+"RoIs")

    l2MuFastAlgAcc = ComponentAccumulator()
    l2MuFastAlgAcc.addEventAlgo(alg)
    
    reco.mergeReco( l2MuFastAlgAcc )
    reco.merge( algAcc )
    #    l2muFastReco = l2MuFastRecoCfg(flags)
    acc.merge( reco, sequenceName=stepReco.getName() )

    ### Set muon step1 ###
    l2muFastHypo = l2MuFastHypoCfg( flags,
                                    name = 'TrigL2MuFastHypo',
                                    muFastInfo = 'MuonL2SAInfo' )

    acc.addEventAlgo(l2muFastHypo, sequenceName=stepView.getName())

    l2muFastSequence = CAMenuSequence( Sequence = reco.sequence(),
                                     Maker = reco.inputMaker(),
                                     Hypo = l2muFastHypo,
                                     HypoToolGen = TrigMufastHypoToolFromDict,
                                     CA = acc )

    l2muFastStep = ChainStep( name=stepName, Sequences=[l2muFastSequence], chainDicts=[chainDict] )

    ### Set muon step2 ###
    # Please set up L2muComb step here

    #EF MS only
    stepEFMSName = getChainStepName('EFMSMuon', 2)
    stepEFMSReco, stepEFMSView = createStepView(stepEFMSName)

    #Clone and replace offline flags so we can set muon trigger specific values
    muonflags = flags.cloneAndReplace('Muon', 'Trigger.Offline.Muon')
    muonflags.Muon.useTGCPriorNextBC=True
    muonflags.Muon.enableErrorTuning=False
    muonflags.Muon.MuonTrigger=True
    muonflags.Muon.SAMuonTrigger=True
    muonflags.lock()

    accMS = ComponentAccumulator()
    accMS.addSequence(stepEFMSView)

    from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import InViewReco
    recoMS = InViewReco("EFMuMSReco")
    recoMS.inputMaker().RequireParentView = True
    
    #Probably this block will eventually need to move somewhere more central
    from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg
    accMS.merge( BeamPipeGeometryCfg(flags) ) 
    
    from PixelGeoModel.PixelGeoModelConfig import PixelGeometryCfg
    accMS.merge(PixelGeometryCfg(flags))
    
    from SCT_GeoModel.SCT_GeoModelConfig import SCT_GeometryCfg
    accMS.merge(SCT_GeometryCfg(flags))
    
    from TRT_GeoModel.TRT_GeoModelConfig import TRT_GeometryCfg
    accMS.merge(TRT_GeometryCfg(flags))
    
    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    accMS.merge(TrackingGeometrySvcCfg(flags))
    ###################
    
    EFMuonViewDataVerifier = EFMuonViewDataVerifierCfg()
    recoMS.mergeReco(EFMuonViewDataVerifier)

    from MuonConfig.MuonSegmentFindingConfig import MooSegmentFinderAlgCfg
    segCfg = MooSegmentFinderAlgCfg(muonflags,name="TrigMooSegmentFinder",UseTGCNextBC=False, UseTGCPriorBC=False)
    recoMS.mergeReco(segCfg)

    from MuonConfig.MuonTrackBuildingConfig import MuonTrackBuildingCfg
    trkCfg = MuonTrackBuildingCfg(muonflags, name="TrigMuPatTrackBuilder")
    recoMS.mergeReco(trkCfg)

    cnvCfg = MuonTrackParticleCnvCfg(muonflags, name = "TrigMuonTrackParticleCnvAlg")
    recoMS.mergeReco(cnvCfg)

    from MuonCombinedConfig.MuonCombinedReconstructionConfig import MuonCombinedMuonCandidateAlgCfg
    candCfg = MuonCombinedMuonCandidateAlgCfg(muonflags, name = "TrigMuonCandidateAlg")
    recoMS.mergeReco(candCfg)

    from MuonCombinedConfig.MuonCombinedReconstructionConfig import MuonCreatorAlgCfg
    creatorCfg = MuonCreatorAlgCfg(muonflags, name = "TrigMuonCreatorAlg")
    recoMS.mergeReco(creatorCfg)

    accMS.merge(recoMS, sequenceName=stepEFMSReco.getName())

    efmuMSHypo = efMuMSHypoCfg( muonflags,
                                name = 'TrigMuonEFMSonlyHypo',
                                inputMuons = "Muons" )

    accMS.addEventAlgo(efmuMSHypo, sequenceName=stepEFMSView.getName())

    efmuMSSequence = CAMenuSequence( Sequence = recoMS.sequence(),
                                     Maker = recoMS.inputMaker(),
                                     Hypo = efmuMSHypo, 
                                     HypoToolGen = TrigMuonEFMSonlyHypoToolFromDict,
                                     CA = accMS )

    efmuMSStep = ChainStep( name=stepEFMSName, Sequences=[efmuMSSequence], chainDicts=[chainDict] )

    l1Thresholds=[]
    for part in chainDict['chainParts']:
        l1Thresholds.append(part['L1threshold'])
    
    log.debug('dictionary is: %s\n', pprint.pformat(chainDict))


    chain = Chain( name=chainDict['chainName'], L1Thresholds=l1Thresholds, ChainSteps=[ l2muFastStep, efmuMSStep ] )
    return chain