Ejemplo n.º 1
0
def createIsoToolElectronSelector():

    from AthenaCommon.AppMgr import ToolSvc
    from TrigEgammaEmulationTool.TrigEgammaEmulationToolConf import Trig__TrigEgammaIsolationSelectorTool
    from TrigEgammaEmulationTool.TrigEgammaEmulationToolConfig import OutputLevel

    from TrigEgammaHypo.TrigEFElectronHypoConfig import isolation_dict, caloisolation_dict

    # Track isolation -- remember to add TrackIsolation as a property of the class
    from IsolationTool.IsolationToolConf import xAOD__TrackIsolationTool

    TrackIsoTool = xAOD__TrackIsolationTool("TrackIsoTool")
    TrackIsoTool.TrackSelectionTool.maxZ0SinTheta = 3.
    TrackIsoTool.OutputLevel = 0
    #TrackIsoTool.OverlapCone=0.15
    TrackIsoTool.TrackParticleLocation = "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig"
    TrackIsoTool.TrackSelectionTool.OutputLevel = 0
    TrackIsoTool.TrackSelectionTool.minPt = 1000.
    #TrackIsoTool.TrackSelectionTool.CutLevel= "Tight"
    TrackIsoTool.TrackSelectionTool.CutLevel = "Loose"
    ToolSvc += TrackIsoTool

    # the order matter, do not change this order!
    isolations = [
        'ivartight', 'ivarmedium', 'ivarloose', 'iloose', 'icalotight',
        'icalomedium', 'icaloloose'
    ]

    IsoToolSelectors = []

    ### loop over working points (WP)
    for wp in isolations:

        caloiso = True if 'icalo' in wp else False
        trkiso = True if 'icalo' not in wp else False

        tool = Trig__TrigEgammaIsolationSelectorTool(
            'IsolationTool_' + wp,
            RelEtConeCut=caloisolation_dict[wp]
            if caloiso else [-1, -1, -1, -1, -1, -1],
            RelPtConeCut=isolation_dict[wp]
            if trkiso else [-1, -1, -1, -1, -1, -1],
            EtConeCut=[-1, -1, -1, -1, -1, -1],
            PtConeCut=[-1, -1, -1, -1, -1, -1],
            UseTrackIsolationTool=False,
            OutputLevel=OutputLevel,
            #TrackIsolationTool = TrigTrackIsolationTool
            TrackIsolationTool=TrackIsoTool)
        ToolSvc += tool
        IsoToolSelectors.append(tool)

    return IsoToolSelectors
Ejemplo n.º 2
0
def AddIsolationTools():
    from AthenaCommon.AlgSequence import AlgSequence
    job = AlgSequence()
    from AthenaCommon.AppMgr import ToolSvc

    if not hasattr(ToolSvc, "MyTrackIsoTool"):
        print "Adding it!!"

        #try:
        from IsolationTool.IsolationToolConf import xAOD__TrackIsolationTool
        ToolSvc += xAOD__TrackIsolationTool("MyTrackIsoTool")
        # Cuts suggested by Dongliang to reproduce the default muon ptcone
        ToolSvc.MyTrackIsoTool.TrackSelectionTool.maxZ0SinTheta = 3.
        ToolSvc.MyTrackIsoTool.TrackSelectionTool.minPt = 1000.
        #ToolSvc.MyTrackIsoTool.TrackSelectionTool.minNSiHits= 9
        #ToolSvc.MyTrackIsoTool.TrackSelectionTool.minNPixelHits= 1
        ToolSvc.MyTrackIsoTool.TrackSelectionTool.CutLevel = "Loose"

        from AthenaCommon.GlobalFlags import globalflags
        isMC = not globalflags.DataSource() == 'data'
        from IsolationCorrections.IsolationCorrectionsConf import CP__IsolationCorrectionTool
        IsoCorrectionTool = CP__IsolationCorrectionTool("NewLeakageCorrTool",
                                                        IsMC=isMC)
        ToolSvc += IsoCorrectionTool

        # tool to collect topo clusters in cone
        from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__CaloClustersInConeTool
        ToolSvc += xAOD__CaloClustersInConeTool(
            "MyCaloClustersInConeTool",
            CaloClusterLocation="CaloCalTopoClusters")

        from CaloIdentifier import SUBCALO

        from IsolationTool.IsolationToolConf import xAOD__CaloIsolationTool
        ToolSvc += xAOD__CaloIsolationTool("MyCaloIsoTool")
        ToolSvc.MyCaloIsoTool.IsoLeakCorrectionTool = ToolSvc.NewLeakageCorrTool
        ToolSvc.MyCaloIsoTool.ClustersInConeTool = ToolSvc.MyCaloClustersInConeTool
        ToolSvc.MyCaloIsoTool.EMCaloNums = [SUBCALO.LAREM]
        ToolSvc.MyCaloIsoTool.HadCaloNums = [SUBCALO.LARHEC, SUBCALO.TILE]
        ToolSvc.MyCaloIsoTool.UseEMScale = True
        ToolSvc.MyCaloIsoTool.saveOnlyRequestedCorrections = True
