diff --git a/Reconstruction/RecoAlgs/CaloRingerAlgs/python/CaloRingerAlgsConfig.py b/Reconstruction/RecoAlgs/CaloRingerAlgs/python/CaloRingerAlgsConfig.py index 066d0410f51e8ab3a145d647aab61225f5cd941a..194b5368f1014c42d913c72ffafdbfa6a2c573df 100755 --- a/Reconstruction/RecoAlgs/CaloRingerAlgs/python/CaloRingerAlgsConfig.py +++ b/Reconstruction/RecoAlgs/CaloRingerAlgs/python/CaloRingerAlgsConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -142,7 +142,9 @@ def CaloRingerElectronsInputReaderCfg(flags, name="CaloRingerElectronsReader", * return inputReaderTool, builderTool -def CaloRingerPhotonsInputReaderCfg(flags, name="CaloRingerPhotonsReader", **kwargs): +def CaloRingerPhotonsInputReaderCfg(flags, + name="CaloRingerPhotonsReader", + **kwargs): builderTool = CaloRingsPhotonBuilderCfg(flags) kwargs.setdefault('crBuilder', builderTool) @@ -155,7 +157,7 @@ def CaloRingerPhotonsInputReaderCfg(flags, name="CaloRingerPhotonsReader", **kwa def CaloRingerOutputCfg(flags, name="CaloRingerOutput"): - """Configure the CaloRingeOutput.""" + """Configure the CaloRingerOutput.""" from OutputStreamAthenaPool.OutputStreamConfig import addToAOD, addToESD acc = ComponentAccumulator() # For now keep it like Run-2 Electron only diff --git a/Reconstruction/RecoAlgs/CaloRingerAlgs/python/CaloRingerLocker.py b/Reconstruction/RecoAlgs/CaloRingerAlgs/python/CaloRingerLocker.py deleted file mode 100644 index 0f088a056106bd22ca9408463ae550540e849ae3..0000000000000000000000000000000000000000 --- a/Reconstruction/RecoAlgs/CaloRingerAlgs/python/CaloRingerLocker.py +++ /dev/null @@ -1,134 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -__doc__ = "Algorithm to lock CaloRinger containers (based on egammaLocker by Bruno Lenzi)" -__author__ = "Werner Freund <wsfreund@cern.ch>" - -from AthenaPython import PyAthena -from AthenaPython.PyAthena import StatusCode - - -class CaloRingerLocker( PyAthena.Alg ): - "Algorithm to lock Ringer containers" - def __init__(self, name = 'CaloRingerLocker', cacheKeys = True, - doElectron = True, - doPhoton = True, - EvtStoreName = 'StoreGateSvc', - MetaDataStoreName = 'MetaDataStore', - CaloRingerDict = dict(), - CaloRingerMetaDict = dict()): - - super(CaloRingerLocker, self).__init__(name = name, cacheKeys = cacheKeys, - doElectron = doElectron, - doPhoton = doPhoton, - EvtStoreName = EvtStoreName, - MetaDataStoreName = MetaDataStoreName, - CaloRingerDict = CaloRingerDict, - CaloRingerMetaDict = CaloRingerMetaDict) - self.keys = {} - - def initialize(self): - self.msg.info("initializing [%s]", self.name()) - - self.metaDataStore = PyAthena.py_svc(self.MetaDataStoreName, False) - if not self.metaDataStore: - self.msg.error("Problem retrieving MetaDataStore !!") - return StatusCode.Failure - - self.msg.debug("MetaDict = %s", self.CaloRingerMetaDict) - self.msg.debug("EvtStoreDict = %s", self.CaloRingerDict) - self.msg.debug("doElectron = %r", self.doElectron) - self.msg.debug("doPhoton = %r", self.doPhoton) - self.msg.debug("MetaDataStoreName = %s", self.MetaDataStoreName) - self.msg.debug("EvtStoreName = %s", self.EvtStoreName) - self.msg.debug("CacheKeys = %s", self.cacheKeys) - - # We can lock the MetaData containers, they are allocated and filled during - # xAODRingSetConfWriter initialize: - self.lockMetaDict() - - # Retrieve StoreGateSvc - self.storeGateSvc = PyAthena.py_svc(self.EvtStoreName, False) - if not self.storeGateSvc: - self.msg.error("Problem retrieving StoreGate !!") - return StatusCode.Failure - - return StatusCode.Success - - #------------------------------------------------------- - def filterKey(self, key): - """Return true if the container associated to the given key should be locked. - Skip central, forward or truth if not requested""" - - if (not self.doElectron and 'Electron' in key) or \ - (not self.doPhoton and 'Photon' in key): - return False - return True - - def getEventKeys(self): - "Loop over event dict items and yield (key, type) for those that pass filterKey" - for cType, cKeys in self.CaloRingerDict.items(): - for cKey in cKeys: - if not self.filterKey(cKey) or cKey not in self.storeGateSvc.keys(): - continue - yield cKey, cType - - def getMetadataKeys(self): - "Loop over event dict items and yield (key, type) for those that pass filterKey" - for cType, cKeys in self.CaloRingerMetaDict.items(): - for cKey in cKeys: - if not self.filterKey(cKey) or cKey not in self.metaDataStore.keys(): - continue - yield cKey, cType - - def execute(self): - "Loop over the EvtStore Ringer keys and lock each one" - sc = self.lockEventDict() - return sc - - def lockEventDict(self): - "Loop over the event containers and lock each one" - # Retrieve the keys of the containers to be locked - # Only do it the first time if cacheKeys is true - self.msg.debug('Entering execute.') - - sc = StatusCode.Success - - if not self.cacheKeys or not self.keys: - self.keys = dict( self.getEventKeys() ) - self.msg.debug( 'Keys are: %r', self.keys) - - for cKey, cType in self.keys.items(): - self.msg.debug('Locking container %s of type %s', cKey, cType) - if self.storeGateSvc.setConst( self.storeGateSvc[cKey] ).isFailure(): - self.msg.error('Problem locking container %s of type %s', cKey, cType) - # Flag that a failure happened, but keep looping to try to lock other - # containers - sc = StatusCode.Failure - - return sc - - def lockMetaDict(self): - "Loop over the Metadata containers and lock each one" - # Retrieve the keys of the containers to be locked - # Only do it the first time if cacheKeys is true - self.msg.info('Locking Ringer Configuration Metadata.') - - sc = StatusCode.Success - - metaKeys = dict( self.getMetadataKeys() ) - - for cKey, cType in metaKeys.items(): - self.msg.debug('Locking Metadata container %s of type %s', cKey, cType) - if self.metaDataStore.setConst( self.metaDataStore[cKey] ).isFailure(): - self.msg.error('Problem locking Metadata container %s of type %s', cKey, cType) - # Flag that a failure happened, but keep looping to try to lock other - # containers - sc = StatusCode.Failure - - return sc - #------------------------------------------------------- - - def finalize(self): - self.msg.debug("finalizing [%s]", self.name()) - return StatusCode.Success - diff --git a/Reconstruction/RecoAlgs/CaloRingerAlgs/python/CaloRingerMetaDataBuilder.py b/Reconstruction/RecoAlgs/CaloRingerAlgs/python/CaloRingerMetaDataBuilder.py deleted file mode 100644 index 9ebfd24ceab4b07c2e38b96e3ee125b1e5db8006..0000000000000000000000000000000000000000 --- a/Reconstruction/RecoAlgs/CaloRingerAlgs/python/CaloRingerMetaDataBuilder.py +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -import traceback -from . import CaloRingerAlgsConf -from AthenaCommon.Resilience import treatException -from RecExConfig.Configured import Configured -from CaloRingerAlgs import CaloRingerKeys as ringer -from CaloRingerAlgs.CaloRingerFlags import caloRingerFlags -from CaloRingerAlgs.CaloRingerAlgorithmBuilder import removeFromTopSequence -from egammaRec.Factories import AlgFactory - - -from AthenaCommon.Logging import logging - -mlog = logging.getLogger( 'CaloRingerMetaDataBuilder.py' ) -mlog.info("Entering") - -# Flag whether we will overwrite input data -_overwriting = False - -def metaDataInputAvailable(inputType, inputKey): - """ metaDataInputAvailable(inputType, inputKey) - Return true if inputType with inputKey is available.""" - # Check if it is on metadata: - # FIXME How can I do that using objKeyStore?? - flag = False - - from PyUtils.MetaReaderPeeker import convert_metadata_items - metaItemList = convert_metadata_items(layout='#join') - - if metaItemList and ( '%s#%s' % (inputType, inputKey) ) in metaItemList: - flag = True - mlog.verbose(("metaItemList does have ContainerType input %s with " - "key %s."), inputType, inputKey) - else: - mlog.verbose(("metaItemList does NOT have ContainerType input %s with " - "key %s."), inputType, inputKey) - return flag - -class CaloRingerMetaDataBuilder ( Configured ): - """ - Configure xAODRingSetConfWriter. - - NOTE: This must be done after setting CaloRingerAlgorithmBuilder. - """ - - _confWriter = None - _overwriting = False - _outputMetaData = {} - _output = {} - _output = {} - - def getLastWriterHandle(self): - "Return last CaloRinger algorithm to write into StoreGate Services." - return self._confWriter - - def metaDataOutputs(self): - "Return the metadata outputs from this builder" - return self._outputMetaData - - def getMetaDataWriterHandle(self): - "Return the CaloRinger MetaData configuration writer algorithm handle." - return self._confWriter - - def getConfigWriterHandle(self): - "Return the CaloRinger MetaData configuration writer algorithm handle." - return self._confWriter - - def __init__( self, disable=False, - ignoreExistingDataObject=caloRingerFlags.ignoreRingerExistingDataObject(), - ignoreConfigError=False ): - "Call Configured init, but with new default ignoreExistingDataObject" - Configured.__init__(self,disable,ignoreExistingDataObject,ignoreConfigError) - - def _setCaloRingerConfOutputs(self, metaBuilder): - """Setup metabuilder RingSetConfWriter container names.""" - outputList = [] - self._overwriting = False - from CaloRingerAlgs.CaloRingerAlgorithmBuilder import CaloRingerAlgorithmBuilder - crBuilder = CaloRingerAlgorithmBuilder() - if crBuilder.usable(): - builderNames = [tool.getName() for tool in crBuilder.getCaloRingerBuilderHandles()] - if any(['Electron' in builderName for builderName in builderNames]): - outputList.append(ringer.outputElectronRingSetsConfKey()) - electronMetaAvailable = metaDataInputAvailable(ringer.outputRingSetConfType(), ringer.outputElectronRingSetsConfKey()) - if electronMetaAvailable: - self._overwriting = True - if any(['Photon' in builderName for builderName in builderNames]): - outputList.append(ringer.outputPhotonRingSetsConfKey()) - photonMetaAvailable = metaDataInputAvailable(ringer.outputRingSetConfType(), ringer.outputPhotonRingSetsConfKey()) - if photonMetaAvailable: - self. _overwriting = True - metaBuilder.RingSetConfContainerNames = outputList - self._outputMetaData = {ringer.outputRingSetConfType() : outputList } - self._output.update(self._outputMetaData) - - - def _setCaloRingsBuilderTools(self, metaBuilder): - """ - Configure metaBuilder CaloRinger available builders. - """ - from CaloRingerAlgs.CaloRingerAlgorithmBuilder import CaloRingerAlgorithmBuilder - crBuilder = CaloRingerAlgorithmBuilder() - metaBuilder.CaloRingsBuilderTools = crBuilder.getCaloRingerBuilderHandles() - - 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 - diff --git a/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRingerLock_joboptions.py b/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRingerLock_joboptions.py deleted file mode 100644 index fdbcdf27f6cdf7700242428b95f38b9e8098d899..0000000000000000000000000000000000000000 --- a/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRingerLock_joboptions.py +++ /dev/null @@ -1,57 +0,0 @@ -__doc__ = "Lock containers in ESD/AOD ItemList using the definitions from CaloRingerKeys" - -import traceback - -from AthenaCommon.Logging import logging -from AthenaCommon.Resilience import treatException - -mlog = logging.getLogger( 'CaloRingerLock_joboptions' ) -mlog.info("Entering") - -from RecExConfig.RecFlags import rec - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -from CaloRingerAlgs.CaloRingerFlags import caloRingerFlags -from CaloRingerAlgs.CaloRingerKeys import CaloRingerKeysDict - -# Get CaloRinger algorithm handles -from CaloRingerAlgs.CaloRingerAlgorithmBuilder import CaloRingerAlgorithmBuilder -CRAlgBuilder = CaloRingerAlgorithmBuilder() -from CaloRingerAlgs.CaloRingerMetaDataBuilder import CaloRingerMetaDataBuilder -CRMetaDataBuilder = CaloRingerMetaDataBuilder(disable=True) - -if rec.doESD() and caloRingerFlags.buildCaloRingsOn() and CRAlgBuilder.usable(): - LastCRWriter = CRMetaDataBuilder.getLastWriterHandle() - CRMainAlg = CRAlgBuilder.getCaloRingerAlgHandle() - CRMetaDataWriterAlg = CRMetaDataBuilder.getMetaDataWriterHandle() - try: - # FIXME: It seems that the python implementation takes a lot of memory - # (https://its.cern.ch/jira/browse/ATLASRECTS-2769?filter=-1), - # replace it as egamma is doing to use a C++ implementation - pass - # Make sure we add it before streams: - for pos, alg in enumerate(topSequence): - if LastCRWriter.getName() == alg.getName(): - from CaloRingerAlgs.CaloRingerLocker import CaloRingerLocker - CRLocker = CaloRingerLocker(name = "CaloRingerLocker", \ - doElectron = caloRingerFlags.buildElectronCaloRings(), \ - doPhoton = caloRingerFlags.buildPhotonCaloRings(), \ - EvtStoreName = CRMainAlg.EvtStore.getName(), \ - MetaDataStoreName = CRMetaDataWriterAlg.MetaDataStore.getName(), \ - CaloRingerDict = CRAlgBuilder.eventOutputs(), \ - CaloRingerMetaDict = CRMetaDataBuilder.metaDataOutputs() \ - ) - topSequence.insert(pos + 1, CRLocker) - mlog.verbose("Successfully added CaloRingerLocker to TopSequence.") - break - else: - treatException("Could not find CaloRingerDecorator algorithm.") - except Exception,e: - treatException("Could not set up CaloRingerLocker. Switched off ! Reason:\n %s" % traceback.format_exc()) - - from CaloRingerAlgs.CaloRingerLocker import CaloRingerLocker - CaloRingerLocker.OutputLevel = RingerOutputLevel - mlog.verbose('Changing %r output level to %s', CaloRingerLocker, RingerOutputLevel) - diff --git a/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_ATN.py b/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_ATN.py deleted file mode 100644 index 4da8876e0d995426bba1fa3477df504869990603..0000000000000000000000000000000000000000 --- a/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_ATN.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/python -# vim: set fileencoding=utf-8 : - -########################### RINGER CONF ################################# -######################################################################### -from CaloRingerAlgs.CaloRingerFlags import caloRingerFlags -caloRingerFlags.useAsymBuilder.set_Value_and_Lock(False) -caloRingerFlags.buildElectronCaloRings.set_Value_and_Lock(True) -caloRingerFlags.minElectronEnergy.set_Value_and_Lock(None) -caloRingerFlags.doElectronIdentification.set_Value_and_Lock(True) -caloRingerFlags.buildPhotonCaloRings.set_Value_and_Lock(True) -caloRingerFlags.minPhotonEnergy.set_Value_and_Lock(None) -caloRingerFlags.OutputLevel.set_Value_and_Lock(VERBOSE) -######################################################################### - -####################### CHANGE CONFIGURATION HERE ###################### -######################################################################### -doDumpStoreGate = False -ManualDetDescrVersion = 'ATLAS-R2-2015-01-01-00' -ConditionsTag = "CONDBR2-BLKPA-2016-11" -from AtlasGeoModel.SetGeometryVersion import GeoModelSvc -GeoModelSvc.IgnoreTagSupport = True -GeoModelSvc.AtlasVersion = ManualDetDescrVersion -########################### REC FLAGS ################################# -from RecExConfig.RecFlags import rec -rec.OutputLevel.set_Value_and_Lock(INFO) -rec.doWriteTAG.set_Value_and_Lock(False) -rec.doCBNT.set_Value_and_Lock(False) -rec.doESD.set_Value_and_Lock(True) -rec.doWriteESD.set_Value_and_Lock(False) -rec.doFileMetaData.set_Value_and_Lock(True) -rec.doAOD.set_Value_and_Lock(True) -rec.doWriteAOD.set_Value_and_Lock(True) -rec.doTrigger.set_Value_and_Lock(False) -rec.doJetMissingETTag.set_Value_and_Lock(False) -rec.doMuon.set_Value_and_Lock(False) -rec.doMuonCombined.set_Value_and_Lock(False) -rec.doTau.set_Value_and_Lock(False) -rec.doPerfMon.set_Value_and_Lock(False) -rec.doDetailedPerfMon.set_Value_and_Lock(False) -rec.doHist.set_Value_and_Lock(False) -rec.doPyDump.set_Value_and_Lock(False) -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.AllowIgnoreConfigError = False -######################################################################### - -######################################################################### -####################### Some autoconfiguration: ######################### -# Add files to input picker if running on local: -from AthenaCommon.AthenaCommonFlags import jobproperties -jobproperties.AthenaCommonFlags.PoolRDOInput=jobproperties.AthenaCommonFlags.FilesInput.get_Value() -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -numEvt = 26 -if 'file' in dir(): - athenaCommonFlags.PoolRDOInput = [file] -athenaCommonFlags.EvtMax = numEvt -athenaCommonFlags.PoolAODOutput = 'AOD.pool.root' -from AthenaCommon.GlobalFlags import globalflags -globalflags.DetGeo = 'atlas' - -from PyUtils.MetaReaderPeeker import metadata -globalflags.DataSource = 'data' if metadata['eventTypes'][0] == "IS_DATA" else 'geant4' -######################################################################### - -########################### PRE-EXEC #################################### -######################################################################### -# Insert Reconstruction pre-execs here. -######################################################################### - -########################### PRE-EXTRA ################################### -######################################################################### -# You may add you own extra stuff in here. An example that may be useful -# follows. -######################################################################### - -################## MAIN REC JOBOPTION INCLUDE: ########################## -######################################################################### -include( "RecExCommon/RecExCommon_topOptions.py" ) -######################################################################### - -########################### Ringer!!! ################################## -######################################################################### -include('CaloRingerAlgs/CaloRinger_jobOptions.py') -######################################################################### - -########################### POST-INCLUDE ################################ -######################################################################### -# Insert Reconstruction post-includes here. -######################################################################### - - -########################### POST-EXEC ################################### -######################################################################### -# Insert Reconstruction post-execs here. -######################################################################### - -########################### POST-EXTRA ################################## -######################################################################### -# Insert extra post here -######################################################################### diff --git a/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_in2out.py b/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_in2out.py deleted file mode 100644 index f671eb74e56bb964761454480db0be65a697651b..0000000000000000000000000000000000000000 --- a/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_in2out.py +++ /dev/null @@ -1,32 +0,0 @@ -__doc__ = """Joboption fragment to add ringer containers to AOD/ESD streamers - using input file containers.""" - -from AthenaCommon.Logging import logging - -mlog = logging.getLogger( 'CaloRinger_in2out.py' ) -mlog.info('Entering') - -from CaloRingerAlgs.CaloRingerFlags import caloRingerFlags -caloRingerFlags.Enabled = True -caloRingerFlags.doWriteRingsToFile = True - -# Make sure we have the main algorithm disabled: -from CaloRingerAlgs.CaloRingerAlgorithmBuilder import CaloRingerAlgorithmBuilder -CRAlgBuilder = CaloRingerAlgorithmBuilder(disable = True) -from CaloRingerAlgs.CaloRingerMetaDataBuilder import CaloRingerMetaDataBuilder -CRMetaBuilder = CaloRingerMetaDataBuilder(disable=True) - -# Make sure all MetaData algoritms have the ringerOutputLevel -if CRMetaBuilder.usable(): - ringerOutputLevel = caloRingerFlags.OutputLevel() - # Get the ringer configuration writter handle - configWriter = CRMetaBuilder.getConfigWriterHandle() - - if configWriter: - # Change its output level - mlog.verbose('Changing %r output level to %s', configWriter, ringerOutputLevel) - configWriter.OutputLevel = ringerOutputLevel - -# And then include the output item list joboption to check for -# available ringer containers: -include('CaloRingerAlgs/CaloRingerOutputItemList_jobOptions.py') diff --git a/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_jobOptions.py b/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_jobOptions.py deleted file mode 100644 index 9356820896c8b2f4ca9e7f19773a0a294eb00be8..0000000000000000000000000000000000000000 --- a/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_jobOptions.py +++ /dev/null @@ -1,99 +0,0 @@ -__doc__ = "JobOption fragment to add CaloRinger algorithm to run." - -from AthenaCommon.Logging import logging - -from CaloRingerAlgs.CaloRingerFlags import caloRingerFlags -from CaloRingerAlgs.CaloRingerAlgorithmBuilder import CaloRingerAlgorithmBuilder -from CaloRingerAlgs.CaloRingerMetaDataBuilder import CaloRingerMetaDataBuilder -from AthenaConfiguration.AllConfigFlags import ConfigFlags - -mlog = logging.getLogger( 'CaloRinger_joboptions.py' ) -mlog.info('Entering') - -ringerOutputLevel = caloRingerFlags.OutputLevel() - -# Check if we have our other algorithm dependencies enabled, otherwise disable -# ringer: -if caloRingerFlags.buildCaloRingsOn(): - # Check egamma related objects: - if not ConfigFlags.Reco.EnableEgamma or not ConfigFlags.Egamma.doCentral: - if caloRingerFlags.buildElectronCaloRings(): - caloRingerFlags.buildElectronCaloRings.set_Value( False ) - caloRingerFlags.doElectronIdentification.set_Value( False ) - if not caloRingerFlags.buildElectronCaloRings(): - mlog.info('No egamma builder available... disabling ElectronCaloRings reconstruction and electron selection.') - if caloRingerFlags.buildPhotonCaloRings(): - caloRingerFlags.buildPhotonCaloRings.set_Value( False ) - #caloRingerFlags.doPhotonIdentification.set_Value( False ) - if not caloRingerFlags.buildPhotonCaloRings(): - mlog.info('No egamma builder available... disabling PhotonCaloRings reconstruction and electron selection.') - - -# To build CaloRings it is required to have doESD flag set to on. -if not rec.doESD() and caloRingerFlags.buildCaloRingsOn(): - caloRingerFlags.buildCaloRingsOn.set_Value( False ) - caloRingerFlags.doIdentificationOn.set_Value( False ) - if not caloRingerFlags.buildCaloRingsOn(): - mlog.info('Job will not build CaloRings as we are not doing ESD.') - if not caloRingerFlags.doIdentificationOn(): - mlog.info('Job will not run Ringer selectors as we are not doing ESD.') - -if caloRingerFlags.buildCaloRingsOn() or caloRingerFlags.doIdentificationOn(): - - # Add main algorithm builder - CRAlgBuilder = CaloRingerAlgorithmBuilder() - - # TODO This code can be cleaned by using the flag on the Factories configuration - - # Make sure all algoritms have the ringerOutputLevel - if CRAlgBuilder.usable(): - # Get the main logger algorithm - mainAlg = CRAlgBuilder.getCaloRingerAlgHandle() - if mainAlg: - # Change the main algorithm output level - mlog.verbose('Changing %r output level to %s', mainAlg, ringerOutputLevel) - mainAlg.OutputLevel = ringerOutputLevel - - # Get the builder handles - inputReaderHandles = CRAlgBuilder.getInputReaders() - for reader in inputReaderHandles: - # Change builders output level - mlog.verbose('Changing %r output level to %s', reader, ringerOutputLevel) - reader.OutputLevel = ringerOutputLevel - - # Get the builder handles - builderHandles = CRAlgBuilder.getCaloRingerBuilders() - for builder in builderHandles: - # Change builders output level - mlog.verbose('Changing %r output level to %s', builder, ringerOutputLevel) - builder.OutputLevel = ringerOutputLevel - - # Get the selector handles - selectorHandles = CRAlgBuilder.getRingerSelectors() - for selector in selectorHandles: - # Change the builders output level - mlog.verbose('Changing %r output level to %s', selector, ringerOutputLevel) - selector.OutputLevel = ringerOutputLevel -else: - # Otherwise we disable the main algorithm - CRAlgBuilder = CaloRingerAlgorithmBuilder( disable = True ) - -from PyUtils.MetaReaderPeeker import convert_metadata_items, metadata -metaItemDict = convert_metadata_items(layout='dict') - -if CRAlgBuilder.usable() or (metaItemDict and any( ['RingSetConf' in key for key in metaItemDict ] )): - MetaDataBuilder = CaloRingerMetaDataBuilder(disable=True) - - # Make sure all MetaData algoritms have the ringerOutputLevel - if MetaDataBuilder.usable(): - # Get the ringer configuration writter handle - configWriter = MetaDataBuilder.getConfigWriterHandle() - - if configWriter: - # Change its output level - mlog.verbose('Changing %r output level to %s', configWriter, ringerOutputLevel) - configWriter.OutputLevel = ringerOutputLevel -else: - # Otherwise we disable the metadata algorith: - MetaDataBuilder = CaloRingerMetaDataBuilder( disable = True ) - diff --git a/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_skeleton.py b/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_skeleton.py deleted file mode 100644 index f60bda89eb8bd909cb098f5a00fa912998d4fb47..0000000000000000000000000000000000000000 --- a/Reconstruction/RecoAlgs/CaloRingerAlgs/share/CaloRinger_skeleton.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/python -# vim: set fileencoding=utf-8 : - -########################### SOME RINGER CONFIG ########################## -######################################################################### -from CaloRingerAlgs.CaloRingerFlags import caloRingerFlags -caloRingerFlags.useAsymBuilder.set_Value_and_Lock(False) -caloRingerFlags.doElectronIdentification.set_Value_and_Lock(False) -caloRingerFlags.doPhotonIdentification.set_Value_and_Lock(False) -caloRingerFlags.OutputLevel.set_Value_and_Lock(DEBUG) -######################################################################### - -####################### CHANGE CONFIGURATION HERE ###################### -######################################################################### -localRunOnFolder = '/tmp/nbullacr/mc14_13TeV.147406.PowhegPythia8_AZNLO_Zee.recon.RDO.e3059_s1982_s2008_r5993_tid05320067_00/' -doCaloRinger = True -doDumpStoreGate = False -ManualDetDescrVersion = 'ATLAS-R2-2015-01-01-00' # Set to False or empty if you want it to be automatically set. -ConditionsTag = "OFLCOND-RUN12-SDR-14" -########################### REC FLAGS ################################# -from RecExConfig.RecFlags import rec -rec.OutputLevel.set_Value_and_Lock(INFO) -rec.doWriteTAG.set_Value_and_Lock(False) -rec.doCBNT.set_Value_and_Lock(False) -rec.doESD.set_Value_and_Lock(True) -rec.doWriteESD.set_Value_and_Lock(False) -rec.doAOD.set_Value_and_Lock(True) -rec.doWriteAOD.set_Value_and_Lock(True) -rec.doTrigger.set_Value_and_Lock(False) -rec.doJetMissingETTag.set_Value_and_Lock(False) -rec.doMuon.set_Value_and_Lock(False) -rec.doMuonCombined.set_Value_and_Lock(False) -rec.doTau.set_Value_and_Lock(False) -rec.doPerfMon.set_Value_and_Lock(False) -rec.doDetailedPerfMon.set_Value_and_Lock(False) -rec.doHist.set_Value_and_Lock(False) -rec.doPyDump.set_Value_and_Lock(False) -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.AllowIgnoreConfigError = False -######################################################################### - -######################################################################### -####################### Some autoconfiguration: ######################### -# Add files to input picker if running on local: -if localRunOnFolder: - import os - # Put dir for your data here: - f = os.popen('ls '+localRunOnFolder) - files = [] - for j in f: - i = j[0:-1] - files += [localRunOnFolder+i] - files.sort() - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - numEvt = -1 - athenaCommonFlags.EvtMax = numEvt - athenaCommonFlags.FilesInput = files - athenaCommonFlags.PoolAODOutput = 'AOD.pool.root' -from AthenaCommon.GlobalFlags import globalflags -globalflags.DetGeo = 'atlas' - -# here is an example of the MetaReader to autoconfigure the flags -from PyUtils.MetaReaderPeeker import metadata -globalflags.DataSource = 'data' if metadata['eventTypes'][0] == "IS_DATA" else 'geant4' - -if not ManualDetDescrVersion: - globalflags.DetDescrVersion.set_Value_and_Lock(metadata['GeoAtlas']) -else: - globalflags.DetDescrVersion.set_Value_and_Lock(ManualDetDescrVersion) -globalflags.ConditionsTag.set_Value_and_Lock(ConditionsTag) -#from AthenaCommon.DetFlags import DetFlags -#DetFlags.detdescr.all_setOff() # skip this line out to leave everything on. But this will take longer -#DetFlags.detdescr.Calo_setOn() # e.g. if I am accessing CaloCellContainer, I need the calo detector description -#include("RecExCond/AllDet_detDescr.py") -######################################################################### - -########################### PRE-INCLUDE ################################# -######################################################################### -# Include Reconstruction pre-includes here. -######################################################################### - -########################### PRE-EXEC #################################### -######################################################################### -# Insert Reconstruction pre-execs here. -######################################################################### - -########################### PRE-EXTRA ################################### -######################################################################### -# You may add you own extra stuff in here. An example that may be useful -# follows. -##from AthenaCommon.JobProperties import jobproperties -##jobproperties.Beam.energy.set_Value_and_Lock(7000*Units.GeV) -##jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(27.5) -##jobproperties.Beam.bunchSpacing.set_Value_and_Lock(25) -######################################################################### - -################## MAIN REC JOBOPTION INCLUDE: ########################## -######################################################################### -include( "RecExCommon/RecExCommon_topOptions.py" ) -######################################################################### - -########################### Ringer!!! ################################## -######################################################################### -if doCaloRinger: - include('CaloRingerAlgs/CaloRinger_joboptions.py') -######################################################################### - -########################### POST-INCLUDE ################################ -######################################################################### -# Insert Reconstruction post-includes here. -######################################################################### - -########################### POST-EXEC ################################### -######################################################################### -# Insert Reconstruction post-execs here. -######################################################################### - -########################### POST-EXTRA ################################## -######################################################################### -if doDumpStoreGate: - StoreGateSvc = Service( "StoreGateSvc" ) - StoreGateSvc.Dump = True #true will dump data store contents - StoreGateSvc.OutputLevel = DEBUG -#########################################################################