Esempio n. 1
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
Esempio n. 2
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
Esempio n. 3
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
Esempio n. 4
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
Esempio n. 5
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
Esempio n. 6
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
Esempio n. 7
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
Esempio n. 8
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)
Esempio n. 9
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)