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 configure(self): "This method will be called when object is initialized" mlog = logging.getLogger( 'CaloRingerMetaDataBuilder::configure:%s:' \ % self.__class__.__name__.replace( ".", '_' ) ) mlog.info('entering') # Instantiate the MetaDataWriter: try: MetaDataWriter = AlgFactory( CaloRingerAlgsConf.Ringer__xAODRingSetConfWriter, name="xAODRingSetConfWriter", postInit=[ self._setCaloRingsBuilderTools, self._setCaloRingerConfOutputs ]) self._confWriter = MetaDataWriter() # Check for existing output: self.checkExistingOutput() if not self.ignoreExistingDataObject() and self._overwriting: raise RuntimeError(( "Already existing input will be overwriten and not set flag to" "ignoreExistingDataObject.")) except Exception: removeFromTopSequence(self._confWriter) mlog.error(("Could not get handle to xAODRingSetConfWriter." " Reason:\n %s"), traceback.format_exc()) treatException(("Couldn't set xAODRingSetConfWriter." " Reason:\n%s") % traceback.format_exc()) return False return True
def TrigElectronIsoBuilderCfg(name='TrigElectronIsolationBuilder'): TrigElectronIsolationBuilder = AlgFactory( IsolationBuilder, name=name, doAdd=False, ElectronCollectionContainerName='HLT_egamma_Electrons', CaloCellIsolationTool=None, CaloTopoIsolationTool=None, PFlowIsolationTool=None, TrackIsolationTool=TrigTrackIsolationTool, FeIsoTypes=[[]], FeCorTypes=[[]], FeCorTypesExtra=[[]], ElIsoTypes=[[isoPar.ptcone20]], ElCorTypes=[[]], ElCorTypesExtra=[[]], ) return TrigElectronIsolationBuilder()
def precisionCaloRecoSequence(DummyFlag, RoIs): log.debug('DummyFlag = %s', str(DummyFlag)) log.debug('RoIs = %s', RoIs) egammaTopoClusterCopier = AlgFactory( egammaAlgsConf.egammaTopoClusterCopier, name='TrigEgammaTopoClusterCopier' + RoIs, InputTopoCollection="caloclusters", OutputTopoCollection=precisionCaloMenuDefs.precisionCaloClusters, OutputTopoCollectionShallow="tmp_" + precisionCaloMenuDefs.precisionCaloClusters, doAdd=False) from TrigT2CaloCommon.CaloDef import HLTRoITopoRecoSequence (precisionRecoSequence, caloclusters) = RecoFragmentsPool.retrieve(HLTRoITopoRecoSequence, RoIs) algo = egammaTopoClusterCopier() algo.InputTopoCollection = caloclusters precisionRecoSequence += algo sequenceOut = algo.OutputTopoCollection return (precisionRecoSequence, sequenceOut)
def TrigTopoEgammaElectronCfg(name='topoEgammaBuilder_TrigElectrons'): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram monTool = GenericMonitoringTool("MonTool_topoEgammaBuilder") monTool.Histograms = [ defineHistogram('EldeltaEta',type='TH1F', title='#Delta#eta', path='EXPERT',xbins=80, xmin=-0.01,xmax=0.01), defineHistogram('EldeltaPhi',type='TH1F', title='#Delta#phi', path='EXPERT',xbins=80, xmin=-0.01, xmax=0.01), defineHistogram('EleT', type='TH1F', title='p#_{T} [GeV]', path='EXPERT',xbins=80, xmin=0., xmax=100)] mlog = logging.getLogger("TrigElectronFactories") mlog.info('Starting configuration') TrigTopoEgammaElectron = AlgFactory( egammaAlgsConf.topoEgammaBuilder, name = name, SuperElectronRecCollectionName = TrigEgammaKeys.SuperElectronRecCollectionName, SuperPhotonRecCollectionName = TrigEgammaKeys.SuperPhotonRecCollectionName, ElectronOutputName = TrigEgammaKeys.outputElectronKey, PhotonOutputName = TrigEgammaKeys.outputPhotonKey, AmbiguityTool = EGammaAmbiguityTool, EMClusterTool = TrigEMClusterTool, EMShowerTool=TrigEMShowerBuilder, egammaTools = FcnWrapper(TrigEgammaDecorationTools), doAdd = False, doPhotons = False, doElectrons = True, #MonTool = monTool ) return TrigTopoEgammaElectron()
# 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)
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration __doc__ = """ToolFactory to instantiate the two supercluster builders with default configuration""" __author__ = "Jovan Mitrevski" from egammaAlgs import egammaAlgsConf from egammaRec.Factories import AlgFactory from egammaRec import egammaKeys from egammaTools.egammaToolsFactories import EGammaAmbiguityTool topoEgammaBuilder = AlgFactory( egammaAlgsConf.topoEgammaBuilder, name='topoEgammaBuilder', SuperElectronRecCollectionName=egammaKeys.ElectronSuperRecKey(), SuperPhotonRecCollectionName=egammaKeys.PhotonSuperRecKey(), ElectronOutputName=egammaKeys.outputElectronKey(), PhotonOutputName=egammaKeys.outputPhotonKey(), AmbiguityTool=EGammaAmbiguityTool)
# ...but the corrections are different for El/Ph vs Fwd IsoCorEG = [[isoPar.core57cells, isoPar.ptCorrection, isoPar.pileupCorrection]] IsoCorFe = [[isoPar.coreCone, isoPar.pileupCorrection]] from IsolationAlgs.IsolationAlgsConf import IsolationBuilder isoAODFixBuilderElectron = AlgFactory( IsolationBuilder, name="IsolationBuilderElectron", ElectronCollectionContainerName="Electrons", PhotonCollectionContainerName="", MuonCollectionContainerName="", FwdElectronCollectionContainerName="", CaloCellIsolationTool=None, CaloTopoIsolationTool=CaloIsolationTool, PFlowIsolationTool=None, TrackIsolationTool=None, FeIsoTypes=[[]], FeCorTypes=[[]], EgIsoTypes=IsoTypesEG, EgCorTypes=IsoCorEG, MuIsoTypes=[[]], MuCorTypes=[[]], IsAODFix=True, LeakageTool=None, IsolateEl=True) isoAODFixBuilderPhoton = AlgFactory(IsolationBuilder, name="IsolationBuilderPhoton", ElectronCollectionContainerName="", PhotonCollectionContainerName="Photons", MuonCollectionContainerName="",
IsoCorFe = [[isoPar.coreCone, isoPar.pileupCorrection]] if doPFlow: IsoTypes.append( [isoPar.neflowisol20, isoPar.neflowisol30, isoPar.neflowisol40]) IsoCorEg.append([isoPar.coreCone, isoPar.pileupCorrection]) IsoCorMu.append([isoPar.coreCone, isoPar.pileupCorrection]) from IsolationAlgs.IsolationAlgsConf import IsolationBuilder isoBuilder = AlgFactory(IsolationBuilder, name="IsolationBuilder", CaloCellIsolationTool=CaloIsolationTool, CaloTopoIsolationTool=CaloIsolationTool, PFlowIsolationTool=CaloIsolationTool, TrackIsolationTool=TrackIsolationTool, FeIsoTypes=[[]] if not rec.doEgamma() else IsoTypesFe, FeCorTypes=IsoCorFe, EgIsoTypes=[[]] if not rec.doEgamma() else IsoTypes, EgCorTypes=IsoCorEg, MuIsoTypes=[[]] if not rec.doMuon() else IsoTypes, MuCorTypes=IsoCorMu, LeakageTool=None, OutputLevel=3) from RecExConfig.Configured import Configured class isoGetter(Configured): def configure(self): mlog = logging.getLogger('isoGetter.py::configure:') mlog.info('entering')
def configure(self): mlog = logging.getLogger ('egammaGetter.py::configure:') mlog.info('entering') if doSuperclusters() : egammaBuilder = AlgFactory(egammaRecConf.topoEgammaBuilder, name = 'egamma', # Keys ElectronOutputName = egammaKeys.outputElectronKey(), PhotonOutputName = egammaKeys.outputPhotonKey(), #Super Cluster Tools TopoClusterCopier = egammaTopoClusterCopier, electronSuperClusterBuilder = electronSuperClusterBuilder, photonSuperClusterBuilder = photonSuperClusterBuilder, InputTopoClusterContainerName = egammaRecFlags.egammaTopoClusterCollection(), # Builder tools BremCollectionBuilderTool = EMBremCollectionBuilder, TrackMatchBuilderTool = EMTrackMatchBuilder, VertexBuilder = EMVertexBuilder if doConversions() else None, ConversionBuilderTool = EMConversionBuilder if doConversions() else None, AmbiguityTool = EGammaAmbiguityTool, # Decoration tools egammaTools = FcnWrapper(egammaDecorationTools), ElectronTools = FcnWrapper(electronDecorationTools), PhotonTools = FcnWrapper(photonDecorationTools), # Flags and other properties # Track matching depending if ID is on/off doTrackMatching = DetFlags.detdescr.ID_on(), # conversions building/matching depending if ID is on/off doVertexCollection=doConversions(), doConversions = doConversions() ) else : egammaBuilder = AlgFactory(egammaRecConf.egammaBuilder, name = 'egamma', # Keys ElectronOutputName = egammaKeys.outputElectronKey(), PhotonOutputName = egammaKeys.outputPhotonKey(), TopoSeededClusterContainerName = getTopoSeededCollectionName(), # Builder tools BremCollectionBuilderTool = EMBremCollectionBuilder, TrackMatchBuilderTool = EMTrackMatchBuilder, VertexBuilder = EMVertexBuilder if doConversions() else None, ConversionBuilderTool = EMConversionBuilder if doConversions() else None, AmbiguityTool = EGammaAmbiguityTool, # Decoration tools egammaTools = FcnWrapper(egammaDecorationTools), ElectronTools = FcnWrapper(electronDecorationTools), PhotonTools = FcnWrapper(photonDecorationTools), # Flags and other properties # Track matching depending if ID is on/off doTrackMatching = DetFlags.detdescr.ID_on(), # conversions building/matching depending if ID is on/off doVertexCollection=doConversions(), doConversions = doConversions(), # clusterEnergyCut = 10*MeV, doTopoSeededPhotons = egammaRecFlags.doTopoCaloSeeded() ) # configure egamma here: try: self._egammaBuilderHandle = egammaBuilder() except Exception: mlog.error("could not get handle to egamma") import traceback print traceback.format_exc() return False print self._egammaBuilderHandle return True
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration __doc__ = """ ToolFactory to instantiate egammaTopoClusterCopier with default configuration""" __author__ = "Jovan Mitrevski" from egammaAlgs import egammaAlgsConf from egammaRec.Factories import AlgFactory from egammaRec.egammaRecFlags import jobproperties egammaTopoClusterCopier = AlgFactory( egammaAlgsConf.egammaTopoClusterCopier, name='egammaTopoClusterCopier', InputTopoCollection=jobproperties.egammaRecFlags. inputTopoClusterCollection(), OutputTopoCollection=jobproperties.egammaRecFlags. egammaTopoClusterCollection(), OutputTopoCollectionShallow="tmp_" + jobproperties.egammaRecFlags.egammaTopoClusterCollection())
TightElectronSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMTightSelectorCutDefs.conf" # 2017 (v11) LooseLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodLooseOfflineConfig2016_CutBL_Smooth.conf" MediumLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodMediumOfflineConfig2016_Smooth.conf" TightLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodTightOfflineConfig2016_Smooth.conf" VeryLooseLHSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodVeryLooseOfflineConfig2016_Smooth.conf" else: print('Wrong run flag configuration') # The main algorithm # Add triggerlist tools to ToolHandleArray TrigEgammaAnalysisAlg = AlgFactory( TrigEgammaAnalysisToolsConf.TrigEgammaAnalysisAlg, name='TrigEgammaAnalysisAlg', Tools=FcnWrapper(getAllTools), ) # This function will be used to collect events from Zee,JF17 and PhysicsMain samples. # Use this if you really know. (for experts) def getEventSelectionTool(runFlag): from TrigEgammaEmulationTool.TrigEgammaEmulationPidToolsConfig import getEgammaIsEMSelectorCaloOnly, \ getElectronIsEMSelector,\ getEgammaLikelihoodSelectorCaloOnly, \ getElectronLikelihoodSelector2015,\ getElectronLikelihoodSelectorNoD0 from AthenaCommon import CfgMgr from AthenaCommon.AppMgr import ToolSvc
__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)
Extrapolator=AtlasPublicExtrapolator(), TrackSummaryTool=GSFBuildInDetTrackSummaryTool, UseTrackSummaryTool=False) # # Track slimming (private not in ToolSvc) # from TrkTrackSlimmingTool.TrkTrackSlimmingToolConf import ( Trk__TrackSlimmingTool as ConfigurableTrackSlimmingTool) GSFBuildInDetTrkSlimmingTool = ConfigurableTrackSlimmingTool( name="GSFBuildInDetTrackSlimmingTool", KeepParameters=False, KeepOutliers=True) # # Default Configuration # self.TrackRefitTool = GSFRefitterTool self.TrackParticleCreatorTool = GSFBuildInDetParticleCreatorTool self.TrackSlimmingTool = GSFBuildInDetTrkSlimmingTool self.TrackSummaryTool = GSFBuildInDetTrackSummaryTool EMBremCollectionBuilder = AlgFactory( egammaBremCollectionBuilder, name='EMBremCollectionBuilder', TrackParticleContainerName=InDetKeys.xAODTrackParticleContainer(), OutputTrkPartContainerName=egammaKeys.outputTrackParticleKey(), OutputTrackContainerName=egammaKeys.outputTrackKey(), DoTruth=rec.doTruth(), usePixel=DetFlags.haveRIO.pixel_on(), useSCT=DetFlags.haveRIO.SCT_on())
IsoCorEg.append([isoPar.coreCone, isoPar.pileupCorrection]) IsoCorEgExtra.append([isoPar.ptCorrection]) IsoCorMu.append([isoPar.coreCone, isoPar.pileupCorrection]) IsoCorMuExtra.append([]) from IsolationAlgs.IsolationAlgsConf import IsolationBuilder isoBuilder = AlgFactory( IsolationBuilder, name="IsolationBuilder", CaloCellIsolationTool=CaloIsolationTool, CaloTopoIsolationTool=CaloIsolationTool, PFlowIsolationTool=CaloIsolationTool, TrackIsolationTool=TrackIsolationTool, FeIsoTypes=[] if not rec.doEgamma() else IsoTypesFe, FeCorTypes=IsoCorFe, FeCorTypesExtra=IsoCorFeExtra, ElIsoTypes=[] if not rec.doEgamma() else IsoTypes, ElCorTypes=IsoCorEg, ElCorTypesExtra=IsoCorEgExtra, PhIsoTypes=[] if not rec.doEgamma() else IsoTypes, PhCorTypes=IsoCorEg, PhCorTypesExtra=IsoCorEgExtra, MuIsoTypes=IsoTypes if rec.doMuon() and muonRecFlags.doMuonIso() else [], MuCorTypes=IsoCorMu, MuCorTypesExtra=IsoCorMuExtra) from RecExConfig.Configured import Configured class isoGetter(Configured): def configure(self):
"Return a list with the selectors for forward electrons" return [ LooseForwardElectronSelector(), MediumForwardElectronSelector(), TightForwardElectronSelector() ] egammaForwardBuilder = AlgFactory( egammaAlgsConf.egammaForwardBuilder, name='egammaForward', # Keys ElectronOutputName=egammaKeys.outputFwdElectronKey(), TopoClusterName="CaloCalTopoClusters", ClusterContainerName=egammaKeys.outputFwdClusterKey(), # Tools ObjectQualityTool=egammaOQFlagsBuilder, FourMomBuilderTool=EMFourMomBuilder, # Flags and other properties EtCut=5 * GeV, EtaCut=2.5, forwardelectronIsEMselectors=FcnWrapper(forwardSelectorTools), forwardelectronIsEMselectorResultNames=["Loose", "Medium", "Tight"]) class egammaForwardGetter(Configured): def configure(self): mlog = logging.getLogger('egammaForwardGetter.py::configure:') mlog.info('entering') # configure egammaForward here:
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration __doc__ = """ToolFactory to instantiate egammaLargeClusterMaker with default configuration""" __author__ = "Jovan Mitrevski" from egammaTools.egammaToolsFactories import egammaLargeClusterMakerTool from CaloRec import CaloRecConf from egammaRec.Factories import AlgFactory, FcnWrapper from egammaRec import egammaKeys from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrections def clusMakerTools(): return [egammaLargeClusterMakerTool()] egammaLargeClusterMakerAlg = AlgFactory( CaloRecConf.CaloClusterMaker, name="egammaLargeClusterMaker", SaveUncalibratedSignalState=False, ClustersOutputName=egammaKeys.EgammaLargeClustersKey(), ClusterMakerTools=FcnWrapper(clusMakerTools), ClusterCorrectionTools=make_CaloSwCorrections("ele7_11", suffix="Nocorr", version="none", cells_name=egammaKeys.caloCellKey()))
# Load TrigEgammaKeys where we store the container names and other TrigEgamma configuration values from TriggerMenuMT.HLTMenuConfig.Egamma.EgammaDefs import TrigEgammaKeys from TriggerMenuMT.HLTMenuConfig.Egamma.PrecisionCaloSequenceSetup import precisionCaloMenuDefs # Decoration tools for egamma and photon objects: # Copying from https://gitlab.cern.ch/atlas/athena/blob/master/Reconstruction/egamma/egammaRec/python/topoEgammaGetter.py#L28 # Factory for egamaRecBuilder/TrigEgammaRecPhoton TrigEgammaRecPhoton = AlgFactory( egammaAlgsConf.egammaRecBuilder, name = 'TrigEgammaRecPhoton' , InputTopoClusterContainerName = precisionCaloMenuDefs.precisionCaloClusters, # Use as input, the clusters made by precisionCalo egammaRecContainer=TrigEgammaKeys.EgammaRecKey, doTrackMatching = False, doConversions = False, ## Builder tools TrackMatchBuilderTool = TrigEMTrackMatchBuilder, # Don't want to use these for trigger.... ConversionBuilderTool = None, # Don't want to use these for trigger.... doAdd = False, ) #Factory for photon SC builder TrigPhotonSuperClusterBuilder = AlgFactory( egammaAlgsConf.photonSuperClusterBuilder, name = 'TrigPhotonSuperClusterBuilder', InputEgammaRecContainerName=TrigEgammaKeys.EgammaRecKey, SuperPhotonRecCollectionName=TrigEgammaKeys.SuperPhotonRecCollectionName, ClusterCorrectionTool=egammaSwSuperClusterTool, MVACalibSvc= egammaMVASvc, doConversions = False, AddClustrsMatchingVtxTracks = False,
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(), printConfig=False) return theemvertexfindertool.toolInstance() EMVertexBuilder = AlgFactory( egammaAlgsConf.EMVertexBuilder, InputTrackParticleContainerName=egammaKeys.outputTrackParticleKey(), OutputConversionContainerName=egammaKeys.outputConversionKey(), VertexFinderTool=VertexFinderToolInstance(), ExtrapolationTool=EMExtrapolationTools)
# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration __doc__ = "ToolFactory to instantiate the EMGSFCaloExtensionBuilder with default configuration" __author__ = "Christos" from egammaAlgs import egammaAlgsConf from egammaRec.Factories import AlgFactory from egammaRec import egammaKeys from egammaTrackTools.egammaTrackToolsFactories import ( EMLastCaloExtensionTool, EMParticleCaloExtensionTool) EMGSFCaloExtensionBuilder = AlgFactory( egammaAlgsConf.EMGSFCaloExtensionBuilder, name='EMGSFCaloExtensionBuilder', LastCaloExtensionTool=EMLastCaloExtensionTool, PerigeeCaloExtensionTool=EMParticleCaloExtensionTool, GSFPerigeeCache='GSFPerigeeCaloExtension', GSFLastCache='GSFLastCaloExtension', GFFTrkPartContainerName=egammaKeys.outputTrackParticleKey())
from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from egammaRec.Factories import ToolFactory, AlgFactory from egammaRec import egammaKeys from xAODEgammaCnv.xAODEgammaCnvConf import \ xAODMaker__ElectronCnvTool, xAODMaker__ElectronCnvAlg, \ xAODMaker__PhotonCnvTool, xAODMaker__PhotonCnvAlg #Cluster Converter from xAODCaloEventCnv.xAODCaloEventCnvConf import ClusterCreator egClusterCnvAlg = AlgFactory(ClusterCreator, name="egCaloCluster2xAOD") #GSF Track Particle converter from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg GSFTrackParticleCnvAlg = AlgFactory(xAODMaker__TrackParticleCnvAlg, name = "egGSFTrackParticle2xAOD", AODContainerName="GSFTrackParticleCandidate", xAODContainerName=egammaKeys.TrackParticleKey()) #GSF track map Converter from xAODEgammaCnv.xAODEgammaCnvConf import xAODMaker__GSFTrackParticleMapCnvAlg GSFTrackParticleMapCnvAlg = AlgFactory(xAODMaker__GSFTrackParticleMapCnvAlg, name = "GSFTrackParticleMap2xAOD", AODContainerName = "TrackParticleCandidate", AODContainerNameGSF = "GSFTrackParticleCandidate", xAODContainerName = egammaKeys.inputTrackParticleKey(),
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(), TruthParticleContainerName=egammaKeys.truthParticleKey(), EgammaTruthContainerName=egammaKeys.outputTruthKey(), MCTruthClassifier=EMMCTruthClassifier, MatchForwardElectrons=egammaRecFlags.doEgammaForwardSeeded(), MatchClusters=False, SimBarcodeOffset=FcnWrapper(getSimBarcodeOffset)) class egammaTruthAssociationGetter(Configured): def configure(self): from AthenaCommon.Logging import logging mlog = logging.getLogger('egammaTruthAssociationGetter::configure:') mlog.info('entering') # configure egammaTruthAssociation here:
def configure(self): "This method will be called when object is initialized" mlog = logging.getLogger( 'CaloRingerAlgorithmBuilder::configure:%s:' \ % self.__class__.__name__.replace( ".", '_' ) ) mlog.info('entering') try: # Instantiate the main algorithm: MainCaloRingerAlgorithm = AlgFactory( CaloRingerAlgsConf.Ringer__CaloRingerAlgorithm, name="MainCaloRingerAlgorithm", inputReaderTools=FcnWrapper(getCaloRingerInputReaderTools)) self._caloRingerAlg = MainCaloRingerAlgorithm() if caloRingerFlags.buildCaloRingsOn(): # Egamma locker not being used anymore. #postponeEgammaLock(self._caloRingerAlg) pass # Check if CaloRingerAlgorithm has readers: if not self._caloRingerAlg.inputReaderTools: raise RuntimeError(("Cannot instantiate CaloRingerAlgorithm " "without readers.")) if caloRingerFlags.buildCaloRingsOn(): self._eventOutputs = { outputCaloRingsType() : \ getCaloRingerOutputs(self._caloRingerAlg.inputReaderTools,addRingSetsContainers=False), \ outputRingSetType() : \ getCaloRingerOutputs(self._caloRingerAlg.inputReaderTools,addCaloRingsContainers=False) \ } self._output.update(self._eventOutputs) # Check for existing output: self.checkExistingOutput() if not self.ignoreExistingDataObject() \ and ( ( caloRingerFlags.buildElectronCaloRings() and \ ( inputAvailable(outputCaloRingsType(), outputElectronCaloRingsKey()) or \ inputAvailable(outputCaloRingsType(), outputElectronCaloAsymRingsKey()) ) or \ ( inputAvailable(outputRingSetType(), outputElectronRingSetsKey()) or \ inputAvailable(outputRingSetType(), outputElectronAsymRingSetsKey()) ) ) \ or ( caloRingerFlags.buildPhotonCaloRings() and \ ( inputAvailable(outputCaloRingsType(), outputPhotonCaloRingsKey()) or \ inputAvailable(outputCaloRingsType(), outputPhotonCaloAsymRingsKey()) ) or \ ( inputAvailable(outputRingSetType(), outputPhotonRingSetsKey()) or \ inputAvailable(outputRingSetType(), outputPhotonAsymRingSetsKey()) ) ) ): raise RuntimeError(( "Already existing input will be overwriten and not set Ringer flag " "ignoreExistingDataObject.")) except Exception: removeFromTopSequence(self._caloRingerAlg) caloRingerFlags.Enabled = False self._disabled = True treatException(("Could not get handle to CaloRingerAlgorithm." " Reason:\n%s") % traceback.format_exc()) return False return True
from egammaAlgs import egammaAlgsConf from egammaRec.Factories import AlgFactory from egammaRec import egammaKeys from egammaTools.egammaToolsFactories import ( EMTrackMatchBuilder, EMConversionBuilder, egammaSwTool, egammaMVASvc) from egammaCaloTools.egammaCaloToolsFactories import ( egammaCheckEnergyDepositTool) electronSuperClusterBuilder = AlgFactory( egammaAlgsConf.electronSuperClusterBuilder, name='electronSuperClusterBuilder', InputEgammaRecContainerName=egammaKeys.EgammaRecKey(), SuperElectronRecCollectionName=egammaKeys.ElectronSuperRecKey(), ClusterCorrectionTool=egammaSwTool, egammaCheckEnergyDepositTool=egammaCheckEnergyDepositTool, MVACalibSvc=egammaMVASvc, EtThresholdCut=1000, TrackMatchBuilderTool=EMTrackMatchBuilder ) photonSuperClusterBuilder = AlgFactory( egammaAlgsConf.photonSuperClusterBuilder, name='photonSuperClusterBuilder', InputEgammaRecContainerName=egammaKeys.EgammaRecKey(), SuperPhotonRecCollectionName=egammaKeys.PhotonSuperRecKey(), ClusterCorrectionTool=egammaSwTool, egammaCheckEnergyDepositTool=egammaCheckEnergyDepositTool, MVACalibSvc=egammaMVASvc, ConversionBuilderTool=EMConversionBuilder
""" Importing all read/write "DataHandles" static classes """ from TriggerMenuMT.HLTMenuConfig.Egamma.EgammaDefs import TrigEgammaKeys from TriggerMenuMT.HLTMenuConfig.Egamma.TrigEgammaFactories import TrigEMClusterTool, TrigEMTrackMatchBuilder, TrigEMShowerBuilder, TrigEgammaDecorationTools """ Importing all the tool components """ from egammaTools.egammaToolsFactories import egammaSwSuperClusterTool, egammaMVASvc, EGammaAmbiguityTool from egammaAlgs import egammaAlgsConf from egammaRec.Factories import AlgFactory, FcnWrapper # Prepare first egammaRec: """Configuring egammaRecBuilder """ TrigEgammaRecElectron = AlgFactory( egammaAlgsConf.egammaRecBuilder, name = 'TrigEgammaRecElectron', InputTopoClusterContainerName= "precisionCaloCluster", egammaRecContainer= TrigEgammaKeys.EgammaRecKey, doConversions = False, doAdd= False, # Builder tools TrackMatchBuilderTool = TrigEMTrackMatchBuilder) """Configuring electronSuperClusterBuilder""" TrigElectronSuperClusterBuilder = AlgFactory( egammaAlgsConf.electronSuperClusterBuilder, name = 'TrigElectronSuperClusterBuilder', InputEgammaRecContainerName = TrigEgammaKeys.EgammaRecKey, SuperElectronRecCollectionName = TrigEgammaKeys.SuperElectronRecCollectionName, ClusterCorrectionTool=egammaSwSuperClusterTool, MVACalibSvc=egammaMVASvc, EtThresholdCut=1000, TrackMatchBuilderTool = TrigEMTrackMatchBuilder, doAdd= False )
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration __doc__ = """ToolFactory to instantiate egammaRecBuilder with default configuration""" __author__ = "Jovan Mitrevski" from egammaAlgs import egammaAlgsConf from egammaRec.Factories import AlgFactory from egammaRec.egammaRecFlags import jobproperties from egammaRec import egammaKeys from egammaTools.egammaToolsFactories import \ EMTrackMatchBuilder, EMConversionBuilder egammaRecBuilder = AlgFactory( egammaAlgsConf.egammaRecBuilder, name='egammaRecBuilder', InputTopoClusterContainerName=jobproperties.egammaRecFlags. egammaTopoClusterCollection(), egammaRecContainer=egammaKeys.EgammaRecKey(), # Builder tools TrackMatchBuilderTool=EMTrackMatchBuilder, ConversionBuilderTool=EMConversionBuilder)