From b21d1ab6a8ad4f7dbbd4167a7d36e77f5c702a46 Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <frank.winklmeier@cern.ch>
Date: Tue, 3 Mar 2020 10:57:51 +0100
Subject: [PATCH] Generators: Fix unchecked StatusCodes

---
 .../src/EmbeddedGeneratorCommon.cxx                       | 6 +++---
 Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx | 4 ++--
 Generators/GeneratorFilters/src/TruthJetWeightFilter.cxx  | 6 +++---
 .../GeneratorObjects/test/HepMcParticleLink_test.cxx      | 8 ++++----
 Generators/PythiaRhad_i/src/PythiaRhad.cxx                | 4 ++--
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/Generators/EmbeddedTrackGenerator/src/EmbeddedGeneratorCommon.cxx b/Generators/EmbeddedTrackGenerator/src/EmbeddedGeneratorCommon.cxx
index 5bc81beee72..37a57fc28b6 100644
--- a/Generators/EmbeddedTrackGenerator/src/EmbeddedGeneratorCommon.cxx
+++ b/Generators/EmbeddedTrackGenerator/src/EmbeddedGeneratorCommon.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // Common code for generators that need reconstructed event data inputs.
@@ -59,7 +59,7 @@ StatusCode EmbeddedGeneratorCommon::fillEvt(HepMC::GenEvent* genEvt) {
   }
   
   const EventInfo* pInputEvent(0);
-  m_pileUpStream.store().retrieve(pInputEvent);
+  m_pileUpStream.store().retrieve(pInputEvent).ignore();
   if (pInputEvent) {
     ATH_MSG_DEBUG("Event from file: " << *pInputEvent->event_ID());
   } else {
@@ -67,7 +67,7 @@ StatusCode EmbeddedGeneratorCommon::fillEvt(HepMC::GenEvent* genEvt) {
   }
   
   const EventInfo* pOutputEvent(0);
-  evtStore()->retrieve(pOutputEvent);
+  evtStore()->retrieve(pOutputEvent).ignore();
   if (pOutputEvent) {
     ATH_MSG_DEBUG("New event: "<< *pOutputEvent->event_ID());
   } else {
diff --git a/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx b/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx
index a1972c9482e..1ab7778322a 100755
--- a/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx
+++ b/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /////////////////////////////////////////////////
@@ -83,7 +83,7 @@ StatusCode EventBoost::execute() {
   for(it=mcCollptr->begin(); it!=mcCollptr->end(); it++) {
 
     const HepMC::GenEvent* genEvt = (*it);
-    EventCopy(genEvt);
+    ATH_CHECK(EventCopy(genEvt));
 
   }
 
diff --git a/Generators/GeneratorFilters/src/TruthJetWeightFilter.cxx b/Generators/GeneratorFilters/src/TruthJetWeightFilter.cxx
index 6cbcb074a9f..0e6b7251ab0 100644
--- a/Generators/GeneratorFilters/src/TruthJetWeightFilter.cxx
+++ b/Generators/GeneratorFilters/src/TruthJetWeightFilter.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "GaudiKernel/PhysicalConstants.h"
@@ -82,11 +82,11 @@ StatusCode TruthJetWeightFilter::filterEvent() {
   ATH_MSG_DEBUG("prob rnd weight sel " << prob << " " << rnd << " " << weight << " " << (rnd < prob));
   if (rnd < prob) {
     ATH_MSG_INFO("Pass filter weight "  << weight);
-    saveWeight(weight);
+    ATH_CHECK(saveWeight(weight));
     return sc;
   } else {
     setFilterPassed(m_deactivateFilter || false);
-    saveWeight(0.);
+    ATH_CHECK(saveWeight(0.));
     ATH_MSG_INFO("Fail filter weight "  << weight);
     return sc;
   }
diff --git a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
index c7ff97a404d..305f6767b10 100644
--- a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
+++ b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -237,7 +237,7 @@ namespace MCTesting {
     ASSERT_LT( gammaLink1, gammaLink11 );  //FIXME weird! Can't check ptr...
     StoreGateSvc* pStore(nullptr);
     ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess());
-    pStore->clearStore(true); // forceRemove=true to remove all proxies
+    pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies
     std::cout << "*** HepMcParticleLink_test OK ***" <<std::endl;
   }
 
@@ -260,7 +260,7 @@ namespace MCTesting {
     ASSERT_TRUE( testLink1b.isValid() );
     StoreGateSvc* pStore(nullptr);
     ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess());
-    pStore->clearStore(true); // forceRemove=true to remove all proxies
+    pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies
   }
 
   TEST_F(HepMcParticleLink_test, truth_event_link) {
@@ -405,7 +405,7 @@ namespace MCTesting {
 
     StoreGateSvc* pStore(nullptr);
     ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess());
-    pStore->clearStore(true); // forceRemove=true to remove all proxies
+    pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies
   }
 
 } // <-- namespace MCTesting
diff --git a/Generators/PythiaRhad_i/src/PythiaRhad.cxx b/Generators/PythiaRhad_i/src/PythiaRhad.cxx
index a3fcd5b5433..805983b8c94 100644
--- a/Generators/PythiaRhad_i/src/PythiaRhad.cxx
+++ b/Generators/PythiaRhad_i/src/PythiaRhad.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // File: GeneratorModules/PythiaRhad.cxx
@@ -752,7 +752,7 @@ StatusCode PythiaRhad::genuserInitialize() {
   //Set myself off to prevent generation, if we are in the sim step!
   if (!m_enable_after_initialize){
     ATH_MSG_INFO("Setting Enable to False, at the end of initialization...");
-    setProperty("Enable", "False" );
+    ATH_CHECK(setProperty("Enable", "False" ));
   }
 
   return StatusCode::SUCCESS;
-- 
GitLab