diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/CMakeLists.txt index 9cd1a70bd5a8821925ebe4df7d863e3d93bfd651..e8b6972bd274e64195e7bc50de1f630d8961c614 100644 --- a/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/CMakeLists.txt +++ b/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( PhotonVertexSelection ) @@ -30,5 +30,6 @@ atlas_add_dictionary( PhotonVertexSelectionDict # Test(s) in the package: if( NOT XAOD_ANALYSIS ) atlas_add_test( PhotonVertexSelection_test - SCRIPT test/testPhotonVertexSelection.py ) + SCRIPT test/testPhotonVertexSelection.py + POST_EXEC_SCRIPT nopost.sh ) endif() diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/test/testPhotonVertexSelection.py b/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/test/testPhotonVertexSelection.py index 6417a171668e60d38d5b2ca1416a1bc2902a4d29..208e1b8499278af661c0abe6cd7449574f7952ea 100755 --- a/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/test/testPhotonVertexSelection.py +++ b/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/test/testPhotonVertexSelection.py @@ -1,12 +1,15 @@ #!/usr/bin/env python -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration __doc__ = """Script / jobOptions to test PhotonVertexSelectionTool using an AOD from mc15_13TeV:mc15_13TeV.341000.PowhegPythia8EvtGen_CT10_AZNLOCTEQ6L1_ggH125_gamgam.merge.AOD.e3806_s2608_r7772_r7676""" __author__ = "Bruno Lenzi" -defaultFile = "$ASG_TEST_FILE_MC" +import os +import sys + +defaultFile = os.environ.get("ASG_TEST_FILE_MC", None) defaultNevents = 5 def printMethod(x): @@ -39,7 +42,7 @@ def printOutput(container, tool, printMethod = printMethod): def setupAthenaJob(algoClass, inputfile = defaultFile, EvtMax = None): "Setup athena job" import AthenaPoolCnvSvc.ReadAthenaPool # EventSelector - from AthenaCommon.AppMgr import ServiceMgr as svcMgr + from AthenaCommon.AppMgr import ServiceMgr as svcMgr, theApp svcMgr.EventSelector.InputCollections = [inputfile] @@ -63,16 +66,15 @@ def setupAthenaJob(algoClass, inputfile = defaultFile, EvtMax = None): testAlg = AlgFactory(algoClass, PhotonVertexSelectionTool = PhotonVertexSelectionTool)() - # Maximum events - if EvtMax: - from Configurables import AthenaStopperAlg - AlgFactory( AthenaStopperAlg, StopCount=EvtMax )() + from AthenaCommon.Constants import INFO + theApp.setOutputLevel(INFO) + theApp.run( EvtMax ) # -------------------------------- # Athena algorithm and setup # -------------------------------- import os -if not 'ROOTCOREBIN' in os.environ: +if 'ROOTCOREBIN' not in os.environ: from AthenaPython import PyAthena from AthenaPython.PyAthena import StatusCode @@ -82,7 +84,7 @@ if not 'ROOTCOREBIN' in os.environ: super(TestPhotonVertexSelection,self).__init__(name = name, containerName = containerName, **kw) def initialize(self): - self.msg.info("initializing [%s]", self.name()) + self.msg.info("initializing [%s]", self.name) self.vertexTool = PyAthena.py_tool(self.PhotonVertexSelectionTool.getFullName(), iface='CP::IPhotonVertexSelectionTool') if not self.vertexTool: