def setupAthenaJob(algoClass, inputfile=defaultFile, EvtMax=None): "Setup athena job" import AthenaPoolCnvSvc.ReadAthenaPool # EventSelector from AthenaCommon.AppMgr import ServiceMgr as svcMgr svcMgr.EventSelector.InputCollections = [inputfile] # Redefine the function InputFileNames to make autoconfiguration work # outside RecExCommon from RecExConfig import RecoFunctions RecoFunctions.InputFileNames = lambda: svcMgr.EventSelector.InputCollections from RecExConfig.AutoConfiguration import ConfigureFromListOfKeys ConfigureFromListOfKeys(['everything']) ################### from egammaRec.Factories import ToolFactory, AlgFactory from RecExConfig.RecFlags import rec import PhotonVertexSelection.PhotonVertexSelectionConf as PVS # Configure and PhotonVertexSelectionTool PhotonVertexSelectionTool = ToolFactory(PVS.CP__PhotonVertexSelectionTool) # Configure the test algorithm and add it to topSequence testAlg = AlgFactory(algoClass, PhotonVertexSelectionTool=PhotonVertexSelectionTool)() # Maximum events if EvtMax: from Configurables import StopperAlg AlgFactory(StopperAlg, StopCount=EvtMax)()
def egammaTruthParticleConfig \ (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()), sgkey = 'egammaTruth', prefix = '', doPileup = D3PDMakerFlags.TruthDoPileup(), **kwargs): if not rec.doTruth(): return # Is the container already in SG? if cfgKeyStore.isInInput ('DataVector<xAOD::TruthParticle_v1>', sgkey): return algname = prefix + sgkey + 'Builder' if not hasattr (seq, algname): import AthenaCommon.CfgMgr as CfgMgr from egammaRec.Factories import ToolFactory exten = ToolFactory (CfgMgr.Trk__ParticleCaloExtensionTool, name="GSFParticleCaloExtensionTool", StartFromPerigee = True)() seq += egammaD3PDAnalysis.egammaTruthAlg ( algname, InputKey = D3PDMakerFlags.TruthSGKey(), OutputKey = sgkey, ParticleCaloExtensionTool = exten, AuxPrefix = D3PDMakerFlags.EgammaUserDataPrefix()) cfgKeyStore.addTransient ('DataVector<xAOD::TruthParticle_v1>', sgkey) return
def __init__(self, name="TrigMuonEFCaloIsolationConfig"): super(TrigMuonEFCaloIsolationConfig, self).__init__(name) self.RequireCombinedMuon = True self.applyPileupCorrection = False CaloTopoIsolationTool = ToolFactory( xAOD__CaloIsolationTool, name="CaloTopoClusterIsolationTool", doEnergyDensityCorrection=self.applyPileupCorrection, saveOnlyRequestedCorrections=True, IsoLeakCorrectionTool=IsoCorrectionTool, ClustersInConeTool=CaloClustersInConeTool, CaloFillRectangularClusterTool=TrigCaloFillRectangularCluster, UseEMScale=True) self.CaloTopoClusterIsolationTool = CaloTopoIsolationTool() from TrigMuonEF.TrigMuonEFMonitoring import TrigMuonEFCaloIsolationValidationMonitoring # histograms self.HistoPathBase = "" validation_caloiso = TrigMuonEFCaloIsolationValidationMonitoring() #online_caloiso = TrigMuonEFCaloIsolationOnlineMonitoring() #monitoring_caloiso = TrigMuonEFCaloIsolationMonitoring() self.AthenaMonTools = [validation_caloiso]
egammaIsoPtCorrection = ToolFactory(IsolationToolConf.egammaIsoPtCorrection, # # R17 correction numbers # # range of eta bins for e-ID EtaBins = [0.0, 0.10, 0.60, 0.80, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47], # electron slope ElectronPtCorrection15 = [0.01466, 0.01421, 0.01427, 0.01872, 0.02008, 0.02181, 0.02141, 0.02636, 0.03285, 0.03564], ElectronPtCorrection20 = [0.01616, 0.01572, 0.01596, 0.02139, 0.02339, 0.03350, 0.02499, 0.03038, 0.03870, 0.04337], ElectronPtCorrection25 = [0.01663, 0.01616, 0.01667, 0.02223, 0.02445, 0.03852, 0.02611, 0.03174, 0.04093, 0.04692], ElectronPtCorrection30 = [0.01689, 0.01635, 0.01684, 0.02256, 0.02485, 0.04223, 0.02660, 0.03232, 0.04182, 0.04846], ElectronPtCorrection35 = [0.01695, 0.01642, 0.01693, 0.02268, 0.02501, 0.04403, 0.02685, 0.03254, 0.04223, 0.04928], ElectronPtCorrection40 = [0.01701, 0.01646, 0.01702, 0.02272, 0.02517, 0.04550, 0.02698, 0.03267, 0.04242, 0.04964], ElectronPtCorrectiontp40 = [0.01470, 0.01420, 0.01450, 0.02080, 0.02400, 0.04660, 0.02630, 0.03020, 0.03980, 0.04850], # electron offset ElectronOffset15 = [21.71, 36.00, 132.56, 191.64, 263.46, 619.58, 288.75, 121.92, 102.35, 175.02], ElectronOffset20 = [76.67, 85.35, 184.90, 276.72, 384.97, 595.60, 657.99, 231.88, 170.48, 312.30], ElectronOffset25 = [90.44, 105.02, 267.95, 420.38, 555.09, 1014.50, 765.83, 283.50, 224.18, 357.30], ElectronOffset30 = [119.55, 127.09, 279.48, 430.96, 571.81, 846.86, 968.01, 354.46, 263.11, 455.21], ElectronOffset35 = [138.79, 161.87, 371.47, 572.08, 754.17, 1249.38, 1000.44, 389.22, 295.72, 464.28], ElectronOffset40 = [180.08, 187.89, 363.31, 553.46, 707.60, 1006.20, 1105.73, 434.21, 312.78, 535.90], ElectronOffsettp40 = [-371.90, -338.90, -284.00, -322.10, -238.80, 53.20, -437.70, -477.50, -538.10, -491.90], # Converted photons slope : last eta bin isn't used PhotonConvertedPtCorrection15 = [0.01450, 0.01410, 0.01410, 0.01860, 0.01990, 0.0, 0.02120, 0.02610, 0.03260, 0.0], PhotonConvertedPtCorrection20 = [0.01600, 0.01560, 0.01580, 0.02130, 0.02320, 0.0, 0.02450, 0.03000, 0.03840, 0.0 ], PhotonConvertedPtCorrection25 = [0.01630, 0.01600, 0.01620, 0.02210, 0.02420, 0.0, 0.02560, 0.03140, 0.04060, 0.0], PhotonConvertedPtCorrection30 = [0.01630, 0.01600, 0.01630, 0.02240, 0.02460, 0.0, 0.02610, 0.03190, 0.04150, 0.0 ], PhotonConvertedPtCorrection35 = [0.01660, 0.01600, 0.01630, 0.02240, 0.02470, 0.0, 0.02640, 0.03210, 0.04190, 0.0], PhotonConvertedPtCorrection40 = [0.01610, 0.01590, 0.01620, 0.02250, 0.02480, 0.0, 0.02650, 0.03220, 0.04210, 0.0], PhotonConvertedPtCorrectiontp40 = [0.01490, 0.01430, 0.01450, 0.02090, 0.02370, 0.0, 0.02590, 0.02970, 0.03930, 0.0], # Converted photons offset : last eta bin isn't used PhotonConvertedOffset15 = [36.50, 61.80, 176.90, 206.40, 300.70, 0.0, 277.40, 91.70, 126.60, 0.0], PhotonConvertedOffset20 = [93.30, 101.40, 270.60, 369.10, 514.70, 0.0, 586.10, 160.80, 193.80, 0.0], PhotonConvertedOffset25 = [195.80, 166.20, 386.50, 472.30, 637.30, 0.0, 739.40, 207.60, 240.60, 0.0], PhotonConvertedOffset30 = [286.60, 241.60, 501.60, 570.70, 739.50, 0.0, 860.00, 264.50, 270.40, 0.0], PhotonConvertedOffset35 = [329.90, 314.70, 585.60, 655.60, 835.70, 0.0, 934.30, 291.50, 291.90, 0.0], PhotonConvertedOffset40 = [478.70, 383.80, 679.20, 725.70, 938.70, 0.0, 999.30, 322.80, 316.20, 0.0], PhotonConvertedOffsettp40 = [-432.10, -368.20, -284.10, -294.40, -141.20, 0.0, -455.70, -470.10, -474.10, 0.0], # Unconverted photons slope PhotonUnconvertedPtCorrection15 = [0.01480, 0.01410, 0.01400, 0.01820, 0.01950, 0.0, 0.02140, 0.02660, 0.03250, 0.0], PhotonUnconvertedPtCorrection20 = [0.01630, 0.01560, 0.01560, 0.02060, 0.02240, 0.0, 0.02480, 0.03060, 0.03830, 0.0], PhotonUnconvertedPtCorrection25 = [0.01670, 0.01610, 0.01620, 0.02140, 0.02330, 0.0, 0.02590, 0.03200, 0.04050, 0.0], PhotonUnconvertedPtCorrection30 = [0.01690, 0.01630, 0.01640, 0.02170, 0.02360, 0.0, 0.02630, 0.03260, 0.04140, 0.0], PhotonUnconvertedPtCorrection35 = [0.01700, 0.01640, 0.01650, 0.02180, 0.02380, 0.0, 0.02650, 0.03280, 0.04180, 0.0], PhotonUnconvertedPtCorrection40 = [0.01710, 0.01640, 0.01650, 0.02190, 0.02390, 0.0, 0.02660, 0.03290, 0.04200, 0.0], PhotonUnconvertedPtCorrectiontp40 = [0.01470, 0.01410, 0.01410, 0.01940, 0.02230, 0.0, 0.02550, 0.02990, 0.03860, 0.0], # Unconverted photons offset PhotonUnconvertedOffset15 = [-27.80, 3.80, 67.50, 80.90, 114.90, 0.0, 82.60, 2.10, 39.80, 0.0], PhotonUnconvertedOffset20 = [-17.70, 12.60, 97.80, 126.50, 186.20, 0.0, 200.80, 24.00, 62.30, 0.0], PhotonUnconvertedOffset25 = [-8.60, 20.30, 118.20, 161.80, 244.30, 0.0, 271.80, 39.80, 79.10, 0.0], PhotonUnconvertedOffset30 = [5.40, 33.80, 141.60, 199.50, 295.40, 0.0, 336.50, 64.80, 90.40, 0.0], PhotonUnconvertedOffset35 = [9.60, 47.80, 154.10, 231.10, 346.10, 0.0, 384.60, 77.80, 96.90, 0.0], PhotonUnconvertedOffset40 = [13.30, 62.00, 177.00, 267.10, 406.20, 0.0, 419.80, 89.40, 105.90, 0.0], PhotonUnconvertedOffsettp40 = [-373.70, -347.40, -308.10, -372.90, -394.30, 0.0, -461.00, -469.00, -493.30, 0.0] )
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration __doc__ = "ToolFactories to instantiate all CaloIsolationTool for egammaCaloTools with default configuration" __author__ = "Nathan Readioff" from AthenaCommon.Constants import INFO from egammaRec.Factories import ToolFactory, getPropertyValue from CaloIdentifier import SUBCALO #--------------------------------------- # egamma specifics from egammaCaloTools.egammaCaloToolsFactories import CaloFillRectangularCluster # tool to collect topo clusters in cone from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__CaloClustersInConeTool CaloClustersInConeTool = ToolFactory(xAOD__CaloClustersInConeTool, CaloClusterLocation = "CaloCalTopoCluster") from AthenaCommon.GlobalFlags import globalflags isMC = not globalflags.DataSource()=='data' from IsolationCorrections.IsolationCorrectionsConf import CP__IsolationCorrectionTool as ICT IsoCorrectionTool = ToolFactory(ICT, name = "NewLeakageCorrTool", IsMC = isMC) # configuration for ED computation def configureEDCorrection(tool): """Configure tools and algorithm for energy density correction (only if doEnergyDensityCorrection = True)""" # Return if doEnergyDensityCorrection is false if not getPropertyValue(tool, 'doEnergyDensityCorrection'): return
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.Logging import logging from egammaRec.Factories import ToolFactory, AlgFactory #--------------------------------------- # tool to collect topo clusters in cone from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__CaloClustersInConeTool CaloClustersInConeTool = ToolFactory(xAOD__CaloClustersInConeTool, CaloClusterLocation="CaloCalTopoClusters") # tool for the leakage correction (std calo iso) from IsolationCorrections.IsolationCorrectionsConf import CP__IsolationCorrectionTool as ict leakTool = ict(name="LeakageCorrection") ToolSvc += leakTool # too to compute the calo iso from CaloIdentifier import SUBCALO from IsolationTool.IsolationToolConf import xAOD__CaloIsolationTool, xAOD__TrackIsolationTool CaloIsolationTool = ToolFactory(xAOD__CaloIsolationTool, name="CaloIsolationTool", CaloFillRectangularClusterTool=None, ClustersInConeTool=CaloClustersInConeTool, PFlowObjectsInConeTool=None, IsoLeakCorrectionTool=leakTool, saveOnlyRequestedCorrections=False, EMCaloNums=[], HadCaloNums=[], UseEMScale=True,
from AthenaCommon.Constants import INFO from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.Logging import logging from RecExConfig.RecFlags import rec from egammaRec.Factories import ToolFactory, AlgFactory, getPropertyValue #--------------------------------------- # egamma specifics from egammaCaloTools.egammaCaloToolsFactories import CaloFillRectangularCluster from AthenaCommon.GlobalFlags import globalflags isMC = not globalflags.DataSource() == 'data' from IsolationCorrections.IsolationCorrectionsConf import CP__IsolationCorrectionTool as ICT IsoCorrectionTool = ToolFactory(ICT, name="NewLeakageCorrTool") doPFlow = False PFlowObjectsInConeTool = None from RecExConfig.RecAlgsFlags import recAlgs if recAlgs.doEFlow(): doPFlow = True # tool to collect pflow objects in cone from PFlowUtils.PFlowUtilsConf import CP__RetrievePFOTool as RetrievePFOTool pfoTool = RetrievePFOTool() ToolSvc += pfoTool from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__PFlowObjectsInConeTool PFlowObjectsInConeTool = ToolFactory(xAOD__PFlowObjectsInConeTool,
#from LumiBlockComps.LuminosityToolDefault import LuminosityToolOnline #lumiTool = LuminosityToolOnline() #from LumiBlockComps.LumiBlockCompsConf import LumiBlockMuTool #ToolSvc += LumiBlockMuTool("LumiBlockMuTool") # Following tools have TrigEgamma factories from egammaTools.egammaToolsFactories import EMTrackMatchBuilder, EMFourMomBuilder, EMShowerBuilder from egammaTrackTools.egammaTrackToolsFactories import EMExtrapolationTools from egammaTools import egammaToolsConf from egammaTools.egammaToolsConf import EMPIDBuilder from CaloClusterCorrection import CaloClusterCorrectionConf as Cccc TrigCaloFillRectangularCluster = ToolFactory( Cccc.CaloFillRectangularCluster, name="trigegamma_CaloFillRectangularCluster", eta_size=5, phi_size=7, cells_name="") from AthenaCommon.GlobalFlags import globalflags isMC = not globalflags.DataSource() == 'data' from IsolationCorrections.IsolationCorrectionsConf import CP__IsolationCorrectionTool as ICT IsoCorrectionToolTrig = ToolFactory(ICT, name="NewLeakageCorrToolTrig", IsMC=isMC) from IsolationTool.IsolationToolConf import xAOD__CaloIsolationTool, xAOD__TrackIsolationTool from CaloIdentifier import SUBCALO TrigCaloIsolationTool = ToolFactory( xAOD__CaloIsolationTool, name="TrigEgammaCaloIsolationTool", doEnergyDensityCorrection=False,
AODContainerName = "TrackParticleCandidate", AODContainerNameGSF = "GSFTrackParticleCandidate", xAODContainerName = egammaKeys.inputTrackParticleKey(), xAODContainerNameGSF = egammaKeys.TrackParticleKey(), TrackMapName = "GSFTrackAssociation") #Vertex converter from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__VertexCnvAlg VertexCnvAlg = AlgFactory(xAODMaker__VertexCnvAlg, name = "egVertex2xAOD", AODContainerName="AllPhotonsVxCandidates", xAODContainerName=egammaKeys.ConversionKey(), TPContainerName=egammaKeys.TrackParticleKey()) #Electron Converter Electrons2xAODTool=ToolFactory(xAODMaker__ElectronCnvTool, name = "Electrons2xAODTool") ElectronCnvAlg = AlgFactory(xAODMaker__ElectronCnvAlg, name = "Electrons2xAOD", CnvTool = Electrons2xAODTool, xAODContainerName = egammaKeys.ElectronKey(), xAODContainerFrwdName = egammaKeys.FwdElectronKey()) #Photon Converter Photons2xAODTool = ToolFactory(xAODMaker__PhotonCnvTool, name="Photons2xAODTool") PhotonCnvAlg = AlgFactory(xAODMaker__PhotonCnvAlg, name = "Photons2xAOD", CnvTool = Photons2xAODTool, xAODContainerName = egammaKeys.PhotonKey())
swTool, make_CaloSwCorrections( clName, suffix='EGSuperCluster', corrlist=[[rfac, 'v5'], [etaoff_b1, 'v5'], [etaoff_e1, 'v5'], [etaoff_b2, 'v5'], [etaoff_e2, 'v5'], [phioff_b2, 'v5data'], [phioff_e2, 'v5data'], [update], [time], [listBadChannel]], cells_name=egammaKeys.caloCellKey()))) #End of super cluster position only corrections #------------------------- egammaSwTool = ToolFactory(egammaToolsConf.egammaSwTool, postInit=[configureClusterCorrections]) from egammaMVACalib import egammaMVACalibConf egammaMVATool = ToolFactory( egammaMVACalibConf.egammaMVATool, folder=jobproperties.egammaRecFlags.calibMVAVersion()) EMClusterTool = ToolFactory( egammaToolsConf.EMClusterTool, OutputClusterContainerName=egammaKeys.outputClusterKey(), OutputTopoSeededClusterContainerName=egammaKeys.outputTopoSeededClusterKey( ), ElectronContainerName=egammaKeys.outputElectronKey(), PhotonContainerName=egammaKeys.outputPhotonKey(), ClusterCorrectionToolName=FullNameWrapper(egammaSwTool), doSuperCluster=jobproperties.egammaRecFlags.doSuperclusters(),
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration __doc__ = """Tool and service factories to instantiate MVA calibration""" __author__ = "Jovan Mitrevski" from egammaRec.Factories import ToolFactory, ServiceFactory from egammaMVACalib import egammaMVACalibConf from egammaRec.egammaRecFlags import jobproperties from xAODEgamma.xAODEgammaParameters import xAOD electronMVATool = ToolFactory( egammaMVACalibConf.egammaMVACalibTool, name="electronMVATool", ParticleType=xAOD.EgammaParameters.electron, folder=jobproperties.egammaRecFlags.calibMVAVersion()) unconvPhotonMVATool = ToolFactory( egammaMVACalibConf.egammaMVACalibTool, name="unconvPhotonMVATool", ParticleType=xAOD.EgammaParameters.unconvertedPhoton, folder=jobproperties.egammaRecFlags.calibMVAVersion()) convertedPhotonMVATool = ToolFactory( egammaMVACalibConf.egammaMVACalibTool, name="convertePhotonMVATool", ParticleType=xAOD.EgammaParameters.convertedPhoton, folder=jobproperties.egammaRecFlags.calibMVAVersion()) egammaMVASvc = ServiceFactory(egammaMVACalibConf.egammaMVASvc, ElectronTool=electronMVATool,
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration __doc__ = """ToolFactories to instantiate all egammaCaloTools with default configuration""" __author__ = "Bruno Lenzi , Christos Anastopoulos" from egammaRec.Factories import ToolFactory from egammaTrackTools import egammaTrackToolsConf from egammaTools.egammaExtrapolators import (egammaCaloExtrapolator, egammaExtrapolator) import AthenaCommon.CfgMgr as CfgMgr EMLastCaloExtensionTool = ToolFactory(CfgMgr.Trk__ParticleCaloExtensionTool, name="EMLastCaloExtensionTool", Extrapolator=egammaCaloExtrapolator, ParticleType="electron") EMParticleCaloExtensionTool = ToolFactory( CfgMgr.Trk__ParticleCaloExtensionTool, name="EMParticleCaloExtensionTool", Extrapolator=egammaCaloExtrapolator, ParticleType="electron", StartFromPerigee=True) EMExtrapolationTools = ToolFactory( egammaTrackToolsConf.EMExtrapolationTools, name="EMExtrapolationTools", LastCaloExtensionTool=EMLastCaloExtensionTool, PerigeeCaloExtensionTool=EMParticleCaloExtensionTool, Extrapolator=egammaExtrapolator, useCaching=False, useLastCaching=False)
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from egammaTools import egammaToolsConf from egammaRec.Factories import ToolFactory from egammaRec import egammaKeys from CaloTools.CaloToolsConf import CaloAffectedTool egammaOQFlagsBuilder = ToolFactory(egammaToolsConf.egammaOQFlagsBuilder, QCellCut=4000., QCellHECCut=60000., QCellSporCut=4000., LArQCut=0.8, TCut=10., TCutVsE=2., RcellCut=0.8, CellsName=egammaKeys.caloCellKey(), affectedTool=CaloAffectedTool())
[phioff_e2, 'v5data'], [update], [time], [listBadChannel]], cells_name=egammaKeys.caloCellKey()))) def configureClusterCorrections(swTool): "Add attributes ClusterCorrectionToolsXX to egammaSwTool object" configureFixedSizeClusterCorrections(swTool) if jobproperties.egammaRecFlags.doSuperclusters(): configureSuperClusterCorrections(swTool) egammaSwTool = ToolFactory(egammaToolsConf.egammaSwTool, postInit=[configureClusterCorrections]) egammaSwSuperClusterTool = ToolFactory(egammaToolsConf.egammaSwTool, postInit=[configureSuperClusterCorrections]) EMClusterTool = ToolFactory( egammaToolsConf.EMClusterTool, OutputClusterContainerName=egammaKeys.outputClusterKey(), OutputTopoSeededClusterContainerName=egammaKeys.outputTopoSeededClusterKey(), ClusterCorrectionTool=egammaSwTool, doSuperCluster=jobproperties.egammaRecFlags.doSuperclusters(), MVACalibSvc=egammaMVASvc )
try: return int(metadata['SimBarcodeOffset']) except Exception: print('Could not retrieve SimBarcodeOffset from' '/Simulation/Parameters, leaving at 200k') return int(offset) def getSimBarcodeOffset1(): "Return the simulation barcode offset for G4 particles from metadata + 1" return getSimBarcodeOffset() + 1 EMClassifierParticleCaloExtensionTool = ToolFactory( CfgMgr.Trk__ParticleCaloExtensionTool, name="EMClassifierParticleCaloExtensionTool", Extrapolator=egammaCaloExtrapolator) EMMCTruthClassifier = ToolFactory( MCTruthClassifierConf.MCTruthClassifier, name='EMMCTruthClassifier', ParticleCaloExtensionTool=EMClassifierParticleCaloExtensionTool, barcodeG4Shift=FcnWrapper(getSimBarcodeOffset1)) egammaTruthAssociationAlg = AlgFactory( egammaAlgsConf.egammaTruthAssociationAlg, ClusterContainerName=egammaKeys.outputClusterKey(), ElectronContainerName=egammaKeys.outputElectronKey(), PhotonContainerName=egammaKeys.outputPhotonKey(), FwdElectronContainerName=egammaKeys.outputFwdElectronKey(), TruthEventContainerName=egammaKeys.truthEventKey(),
from CaloClusterCorrection import CaloClusterCorrectionConf as Cccc __doc__ = """ToolFactories to instantiate all egammaCaloTools with default configuration""" __author__ = "Bruno Lenzi" from egammaRec.Factories import ToolFactory from egammaCaloTools import egammaCaloToolsConf from egammaRec import egammaKeys # --------------------------------------- egammaShowerShape = ToolFactory( egammaCaloToolsConf.egammaShowerShape, # Samplings to execute ExecAllVariables=True, ExecPreSampler=True, ExecEMFirst=True, ExecEMSecond=True, ExecEMThird=True, ExecEMCombined=True) CaloFillRectangularCluster = ToolFactory( Cccc.CaloFillRectangularCluster, name="egamma_CaloFillRectangularCluster", eta_size=5, phi_size=7, cells_name=egammaKeys.caloCellKey()) egammaIso = ToolFactory(egammaCaloToolsConf.egammaIso) egammaCheckEnergyDepositTool = ToolFactory(
from TrigEgammaEmulationTool.TrigEgammaEmulationToolConf import Trig__TrigEgammaL2ElectronSelectorTool from AthenaCommon.SystemOfUnits import GeV from TrigEgammaEmulationTool.TrigEgammaEmulationToolConfig import OutputLevel # L2 Calo step configurations # Only Up to 22 GeV from TrigEgammaHypo.TrigL2CaloHypoCutDefs import L2CaloCutMaps # define eta bins EtaBins = [0.00, 0.60, 0.80, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] theCutMaps = L2CaloCutMaps(22) # create L2Calo tool EgammaL2CaloLooseEmulator = ToolFactory( Trig__TrigEgammaL2CaloSelectorTool, OutputLevel=OutputLevel, name="TrigEgammaL2CaloLooseEmulator", HADETthr=theCutMaps.MapsHADETthr["loose"], CARCOREthr=theCutMaps.MapsCARCOREthr["loose"], CAERATIOthr=theCutMaps.MapsCAERATIOthr["loose"], EtaBins=EtaBins, dETACLUSTERthr=0.1, dPHICLUSTERthr=0.1, ET2thr=90.0 * GeV, F1thr=0.005) #******************************************************************************** # VeryLoose EgammaL2CaloVeryLooseEmulator = EgammaL2CaloLooseEmulator.copy( name="TrigEgammaL2CaloVeryLooseEmulator", OutputLevel=OutputLevel, HADETthr=theCutMaps.MapsHADETthr['vloose'], CARCOREthr=theCutMaps.MapsCARCOREthr['vloose'], CAERATIOthr=theCutMaps.MapsCAERATIOthr['vloose'])
__doc__ = "ToolFactory to instantiate EMTrackMatchBuilder with default configuration" __author__ = "Bruno Lenzi" import egammaToolsConf from egammaRec.Factories import FcnWrapper, ToolFactory from egammaRec import egammaKeys from RecExConfig.RecFlags import rec from AthenaCommon.BeamFlags import jobproperties from egammaTrackTools.egammaTrackToolsFactories import EMExtrapolationTools def appendToEMTrackMatchBuilder(tool): "add track to calo tool (like it was done in egammaGetter)" tool += EMExtrapolationTools() EMTrackMatchBuilder = ToolFactory( egammaToolsConf.EMTrackMatchBuilder, postInit=[appendToEMTrackMatchBuilder], TrackParticlesName=egammaKeys.outputTrackParticleKey(), ExtrapolationTool=EMExtrapolationTools, broadDeltaEta=0.1, #candidate match is done in 2 times this so +- 0.2 broadDeltaPhi=0.15, #candidate match is done in 2 times this so +- 0.3 useLastMeasurement=False, #important for GSF!!! useCandidateMatch=True, useScoring=True, SecondPassRescale=True, UseRescaleMetric=True, isCosmics=(jobproperties.Beam.beamType() == "cosmics"))
def getCaloRingerPhotonSelectorsBuilder(): "Return the Photon Selectors" #if caloRingerFlags.doPhotonIdentification: # from CaloRingerTools.CaloRingerSelectorsBuilders import CaloRingerPhotonSelectorsBuilder # return CaloRingerPhotonSelectorBuilder().getAllSelectorHandles() #else: return PublicToolHandleArray([]) from CaloRingerAlgs.CaloRingerAlgorithmBuilder import checkBuildElectronCaloRings from CaloRingerAlgs.CaloRingerAlgorithmBuilder import checkDoElectronIdentification CaloRingerElectronsReaderTool = ToolFactory( CaloRingerToolsConf.Ringer__CaloRingerElectronsReader, name="CaloRingerElectronsReaderTool", inputKey=CaloRingerKeys.inputElectronKey(), crBuilder=FcnWrapper(getElectronCaloRingsBuilder), builderAvailable=FcnWrapper(checkBuildElectronCaloRings), ElectronSelectors=FcnWrapper(getCaloRingerElectronSelectorsBuilder), selectorsAvailable=FcnWrapper(checkDoElectronIdentification), ) from CaloRingerAlgs.CaloRingerAlgorithmBuilder import checkBuildPhotonCaloRings from CaloRingerAlgs.CaloRingerAlgorithmBuilder import checkDoPhotonIdentification CaloRingerPhotonsReaderTool = ToolFactory( CaloRingerToolsConf.Ringer__CaloRingerPhotonsReader, name="CaloRingerPhotonsReaderTool", inputKey=CaloRingerKeys.inputPhotonKey(), crBuilder=FcnWrapper(getPhotonCaloRingsBuilder), builderAvailable=FcnWrapper(checkBuildPhotonCaloRings), PhotonSelectors=FcnWrapper(getCaloRingerPhotonSelectorsBuilder), #selectorsAvailable = FcnWrapper(checkDoPhotonIdentification)
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration __doc__ = "jobOptions to test EGammaAmbiguityTool" __author__ = "Bruno Lenzi" import AthenaPoolCnvSvc.ReadAthenaPool # EventSelector from AthenaCommon.AppMgr import ServiceMgr as svcMgr svcMgr.EventSelector.InputCollections = [ 'root://eosatlas.cern.ch//eos/atlas/atlasdatadisk/rucio/valid3/24/c7/AOD.05062229._000129.pool.root.1' ] # Redefine the function InputFileNames to make autoconfiguration work # outside RecExCommon from RecExConfig import RecoFunctions RecoFunctions.InputFileNames = lambda: svcMgr.EventSelector.InputCollections from RecExConfig.AutoConfiguration import ConfigureFromListOfKeys ConfigureFromListOfKeys(['everything']) ################### from egammaRec.Factories import ToolFactory, AlgFactory # Add EGammaAmbiguityTool to ToolSvc from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import EGammaAmbiguityTool ToolFactory(EGammaAmbiguityTool)() # Add algorithm to AlgSequence from ElectronPhotonSelectorTools.TestEGammaAmbiguityTool import TestEGammaAmbiguityAlg AlgFactory(TestEGammaAmbiguityAlg)(doAdd=True)
#TrkIsoCfg = CfgMgr.xAOD__TrackIsolationTool('TrigEgammaTrackIsolationTool') #TrkIsoCfg.TrackSelectionTool.maxZ0SinTheta = 3. #TrkIsoCfg.TrackSelectionTool.minPt = 1000. #TrkIsoCfg.TrackSelectionTool.CutLevel = "Loose" #********************************************************************** # EFCalo from TrigEgammaEmulationTool.TrigEgammaEmulationToolConf import Trig__TrigEgammaEFCaloSelectorTool EgammaEFCaloDefaultEmulator = ToolFactory( Trig__TrigEgammaEFCaloSelectorTool, name="TrigEgammaEFCaloEmulator", OutputLevel=OutputLevel, ElectronCaloPPSelector=[ ToolSvc.AsgElectronIsEMTightCaloSelector, ToolSvc.AsgElectronIsEMMediumCaloSelector, ToolSvc.AsgElectronIsEMLooseCaloSelector, ToolSvc.AsgElectronIsEMVLooseCaloSelector ], ElectronCaloLHSelector=[ ToolSvc.AsgElectronLHTightCaloSelector, ToolSvc.AsgElectronLHMediumCaloSelector, ToolSvc.AsgElectronLHLooseCaloSelector, ToolSvc.AsgElectronLHVLooseCaloSelector ]) # EF Electron from TrigEgammaEmulationTool.TrigEgammaEmulationIsolationConfig import createIsoToolElectronSelector IsolationSelectors = createIsoToolElectronSelector() from TrigEgammaEmulationTool.TrigEgammaEmulationToolConf import Trig__TrigEgammaEFElectronSelectorTool EgammaEFElectronDefaultEmulator = ToolFactory( Trig__TrigEgammaEFElectronSelectorTool,
# ------------------------------------------------------------ # # ----------- loading the selection tools for Calo Seeded Brem # # ------------------------------------------------------------ #We are building ROIs corresponding (ideally) to high pt Bs # # --- load the tool to check the energy deposits and select clusters # from egammaRec.Factories import ToolFactory from egammaCaloTools import egammaCaloToolsConf egammaCaloClusterHadROISelector = ToolFactory( egammaCaloToolsConf.egammaCaloClusterSelector, name = 'caloClusterHadROISelector', egammaCheckEnergyDepositTool = "", ClusterEtCut = 150e3 ) # # --- get the builder tool # from InDetCaloClusterROIBuilder.InDetCaloClusterROIBuilderConf import InDet__CaloClusterROI_Builder InDetCaloClusterROIBuilder = InDet__CaloClusterROI_Builder(name = "InDetCaloClusterROIBuilder") if (InDetFlags.doPrintConfigurables()): print (InDetCaloClusterROIBuilder) #
#ToolSvc += TMEFTrackInCaloTools #from IsolationTool.IsolationToolConf import xAOD__CaloIsolationTool #TMEFCaloIsolationTool = xAOD__CaloIsolationTool(name='MuonIsoCaloIsolationTool', # ExtrapolTrackToCaloTool = TMEFTrackInCaloTools) #ToolSvc += TMEFCaloIsolationTool from egammaRec.Factories import ToolFactory, AlgFactory, getPropertyValue from egammaCaloTools.egammaCaloToolsFactories import CaloFillRectangularCluster from AthenaCommon.GlobalFlags import globalflags isMC = not globalflags.DataSource() == 'data' from IsolationCorrections.IsolationCorrectionsConf import CP__IsolationCorrectionTool as ICT IsoCorrectionTool = ToolFactory(ICT, name="NewLeakageCorrTool", IsMC=isMC) from PFlowUtils.PFlowUtilsConf import CP__RetrievePFOTool as RetrievePFOTool pfoTool = RetrievePFOTool() ToolSvc += pfoTool from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__PFlowObjectsInConeTool PFlowObjectsInConeTool = ToolFactory(xAOD__PFlowObjectsInConeTool, name="PFlowObjectsInConeTool", RetrievePFOTool=pfoTool) from CaloIdentifier import SUBCALO from IsolationTool.IsolationToolConf import xAOD__CaloIsolationTool, xAOD__TrackIsolationTool # tool to collect topo clusters in cone from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__CaloClustersInConeTool
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration __doc__ = """ToolFactory to instantiate all EMShowerBuilder with default configuration""" __author__ = "Bruno Lenzi" from egammaTools import egammaToolsConf from egammaRec.Factories import ToolFactory from egammaRec import egammaKeys from egammaCaloTools.egammaCaloToolsFactories import (egammaShowerShape, egammaIso) from CaloIdentifier import SUBCALO EMShowerBuilder = ToolFactory( egammaToolsConf.EMShowerBuilder, CellsName=egammaKeys.caloCellKey(), CaloNums=[SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.TILE], ShowerShapeTool=egammaShowerShape, HadronicLeakageTool=egammaIso, Print=False)
# ----------- loading the selection tools for Calo Seeded Brem # # ------------------------------------------------------------ # # --- load the tool to check the energy deposits and select clusters # from egammaRec.Factories import ToolFactory from egammaCaloTools.egammaCaloToolsFactories import egammaCheckEnergyDepositTool from egammaCaloTools import egammaCaloToolsConf egammaCaloClusterROISelector = ToolFactory( egammaCaloToolsConf.egammaCaloClusterSelector, name='caloClusterROISelector', egammaCheckEnergyDepositTool=egammaCheckEnergyDepositTool, EMEtCut=2250., EMEtSplittingFraction=0.7, EMFCut=0.7, RetaCut=0.65, HadLeakCut=0.15) # # --- get the builder tool # from InDetCaloClusterROIBuilder.InDetCaloClusterROIBuilderConf import InDet__CaloClusterROI_Builder InDetCaloClusterROIBuilder = InDet__CaloClusterROI_Builder( name="InDetCaloClusterROIBuilder", EMEnergyOnly=True) if (InDetFlags.doPrintConfigurables()): printfunc(InDetCaloClusterROIBuilder) #
__doc__ = """ToolFactory to instantiate egammaSelectedTrackCopy with default configuration""" __author__ = "Christos" from egammaAlgs import egammaAlgsConf from egammaRec.Factories import ToolFactory, AlgFactory # to set jobproperties.egammaRecFlags from egammaRec.egammaRecFlags import jobproperties from InDetRecExample.InDetKeys import InDetKeys from egammaTrackTools.egammaTrackToolsFactories import ( EMExtrapolationTools, EMExtrapolationToolsCommonCache) from egammaCaloTools import egammaCaloToolsConf egammaCaloClusterGSFSelector = ToolFactory( egammaCaloToolsConf.egammaCaloClusterSelector, name='caloClusterGSFSelector', EMEtCut=2250., EMEtSplittingFraction=0.7, EMFCut=0.5) egammaSelectedTrackCopy = AlgFactory( egammaAlgsConf.egammaSelectedTrackCopy, name='egammaSelectedTrackCopy', ExtrapolationTool=EMExtrapolationTools, ExtrapolationToolCommonCache=EMExtrapolationToolsCommonCache, ClusterContainerName=jobproperties.egammaRecFlags. egammaTopoClusterCollection(), TrackParticleContainerName=InDetKeys.xAODTrackParticleContainer(), egammaCaloClusterSelector=egammaCaloClusterGSFSelector)
import logging mlog = logging.getLogger('TrigEgammaMVACalibFactories') from egammaMVACalib import egammaMVACalibConf from TriggerMenu.egamma.EgammaSliceFlags import EgammaSliceFlags mlog.info("MVA version version %s" % EgammaSliceFlags.calibMVAVersion()) mlog.info("Cluster Correction version %s" % EgammaSliceFlags.clusterCorrectionVersion()) EgammaSliceFlags.calibMVAVersion.set_On() from xAODEgamma.xAODEgammaParameters import xAOD TrigElectronMVATool = ToolFactory(egammaMVACalibConf.egammaMVACalibTool, name="TrigElectronMVATool", ParticleType=xAOD.EgammaParameters.electron, folder=EgammaSliceFlags.calibMVAVersion(), use_layer_corrected=False) TrigPhotonMVATool = ToolFactory( egammaMVACalibConf.egammaMVACalibTool, name="TrigPhotonMVATool", ParticleType=xAOD.EgammaParameters.unconvertedPhoton, folder=EgammaSliceFlags.calibMVAVersion(), use_layer_corrected=False) TrigEgammaMVASvc = ServiceFactory(egammaMVACalibConf.egammaMVASvc, name="TrigEgammaMVASvc", ElectronTool=TrigElectronMVATool, UnconvertedPhotonTool=TrigPhotonMVATool)
class VertexFinderToolInstance(FcnWrapper): def __call__(self): # # Configured conversion vertex reconstruction cuts # from InDetRecExample.ConfiguredSecondaryVertexCuts import ConfiguredSecondaryVertexCuts egammaConversionVertexCuts = ConfiguredSecondaryVertexCuts( mode="EGammaPileUp") from InDetRecExample.ConfiguredSecVertexFinding import ConfiguredSecVertexFinding theemvertexfindertool = ConfiguredSecVertexFinding( prefix="egammaConversion", VertexCuts=egammaConversionVertexCuts, TrackParticles=egammaKeys.outputTrackParticleKey(), SecVertices=egammaKeys.outputConversionKey(), Extrapolator=egammaExtrapolator(), TrackSummaryTool=egammaInDetTrackSummaryTool(), printConfig=False) return theemvertexfindertool.toolInstance() EMVertexBuilder = ToolFactory( egammaToolsConf.EMVertexBuilder, InputTrackParticleContainerName=egammaKeys.outputTrackParticleKey(), OutputConversionContainerName=egammaKeys.outputConversionKey(), VertexFinderTool=VertexFinderToolInstance(), ExtrapolationTool=EMExtrapolationTools)
LumiOnlineTool = LuminosityToolOnline("OnlLuminosityTool") if not hasattr(ToolSvc, LumiOnlineTool.getName()): ToolSvc += LumiOnlineTool #***************************************************************************** # L1Calo from TrigEgammaEmulationTool.TrigEgammaEmulationToolConf import Trig__TrigEgammaL1SelectorTool EgammaL1Emulator = ToolFactory( Trig__TrigEgammaL1SelectorTool, name="TrigEgammaL1Emulator", WPNames=['Tight', 'Medium', 'Loose'], # [Default, Tight , Medium, Loose ] HadCoreCutMin=[1.0, 1.0, 1.0, 1.0], HadCoreCutOff=[-0.2, -0, 2, -0.2, -0.2], HadCoreSlope=[1 / 23., 1 / 23., 1 / 23., 1 / 23.], EmIsolCutMin=[2.0, 1.0, 1.0, 1.5], EmIsolCutOff=[-1.8, -2.6, -2.0, -1.8], EmIsolSlope=[1 / 8., 1 / 8., 1 / 8., 1 / 8.], IsolCutMax=50, OutputLevel=OutputLevel) #***************************************************************************** # L2 staff (all Asgs will be imported from the current relase) from TrigEgammaEmulationTool.TrigEgammaEmulationToolConf import Trig__TrigEgammaL2SelectorTool from TrigEgammaEmulationTool.TrigEgammaEmulationL2Config import EgammaL2CaloVeryLooseEmulator, EgammaL2CaloLooseEmulator,\ EgammaL2CaloMediumEmulator, EgammaL2CaloTightEmulator, EgammaL2ElectronEmulator from TrigEgammaEmulationTool.TrigEgammaEmulationL2Config import EgammaL2RingerVeryLooseEmulator, EgammaL2RingerLooseEmulator,\ EgammaL2RingerMediumEmulator, EgammaL2RingerTightEmulator
def __init__(self): ConfigureEgammaCaloRings.__init__(self) self.CaloRingsContainerName = CaloRingerKeys.outputPhotonCaloRingsKey() self.RingSetContainerName = CaloRingerKeys.outputPhotonRingSetsKey() def __call__(self, crBuilder): ConfigureEgammaCaloRings.__call__(self, crBuilder) from CaloRingerAlgs.CaloRingerFlags import caloRingerFlags minEnergy = caloRingerFlags.minPhotonEnergy() if minEnergy is not None: from AthenaCommon.SystemOfUnits import GeV crBuilder.MinPartEnergy = minEnergy * GeV ElectronCaloRingsBuilder = ToolFactory( CaloRingerToolsConf.Ringer__CaloRingsBuilder, name="ElectronCaloRingsBuilder", postInit=[ConfigureElectronCaloRings().__call__]) ElectronCaloAsymRingsBuilder = ToolFactory( CaloRingerToolsConf.Ringer__CaloAsymRingsBuilder, name="ElectronCaloAsymRingsBuilder", postInit=[ ConfigureElectronCaloRings().__call__, AsymRings(doEtaAxesDivision=True, doPhiAxesDivision=True).__call__ ]) PhotonCaloRingsBuilder = ToolFactory( CaloRingerToolsConf.Ringer__CaloRingsBuilder, name="PhotonCaloRingsBuilder", postInit=[ConfigurePhotonCaloRings().__call__])