diff --git a/PhysicsAnalysis/PrimaryDPDMaker/CMakeLists.txt b/PhysicsAnalysis/PrimaryDPDMaker/CMakeLists.txt index 0b18f944b5edaad0bfd82afeb24f0d0a6c841953..dc9b8410d65a43b7b58baba07d14ee759c4a4f5e 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/PrimaryDPDMaker/CMakeLists.txt @@ -1,37 +1,28 @@ -################################################################################ -# Package: PrimaryDPDMaker -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( PrimaryDPDMaker ) # External dependencies: -find_package( CLHEP ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) +find_package( ROOT COMPONENTS Core MathCore ) # Component(s) in the package: atlas_add_library( PrimaryDPDMakerLib src/*.cxx PUBLIC_HEADERS PrimaryDPDMaker - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloEvent AthenaBaseComps AthenaKernel AthLinks AthContainers IRegionSelector Identifier EventKernel GaudiKernel InDetIdentifier InDetReadoutGeometry InDetPrepRawData Particle TrkTrack TrkToolInterfaces StoreGateLib SGtests DerivationFrameworkInterfaces - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} RoiDescriptor FourMom FourMomUtils NavFourMom xAODEventInfo xAODMuon xAODTracking InDetRIO_OnTrack LArRecEvent AnalysisTriggerEvent MuonSelectorToolsLib JetEvent muonEvent egammaEvent tauEvent TileEvent TileIdentifier TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack TrkTrackSummary VxVertex ) + LINK_LIBRARIES AthenaBaseComps DerivationFrameworkInterfaces GaudiKernel MuonAnalysisInterfacesLib StoreGateLib TrkToolInterfaces TrkTrack + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} CxxUtils EventKernel LArRecEvent NavFourMom TileEvent TileIdentifier xAODEventInfo xAODMuon xAODTracking ) atlas_add_component( PrimaryDPDMaker src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} CaloEvent AthenaBaseComps AthenaKernel AthLinks AthContainers StoreGateLib SGtests IRegionSelector Identifier EventKernel GaudiKernel InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData Particle TrkTrack TrkToolInterfaces RoiDescriptor FourMom FourMomUtils NavFourMom xAODEventInfo xAODMuon xAODTracking InDetRIO_OnTrack LArRecEvent AnalysisTriggerEvent MuonSelectorToolsLib JetEvent muonEvent egammaEvent tauEvent TileEvent TileIdentifier TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack TrkTrackSummary VxVertex PrimaryDPDMakerLib ) + LINK_LIBRARIES PrimaryDPDMakerLib ) atlas_add_dictionary( PrimaryDPDMakerDict PrimaryDPDMaker/PrimaryDPDMakerDict.h PrimaryDPDMaker/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} CaloEvent AthenaBaseComps AthenaKernel AthLinks AthContainers StoreGateLib SGtests IRegionSelector Identifier EventKernel GaudiKernel InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData Particle TrkTrack TrkToolInterfaces RoiDescriptor FourMom FourMomUtils NavFourMom xAODEventInfo xAODMuon xAODTracking InDetRIO_OnTrack LArRecEvent AnalysisTriggerEvent MuonSelectorToolsLib JetEvent muonEvent egammaEvent tauEvent TileEvent TileIdentifier TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack TrkTrackSummary VxVertex PrimaryDPDMakerLib ) + LINK_LIBRARIES PrimaryDPDMakerLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -atlas_install_runtime( test/PrimaryDPDMaker_TestConfiguration.xml ) - diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/DummyFilter.py b/PhysicsAnalysis/PrimaryDPDMaker/python/DummyFilter.py index 1d46a7f9a51f47abcbc437b60b7b3e8b54127891..4c12c30677caafa7fbb9fb7def4905350592fd6a 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/DummyFilter.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/DummyFilter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ##============================================================================= ## Name: DummyFilter.py @@ -49,7 +49,7 @@ class DummyFilter( PyAthena.AthFilterAlgorithm ): def execute(self): self.nProcessed += 1 - self.msg.debug( '==> execute %s on %r. event...' % (self.name(), self.nProcessed) ) + self.msg.debug( '==> execute %s on %r. event...', self.name(), self.nProcessed ) self.setFilterPassed(True) return StatusCode.Success diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/ElectronFilter.py b/PhysicsAnalysis/PrimaryDPDMaker/python/ElectronFilter.py index 05d6f74a01cba635aef1cbacb59e90a42502a05e..5ed593ddc1fcb848394c263abc3d23c83d073296 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/ElectronFilter.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/ElectronFilter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ##============================================================================= ## Name: Electron Skimmer @@ -95,7 +95,7 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ): ## Import needed modules import PyUtils.RootUtils as ru - ROOT = ru.import_root() + ROOT = ru.import_root() # noqa: F841 ## Get the StoreGate service self.storeGateSvc = PyAthena.py_svc('StoreGateSvc') @@ -110,7 +110,7 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ): def execute(self): self.nProcessed+=1 - self.msg.debug( '==> execute %s on %r. event...' % (self.name(), self.nProcessed) ) + self.msg.debug( '==> execute %s on %r. event...', self.name(), self.nProcessed ) nElPassEta = 0 nElPassEt = 0 @@ -126,7 +126,7 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ): ## If passAll is selected, accept all events if self.passAll : - self.msg.debug( '%s event passed because passAll is true' % self.name() ) + self.msg.debug( '%s event passed because passAll is true', self.name() ) self.setFilterPassed(True) return StatusCode.Success @@ -138,7 +138,7 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ): electronCollection = self.storeGateSvc.retrieve( self.electronCollectionType, self.electronCollectionName ) pass except LookupError: - self.msg.warning( 'Collection %s not found' % self.electronCollectionName ) + self.msg.warning( 'Collection %s not found', self.electronCollectionName ) self.setFilterPassed(True) return StatusCode.Success @@ -148,7 +148,7 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ): # Use Et of CaloCluster. cluster = None cluster = electron.cluster() - if cluster == None : + if cluster is None : self.msg.warning( 'Could not get the cluster for this electron!' ) pass else : @@ -193,18 +193,18 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ): # goodElectronColl.push_back(el) # pass if self.storeGateSvc.record( goodElectrons, self.goodElectronCollectionName ) != StatusCode.Success : - self.msg.error( 'Could not record the goodElectrons into StoreGate with the key = ' % self.goodElectronCollectionName ) + self.msg.error( 'Could not record the goodElectrons into StoreGate with the key = ', self.goodElectronCollectionName ) pass ## Check if the event is accepted if goodElectrons.__len__() >= self.minNumberPassed : self.nEventMinNumPassed += 1 - self.msg.debug( '%s event passed.' % self.name() ) + self.msg.debug( '%s event passed.', self.name() ) self.setFilterPassed(True) pass else : - self.msg.debug( '%s event failed.' % self.name() ) + self.msg.debug( '%s event failed.', self.name() ) self.setFilterPassed(False) pass @@ -257,17 +257,17 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ): pass - self.msg.info( '==> finalize %s...' % self.name() ) + self.msg.info( '==> finalize %s...', self.name() ) self.msg.info( '***************************************************************' ) - self.msg.info( 'Cut-flow table of %s skimming algorithm:' % self.name() ) + self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name() ) self.msg.info( '-------------' ) - self.msg.info( ' Number of processed events: %r' % self.nProcessed ) - self.msg.info( ' Number of all electrons: %r and number of electrons per event: %3.3f +/- %3.3f' % ( self.nElectrons, effiElectrons, effiErrElectrons ) ) - self.msg.info( ' Events after eta cut: %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventElPassEta, effiElPassEta, effiErrElPassEta ) ) - self.msg.info( ' Events after E_T cut: %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventElPassEt, effiElPassEt, effiErrElPassEt ) ) - self.msg.info( ' Events after author cut: %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventElPassAuthor, effiElPassAuthor, effiErrElPassAuthor ) ) - self.msg.info( ' Events after IsEM cut: %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventElPassIsEM, effiElPassIsEM, effiErrElPassIsEM ) ) - self.msg.info( ' Events after minNumberPassed %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventMinNumPassed, effiMinNumPassed, effiErrMinNumPassed ) ) + self.msg.info( ' Number of processed events: %r', self.nProcessed ) + self.msg.info( ' Number of all electrons: %r and number of electrons per event: %3.3f +/- %3.3f', self.nElectrons, effiElectrons, effiErrElectrons ) + self.msg.info( ' Events after eta cut: %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventElPassEta, effiElPassEta, effiErrElPassEta ) + self.msg.info( ' Events after E_T cut: %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventElPassEt, effiElPassEt, effiErrElPassEt ) + self.msg.info( ' Events after author cut: %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventElPassAuthor, effiElPassAuthor, effiErrElPassAuthor ) + self.msg.info( ' Events after IsEM cut: %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventElPassIsEM, effiElPassIsEM, effiErrElPassIsEM ) + self.msg.info( ' Events after minNumberPassed %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventMinNumPassed, effiMinNumPassed, effiErrMinNumPassed ) self.msg.info( '***************************************************************' ) return StatusCode.Success diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/JobTransformConfiguration.py b/PhysicsAnalysis/PrimaryDPDMaker/python/JobTransformConfiguration.py index fda61e91ba222fc97bf39bfae5bc05b0d14767d3..ddffdb150c2d6018d4e2fef43409460d0f396508 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/JobTransformConfiguration.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/JobTransformConfiguration.py @@ -7,8 +7,6 @@ # Creation: David Cote (DESY), August 2008 # ############################################ -from __future__ import print_function - __doc__ = """Set of functions to configure DPD from PATJobTransforms""" def ApplyPrescale(arg): @@ -18,13 +16,13 @@ def ApplyPrescale(arg): name_val=arg[4:] try: i=name_val.rindex('_') - except: + except Exception: raise SyntaxError("ApplyPrescale arg needs to have the form 'SET_StreamName_val', arg= "+arg) name=name_val[:i] val=name_val[i+1:] try: prescale=int(val) - except: + except Exception: raise TypeError("ApplyPrescale val needs to be an integer: val= "+val) else: raise SyntaxError("ApplyPrescale arg needs to start with 'SET_'. arg= "+arg) diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py b/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py index bfa191a6f1a62dfd6e9dd9ef37bdfb26a50c592e..cf7072bb97794cde0fb026a809658a573dd9553e 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py @@ -19,9 +19,6 @@ __author__ = "Marcello Barisonzi <Marcello.Barisonzi@desy.de>" import AthenaPython.PyAthena as PyAthena -from AthenaCommon.AlgSequence import AlgSequence -from AthenaCommon.Logging import logging - import tokenize from io import StringIO @@ -93,7 +90,7 @@ class LogicalFilterCombiner( PyAthena.AthFilterAlgorithm ): self.msg.error("Algorithm %s not found" , tokval) return False else: - self.msg.debug("Found algorithm: %s -> %s" % (tokval, _alg)) + self.msg.debug("Found algorithm: %s -> %s", tokval, _alg) exec('self.%s = _alg' % tokval) self.cutFlowSvc().declareChildFilter(tokval,self.cutID) @@ -114,7 +111,7 @@ class LogicalFilterCombiner( PyAthena.AthFilterAlgorithm ): self.msg.debug("String changed internally to:\n%s", self.cmd) #execute command once to validate - response = bool(eval(self.cmd)) + eval(self.cmd) except Exception as e: self.msg.fatal("Not a valid Python string. Exception: %s" % e) import traceback @@ -129,7 +126,7 @@ class LogicalFilterCombiner( PyAthena.AthFilterAlgorithm ): self.nEventsProcessed+=1 for k,v in self.algdict.iteritems(): - self.msg.debug("Alg %s : %s" % (k, v.filterPassed())) + self.msg.debug("Alg %s : %s", k, v.filterPassed()) pass @@ -137,13 +134,13 @@ class LogicalFilterCombiner( PyAthena.AthFilterAlgorithm ): response = bool(eval(self.cmd)) if response: self.nEventsPassed+=1 - self.msg.debug("Response is: %s" % response) + self.msg.debug("Response is: %s", response) self.setFilterPassed(response) return True def finalize(self): - self.msg.info("nEventsProcessed is: %s" % self.nEventsProcessed) - self.msg.info("nEventsPassed is: %s" % self.nEventsPassed) + self.msg.info("nEventsProcessed is: %s", self.nEventsProcessed) + self.msg.info("nEventsPassed is: %s", self.nEventsPassed) return True diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/MissingEtFilter.py b/PhysicsAnalysis/PrimaryDPDMaker/python/MissingEtFilter.py index 3db0f7cca3d55af99452b8f640ccb73c8791203c..0c7bb2c7c8b04e110d32f59fc9dabc3ce04fb9d7 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/MissingEtFilter.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/MissingEtFilter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ##============================================================================= ## Name: MissingEtFilter.py @@ -27,8 +27,6 @@ __author__ = "Karsten Koeneke <karsten.koeneke@cern.ch>" import AthenaPython.PyAthena as PyAthena from AthenaPython.PyAthena import StatusCode -from PrimaryDPDMaker import PrimaryDPDHelpers - ## Import the module that allows to use named units, e.g. GeV import AthenaCommon.SystemOfUnits as Units @@ -102,7 +100,7 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ): ## Import needed modules import PyUtils.RootUtils as ru - ROOT = ru.import_root() + ROOT = ru.import_root() # noqa: F841 ## Eagerly load library due to reflex bug (autoloading enums/namespaces doesn't work) #PyAthena.load_library ('FourMomUtils') @@ -112,7 +110,7 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ): self.jss = PyAthena.SignalStateHelper(PyAthena.P4SignalState.JETFINAL) ## import some 4-mom utils - import FourMomUtils.Bindings + import FourMomUtils.Bindings # noqa: F401 self.utils = { 'deltaR' : PyAthena.P4Helpers.deltaR , 'deltaEta' : PyAthena.P4Helpers.deltaEta , 'deltaPhi' : PyAthena.P4Helpers.deltaPhi } @@ -128,12 +126,12 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ): self.nProcessed+=1 # Print a message to the log file - self.msg.debug( '==> execute %s on %r. event...' % (self.name(), self.nProcessed) ) + self.msg.debug( '==> execute %s on %r. event...', self.name(), self.nProcessed ) ## If passAll is selected, accept all events if self.passAll : - self.msg.debug( '%s event passed because passAll is true' % self.name() ) + self.msg.debug( '%s event passed because passAll is true', self.name() ) self.setFilterPassed(True) return StatusCode.Success @@ -144,7 +142,7 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ): met = self.storeGateSvc.retrieve( self.metCollectionType, self.metCollectionName ) pass except LookupError: - self.msg.warning( 'Collection %s not found' % self.metCollectionName ) + self.msg.warning( 'Collection %s not found', self.metCollectionName ) if self.requireMet: self.setFilterPassed(False) else: @@ -157,28 +155,28 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ): jetList = [] leadJet = None if self.useLeadingJet : - self.msg.debug( 'Going to load the jets of type %s and key %s.' % (self.jetCollectionTypeList, self.jetCollectionNameList) ) + self.msg.debug( 'Going to load the jets of type %s and key %s.', self.jetCollectionTypeList, self.jetCollectionNameList) if self.jetCollectionTypeList.__len__() == self.jetCollectionNameList.__len__() : for i in range( self.jetCollectionTypeList.__len__() ) : try: lepColl = self.storeGateSvc.retrieve( self.jetCollectionTypeList[i], self.jetCollectionNameList[i] ) - self.msg.debug( 'Loading the jet collection %s from the input file.' - % self.jetCollectionNameList[i] ) + self.msg.debug( 'Loading the jet collection %s from the input file.', + self.jetCollectionNameList[i] ) for lep in lepColl : jetList.append(lep) pass pass except LookupError: if self.nProcessed <100: - self.msg.warning( 'Collection %s not found' % self.jetCollectionNameList[i] ) + self.msg.warning( 'Collection %s not found', self.jetCollectionNameList[i] ) pass pass pass pass else : - self.msg.error( 'List of jets type %s and key %s has different lenght!' - % (self.jetCollectionTypeList, self.jetCollectionNameList) ) + self.msg.error( 'List of jets type %s and key %s has different lenght!', + self.jetCollectionTypeList, self.jetCollectionNameList ) pass @@ -242,10 +240,10 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ): ## Check if the event is accepted if PassMet and PassDeltaPhi : - self.msg.debug( '%s event passed ' % self.name() ) + self.msg.debug( '%s event passed ', self.name() ) self.setFilterPassed(True) else: - self.msg.debug( '%s event failed ' % self.name() ) + self.msg.debug( '%s event failed ', self.name() ) self.setFilterPassed(False) pass @@ -279,15 +277,15 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ): pass - self.msg.info( '==> finalize %s...' % self.name() ) + self.msg.info( '==> finalize %s...', self.name() ) self.msg.info( '***************************************************************' ) - self.msg.info( 'Cut-flow table of %s skimming algorithm:' % self.name() ) + self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name() ) self.msg.info( '-------------' ) - self.msg.info( ' Number of processed events: %r' % self.nProcessed ) - self.msg.info( ' Events after Met cut: %r, efficiency = (%3.3f +/- %3.3f)%%' % - ( self.nEventPassMet, effPassMet, efferrPassMet ) ) - self.msg.info( ' Events after deltaPhi cut: %r, efficiency = (%3.3f +/- %3.3f)%%' % - ( self.nEventPassDeltaPhi, effDeltaPhi, efferrDeltaPhi ) ) + self.msg.info( ' Number of processed events: %r', self.nProcessed ) + self.msg.info( ' Events after Met cut: %r, efficiency = (%3.3f +/- %3.3f)%%', + self.nEventPassMet, effPassMet, efferrPassMet ) + self.msg.info( ' Events after deltaPhi cut: %r, efficiency = (%3.3f +/- %3.3f)%%', + self.nEventPassDeltaPhi, effDeltaPhi, efferrDeltaPhi ) self.msg.info( '***************************************************************' ) return StatusCode.Success diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_PerfMS.py b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_PerfMS.py index 3484d461c87766aacf063bef3d1dab8a81901c2f..f7345496c1fac07b7de7f131e8f80c8b7f36b4f0 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_PerfMS.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_PerfMS.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ##============================================================================= ## Name: PrimaryDESDMFlags_PerfMSStream @@ -15,7 +15,6 @@ __author__ = "Saminder Dhaliwal <s.dhaliwal@cern.ch>" from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer from AthenaCommon.JobProperties import jobproperties -import AthenaCommon.SystemOfUnits as Units #===================================================================== @@ -39,11 +38,11 @@ primDPDAlignTrigMu=jobproperties.PrimaryDESDMFlags_PerfMSStream ## General switches class doAlignmentFormat(JobProperty): - """ Switch between Alignment and Trigger DESDM format. Default is Trigger. """ - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - pass + """ Switch between Alignment and Trigger DESDM format. Default is Trigger. """ + statusOn = True + allowedTypes = ['bool'] + StoredValue = False + pass jobproperties.PrimaryDESDMFlags_PerfMSStream.add_JobProperty(doAlignmentFormat) class ApplySkimming(JobProperty): diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_TileMu.py b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_TileMu.py index 5fb3f3b1af629907173500661977918c52d4137b..ab0c6e8ee3b4ccc904a5d703f19c1fdb32f28ae2 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_TileMu.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_TileMu.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ##============================================================================= ## Name: PrimaryDESDMFlags_TileMuStream @@ -14,7 +14,6 @@ __author__ = "Tomoe Kishimoto <tomoe.kishimoto@cern.ch>" from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer from AthenaCommon.JobProperties import jobproperties -import AthenaCommon.SystemOfUnits as Units #===================================================================== diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDFlags.py b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDFlags.py index c086a7c36e3a594f5a299cd977c27b39caa2a449..225a35b8777a0482b7221b1d861e4ab077774d6d 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDFlags.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDFlags.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ##============================================================================= ## Name: PrimaryDPDFlags @@ -9,16 +9,12 @@ ## Description: Here, all neccessary job flags for the PrimaryDPDMaker ## are defined. ## -## $Id: PrimaryDPDFlags.py,v 1.44 2009-05-11 12:20:32 cgatti Exp $ ##============================================================================= __doc__ = """Here, all neccessary job flags for the PrimaryDPDMaker are defined.""" __version__ = "0.0.1" __author__ = "Karsten Koeneke <karsten.koeneke@desy.de>" -## Import the module that allows to use named units, e.g. GeV -import AthenaCommon.SystemOfUnits as Units - from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer from AthenaCommon.JobProperties import jobproperties diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDHelpers.py b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDHelpers.py index a6255a9e8a45c432038e3c28295d60e5be44aa73..c3ce176bf7fe72c51cdbc18c7ca2f40356b8d345 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDHelpers.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDHelpers.py @@ -19,7 +19,6 @@ msg = logging.getLogger( 'PrimaryDPDHelpers' ) ## Import needed modules import PyUtils.RootUtils as ru ROOT = ru.import_root() -import cppyy # This function correctly determines the name of the output file. @@ -50,42 +49,42 @@ def checkEgammaAuthor(egammaCand, authorName="either"): if ROOT.egamma.author(egammaCand) != 8 : return True else : - msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) ) + msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName) return False elif authorName == "forward" : if ROOT.egamma.author(egammaCand) == 8 : return True else : - msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) ) + msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName) return False elif authorName == "onlyEgamma" or authorName == "onlyElectron" : if ROOT.egamma.author(egammaCand) == 1 : return True else : - msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) ) + msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName) return False elif authorName == "egamma" or authorName == "Electron" : if ROOT.egamma.author(egammaCand) == 1 or ROOT.egamma.author(egammaCand) == 3 : return True else : - msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) ) + msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName) return False elif authorName == "onlySofte" : if ROOT.egamma.author(egammaCand) == 2 : return True else : - msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) ) + msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName) return False elif authorName == "softe" : if ROOT.egamma.author(egammaCand) == 2 or ROOT.egamma.author(egammaCand) == 3 : return True else : - msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) ) + msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName) return False elif authorName == "eitherElectron" : @@ -94,18 +93,18 @@ def checkEgammaAuthor(egammaCand, authorName="either"): or ROOT.egamma.author(egammaCand) == 3 : return True else : - msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) ) + msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName) return False elif authorName == "Photon" : if ROOT.egamma.author(egammaCand) == 4 : return True else : - msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) ) + msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName) return False else : - msg.debug("Unrecognized authorName=%s of egamma object of type=%s" % (authorName, type(egammaCand)) ) + msg.debug("Unrecognized authorName=%s of egamma object of type=%s", authorName, type(egammaCand)) return False @@ -116,7 +115,7 @@ def checkEgammaAuthor(egammaCand, authorName="either"): return e - msg.error("Problem checking the author of the egamm object with provided authorName=%s and type of passed object=%s" % (authorName, type(egammaCand)) ) + msg.error("Problem checking the author of the egamm object with provided authorName=%s and type of passed object=%s", authorName, type(egammaCand)) return False @@ -134,28 +133,28 @@ def checkElectronIsEM(electronCand, isemName="None"): if electronCand.isem(ROOT.egammaPID.ElectronLoose) == 0 or electronCand.isem(ROOT.egammaPID.frwdElectronLoose) == 0 : return True else : - msg.debug("Electron object of type=%s failed isemName=%s" % (type(electronCand), isemName) ) + msg.debug("Electron object of type=%s failed isemName=%s", type(electronCand), isemName) return False elif isemName == "Medium" : if electronCand.isem(ROOT.egammaPID.ElectronMedium) == 0 : return True else : - msg.debug("Electron object of type=%s failed isemName=%s" % (type(electronCand), isemName) ) + msg.debug("Electron object of type=%s failed isemName=%s", type(electronCand), isemName) return False elif isemName == "Tight" : if electronCand.isem(ROOT.egammaPID.ElectronTight) == 0 or electronCand.isem(ROOT.egammaPID.frwdElectronTight) == 0 : return True else : - msg.debug("Electron object of type=%s failed isemName=%s" % (type(electronCand), isemName) ) + msg.debug("Electron object of type=%s failed isemName=%s", type(electronCand), isemName) return False elif isemName == "TightNoIsolation" : if electronCand.isem(ROOT.egammaPID.ElectronTightNoIsolation) == 0 : return True else : - msg.debug("Electron object of type=%s failed isemName=%s" % (type(electronCand), isemName) ) + msg.debug("Electron object of type=%s failed isemName=%s", type(electronCand), isemName) return False else : @@ -165,11 +164,11 @@ def checkElectronIsEM(electronCand, isemName="None"): if electronCand.isem( cut ) == 0 : return True else : - msg.debug("Electron object of type=%s failed isemName=%s" % (type(electronCand), isemName) ) + msg.debug("Electron object of type=%s failed isemName=%s", type(electronCand), isemName) return False pass except AttributeError as err : - msg.error("AttributeError when calling checkElectronIsEM with isemName=%s of electron object of type=%s. The error is %s" % (isemName, type(electronCand), err) ) + msg.error("AttributeError when calling checkElectronIsEM with isemName=%s of electron object of type=%s. The error is %s", isemName, type(electronCand), err) import traceback msg.error(traceback.format_exc()) return False @@ -181,7 +180,7 @@ def checkElectronIsEM(electronCand, isemName="None"): msg.error(traceback.format_exc()) return e - msg.error("Problem checking the IsEM of the electron object with provided IsEM=%s and type of passed object=%s" % (isemName, type(electronCand)) ) + msg.error("Problem checking the IsEM of the electron object with provided IsEM=%s and type of passed object=%s", isemName, type(electronCand)) return False @@ -198,14 +197,14 @@ def checkPhotonIsEM(photonCand, isemName="None"): if photonCand.isem(ROOT.egammaPID.PhotonLoose) == 0 : return True else : - msg.debug("Photon object of type=%s failed isemName=%s" % (type(photonCand), isemName) ) + msg.debug("Photon object of type=%s failed isemName=%s", type(photonCand), isemName) return False elif isemName == "Photon" or isemName == "PhotonTight" or isemName == "Tight" : if photonCand.isem(ROOT.egammaPID.PhotonTight) == 0 : return True else : - msg.debug("Photon object of type=%s failed isemName=%s" % (type(photonCand), isemName) ) + msg.debug("Photon object of type=%s failed isemName=%s", type(photonCand), isemName) return False else : @@ -215,11 +214,11 @@ def checkPhotonIsEM(photonCand, isemName="None"): if photonCand.isem( cut ) == 0 : return True else : - msg.debug("Photon object of type=%s failed isemName=%s" % (type(photonCand), isemName) ) + msg.debug("Photon object of type=%s failed isemName=%s", type(photonCand), isemName) return False pass except AttributeError as err : - msg.error("AttributeError when calling checkElectronIsEM with isemName=%s of electron object of type=%s. The error is %s" % (isemName, type(photonCand), err) ) + msg.error("AttributeError when calling checkElectronIsEM with isemName=%s of electron object of type=%s. The error is %s", isemName, type(photonCand), err) import traceback msg.error(traceback.format_exc()) return False @@ -230,7 +229,7 @@ def checkPhotonIsEM(photonCand, isemName="None"): msg.error(traceback.format_exc()) return e - msg.error("Problem checking the IsEM of the photon object with provided IsEM=%s and type of passed object=%s" % (isemName, type(photonCand)) ) + msg.error("Problem checking the IsEM of the photon object with provided IsEM=%s and type of passed object=%s", isemName, type(photonCand)) return False @@ -238,7 +237,7 @@ def checkPhotonIsEM(photonCand, isemName="None"): def checkMuonAuthor(muonCandidate, authorName="all"): try: - if authorName is "all" : + if authorName == "all" : return True except TypeError as e: msg.error("Type error when calling checkMuonAuthor %s",e) @@ -248,17 +247,17 @@ def checkMuonAuthor(muonCandidate, authorName="all"): muCandAuthor = '' authorNum = muonCandidate.author() - if authorNum is 1 or authorNum is 6 or authorNum is 12: + if authorNum == 1 or authorNum == 6 or authorNum == 12: muCandAuthor = 'combined' - elif authorNum is 2 or authorNum is 7 or authorNum is 13: + elif authorNum == 2 or authorNum == 7 or authorNum == 13: muCandAuthor = 'lowpt' - elif authorNum is 4 or authorNum is 5 or authorNum is 10 or authorNum is 11 : + elif authorNum == 4 or authorNum == 5 or authorNum == 10 or authorNum == 11 : muCandAuthor = 'standalone' - elif authorNum is 14 : + elif authorNum == 14 : muCandAuthor = 'calo' try: - if muCandAuthor is authorName : + if muCandAuthor == authorName : return True else : diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPD_OutputDefinitions.py b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPD_OutputDefinitions.py index bb93dadf2dadfa7bd1220f0f52a6288d782c44b6..db5a65525cb315f16f1c6797dba733d6c2857751 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPD_OutputDefinitions.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPD_OutputDefinitions.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ##----------------------------------------------------------------------------- ## Name: PrimaryDPD_BasicOutput.py @@ -9,7 +9,6 @@ ## Description: This defines the basic output containers to be added to ## every output stream. ## -## $Id: PrimaryDPD_OutputDefinitions.py,v 1.31 2009-05-04 19:56:52 kkoeneke Exp $ ##----------------------------------------------------------------------------- @@ -30,7 +29,7 @@ from OutputStreamAthenaPool.MultipleStreamManager import MSMgr # For release 14. def addAllItemsFromInputExceptExcludeList(streamName,ExcludeList): try: stream = MSMgr.GetStream(streamName) - except: + except Exception: raise RuntimeError("Unable to get stream %s"%streamName) # Get the list of all input event-type containers diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/TriggerFilter.py b/PhysicsAnalysis/PrimaryDPDMaker/python/TriggerFilter.py index 08422f3fd96845f7a3724d07389d8a28f443dd93..a47fa0ce6f5c35c451848c14074ffa9a7b9bf06f 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/TriggerFilter.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/TriggerFilter.py @@ -12,8 +12,6 @@ ## set of triggers. ##============================================================================= -from __future__ import print_function - __doc__ = """This is a short algorithm to select events that pass at least one out of a certain set of triggers. """ @@ -24,11 +22,6 @@ __author__ = "Eric Feng <Eric.Feng@cern.ch>" import AthenaPython.PyAthena as PyAthena from AthenaPython.PyAthena import StatusCode -from PrimaryDPDMaker import PrimaryDPDHelpers - -## Import the module that allows to use named units, e.g. GeV -import AthenaCommon.SystemOfUnits as Units - class TriggerFilter( PyAthena.AthFilterAlgorithm ): """ This class is a short algorithm to select events that pass at @@ -62,7 +55,7 @@ class TriggerFilter( PyAthena.AthFilterAlgorithm ): ## Import needed modules import PyUtils.RootUtils as ru - ROOT = ru.import_root() + ROOT = ru.import_root() # noqa: F841 ## Get the TrigDecisionTool tool self.tdt = PyAthena.py_tool('Trig::TrigDecisionTool/TrigDecisionTool', iface='Trig::TrigDecisionTool') @@ -90,12 +83,12 @@ class TriggerFilter( PyAthena.AthFilterAlgorithm ): isPassed = False self.nProcessed+=1 - self.msg.debug( '==> execute %s on %r. event...' % (self.name, self.nProcessed) ) + self.msg.debug( '==> execute %s on %r. event...', self.name, self.nProcessed ) ## If passAll is selected, accept all events if self.passAll : - self.msg.debug( '%s event passed because passAll is true' % self.name ) + self.msg.debug( '%s event passed because passAll is true', self.name ) self.setFilterPassed(True) return StatusCode.Success @@ -103,8 +96,8 @@ class TriggerFilter( PyAthena.AthFilterAlgorithm ): #if self.tdt.isPassed(PyAthena.TrigDec.EF): if self.tdt.isPassed( self.trigger ): self.nEventPassTrigger += 1 - self.msg.debug("Trigger %s passed. Count: %d" - % ( self.trigger, self.nEventPassTrigger ) ) + self.msg.debug("Trigger %s passed. Count: %d", + self.trigger, self.nEventPassTrigger) isPassed = True pass @@ -133,13 +126,13 @@ class TriggerFilter( PyAthena.AthFilterAlgorithm ): except ZeroDivisionError : self.msg.warning( 'Division by zero error when calculating the uncertainties on the pass efficiencies...' ) - self.msg.info( '==> finalize %s...' % self.name ) + self.msg.info( '==> finalize %s...', self.name ) self.msg.info( '***************************************************************' ) - self.msg.info( 'Cut-flow table of %s skimming algorithm:' % self.name ) + self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name ) self.msg.info( '-------------' ) - self.msg.info( ' Number of processed events: %r' % self.nProcessed ) - self.msg.info( ' Events passing trigger %s: %r and resulting efficiency = (%3.3f +/- %3.3f)%%' \ - % ( self.trigger, self.nEventPassTrigger, effiPassTrigger, effiErrPassTrigger ) ) + self.msg.info( ' Number of processed events: %r', self.nProcessed ) + self.msg.info( ' Events passing trigger %s: %r and resulting efficiency = (%3.3f +/- %3.3f)%%', + self.trigger, self.nEventPassTrigger, effiPassTrigger, effiErrPassTrigger ) self.msg.info( '***************************************************************' ) return StatusCode.Success diff --git a/PhysicsAnalysis/PrimaryDPDMaker/test/PrimaryDPDMaker_TestConfiguration.xml b/PhysicsAnalysis/PrimaryDPDMaker/test/PrimaryDPDMaker_TestConfiguration.xml deleted file mode 100755 index 87c8f4103784f0aec00120989885c5d3c025a47d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/PrimaryDPDMaker/test/PrimaryDPDMaker_TestConfiguration.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE unifiedTestConfiguration SYSTEM "http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/unifiedTestConfiguration.dtd"> - - -<unifiedTestConfiguration> - - -<rtt xmlns="http://www.hep.ucl.ac.uk/atlas/AtlasTesting/rtt"> - <rttContactPerson> Karsten Koeneke </rttContactPerson> - <mailto>karsten.koeneke@cern.ch</mailto> - <refRelease>17.2.3</refRelease> - - <jobList> - <classification> - <displayClass>OfflineValidation</displayClass> - <displayProcess>Reco</displayProcess> - <displayComponent>Athena-Core</displayComponent> - </classification> - - <jobTransform userJobId="PrimaryDPDMaker_q122_test"> - <doc>test Reco_trf ESD to DESD production, AMI=q122</doc> - <jobTransformJobName>ESDtoDESDq122</jobTransformJobName> - <jobTransformCmd> - Reco_trf.py maxEvents=100 AMITag=q122 autoConfiguration=everything --omitvalidation=ALL --ignoreerrors=ALL inputESDFile=root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-pat/data/ESD/data10_7TeV.00167607.physics_Egamma.merge.ESD.r1774_p327_tid203271_00/ESD.203271._000001.pool.root.1 outputDESD_CALJETFile=myDESD_CALJET.pool.root outputDESD_SGLELFile=myDESD_SGLEL.pool.root outputDESD_MBIASFile=myDESD_MBIAS.pool.root outputDESDM_TRACKFile=myDESDM_TRACK.pool.root outputDESD_SGLMUFile=myDESD_SGLMU.pool.root outputDESD_PHOJETFile=myDESD_PHOJET.pool.root outputDESDM_EGAMMAFile=myDESDM_EGAMMA.pool.root - </jobTransformCmd> - <group>RecTrf</group> - <queue>medium</queue> - </jobTransform> - - </jobList> - -</rtt> - -</unifiedTestConfiguration> - - - -