Sequencer = AthSequencer("TileD3PDMaker")
Sequencer.StopOverride = False
topSequencer += Sequencer

# ATLAS EXTRAPOLATOR #
from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
ToolSvc += AtlasExtrapolator()

# VERTEXING TOOL
from TrackToVertex.TrackToVertexConf import Reco__TrackToVertex
TrackToVertexTool = Reco__TrackToVertex(name="TrackToVertexTool")
ToolSvc+=TrackToVertexTool

# ISOLATION TOOL
from IsolationTool.IsolationToolConf import xAOD__TrackIsolationTool
TrackIsoTool = xAOD__TrackIsolationTool()
ToolSvc += TrackIsoTool

# TRACK TOOLS
from TileD3PDMaker.TileD3PDMakerConf import TrackTools
TrackTools = TrackTools()
TrackTools.TrackIsolationTool = TrackIsoTool
ToolSvc += TrackTools

print "==============> TOOL ATTRIBUTES SET <=============="
##################
### D3PD Stuff ###
##################

from AthenaCommon.AlgSequence import AlgSequence
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
Ejemplo n.º 4
0
expression = '(((count('+electronsRequirements+') + count('+muonsRequirements+') >= 1) && (count('+jetRequirements+') >=3)) || ((count('+electronsRequirements+') + count('+muonsRequirements+') >= 2) && (count('+jetRequirements+') >=2)) || (HLT_6j45_0eta240) || (HLT_6j45_0eta240_L14J20) || (HLT_6j50_0eta240_L14J20) || (HLT_7j45) || (HLT_5j70) || (HLT_5j85) || (HLT_5j45) || (HLT_6j45) )'

from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool
SUSY4SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "SUSY4SkimmingTool",
                                                                expression = expression)

ToolSvc += SUSY4SkimmingTool

from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAlg

#====================================================================
# ISOLATION TOOL 
#====================================================================
#Track selection
from IsolationTool.IsolationToolConf import xAOD__TrackIsolationTool
TrackIsoTool = xAOD__TrackIsolationTool("TrackIsoTool")
TrackIsoTool.TrackSelectionTool.maxZ0SinTheta= 3.
TrackIsoTool.TrackSelectionTool.minPt= 1000.
TrackIsoTool.TrackSelectionTool.CutLevel= "Loose"
ToolSvc += TrackIsoTool

TrackIsoTool500 = xAOD__TrackIsolationTool("TrackIsoTool500")
TrackIsoTool500.TrackSelectionTool.maxZ0SinTheta= 3.
TrackIsoTool500.TrackSelectionTool.minPt= 500.
TrackIsoTool500.TrackSelectionTool.CutLevel= "Loose"
ToolSvc += TrackIsoTool500

from DerivationFrameworkSUSY.DerivationFrameworkSUSYConf import DerivationFramework__trackIsolationDecorator
import ROOT, cppyy
cppyy.loadDictionary('xAODCoreRflxDict')
cppyy.loadDictionary('xAODPrimitivesDict')
Ejemplo n.º 5
0
    print 'index of algo ', theAlgBeforeWhereToPutIsoAlg, ' = ', index, ', putting custom track isol algs just after...'

from IsolationAlgs.IsolationAlgsConf import IsolationBuilder
from IsolationTool.IsolationToolConf import xAOD__TrackIsolationTool

#Customisation
CustomCuts = [[3.0, 400, 'TightPrimary'], [3.0, 500, 'TightPrimary'],
              [3.0, 800, 'TightPrimary'], [3.0, 1200, 'TightPrimary'],
              [3.0, 1000, 'Loose'], [1.5, 1000, 'TightPrimary'],
              [5.0, 1000, 'TightPrimary']]
for icut in CustomCuts:

    CustomType = icut[2] + 'z0' + str(int(10 * icut[0])) + 'Pt' + str(
        icut[1]) + 'MeV'
    print 'Building track isolation tool for type ', CustomType
    TrackIsolationCustom = xAOD__TrackIsolationTool(name='TrackIsolationTool' +
                                                    CustomType)
    TrackIsolationCustom.TrackSelectionTool.maxZ0SinTheta = float(icut[0])
    TrackIsolationCustom.TrackSelectionTool.minPt = float(icut[1])
    TrackIsolationCustom.TrackSelectionTool.CutLevel = icut[2]
    ToolSvc += TrackIsolationCustom
    isoBuilderCustom = IsolationBuilder(
        name="IsolationBuilder" + CustomType,
        CaloCellIsolationTool=None,
        CaloTopoIsolationTool=None,
        PFlowIsolationTool=None,
        TrackIsolationTool=TrackIsolationCustom,
        EgIsoTypes=[[]] if not rec.doEgamma() else ptconeList,
        MuIsoTypes=[[]] if not rec.doMuon() else ptconeList,
        CustomConfgurationName=CustomType,
        OutputLevel=3)
    topSequence.insert(index, isoBuilderCustom)