From 4e71ae01bf18ee32cd51251c8fb2fea7d58c8aca Mon Sep 17 00:00:00 2001
From: Peter Van Gemmeren <peter.van.gemmeren@cern.ch>
Date: Tue, 23 Sep 2014 23:52:16 +0200
Subject: [PATCH] For EventServer Output file sequencing
 (AthenaServices-01-58-17)

	* tagging AthenaServices-01-58-17
	* src/AthenaOutputStream.cxx, MetaDataSvc.cxx: Instead of clearing the
	Metadata store after output file transitions, call preInit() on helper
	tools to remove selected proxies.

2014-09-17  Peter van Gemmeren  <gemmeren@anl.gov>
	* tagging AthenaServices-01-58-16
	* src/OutputStreamSequencerSvc.cxx: Rename outputfile only on first
	call. This seems to be needed, as AthenaMP forks after opening output
	files and sends the first name range incident while the stream has an
	existing file without range extension.

2014-09-15  scott snyder  <snyder@bnl.gov>

	* Tagging AthenaServices-01-58-15.
	* cmt/requirements: More patterns to ignore.

2014-09-14  scott snyder  <snyder@bnl.gov>

	* Tagging AthenaServices-01-58-14.
...
(Long ChangeLog diff - truncated)
---
 Control/AthenaServices/cmt/requirements                 | 2 +-
 Control/AthenaServices/src/AthenaOutputStream.cxx       | 7 +++++++
 Control/AthenaServices/src/AthenaSummarySvc.cxx         | 9 +++++----
 Control/AthenaServices/src/AthenaSummarySvc.h           | 6 ++----
 Control/AthenaServices/src/CoreDumpSvc.cxx              | 1 +
 Control/AthenaServices/src/FPEControlSvc.cxx            | 1 +
 Control/AthenaServices/src/MetaDataSvc.cxx              | 2 ++
 Control/AthenaServices/src/OutputStreamSequencerSvc.cxx | 9 +++++----
 8 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/Control/AthenaServices/cmt/requirements b/Control/AthenaServices/cmt/requirements
index c1f1ffd4bb45..7d0f066b74f4 100755
--- a/Control/AthenaServices/cmt/requirements
+++ b/Control/AthenaServices/cmt/requirements
@@ -61,7 +61,7 @@ apply_pattern install_runtime
 use TestTools       TestTools-*          AtlasTest
 
 apply_pattern UnitTest_run unit_test=AthenaOutputStream \
-extrapatterns="^SGAudSvc +(INFO|DEBUG)|of type DataHistory|DEBUG Recorded object|object modifiable when retrieved|^ToolSvc +DEBUG Service base class initialized|^IncidentSvc *DEBUG Adding .* listener|^Py:Athena *INFO using release|DecisionSvc +DEBUG|DEBUG loadDictFiller - Ntypes|: duplicate entry|^IoComponentMgr +(INFO|DEBUG)|DBReplicaSvc|^HistogramPersis.*DEBUG|^JobOptionsSvc +INFO|^//GP:=|^ItemListSvc +(INFO|DEBUG)|Info File PoolFileCatalog.xml does not exist|DataModelCompatSvc::initialize"
+extrapatterns="^SGAudSvc +(INFO|DEBUG)|of type DataHistory|DEBUG Recorded object|object modifiable when retrieved|^ToolSvc +DEBUG Service base class initialized|^IncidentSvc *DEBUG Adding .* listener|^Py:Athena *INFO using release|DecisionSvc +DEBUG|DEBUG loadDictFiller - Ntypes|: duplicate entry|^IoComponentMgr +(INFO|DEBUG)|DBReplicaSvc|^HistogramPersis.*DEBUG|^JobOptionsSvc +INFO|^//GP:=|^ItemListSvc +(INFO|DEBUG)|Info File PoolFileCatalog.xml does not exist|DataModelCompatSvc::initialize|^ProxyProviderSvc +DEBUG|^DataModelCompatSvc +DEBUG"
 use ToyConversion   ToyConversion-*   Control/AthenaExamples
 macro_append AthenaOutputStream_testlinkopts " -L../$(CMTCONFIG) -lAthenaServices -L$(CMTINSTALLAREA)/lib/$(tag) $(ToyConversion_linkopts)"
 
