From 40e582700c7bbd7e12a98cd137d32896e5aaee9f Mon Sep 17 00:00:00 2001
From: Jack Cranshaw <cranshaw@anl.gov>
Date: Wed, 30 Nov 2016 22:56:14 +0100
Subject: [PATCH] back out v93 changes and remove some debug messages
 (EventBookkeeperTools-00-00-94)

  * Remove changes in EventBookkeeperTools-00-00-93, superseded elsewhere
  * Remove unwanted DEBUG messages
  * Modified: CutFlowHelpers.py, BookkeeperTool.cxx
  * Tagging EventBookkeeperTools-00-00-94

2016-11-07 Jack Cranshaw <cranshaw@anl.gov>
  * Add copy tools for LHE3SumOfWeights and SUSYSumOfWeights
  * Modified CutFlowHelpers.py
  * Tagging EventBookkeeperTools-00-00-93
---
 .../Root/BookkeeperTool.cxx                   | 67 +++++--------------
 .../python/CutFlowHelpers.py                  |  3 -
 2 files changed, 17 insertions(+), 53 deletions(-)

diff --git a/Event/EventBookkeeperTools/Root/BookkeeperTool.cxx b/Event/EventBookkeeperTools/Root/BookkeeperTool.cxx
index b9c3a2e3f51..898b6ac988f 100644
--- a/Event/EventBookkeeperTools/Root/BookkeeperTool.cxx
+++ b/Event/EventBookkeeperTools/Root/BookkeeperTool.cxx
@@ -169,37 +169,20 @@ StatusCode BookkeeperTool::endInputFile()
 
   // Get the tmp bookkeeper from the input
   const xAOD::CutBookkeeperContainer* tmpCompleteBook(NULL);
