From 20a2182972a51f55163d3b8ca2bc1224350bec64 Mon Sep 17 00:00:00 2001 From: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> Date: Fri, 25 Sep 2020 16:00:16 +0200 Subject: [PATCH] Fixed the tests of PhotonVertexSelection for Athena and AnalysisBase. Since the package was not built as part of Athena before, it is now added to that project as well. The test in Athena doesn't actually run anything... It sets up a job, but doesn't run any event loop. However I didn't want to completely re-design the test to set things up correctly for an Athena test. (The Athena and standalone tests should just be done using separate Python files, as they don't actually share any meaningful amount of code with each other.) --- .../PhotonVertexSelection/CMakeLists.txt | 32 ++----------------- .../test/testPhotonVertexSelection.py | 17 +++------- Projects/Athena/package_filters.txt | 2 -- 3 files changed, 8 insertions(+), 43 deletions(-) diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/CMakeLists.txt index 360ebdf48ab..03a6d01115c 100644 --- a/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/CMakeLists.txt +++ b/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/CMakeLists.txt @@ -1,29 +1,8 @@ -################################################################################ -# Package: PhotonVertexSelection -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( PhotonVertexSelection ) -# Extra dependencies, based on the build environment: -set( extra_deps ) -if( NOT XAOD_STANDALONE ) - set( extra_deps Control/AthenaBaseComps GaudiKernel ) -endif() - -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthToolSupport/AsgTools - Event/xAOD/xAODEgamma - Event/xAOD/xAODEventInfo - Event/xAOD/xAODTracking - PRIVATE - Control/AthContainers - PhysicsAnalysis/ElectronPhotonID/IsolationCorrections - Tools/PathResolver - ${extra_deps} ) - # External dependencies: find_package( ROOT COMPONENTS Core Hist RIO Physics TMVA ) @@ -49,10 +28,5 @@ atlas_add_dictionary( PhotonVertexSelectionDict LINK_LIBRARIES PhotonVertexSelectionLib ) # Test(s) in the package: -if( XAOD_STANDALONE ) - # FIX ME: temporarily disabled as part of the migration of - # AnalysisBase to master - - # atlas_add_test( PhotonVertexSelection_test - # SCRIPT test/testPhotonVertexSelection.py ) -endif() +atlas_add_test( PhotonVertexSelection_test + SCRIPT test/testPhotonVertexSelection.py ) diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/test/testPhotonVertexSelection.py b/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/test/testPhotonVertexSelection.py index 7c3478866c7..a5fbaa361b4 100755 --- a/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/test/testPhotonVertexSelection.py +++ b/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/test/testPhotonVertexSelection.py @@ -21,7 +21,7 @@ def getViewContainer(container): return x.author() not in [xAOD.EgammaParameters.AuthorCaloTopo35, xAOD.EgammaParameters.AuthorFwdElectron] egammas = container.__class__(ROOT.SG.VIEW_ELEMENTS) - for eg in filter(filterAuthor, container)[:2]: + for eg in list(filter(filterAuthor, container))[:2]: egammas.push_back( eg ) return egammas @@ -128,17 +128,10 @@ else: # Initialize the xAOD infrastructure: ROOT.xAOD.Init().ignore() - ROOT.xAOD.TruthParticleContainer() - ROOT.xAOD.MuonRoIContainer() - ROOT.xAOD.CaloClusterContainer() - ROOT.xAOD.TrackParticleContainer() - ROOT.xAOD.ElectronContainer() - ROOT.xAOD.MuonContainer() - ROOT.xAOD.JetContainer() - ROOT.xAOD.TauJetContainer() - ROOT.xAOD.PFOContainer() - ROOT.xAOD.TrigElectronContainer() ROOT.xAOD.L2CombinedMuonContainer() + ROOT.xAOD.TrigElectronContainer() + ROOT.xAOD.MuonContainer() + ROOT.xAOD.ParticleContainer() # Setup the tools vertexTool = ROOT.CP.PhotonVertexSelectionTool("PhotonVertexSelectionTool") @@ -154,7 +147,7 @@ else: sys.exit( 1 ) pass - for entry in xrange(options.nEvents): + for entry in range(options.nEvents): print ('*** Analysing entry %s ***' % entry) _ = t.GetEntry(entry) container = getattr(t, options.container) diff --git a/Projects/Athena/package_filters.txt b/Projects/Athena/package_filters.txt index 9a10110a4df..87796820275 100644 --- a/Projects/Athena/package_filters.txt +++ b/Projects/Athena/package_filters.txt @@ -38,7 +38,6 @@ - PhysicsAnalysis/D3PDTools/MultiDraw - PhysicsAnalysis/D3PDTools/SampleHandler - PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection -- PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection - PhysicsAnalysis/HiggsPhys/Run2/HZZ/Tools/ZMassConstraint - PhysicsAnalysis/JetPhys/SemileptonicCorr - PhysicsAnalysis/SUSYPhys/SUSYTools @@ -64,4 +63,3 @@ # Old packages that don't work with AthenaMT - LArCalorimeter/LArSim - PhysicsAnalysis/HiggsPhys/HSG5/HSG5DPDUtils - -- GitLab