Exemple #1
0
def getPFTrackSelectorAlgorithm(inputFlags, algName, useCaching=True):
    PFTrackSelector = CompFactory.PFTrackSelector
    PFTrackSelector = PFTrackSelector(algName)

    from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg
    Trk__ParticleCaloExtensionTool = CompFactory.Trk.ParticleCaloExtensionTool
    extrapCfg = AtlasExtrapolatorCfg(inputFlags)
    pcExtensionTool = Trk__ParticleCaloExtensionTool(
        Extrapolator=extrapCfg.popPrivateTools())

    eflowTrackCaloExtensionTool = CompFactory.eflowTrackCaloExtensionTool
    TrackCaloExtensionTool = eflowTrackCaloExtensionTool(
        TrackCaloExtensionTool=pcExtensionTool)
    if False is useCaching:
        TrackCaloExtensionTool.PFParticleCache = ""

    PFTrackSelector.trackExtrapolatorTool = TrackCaloExtensionTool

    InDet__InDetTrackSelectionTool = CompFactory.InDet.InDetTrackSelectionTool
    TrackSelectionTool = InDet__InDetTrackSelectionTool("PFTrackSelectionTool")

    TrackSelectionTool.CutLevel = "TightPrimary"
    TrackSelectionTool.minPt = 500.0

    PFTrackSelector.trackSelectionTool = TrackSelectionTool

    return PFTrackSelector
Exemple #2
0
def ParticleCaloExtensionToolCfg(flags, **kwargs):
    acc = ComponentAccumulator()

    if "Extrapolator" not in kwargs:
        extrapAcc = AtlasExtrapolatorCfg(flags)
        kwargs["Extrapolator"] = extrapAcc.popPrivateTools()
        acc.merge(extrapAcc)

    caloExtensionTool = Trk__ParticleCaloExtensionTool(**kwargs)

    acc.setPrivateTools(caloExtensionTool)
    return acc
Exemple #3
0
def TrackDepositInCaloToolCfg(flags, name ='TrackDepositInCaloTool', **kwargs ):
    from TrackToCalo.TrackToCaloConfig import ParticleCaloExtensionToolCfg, ParticleCaloCellAssociationToolCfg
    result = ParticleCaloExtensionToolCfg(flags)
    kwargs.setdefault("ParticleCaloExtensionTool",       result.popPrivateTools() )
    acc = AtlasExtrapolatorCfg(flags)
    kwargs.setdefault("ExtrapolatorHandle", acc.popPrivateTools() )
    result.merge(acc)
    acc = ParticleCaloCellAssociationToolCfg(flags)
    kwargs.setdefault("ParticleCaloCellAssociationTool",       acc.popPrivateTools() )
    result.merge(acc)
    tool = CompFactory.TrackDepositInCaloTool(name, **kwargs )
    result.setPrivateTools(tool)
    return result
Exemple #4
0
def getCaloExtenstionBuilderAlgorithm(inputFlags, cutLevel = "TightPrimary", minPT = 100.0):
    from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg    
    Trk__ParticleCaloExtensionTool = CompFactory.Trk.ParticleCaloExtensionTool
    extrapPFlowCfg = AtlasExtrapolatorCfg(inputFlags)
    pcExtensionTool = Trk__ParticleCaloExtensionTool(Extrapolator = extrapPFlowCfg.popPrivateTools())
        
    CaloExtensionBuilderAlg = CompFactory.Trk.CaloExtensionBuilderAlg 
    CaloExtensionBuilderAlg = CaloExtensionBuilderAlg(LastCaloExtentionTool = pcExtensionTool)

    InDet__InDetTrackSelectionTool = CompFactory.InDet.InDetTrackSelectionTool    
    TrackSelectionToolHC = InDet__InDetTrackSelectionTool(name = "CaloExtensionBuilderTrackSelectionTool",minPt = minPT, CutLevel = cutLevel, minNSiHits = 7) # SiHits = PixelHits + SCTHits + PixelDeadSensors + SCTDeadSensors    
    CaloExtensionBuilderAlg.TrkSelection = TrackSelectionToolHC
     
    return CaloExtensionBuilderAlg
Exemple #5
0
    def __init__(self,suffix,inputFlags,buildconfigs=[],refconfigs=[],
                 doTracks=False,doSum=False,doRegions=False,
                 doCells=False,doTriggerMET=True,duplicateWarning=True,
                 doOriginCorrClus=False):
        print("{} Creating MET config {}".format(prefix,suffix))
        self.suffix = suffix
        self.doSum = doSum
        self.doTracks = doTracks
        self.doRegions = doRegions
        self.doCells = doCells,
        self.doOriginCorrClus = doOriginCorrClus
        self.doTriggerMET = doTriggerMET
        self.duplicateWarning = duplicateWarning
        #
        self.builders = {}
        self.buildlist = [] # need an ordered list
        #
        self.refiners = {}
        self.reflist = [] # need an ordered list
        #
        self.regions = {}
        self.reglist = [] # need an ordered list
        if doRegions:
            self.setupRegions(buildconfigs)
        #
        from AthenaConfiguration.ComponentFactory import CompFactory
        self.trkseltool=CompFactory.getComp("InDet::InDetTrackSelectionTool")("IDTrkSel_MET",
                                                              CutLevel="TightPrimary",
                                                              maxZ0SinTheta=3,
                                                              maxD0=2,
                                                              minPt=500)
        #
        self.trkvxtool=CompFactory.getComp("CP::TrackVertexAssociationTool")("TrackVertexAssociationTool_MET", WorkingPoint="Nominal")
        #
        self.trkisotool = CompFactory.getComp("xAOD::TrackIsolationTool")("TrackIsolationTool_MET")
        self.trkisotool.TrackSelectionTool = self.trkseltool # As configured above
        ###
        from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg
        extrapCfg = AtlasExtrapolatorCfg(inputFlags)
        CaloExtensionTool= CompFactory.getComp("Trk::ParticleCaloExtensionTool")(Extrapolator = extrapCfg.popPrivateTools())
        CaloCellAssocTool = CompFactory.getComp("Rec::ParticleCaloCellAssociationTool")(ParticleCaloExtensionTool = CaloExtensionTool)
        self.caloisotool = CompFactory.getComp("xAOD::CaloIsolationTool")("CaloIsolationTool_MET",
                                                          saveOnlyRequestedCorrections=True,
                                                          addCaloExtensionDecoration=False,
                                                          ParticleCaloExtensionTool = CaloExtensionTool,
                                                          ParticleCaloCellAssociationTool = CaloCellAssocTool)

        self.setupBuilders(buildconfigs)
        self.setupRefiners(refconfigs)
Exemple #6
0
def MuonCombinedInDetCandidateAlg(flags,
                                  name="MuonCombinedInDetCandidateAlg",
                                  **kwargs):
    # FIXME - need to have InDet flags set at this point to know if doForwardTracks is true.
    from MuonCombinedConfig.MuonCombinedRecToolsConfig import MuonCombinedInDetDetailedTrackSelectorToolCfg
    from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg

    result = MuonCombinedInDetDetailedTrackSelectorToolCfg(flags)
    kwargs.setdefault("TrackSelector", result.getPrimary())
    # if flags.MuonCombined.doSiAssocForwardMuons and flags.InDet.doForwardTracks: FIXME
    if flags.MuonCombined.doSiAssocForwardMuons:
        kwargs.setdefault("DoSiliconAssocForwardMuons", True)
        # From old config, addTool("MuonCombinedRecExample.MuonCombinedTools.MuonCombinedInDetDetailedTrackSelectorTool","MuonCombinedInDetDetailedForwardTrackSelectorTool", nHitSct=0)
        acc = MuonCombinedInDetDetailedTrackSelectorToolCfg(
            flags,
            "MuonCombinedInDetDetailedForwardTrackSelectorTool",
            nHitSct=0)
        kwargs.setdefault("InDetForwardTrackSelector", acc.getPrimary())
        result.merge(acc)

    acc = AtlasExtrapolatorCfg(flags)
    extrapolator = acc.getPrimary()
    result.merge(acc)

    muon_particle_extension_tool = CompFactory.Trk.ParticleCaloExtensionTool(
        Extrapolator=extrapolator)

    muon_ext_tool = CompFactory.Muon.MuonSystemExtensionTool(
        ParticleCaloExtensionTool=muon_particle_extension_tool,
        Extrapolator=extrapolator)
    kwargs.setdefault("MuonSystemExtensionTool", muon_ext_tool)
    alg = CompFactory.MuonCombinedInDetCandidateAlg(name, **kwargs)
    result.addEventAlgo(alg, primary=True)
    return result
Exemple #7
0
def InDetJetFitterUtilsCfg(flags,
                           name='InDetJFUtils',
                           useBTagFlagsDefaults=True,
                           options={}):
    """Sets up a InDetJetFitterUtils tool and returns it.

    The following options have BTaggingFlags defaults:

    input:             name: The name of the tool (should be unique).
          useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                  **options: Python dictionary with options for the tool.
    output: The actual tool."""
    acc = ComponentAccumulator()
    if useBTagFlagsDefaults:
        jetFitterFullLinearizedTrackFactory = acc.popToolsAndMerge(
            BTagFullLinearizedTrackFactoryCfg(flags,
                                              'JFFullLinearizedTrackFactory'))
        jetFitterExtrapolator = acc.popToolsAndMerge(
            AtlasExtrapolatorCfg(flags, 'JFExtrapolator'))
        defaults = {
            'LinearizedTrackFactory': jetFitterFullLinearizedTrackFactory,
            'Extrapolator': jetFitterExtrapolator
        }
        for option in defaults:
            options.setdefault(option, defaults[option])
    options['name'] = name
    acc.setPrivateTools(InDet__InDetJetFitterUtils(**options))

    return acc
