From 2027fa177e6a5d942d34fd09aed65fd081bf6d81 Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <frank.winklmeier@cern.ch>
Date: Tue, 15 Oct 2019 14:27:31 +0200
Subject: [PATCH] DataModelTest: Register conditions output with CondSvc

Register the conditions output objects with the CondSvc. Otherwise the
scheduler will treat the algorithm as a regular algorithm and run it on
every event.
---
 .../DataModelTest/DataModelTestDataCommon/src/CondAlg1.cxx    | 2 ++
 Control/DataModelTest/DataModelTestDataCommon/src/CondAlg1.h  | 4 +++-
 .../DataModelTest/DataModelTestDataCommon/src/CondAlg2.cxx    | 2 ++
 Control/DataModelTest/DataModelTestDataCommon/src/CondAlg2.h  | 4 +++-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg1.cxx b/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg1.cxx
index f9558368f57..af03c033ab9 100644
--- a/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg1.cxx
+++ b/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg1.cxx
@@ -25,6 +25,7 @@ namespace DMTest {
  */
 CondAlg1::CondAlg1 (const std::string &name, ISvcLocator *pSvcLocator)
   : AthReentrantAlgorithm (name, pSvcLocator),
+    m_condSvc("CondSvc", name),
     m_attrListKey ("/DMTest/TestAttrList"),
     m_scondKey ("scond", "DMTest")
 {
@@ -40,6 +41,7 @@ StatusCode CondAlg1::initialize()
 {
   ATH_CHECK( m_attrListKey.initialize() );
   ATH_CHECK( m_scondKey.initialize() );
+  ATH_CHECK( m_condSvc->regHandle(this, m_scondKey) );
   return StatusCode::SUCCESS;
 }
 
diff --git a/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg1.h b/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg1.h
index 37fda17d17c..60dfd2531ce 100644
--- a/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg1.h
+++ b/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg1.h
@@ -1,6 +1,6 @@
 // This file's extension implies that it's C, but it's really -*- C++ -*-.
 /*
- * Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration.
+ * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
  */
 // $Id$
 /**
@@ -14,6 +14,7 @@
 #ifndef DATAMODELTESTDATACOMMON_CONDALG1_H
 #define DATAMODELTESTDATACOMMON_CONDALG1_H
 
+#include "GaudiKernel/ICondSvc.h"
 
 #include "DataModelTestDataCommon/S2Cond.h"
 #include "AthenaBaseComps/AthReentrantAlgorithm.h"
@@ -50,6 +51,7 @@ public:
 
 
 private:
+  ServiceHandle<ICondSvc> m_condSvc;
   SG::ReadCondHandleKey<AthenaAttributeList> m_attrListKey;
   SG::WriteCondHandleKey<DMTest::S2> m_scondKey;
 };
diff --git a/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg2.cxx b/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg2.cxx
index efb47aa0229..6ad8528655f 100644
--- a/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg2.cxx
+++ b/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg2.cxx
@@ -26,6 +26,7 @@ namespace DMTest {
  */
 CondAlg2::CondAlg2 (const std::string &name, ISvcLocator *pSvcLocator)
   : AthReentrantAlgorithm (name, pSvcLocator),
+    m_condSvc("CondSvc", name),
     m_rltestKey ("/DMTest/RLTest"),
     m_tstestKey ("/DMTest/TSTest"),
     m_outKey ("scond3", "DMTest")
@@ -44,6 +45,7 @@ StatusCode CondAlg2::initialize()
   ATH_CHECK( m_rltestKey.initialize() );
   ATH_CHECK( m_tstestKey.initialize() );
   ATH_CHECK( m_outKey.initialize() );
+  ATH_CHECK( m_condSvc->regHandle(this, m_outKey) );
   return StatusCode::SUCCESS;
 }
 
diff --git a/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg2.h b/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg2.h
index b7d15a3b952..89f0f038bce 100644
--- a/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg2.h
+++ b/Control/DataModelTest/DataModelTestDataCommon/src/CondAlg2.h
@@ -1,6 +1,6 @@
 // This file's extension implies that it's C, but it's really -*- C++ -*-.
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 /*
  */
@@ -17,6 +17,7 @@
 #ifndef DATAMODELTESTDATACOMMON_CONDALG2_H
 #define DATAMODELTESTDATACOMMON_CONDALG2_H
 
+#include "GaudiKernel/ICondSvc.h"
 
 #include "DataModelTestDataCommon/S3Cond.h"
 #include "AthenaBaseComps/AthReentrantAlgorithm.h"
@@ -53,6 +54,7 @@ public:
 
 
 private:
+  ServiceHandle<ICondSvc> m_condSvc;
   SG::ReadCondHandleKey<AthenaAttributeList> m_rltestKey;
   SG::ReadCondHandleKey<AthenaAttributeList> m_tstestKey;
   SG::WriteCondHandleKey<DMTest::S3> m_outKey;
-- 
GitLab