From d997e670b4dd26afd908d5fcc5abfaa1b72dcacd Mon Sep 17 00:00:00 2001
From: Scott Snyder <scott.snyder@cern.ch>
Date: Wed, 31 Jul 2019 14:49:31 +0000
Subject: [PATCH] DataModelTestDataCommon: Add DummyDecisionWriter.

Add an algorithm to record a dummy xAOD::TrigDecision object.
To be used to avoid warnings from the BS output conversion.
---
 .../share/ByteStreamTestWrite_jo.py           |  4 +-
 .../src/DummyDecisionWriter.cxx               | 45 ++++++++++++++
 .../src/DummyDecisionWriter.h                 | 58 +++++++++++++++++++
 .../DataModelTestDataCommon_entries.cxx       |  4 +-
 4 files changed, 109 insertions(+), 2 deletions(-)
 create mode 100644 Control/DataModelTest/DataModelTestDataCommon/src/DummyDecisionWriter.cxx
 create mode 100644 Control/DataModelTest/DataModelTestDataCommon/src/DummyDecisionWriter.h

diff --git a/Control/DataModelTest/DataModelRunTests/share/ByteStreamTestWrite_jo.py b/Control/DataModelTest/DataModelRunTests/share/ByteStreamTestWrite_jo.py
index 22cd14243a2..ed55f10c67b 100755
--- a/Control/DataModelTest/DataModelRunTests/share/ByteStreamTestWrite_jo.py
+++ b/Control/DataModelTest/DataModelRunTests/share/ByteStreamTestWrite_jo.py
@@ -41,12 +41,14 @@ bswrite = ['DMTest::CVec#cvec.-dVar2.-dtest',
 
 from TrigNavigation.TrigNavigationConf import HLT__Navigation
 from DataModelTestDataCommon.DataModelTestDataCommonConf import \
-     DMTest__xAODTestDecor
+     DMTest__xAODTestDecor, \
+     DMTest__DummyDecisionWriter
 from DataModelTestDataWrite.DataModelTestDataWriteConf import \
      DMTest__xAODTestWriteCVec, \
      DMTest__xAODTestWriteHVec, \
      DMTest__xAODTestWriteCView, \
      DMTest__HLTResultWriter
+topSequence += DMTest__DummyDecisionWriter ("DummyDecisionWriter")
 topSequence += DMTest__xAODTestWriteCVec ("xAODTestWriteCVec",
                                           CVecKey = 'HLT_DMTest__CVec_cvec')
 topSequence += DMTest__xAODTestWriteCView ("xAODTestWriteCView",
diff --git a/Control/DataModelTest/DataModelTestDataCommon/src/DummyDecisionWriter.cxx b/Control/DataModelTest/DataModelTestDataCommon/src/DummyDecisionWriter.cxx
new file mode 100644
index 00000000000..b7edd573767
--- /dev/null
+++ b/Control/DataModelTest/DataModelTestDataCommon/src/DummyDecisionWriter.cxx
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
+ */
+/**
+ * @file DataModelTestDataCommon/src/DummyDecisionWriter.cxx
+ * @author scott snyder <snyder@bnl.gov>
+ * @date Jul, 2019
+ * @brief Make a dummy xAOD::TrigDecision to avoid warnings
+ *        when writing bytestream.
+ */
+
+
+#include "DummyDecisionWriter.h"
+#include "xAODTrigger/TrigDecisionAuxInfo.h"
+#include "StoreGate/WriteHandle.h"
+
+
+namespace DMTest {
+
+
+/**
+ * @brief Algorithm initialization; called at the beginning of the job.
+ */
+StatusCode DummyDecisionWriter::initialize()
+{
+  ATH_CHECK( m_decisionKey.initialize() );
+  return StatusCode::SUCCESS;
+}
+
+
+/**
+ * @brief Algorithm event processing.
+ */
+StatusCode DummyDecisionWriter::execute (const EventContext& ctx) const
+{
+  SG::WriteHandle<xAOD::TrigDecision> decH (m_decisionKey, ctx);
+  ATH_CHECK( decH.record (std::make_unique<xAOD::TrigDecision>(),
+                          std::make_unique<xAOD::TrigDecisionAuxInfo>()) );
+
+  return StatusCode::SUCCESS;
+}
+
+
+} // namespace DMTest
+
diff --git a/Control/DataModelTest/DataModelTestDataCommon/src/DummyDecisionWriter.h b/Control/DataModelTest/DataModelTestDataCommon/src/DummyDecisionWriter.h
new file mode 100644
index 00000000000..d35cf750afa
--- /dev/null
+++ b/Control/DataModelTest/DataModelTestDataCommon/src/DummyDecisionWriter.h
@@ -0,0 +1,58 @@
+// This file's extension implies that it's C, but it's really -*- C++ -*-.
+/*
+ * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
+ */
+/**
+ * @file DataModelTestDataCommon/src/DummyDecisionWriter.h
+ * @author scott snyder <snyder@bnl.gov>
+ * @date Jul, 2019
+ * @brief Make a dummy xAOD::TrigDecision to avoid warnings
+ *        when writing bytestream.
+ */
+
+
+#ifndef DATAMODELTESTDATACOMMON_DUMMYDECISIONWRITER_H
+#define DATAMODELTESTDATACOMMON_DUMMYDECISIONWRITER_H
+
+
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
+#include "xAODTrigger/TrigDecision.h"
+#include "StoreGate/WriteHandleKey.h"
+
+
+namespace DMTest {
+
+
+/**
+ * @brief Make a dummy xAOD::TrigDecision to avoid warnings
+ *        when writing bytestream.
+ */
+class DummyDecisionWriter
+  : public AthReentrantAlgorithm
+{
+public:
+  using AthReentrantAlgorithm::AthReentrantAlgorithm;
+
+
+  /**
+   * @brief Algorithm initialization; called at the beginning of the job.
+   */
+  virtual StatusCode initialize() override;
+
+
+  /**
+   * @brief Algorithm event processing.
+   */
+  virtual StatusCode execute (const EventContext& ctx) const override;
+
+
+private:
+  SG::WriteHandleKey<xAOD::TrigDecision> m_decisionKey
+  { this, "DecisionKey", "decisions", "" };
+};
+
+
+} // namespace DMTest
+
+
+#endif // not DATAMODELTESTDATACOMMON_DUMMYDECISIONWRITER_H
diff --git a/Control/DataModelTest/DataModelTestDataCommon/src/components/DataModelTestDataCommon_entries.cxx b/Control/DataModelTest/DataModelTestDataCommon/src/components/DataModelTestDataCommon_entries.cxx
index ed7277f358b..06a233379da 100644
--- a/Control/DataModelTest/DataModelTestDataCommon/src/components/DataModelTestDataCommon_entries.cxx
+++ b/Control/DataModelTest/DataModelTestDataCommon/src/components/DataModelTestDataCommon_entries.cxx
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration.
+ * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
  */
 
 // $Id$
@@ -24,6 +24,7 @@
 #include "../CondAlg2.h"
 #include "../MetaWriterAlg.h"
 #include "../MetaReaderAlg.h"
+#include "../DummyDecisionWriter.h"
 
 DECLARE_COMPONENT( DMTest::xAODTestReadSymlink )
 DECLARE_COMPONENT( DMTest::xAODTestReadDecor )
@@ -37,6 +38,7 @@ DECLARE_COMPONENT( DMTest::CondAlg1 )
 DECLARE_COMPONENT( DMTest::CondAlg2 )
 DECLARE_COMPONENT( DMTest::MetaWriterAlg )
 DECLARE_COMPONENT( DMTest::MetaReaderAlg )
+DECLARE_COMPONENT( DMTest::DummyDecisionWriter )
 
 DECLARE_COMPONENT( DMTest::xAODTestReadSymlinkTool )
 
-- 
GitLab