Exemple #8
0
def BTagTrackToVertexIPEstimatorCfg(flags,
                                    name='TrkToVxIPEstimator',
                                    useBTagFlagsDefaults=True,
                                    **options):
    """Sets up a TrackToVertexIPEstimator tool and returns it.

    The following options have BTaggingFlags defaults:

    input:             name: The name of the tool (should be unique).
          useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                  **options: Python dictionary with options for the tool.
    output: The actual tool."""
    acc = ComponentAccumulator()
    if useBTagFlagsDefaults:
        btagFullLinearizedTrackFactory = acc.popToolsAndMerge(
            BTagFullLinearizedTrackFactoryCfg(flags,
                                              'FullLinearizedTrkFactory'))
        atlasExtrapolator = acc.popToolsAndMerge(
            AtlasExtrapolatorCfg(flags, 'AtlasExtrapolator'))
        defaults = {
            'Extrapolator': atlasExtrapolator,
            'LinearizedTrackFactory': btagFullLinearizedTrackFactory,
        }
        for option in defaults:
            options.setdefault(option, defaults[option])
    options['name'] = name
    acc.setPrivateTools(Trk__TrackToVertexIPEstimator(**options))

    return acc
Exemple #9
0
def MooCandidateMatchingToolCfg(flags,
                                name="MooCandidateMatchingTool",
                                doSegmentPhiMatching=True,
                                **kwargs):
    Muon__MooCandidateMatchingTool = CompFactory.Muon.MooCandidateMatchingTool
    from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg
    from MuonConfig.MuonRecToolsConfig import MuonExtrapolatorCfg

    result = ComponentAccumulator()

    # Won't explicitly configure MuonEDMHelperSvc
    kwargs.setdefault("MuonPrinterTool", MuonEDMPrinterTool(flags))

    acc = MuonExtrapolatorCfg(flags, name="MuonStraightLineExtrapolator")
    slextrap = acc.getPrimary()
    result.merge(acc)
    kwargs.setdefault("SLExtrapolator", slextrap)

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

    acc = MuonSegmentMatchingToolCfg(flags, doPhiMatching=doSegmentPhiMatching)
    muon_seg_matching = acc.getPrimary()
    result.merge(acc)
    kwargs.setdefault("SegmentMatchingTool", muon_seg_matching)

    acc = MuonSegmentMatchingToolCfg(flags,
                                     name="MuonSegmentMatchingToolTight",
                                     TightSegmentMatching=True,
                                     doPhiMatching=doSegmentPhiMatching)
    muon_seg_matching_tight = acc.getPrimary()
    result.merge(acc)
    kwargs.setdefault("SegmentMatchingToolTight", muon_seg_matching_tight)

    kwargs.setdefault("DoTrackSegmentMatching",
                      flags.Muon.useTrackSegmentMatching)
    kwargs.setdefault("RequireSameSide", flags.Beam.Type != 'collisions')
    if flags.Muon.useAlignmentCorrections:
        kwargs.setdefault("AlignmentErrorPosX", 5.0)
        kwargs.setdefault("AlignmentErrorPosY", 0.2)
        kwargs.setdefault("AlignmentErrorAngleX", 0.002)
        kwargs.setdefault("AlignmentErrorAngleY", 0.001)

    else:  # no alignment corrections
        kwargs.setdefault("AlignmentErrorPosX", 10.0)
        kwargs.setdefault("AlignmentErrorPosY", 5.0)
        kwargs.setdefault("AlignmentErrorAngleX", 0.004)
        kwargs.setdefault("AlignmentErrorAngleY", 0.002)

    acc = MuPatCandidateToolCfg(flags)
    cand_tool = acc.getPrimary()
    result.merge(acc)
    kwargs.setdefault("MuPatCandidateTool", cand_tool)

    moo_cand_matching_tool = Muon__MooCandidateMatchingTool(name, **kwargs)
    result.setPrivateTools(moo_cand_matching_tool)
    return result
Exemple #10
0
def CaloTrkMuIdAlgTrackSelectorToolCfg(flags, name='CaloTrkMuIdAlgTrackSelectorTool', **kwargs ):
    kwargs.setdefault("pTMin", 5000.)
    kwargs.setdefault("IPd0Max", 7.)
    kwargs.setdefault("IPz0Max", 130)     # 130 (tuned on Z)
    kwargs.setdefault("nHitBLayer", 0)
    kwargs.setdefault("nHitPix", 1)
    kwargs.setdefault("nHitSct", 5)
    kwargs.setdefault("nHitSi", 7)
    kwargs.setdefault("nHitTrt", 0)
    result = MuonCombinedTrackSummaryToolCfg(flags)
    kwargs.setdefault("TrackSummaryTool", result.popPrivateTools() )
    acc = AtlasExtrapolatorCfg(flags)
    kwargs.setdefault("Extrapolator", acc.popPrivateTools() )
    result.merge(acc)
    tool = CompFactory.InDet.InDetDetailedTrackSelectorTool(name, **kwargs )
    result.setPrivateTools(tool)
    return result
Exemple #11
0
def TrackEnergyInCaloToolCfg(flags, name ='TrackEnergyInCaloTool', **kwargs ):
    result = AtlasExtrapolatorCfg(flags)
    extrapolator = result.popPrivateTools()
    result.addPublicTool( extrapolator )
    kwargs.setdefault("ExtrapolatorHandle", extrapolator )
    tool = CompFactory.TrackEnergyInCaloTool(name, **kwargs )
    result.setPrivateTools(tool)
    return result