diff --git a/Control/AthenaServices/src/AthenaOutputStream.cxx b/Control/AthenaServices/src/AthenaOutputStream.cxx
index 5025e280f92b..250756c7b368 100755
--- a/Control/AthenaServices/src/AthenaOutputStream.cxx
+++ b/Control/AthenaServices/src/AthenaOutputStream.cxx
@@ -49,6 +49,7 @@ AthenaOutputStream::AthenaOutputStream(const string& name, ISvcLocator* pSvcLoca
   		m_outSeqSvc("OutputStreamSequencerSvc", name),
 		m_p2BWritten(string("SG::Folder/") + name + string("_TopFolder"), this),
 		m_decoder(string("SG::Folder/") + name + string("_excluded"), this),
+                m_events(0),
 		m_streamer(string("AthenaOutputStreamTool/") + name + string("Tool"), this),
    m_helperTools(this) {
    assert(pSvcLocator);
@@ -259,6 +260,12 @@ void AthenaOutputStream::handle(const Incident& inc) {
             throw GaudiException("Folder property [itemList] not found", name(), StatusCode::FAILURE);
          }
          ATH_MSG_INFO("Records written: " << m_events);
+         for (std::vector<ToolHandle<IAthenaOutputTool> >::const_iterator iter = m_helperTools.begin();
+	         iter != m_helperTools.end(); iter++) {
+            if (!(*iter)->postInitialize().isSuccess()) {
+                ATH_MSG_ERROR("Cannot initialize helper tool");
+            }
+         }
       }
    }
    ATH_MSG_DEBUG("Leaving handle");
diff --git a/Control/AthenaServices/src/AthenaSummarySvc.cxx b/Control/AthenaServices/src/AthenaSummarySvc.cxx
index cd1fc5a4f19d..e4789f4e434e 100644
--- a/Control/AthenaServices/src/AthenaSummarySvc.cxx
+++ b/Control/AthenaServices/src/AthenaSummarySvc.cxx
@@ -132,7 +132,8 @@ inline void tolower(std::string &s)
 //
 
 AthenaSummarySvc::AthenaSummarySvc( const std::string& name, ISvcLocator* svc )
-  : Service( name, svc ), m_log(msgSvc(), name), p_incSvc("IncidentSvc",name),
+  : AthService( name, svc ), m_log(msgSvc(), name), p_incSvc("IncidentSvc",name),
+    p_logMsg(0),
     m_new(0),m_status(0),m_eventsRead(0),m_eventsWritten(0),
     m_eventsSkipped(0),m_runs(0)
 