-  if( !(outputMetaStore()->retrieve( tmpCompleteBook, m_outputCollName+"tmp") ).isSuccess() ) {
-    ATH_MSG_WARNING( "Could not get tmp CutBookkeepers from output MetaDataStore" );
-  }
-  else {
-    // update the complete output with the complete input
-    ATH_CHECK(this->updateContainer(completeBook,tmpCompleteBook));
-    // remove the tmp container
-    const SG::IConstAuxStore* tmpCompleteBookAux = tmpCompleteBook->getConstStore();
-    ATH_CHECK(outputMetaStore()->removeDataAndProxy(tmpCompleteBook));
-    ATH_CHECK(outputMetaStore()->removeDataAndProxy(tmpCompleteBookAux));
-  }
-
-/*
-  if (!m_cutflowTaken) {
-    // Get the bookkeeper from the current processing
-    const xAOD::CutBookkeeperContainer* fileCompleteBook(NULL);
-    if( !(outputMetaStore()->retrieve( fileCompleteBook, m_cutflowCollName) ).isSuccess() ) {
-      ATH_MSG_WARNING( "Could not get CutFlowSvc CutBookkeepers from output MetaDataStore" );
+  if ( outputMetaStore()->contains<xAOD::CutBookkeeperContainer>(m_outputCollName+"tmp") ) {
+    if( !(outputMetaStore()->retrieve( tmpCompleteBook, m_outputCollName+"tmp") ).isSuccess() ) {
+      ATH_MSG_WARNING( "Could not get tmp CutBookkeepers from output MetaDataStore" );
     }
     else {
       // update the complete output with the complete input
-      ATH_CHECK(this->updateContainer(completeBook,fileCompleteBook));
-      // Set flag for cutflow container to false
-      m_cutflowTaken = true;
+      ATH_CHECK(this->updateContainer(completeBook,tmpCompleteBook));
+      // remove the tmp container
+      const SG::IConstAuxStore* tmpCompleteBookAux = tmpCompleteBook->getConstStore();
+      ATH_CHECK(outputMetaStore()->removeDataAndProxy(tmpCompleteBook));
+      ATH_CHECK(outputMetaStore()->removeDataAndProxy(tmpCompleteBookAux));
     }
   }
-  else {
-    ATH_MSG_DEBUG("Cutflow information written into container before endInputFile");
-  }
 
-*/
   if (!m_cutflowTaken) {
     if (addCutFlow().isFailure()) {
       ATH_MSG_ERROR("Could not add CutFlow information");
@@ -231,36 +214,20 @@ StatusCode BookkeeperTool::metaDataStop()
 
   // Get the tmp bookkeeper from the input
   const xAOD::CutBookkeeperContainer* tmpCompleteBook(NULL);
-  if( !(outputMetaStore()->retrieve( tmpCompleteBook, m_outputCollName+"tmp") ).isSuccess() ) {
-    ATH_MSG_WARNING( "Could not get tmp CutBookkeepers from output MetaDataStore for " << m_outputCollName+"tmp");
-  }
-  else {
-    // update the complete output with the complete input
-    ATH_CHECK(this->updateContainer(incompleteBook,tmpCompleteBook));
-    // remove the tmp container
-    const SG::IConstAuxStore* tmpCompleteBookAux = tmpCompleteBook->getConstStore();
-    ATH_CHECK(outputMetaStore()->removeDataAndProxy(tmpCompleteBook));
-    ATH_CHECK(outputMetaStore()->removeDataAndProxy(tmpCompleteBookAux));
-  }
-
-/*
-  if (!m_cutflowTaken) {
-    // Get the bookkeeper from the current processing
-    const xAOD::CutBookkeeperContainer* fileCompleteBook(NULL);
-    if( !(outputMetaStore()->retrieve( fileCompleteBook, m_cutflowCollName) ).isSuccess() ) {
-      ATH_MSG_WARNING( "Could not get CutFlowSvc CutBookkeepers from output MetaDataStore" );
+  if ( outputMetaStore()->contains<xAOD::CutBookkeeperContainer>(m_outputCollName+"tmp") ) {
+    if( !(outputMetaStore()->retrieve( tmpCompleteBook, m_outputCollName+"tmp") ).isSuccess() ) {
+      ATH_MSG_WARNING( "Could not get tmp CutBookkeepers from output MetaDataStore for " << m_outputCollName+"tmp");
     }
     else {
       // update the complete output with the complete input
-      ATH_CHECK(this->updateContainer(incompleteBook,fileCompleteBook));
-      // Set flag for cutflow container to false
-      m_cutflowTaken = true;
+      ATH_CHECK(this->updateContainer(incompleteBook,tmpCompleteBook));
+      // remove the tmp container
+      const SG::IConstAuxStore* tmpCompleteBookAux = tmpCompleteBook->getConstStore();
+      ATH_CHECK(outputMetaStore()->removeDataAndProxy(tmpCompleteBook));
+      ATH_CHECK(outputMetaStore()->removeDataAndProxy(tmpCompleteBookAux));
     }
   }
-  else {
-    ATH_MSG_DEBUG("Cutflow information written into container before metaDataStop");
-  }
-*/  
+
   if (!m_cutflowTaken) {
     if (addCutFlow().isFailure()) {
       ATH_MSG_ERROR("Could not add CutFlow information");
diff --git a/Event/EventBookkeeperTools/python/CutFlowHelpers.py b/Event/EventBookkeeperTools/python/CutFlowHelpers.py
index 5282feb88df..7755a5a6bc7 100644
--- a/Event/EventBookkeeperTools/python/CutFlowHelpers.py
+++ b/Event/EventBookkeeperTools/python/CutFlowHelpers.py
@@ -78,7 +78,6 @@ def CreateCutFlowSvc( svcName="CutFlowSvc", athFile=None, seq=None, addAlgInPlac
     inname = "CutBookkeepers"
     outname = "FileBookkeepers"
     cutflowtool = BookkeeperTool(outname,
-                                 OutputLevel = 2, 
                                  InputCollName = inname,
                                  OutputCollName= outname) 
     svcMgr.ToolSvc += cutflowtool
@@ -95,7 +94,6 @@ def CreateCutFlowSvc( svcName="CutFlowSvc", athFile=None, seq=None, addAlgInPlac
         # PDF
         name = "PDFSumOfWeights"
         pdfweighttool = BookkeeperTool(name,
-                                       OutputLevel = 2, 
                                        OutputCollName= name, 
                                        InputCollName = name)
         svcMgr.ToolSvc += pdfweighttool
@@ -103,7 +101,6 @@ def CreateCutFlowSvc( svcName="CutFlowSvc", athFile=None, seq=None, addAlgInPlac
         # Add tool to MetaDataSvc
         svcMgr.MetaDataSvc.MetaDataTools += [pdfweighttool]
 
-
     # Check if we have a sequence given
     if not seq :
         # Fetch the AthAlgSeq, i.e., one of the existing master sequences where one should attach all algorithms
-- 
GitLab