Exemple #12
0
def MuidMuonRecoveryCfg(flags, name='MuidMuonRecovery',**kwargs):
    result = AtlasExtrapolatorCfg(flags)
    kwargs.setdefault("Extrapolator", result.getPrimary() )
    acc = CombinedMuonTrackBuilderCfg(flags)
    kwargs.setdefault("TrackBuilder", acc.popPrivateTools() )
    result.merge(acc)
    tool = CompFactory.Rec.MuidMuonRecovery(name,**kwargs)
    result.setPrivateTools(tool)
    return result
Exemple #13
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
Exemple #14
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 
Exemple #15
0
def EMExtrapolationToolsCfg(flags, **kwargs):

    mlog = logging.getLogger('EMExtrapolationTools')
    mlog.debug('Start configuration')

    acc = ComponentAccumulator()

    if "Extrapolator" not in kwargs:
        extrapAcc = AtlasExtrapolatorCfg(flags)
        kwargs["Extrapolator"] = extrapAcc.popPrivateTools()
        acc.merge(extrapAcc)

    if "PerigeeCaloExtensionTool" not in kwargs:
        perigeeCaloExtrapAcc = ParticleCaloExtensionToolCfg(
            flags,
            name="PerigeeCaloExtensionTool",
            Extrapolator=kwargs["Extrapolator"],
            ParticleType="electron",
            StartFromPerigee=True)
        kwargs["PerigeeCaloExtensionTool"] = (
            perigeeCaloExtrapAcc.popPrivateTools())
        acc.merge(perigeeCaloExtrapAcc)

    if "LastCaloExtensionTool" not in kwargs:
        lastCaloExtrapAcc = ParticleCaloExtensionToolCfg(
            flags,
            name="LastCaloExtensionTool",
            ParticleType="electron",
            Extrapolator=kwargs["Extrapolator"])

        kwargs["LastCaloExtensionTool"] = lastCaloExtrapAcc.popPrivateTools()
        acc.merge(lastCaloExtrapAcc)

    emExtrapolationTools = EMExtrapolationTools(**kwargs)
    acc.setPrivateTools(emExtrapolationTools)
    return acc
Exemple #16
0
def MuonMaterialProviderToolCfg(flags,  name = "MuonMaterialProviderTool"):
    from TrackToCalo.TrackToCaloConfig import ParticleCaloCellAssociationToolCfg, ParticleCaloExtensionToolCfg

    result = ParticleCaloCellAssociationToolCfg(flags)
    particle_calo_cell_association_tool = result.getPrimary()
    result.addPublicTool( particle_calo_cell_association_tool )

    acc = ParticleCaloExtensionToolCfg(flags)
    particle_calo_extension_tool = acc.getPrimary()
    result.addPublicTool( particle_calo_cell_association_tool )
    result.merge(acc)

    from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg

    # workaround as long as public tool is required
    acc = AtlasExtrapolatorCfg(flags)
    atlas_extrapolator = acc.popPrivateTools()
    result.merge(acc)
    result.addPublicTool(atlas_extrapolator)
    kwargs = dict()
    kwargs["Extrapolator"] = atlas_extrapolator
    if flags.Muon.SAMuonTrigger:
        from MuonConfig.MuonRecToolsConfig import MuonTrackSummaryToolCfg
        acc = MuonTrackSummaryToolCfg(flags)
        kwargs.setdefault("TrackSummaryTool", acc.popPrivateTools())
        result.merge(acc)
    else:
        acc = MuonCombinedTrackSummaryToolCfg(flags)
        muon_combined_track_summary_tool = acc.popPrivateTools()
        result.merge(acc)
        kwargs["TrackSummaryTool"] = muon_combined_track_summary_tool
    kwargs["KeepAllPerigee"] = True 
    kwargs["PerigeeExpression"] = "Origin"
    track_particle_creator = CompFactory.Trk.TrackParticleCreatorTool(name="MuonCaloParticleCreator",**kwargs)
    result.addPublicTool(track_particle_creator)
  
    muonCaloEnergyTool = CompFactory.Rec.MuonCaloEnergyTool(name="MuonCaloEnergy", ParticleCaloExtensionTool = particle_calo_extension_tool,
                                                 ParticleCaloCellAssociationTool = particle_calo_cell_association_tool,
                                                 TrackParticleCreator = track_particle_creator)

    useCaloEnergyMeas = True
    if flags.Muon.MuonTrigger:
        useCaloEnergyMeas = False

    tool = CompFactory.Trk.TrkMaterialProviderTool(name = name, MuonCaloEnergyTool = muonCaloEnergyTool, UseCaloEnergyMeasurement = useCaloEnergyMeas)
    result.addPublicTool(tool)
    result.setPrivateTools(tool)
    return result 
