From 16254b7a684ed0020c7458312bd7ada186a8878f Mon Sep 17 00:00:00 2001
From: Maximilian Goblirsch-Kolb <goblirsc@CERN.CH>
Date: Thu, 30 Apr 2020 15:20:15 +0200
Subject: [PATCH 1/2] avoid warnings in vertex truth match tool in case there
 are no vertices to match

---
 .../Root/InDetVertexTruthMatchTool.cxx                     | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx b/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx
index 600242b170ed..7598b43447e4 100644
--- a/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx
+++ b/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "InDetTruthVertexValidation/InDetVertexTruthMatchTool.h"
@@ -136,7 +136,10 @@ InDetVertexTruthMatchTool::findTrackParticleContainer( const xAOD::VertexContain
 StatusCode InDetVertexTruthMatchTool::matchVertices( const xAOD::VertexContainer & vxContainer ) {
 
   ATH_MSG_DEBUG("Start vertex matching");
-
+  if (vxContainer.empty()){
+    ATH_MSG_DEBUG("No vertices to match.");
+    return StatusCode::SUCCESS; 
+  }
   // Identify MC vertices to match to -- this is the collection for hard scatter
   const xAOD::TruthEventBaseContainer * truthEvents = nullptr;
   if ( evtStore()->contains<xAOD::TruthEventBaseContainer>( "TruthEvents" ) )
-- 
GitLab


From 6990bd47e1f94265dcade087e9287ee769706f8c Mon Sep 17 00:00:00 2001
From: Maximilian Goblirsch-Kolb <goblirsc@CERN.CH>
Date: Thu, 30 Apr 2020 15:58:44 +0200
Subject: [PATCH 2/2] add rejection of contains filled only with a dummy vertex

---
 .../Root/InDetVertexTruthMatchTool.cxx                         | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx b/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx
index 7598b43447e4..99380ae1d99a 100644
--- a/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx
+++ b/InnerDetector/InDetValidation/InDetTruthVertexValidation/Root/InDetVertexTruthMatchTool.cxx
@@ -136,7 +136,8 @@ InDetVertexTruthMatchTool::findTrackParticleContainer( const xAOD::VertexContain
 StatusCode InDetVertexTruthMatchTool::matchVertices( const xAOD::VertexContainer & vxContainer ) {
 
   ATH_MSG_DEBUG("Start vertex matching");
-  if (vxContainer.empty()){
+  if (vxContainer.empty() ||   // reject empty vertex containers
+       (vxContainer.size() == 1 && vxContainer.at(0)->vertexType() == xAOD::VxType::NoVtx)){  // as well as containers containing only a dummy vertex
     ATH_MSG_DEBUG("No vertices to match.");
     return StatusCode::SUCCESS; 
   }
-- 
GitLab