@@ -166,7 +167,7 @@ AthenaSummarySvc::~AthenaSummarySvc() {
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 StatusCode AthenaSummarySvc::initialize() {
-  StatusCode status = Service::initialize();
+  StatusCode status = AthService::initialize();
   m_log.setLevel( m_outputLevel.value() );
 
   m_log << MSG::DEBUG << "Initializing AthenaSummarySvc version " 
@@ -270,7 +271,7 @@ StatusCode AthenaSummarySvc::finalize() {
   std::set_new_handler( m_new );
 
 
-  status = Service::finalize();
+  status = AthService::finalize();
 
   if ( status.isSuccess() )
     m_log << MSG::DEBUG << "Service finalised successfully" << endreq;
@@ -289,7 +290,7 @@ AthenaSummarySvc::queryInterface(const InterfaceID& riid, void** ppvInterface)
     }
     else  {
         // Interface is not directly available: try out a base class
-        return Service::queryInterface(riid, ppvInterface);
+        return AthService::queryInterface(riid, ppvInterface);
     }
     addRef();
     return StatusCode::SUCCESS;
diff --git a/Control/AthenaServices/src/AthenaSummarySvc.h b/Control/AthenaServices/src/AthenaSummarySvc.h
index cd0f8ec88e6e..cf4e064406a9 100755
--- a/Control/AthenaServices/src/AthenaSummarySvc.h
+++ b/Control/AthenaServices/src/AthenaSummarySvc.h
@@ -17,9 +17,7 @@
  *
  *****************************************************************************/
 
-#ifndef GAUDIKERNEL_SERVICE_H
- #include "GaudiKernel/Service.h"
-#endif
+#include "AthenaBaseComps/AthService.h"
 #ifndef KERNEL_STATUSCODES_H
  #include "GaudiKernel/StatusCode.h"
 #endif
@@ -52,7 +50,7 @@ template <class TYPE> class SvcFactory;
 
 
 
-class AthenaSummarySvc: virtual public Service, 
+class AthenaSummarySvc: virtual public AthService, 
 		 virtual public IIncidentListener,
 		 virtual public IAthenaSummarySvc {
 
diff --git a/Control/AthenaServices/src/CoreDumpSvc.cxx b/Control/AthenaServices/src/CoreDumpSvc.cxx
index fe3ad7e47d5f..2a6798363199 100644
--- a/Control/AthenaServices/src/CoreDumpSvc.cxx
+++ b/Control/AthenaServices/src/CoreDumpSvc.cxx
@@ -107,6 +107,7 @@ namespace CoreDumpSvcHandler
 CoreDumpSvc::CoreDumpSvc( const std::string& name, ISvcLocator* pSvcLocator ) : 
   AthService( name, pSvcLocator ),
   m_siginfo(0),
+  m_eventCounter(0),
   m_abortTimer(0, NULL, Athena::AlgorithmTimer::AlgorithmTimerConfig(Athena::AlgorithmTimer::USEREALTIME | Athena::AlgorithmTimer::DELIVERYBYTHREAD ) )
 {
   // Set us as the current instance
diff --git a/Control/AthenaServices/src/FPEControlSvc.cxx b/Control/AthenaServices/src/FPEControlSvc.cxx
index be9b7bd11cfe..df0183c116a3 100644
--- a/Control/AthenaServices/src/FPEControlSvc.cxx
+++ b/Control/AthenaServices/src/FPEControlSvc.cxx
@@ -24,6 +24,7 @@
 FPEControlSvc::FPEControlSvc( const std::string& name, ISvcLocator* svc )
   : AthService( name, svc ),
     m_toolSvc ("ToolSvc", name),
+    m_env(),
     m_enabled (0),
     m_disabled (0),
     m_removeInFinalize(false),
diff --git a/Control/AthenaServices/src/MetaDataSvc.cxx b/Control/AthenaServices/src/MetaDataSvc.cxx
index e0c6144742c9..73db71c25ff6 100755
--- a/Control/AthenaServices/src/MetaDataSvc.cxx
+++ b/Control/AthenaServices/src/MetaDataSvc.cxx
@@ -289,9 +289,11 @@ StatusCode MetaDataSvc::transitionMetaDataFile(bool ignoreInputFile) {
    if (!m_metaDataTools.release().isSuccess()) {
       ATH_MSG_WARNING("Cannot release " << m_metaDataTools);
    }
+/*
    if (!m_outputDataStore->clearStore().isSuccess()) {
       ATH_MSG_WARNING("Unable to clear input MetaData Proxies");
    }
+*/
    AthCnvSvc* cnvSvc = dynamic_cast<AthCnvSvc*>(m_addrCrtr.operator->());
    if (cnvSvc) {
       if (!cnvSvc->disconnectOutput().isSuccess()) {
diff --git a/Control/AthenaServices/src/OutputStreamSequencerSvc.cxx b/Control/AthenaServices/src/OutputStreamSequencerSvc.cxx
index d6debe897ba4..4d21993dfdc7 100755
--- a/Control/AthenaServices/src/OutputStreamSequencerSvc.cxx
+++ b/Control/AthenaServices/src/OutputStreamSequencerSvc.cxx
@@ -74,11 +74,12 @@ StatusCode OutputStreamSequencerSvc::queryInterface(const InterfaceID& riid, voi
 //__________________________________________________________________________
 void OutputStreamSequencerSvc::handle(const Incident& inc) {
    ATH_MSG_INFO("handle " << name() << " incident type " << inc.type());
-   if (m_metaDataSvc->transitionMetaDataFile(m_ignoreInputFile.value()).isSuccess()) {
-      m_fileSequenceNumber++;
-   } else {
-      ATH_MSG_FATAL("Cannot transition MetaDataSvc.");
+   if (m_fileSequenceNumber > 0 || !m_fileSequenceLabel.empty()) { // Do nothing for first call
+      if (!m_metaDataSvc->transitionMetaDataFile(m_ignoreInputFile.value()).isSuccess()) {
+         ATH_MSG_FATAL("Cannot transition MetaDataSvc.");
+      }
    }
+   m_fileSequenceNumber++;
    m_fileSequenceLabel.clear();
    const FileIncident* fileInc  = dynamic_cast<const FileIncident*>(&inc);
    if (fileInc != 0) {
-- 
GitLab