Exemple #17
0
def ExtrapolatorComparisonTestCfg(configFlags,
                                  name="ExtrapolatorComparisonTest",
                                  **kwargs):
    result = ComponentAccumulator()

    if "Extrapolator" not in kwargs:
        kwargs["Extrapolator"] = result.popToolsAndMerge(
            AtlasExtrapolatorCfg(configFlags, 'AtlasExtrapolator'))

    if "ExtrapolationTool" not in kwargs:
        actsextrapolation = ActsExtrapolationToolCfg(configFlags)
        kwargs["ExtrapolationTool"] = actsextrapolation.getPrimary()
        result.merge(actsextrapolation)

    Trk__ExtrapolatorComparisonTest = CompFactory.Trk.ExtrapolatorComparisonTest
    extrapolationTest = Trk__ExtrapolatorComparisonTest(name, **kwargs)
    result.addEventAlgo(extrapolationTest)

    return result
Exemple #18
0
def MuonCombinedParticleCreatorCfg(flags, name="MuonCombinedParticleCreator",**kwargs):
    result = ComponentAccumulator()    
    if flags.Muon.MuonTrigger:
        from MuonConfig.MuonRecToolsConfig import MuonTrackSummaryToolCfg
        acc = MuonTrackSummaryToolCfg(flags)
        kwargs.setdefault("TrackSummaryTool", acc.popPrivateTools())
        result.merge(acc)
    else:
        acc = MuonCombinedTrackSummaryToolCfg(flags)
        kwargs.setdefault("TrackSummaryTool", acc.getPrimary() ) 
        result.merge (acc)

    acc = AtlasExtrapolatorCfg(flags)
    kwargs.setdefault("Extrapolator", acc.getPrimary() )
    result.addPublicTool(kwargs['Extrapolator'])
    result.merge(acc)
    kwargs.setdefault("KeepAllPerigee",True )
    kwargs.setdefault("UseMuonSummaryTool",True )
    if flags.Beam.Type=="cosmics":
        kwargs.setdefault("PerigeeExpression","Origin")
    tool = CompFactory.Trk.TrackParticleCreatorTool(name,**kwargs)
    result.addPublicTool(tool)
    result.setPrivateTools(tool)
    return result
Exemple #19
0
def BTagFullLinearizedTrackFactoryCfg(flags,
                                      name='FullLinearizedTrackFactory',
                                      useBTagFlagsDefaults=True,
                                      **options):
    """Sets up a BTagFullLinearizedTrackFactory tool and returns it.

    input:             name: The name of the tool (should be unique).
          useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                             Note however that this tool has no BTaggingFlags defaults; the option is
                             here only for consistency.
                  **options: Python dictionary with options for the tool.
    output: The actual tool, which can then be added to ToolSvc via ToolSvc += output."""
    acc = ComponentAccumulator()
    if useBTagFlagsDefaults:
        atlasExtrapolator = acc.popToolsAndMerge(
            AtlasExtrapolatorCfg(flags, 'AtlasExtrapolator'))
        defaults = {'Extrapolator': atlasExtrapolator}
        for option in defaults:
            options.setdefault(option, defaults[option])

    options['name'] = name
    acc.setPrivateTools(Trk__FullLinearizedTrackFactory(**options))

    return acc
Exemple #20
0
    def __init__(self,
                 suffix,
                 inputFlags,
                 buildconfigs=[],
                 doPFlow=False,
                 doTruth=False,
                 trksel=None,
                 modConstKey="",
                 modClusColls={}):
        # Set some sensible defaults
        modConstKey_tmp = modConstKey
        modClusColls_tmp = modClusColls
        if doPFlow:
            if modConstKey_tmp == "":
                modConstKey_tmp = "CHSParticleFlowObjects"
        else:
            if modConstKey_tmp == "": modConstKey_tmp = "OriginCorr"
            if modClusColls_tmp == {}:
                modClusColls_tmp = {
                    'LCOriginCorrClusters': 'LCOriginTopoClusters',
                    'EMOriginCorrClusters': 'EMOriginTopoClusters'
                }
        if doTruth:
            print("{} Creating MET TruthAssoc config {}".format(
                prefix, suffix))
        else:
            print("{} Creating MET Assoc config {}".format(prefix, suffix))
        self.suffix = suffix
        self.doPFlow = doPFlow
        self.modConstKey = modConstKey_tmp
        self.modClusColls = modClusColls_tmp
        self.doTruth = doTruth
        if trksel:
            self.trkseltool = trksel
        else:
            self.trkseltool = CompFactory.getComp(
                "InDet::InDetTrackSelectionTool")("IDTrkSel_METAssoc",
                                                  CutLevel="TightPrimary",
                                                  maxZ0SinTheta=3,
                                                  maxD0=2,
                                                  minPt=500)

        self.trkisotool = CompFactory.getComp("xAOD::TrackIsolationTool")(
            "TrackIsolationTool_MET")
        self.trkisotool.TrackSelectionTool = self.trkseltool  # As configured above
        from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg
        extrapCfg = AtlasExtrapolatorCfg(inputFlags)
        CaloExtensionTool = CompFactory.getComp(
            "Trk::ParticleCaloExtensionTool")(
                Extrapolator=extrapCfg.popPrivateTools())
        CaloCellAssocTool = CompFactory.getComp(
            "Rec::ParticleCaloCellAssociationTool")(
                ParticleCaloExtensionTool=CaloExtensionTool)
        self.caloisotool = CompFactory.getComp("xAOD::CaloIsolationTool")(
            "CaloIsolationTool_MET",
            saveOnlyRequestedCorrections=True,
            addCaloExtensionDecoration=False,
            ParticleCaloExtensionTool=CaloExtensionTool,
            ParticleCaloCellAssociationTool=CaloCellAssocTool)
        self.associators = {}
        self.assoclist = []  # need an ordered list
        #
        self.setupAssociators(buildconfigs)
Exemple #21
0
def MuonCombinedTrackSummaryToolCfg(flags, name="", **kwargs):
    # Based on https://gitlab.cern.ch/atlas/athena/blob/release/22.0.8/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/CombinedMuonTrackSummary.py
    # FIXME - check all of this once the ID configuration is available, because probably we can simplify this a lot
    result = AtlasExtrapolatorCfg(flags)
    extrapolator = result.getPrimary()
    result.addPublicTool(extrapolator)

    from InDetConfig.InDetRecToolConfig import InDetTrackHoleSearchToolCfg
    acc = InDetTrackHoleSearchToolCfg(flags,
                                      name            = "CombinedMuonIDHoleSearch",
                                      Extrapolator    = extrapolator,
                                      CountDeadModulesAfterLastHit = True,
                                      Cosmics         = (flags.Beam.Type=="cosmics"))
    indet_hole_search_tool = acc.getPrimary()
    result.addPublicTool(indet_hole_search_tool)
    result.merge(acc)
    #FIXME - need InDet to provide configuration for PixelConditionsSummaryTool
    # Also assuming we don't use DetailedPixelHoleSearch (since it seems to be off in standard workflows)
    from InDetConfig.InDetRecToolConfig import InDetTrackSummaryHelperToolCfg
    acc = InDetTrackSummaryHelperToolCfg(flags,
                                         name="CombinedMuonIDSummaryHelper", 
                                         AssoTool        = None, 
                                         PixelToTPIDTool = None,
                                         TestBLayerTool  = None,
                                         DoSharedHits    = False,
                                         HoleSearch      = indet_hole_search_tool)
    indet_track_summary_helper_tool = acc.getPrimary()
    result.addPublicTool(indet_track_summary_helper_tool)
    result.merge(acc)


    from MuonConfig.MuonRecToolsConfig import MuonTrackSummaryHelperToolCfg
    acc = MuonTrackSummaryHelperToolCfg(flags)
    muon_track_summary_helper_tool = acc.getPrimary()
    track_summary_tool = CompFactory.Trk.TrackSummaryTool(name="CombinedMuonTrackSummary",
                                                          doSharedHits             = False,
                                                          doHolesInDet             = True,
                                                          doHolesMuon              = False,
                                                          AddDetailedInDetSummary  = True,
                                                          AddDetailedMuonSummary   = True,
                                                          InDetSummaryHelperTool   = indet_track_summary_helper_tool,
                                                          TRT_ElectronPidTool      = None,
                                                          PixelToTPIDTool          = None,
                                                          MuonSummaryHelperTool    = muon_track_summary_helper_tool,
                                                          PixelExists              = True )
    result.merge(acc)
    result.addPublicTool(track_summary_tool)
    result.setPrivateTools(track_summary_tool)
    return result
Exemple #22
0
def CombinedMuonTrackBuilderCfg(flags, name='CombinedMuonTrackBuilder', **kwargs ):
    from AthenaCommon.SystemOfUnits import meter
    from MuonConfig.MuonRIO_OnTrackCreatorConfig import CscClusterOnTrackCreatorCfg,MdtDriftCircleOnTrackCreatorCfg
    from MuonConfig.MuonRecToolsConfig import MuonTrackSummaryToolCfg
    result = ComponentAccumulator()
    acc = MuidCaloEnergyToolParamCfg(flags)
    kwargs.setdefault("CaloEnergyParam"               , acc.popPrivateTools() )
    result.merge(acc)
    acc = MuidCaloTrackStateOnSurfaceCfg(flags)
    kwargs.setdefault("CaloTSOS"                      , acc.popPrivateTools() )
    result.merge(acc)
    acc = MuidTrackCleanerCfg(flags)
    kwargs.setdefault("Cleaner"                      , acc.popPrivateTools() )
    result.merge(acc)

    if flags.Detector.GeometryCSC and not flags.Muon.MuonTrigger:
        acc = CscClusterOnTrackCreatorCfg(flags)
        kwargs.setdefault("CscRotCreator"                 , acc.popPrivateTools() )
        result.merge(acc)
    else:
        kwargs.setdefault("CscRotCreator"                 , "")

    acc = AtlasExtrapolatorCfg(flags)
    kwargs.setdefault("Extrapolator", acc.getPrimary() )
    result.merge(acc)

    acc = iPatFitterCfg(flags)
    ipatFitter = acc.popPrivateTools() # possibly used again below
    kwargs.setdefault("Fitter"      , ipatFitter )
    result.merge(acc)

    acc= iPatSLFitterCfg(flags)
    kwargs.setdefault("SLFitter"    , acc.popPrivateTools() )
    result.merge(acc)

    acc = MuidMaterialAllocatorCfg(flags)
    kwargs.setdefault("MaterialAllocator", acc.popPrivateTools() )
    result.merge(acc)

    acc = MdtDriftCircleOnTrackCreatorCfg(flags)
    kwargs.setdefault("MdtRotCreator"                 , acc.popPrivateTools() )
    result.merge(acc)

    kwargs.setdefault("CleanCombined"                 , True )
    kwargs.setdefault("CleanStandalone"               , True )
    kwargs.setdefault("BadFitChi2"                    , 2.5 )
    kwargs.setdefault("LargeMomentumError"            , 0.5 )
    kwargs.setdefault("LineMomentum"                  , flags.Muon.straightLineFitMomentum )
    kwargs.setdefault("LowMomentum"                   , 10.*GeV )
    kwargs.setdefault("MinEnergy"                     , 0.3*GeV )
    kwargs.setdefault("PerigeeAtSpectrometerEntrance" , False )
    kwargs.setdefault("ReallocateMaterial"            , False )
    kwargs.setdefault("Vertex2DSigmaRPhi"             , 100.*mm )
    kwargs.setdefault("Vertex3DSigmaRPhi"             , 6.*mm )
    kwargs.setdefault("Vertex3DSigmaZ"                , 60.*mm)
    kwargs.setdefault("UseCaloTG"                     , True )

    acc = MuonMaterialProviderToolCfg(flags)
    kwargs.setdefault( "CaloMaterialProvider", acc.getPrimary() )
    result.merge(acc)
 
    if flags.Muon.SAMuonTrigger:
        acc = MuonTrackSummaryToolCfg(flags)
        kwargs.setdefault("TrackSummaryTool", acc.popPrivateTools())
        result.merge(acc)
    else:
        acc = MuonCombinedTrackSummaryToolCfg(flags)
        kwargs.setdefault("TrackSummaryTool"              , acc.popPrivateTools() )
        result.merge(acc)

    acc = MuonCombinedPropagatorCfg(flags)
    propagator = acc.popPrivateTools()
    kwargs.setdefault("Propagator"                    , propagator )
    kwargs.setdefault("SLPropagator"                  , propagator )
    result.merge(acc)

    if flags.Beam.Type == 'cosmics':
        kwargs.setdefault("MdtRotCreator" ,  "" )
        kwargs.setdefault("LowMomentum"   ,  1.5*GeV )
        kwargs.setdefault("ReallocateMaterial", False )
        kwargs.setdefault("Vertex2DSigmaRPhi" , 100.*mm )
        kwargs.setdefault("Vertex3DSigmaRPhi" , 100.*mm )
        kwargs.setdefault("Vertex3DSigmaZ"    ,  1.*meter )

    # configure tools for data reprocessing 
    if flags.Muon.enableErrorTuning and 'MuonErrorOptimizer' not in kwargs:
        # use alignment effects on track for all algorithms

        useAlignErrs = True
        # FIXME - handle this.
        #    if conddb.dbdata == 'COMP200' or conddb.dbmc == 'COMP200' or 'HLT' in globalflags.ConditionsTag() or conddb.isOnline or TriggerFlags.MuonSlice.doTrigMuonConfig:
        #         useAlignErrs = False
        from MuonConfig.MuonRecToolsConfig import MuonRefitToolCfg
        acc = MuonRefitToolCfg(flags, name="MuidRefitTool", AlignmentErrors = useAlignErrs, Fitter = ipatFitter)
        # refitTool = getPublicToolClone("MuidRefitTool", "MuonRefitTool", AlignmentErrors = useAlignErrs, Fitter = getPublicTool("iPatFitter"),
                                                                                                #  CscRotCreator=("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator" if MuonGeometryFlags.hasCSC() else "")
        refitTool = acc.popPrivateTools()
        result.merge(acc)
        acc = MuidErrorOptimisationToolCfg(flags, name="MuidErrorOptimisationToolTuning", PrepareForFit = False, 
                                                RecreateStartingParameters = False, RefitTool = refitTool)
        kwargs.setdefault("MuonErrorOptimizer", acc.popPrivateTools())
        result.merge(acc)
    else:
        kwargs.setdefault("MuonErrorOptimizer", "")


    if flags.Muon.MuonTrigger:
        kwargs.setdefault("MuonHoleRecovery"                 , "")
    else:
        from MuonConfig.MuonTrackBuildingConfig import MuonChamberHoleRecoveryToolCfg
        acc = MuonChamberHoleRecoveryToolCfg(flags)
        kwargs.setdefault("MuonHoleRecovery"                 , acc.popPrivateTools())
        result.merge(acc)

    if flags.Muon.doSegmentT0Fit:
        kwargs.setdefault("MdtRotCreator"                 , "" )

    tool = CompFactory.Rec.CombinedMuonTrackBuilder(name,**kwargs)
    result.setPrivateTools(tool)
    return result
Exemple #23
0
def NewJetFitterVxFinderCfg(flags,
                            name='JFVxFinder',
                            suffix="",
                            useBTagFlagsDefaults=True,
                            options={}):
    """Sets up a NewJetFitterVxFinder tool and returns it.

    The following options have BTaggingFlags defaults:

    VxPrimaryContainer                  default: BTaggingFlags.PrimaryVertexCollectionName
    MaxNumDeleteIterations              default: 30
    VertexProbCut                       default: 0.001
    MaxClusteringIterations             default: 30
    VertexClusteringProbabilityCut      default: 0.005

    input:             name: The name of the tool (should be unique).
         useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                  **options: Python dictionary with options for the tool.
    output: The actual tool."""
    acc = ComponentAccumulator()
    if useBTagFlagsDefaults:
        inDetJetFitterUtils = acc.popToolsAndMerge(
            InDetJetFitterUtilsCfg(flags, 'InDetJFUtils' + suffix))
        improvedJetFitterRoutines = acc.popToolsAndMerge(
            ImprovedJetFitterRoutinesCfg('ImprovedJFRoutines' + suffix))
        jetFitterMode3dTo1dFinder = acc.popToolsAndMerge(
            JetFitterMode3dTo1dFinderCfg('JFMode3dTo1dFinder' + suffix))
        inDetImprovedJetFitterTrackSelectorTool = acc.popToolsAndMerge(
            InDetImprovedJetFitterTrackSelectorToolCfg(
                'InDetImprovedJFTrackSelTool' + suffix))
        jetFitterSequentialVertexFitter = acc.popToolsAndMerge(
            JetFitterSequentialVertexFitterCfg('JFSeqVxFitter' + suffix))
        jetFitterExtrapolator = acc.popToolsAndMerge(
            AtlasExtrapolatorCfg(flags, 'JFExtrapolator' + suffix))
        improvedJetFitterInitializationHelper = acc.popToolsAndMerge(
            ImprovedJetFitterInitializationHelperCfg('ImprovedJFInitHelper' +
                                                     suffix))
        vertexEdmFactory = acc.popToolsAndMerge(
            VxInternalEdmFactoryCfg('VxInternalEdmFactory' + suffix))
        defaults = {
            'VxPrimaryContainer': flags.BTagging.PrimaryVertexCollectionName,
            'MaxNumDeleteIterations': 30,
            'VertexProbCut': 0.001,
            'MaxClusteringIterations': 30,
            'VertexClusteringProbabilityCut': 0.005,
            'VertexEdmFactory': vertexEdmFactory,
            'JetFitterInitializationHelper':
            improvedJetFitterInitializationHelper,
            'InDetJetFitterUtils': inDetJetFitterUtils,
            'Extrapolator': jetFitterExtrapolator,
            'JetFitterRoutines': improvedJetFitterRoutines,
            'TrackSelector': inDetImprovedJetFitterTrackSelectorTool,
            'Mode3dFinder': jetFitterMode3dTo1dFinder,
            'SequentialVertexFitter': jetFitterSequentialVertexFitter
        }
        for option in defaults:
            options.setdefault(option, defaults[option])
    options['name'] = name + suffix
    acc.setPrivateTools(InDet__InDetImprovedJetFitterVxFinder(**options))

    return acc
Exemple #24
0
def MuonCombinedInDetDetailedTrackSelectorToolCfg(flags, name="MuonCombinedInDetDetailedTrackSelectorTool",**kwargs):
    if flags.Beam.Type == 'collisions':
        kwargs.setdefault("pTMin", 2000 )
        kwargs.setdefault("IPd0Max", 50.0 )
        kwargs.setdefault("IPz0Max", 9999.0 )
        kwargs.setdefault("z0Max", 9999.0 )
        kwargs.setdefault("useTrackSummaryInfo", True )
        kwargs.setdefault("nHitBLayer", 0 )
        kwargs.setdefault("nHitPix", 1 )
        kwargs.setdefault("nHitBLayerPlusPix", 0 )
        kwargs.setdefault("nHitSct", 3 )
        kwargs.setdefault("nHitSi", 4 )
        kwargs.setdefault("nHitTrt", 0 )
        kwargs.setdefault("useTrackQualityInfo", False )
    else:
        kwargs.setdefault("pTMin", 500 )
        kwargs.setdefault("IPd0Max", 19999.0 )
        kwargs.setdefault("IPz0Max", 19999.0 )
        kwargs.setdefault("z0Max", 19999.0 )
        kwargs.setdefault("useTrackSummaryInfo", False )
        kwargs.setdefault("useTrackQualityInfo", False )

    result = AtlasExtrapolatorCfg(flags)
    extrapolator = result.getPrimary()
    kwargs.setdefault("Extrapolator", extrapolator )

    # FIXME the configuration of TrackSummaryTool should probably be centralised.
    acc = MuonCombinedTrackSummaryToolCfg(flags)
    kwargs.setdefault("TrackSummaryTool", acc.popPrivateTools() )
    result.merge(acc)

    # Has two CondKeys
    # SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };

    # FIXME - let's put this someplace central?
    result.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Beampos","/Indet/Beampos", className='AthenaAttributeList'))
    result.addCondAlgo(CompFactory.BeamSpotCondAlg("BeamSpotCondAlg"))

    # SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"};
    # FIXME - handle this ^
    
    tool = CompFactory.InDet.InDetDetailedTrackSelectorTool(name,**kwargs)
    result.addPublicTool(tool)
    result.setPrivateTools(tool)
    return result
Exemple #25
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