From b716a01f27b1809a6b0e69c3ad64279fb68ebd54 Mon Sep 17 00:00:00 2001
From: Tomasz Bold <tomasz.bold@gmail.com>
Date: Tue, 5 Jun 2018 22:58:31 +0200
Subject: [PATCH] Added an algorithm useful for testing full scal algorithms

Former-commit-id: e45718bfb3ccda900985ac4f7cf7ca5ec8470b1f
---
 .../L1Decoder/src/CreateFullScanRoI.cxx       | 41 +++++++++++++++++++
 .../L1Decoder/src/CreateFullScanRoI.h         | 30 ++++++++++++++
 .../src/components/L1Decoder_entries.cxx      |  2 +
 3 files changed, 73 insertions(+)
 create mode 100644 Trigger/TrigSteer/L1Decoder/src/CreateFullScanRoI.cxx
 create mode 100644 Trigger/TrigSteer/L1Decoder/src/CreateFullScanRoI.h

diff --git a/Trigger/TrigSteer/L1Decoder/src/CreateFullScanRoI.cxx b/Trigger/TrigSteer/L1Decoder/src/CreateFullScanRoI.cxx
new file mode 100644
index 00000000000..bb8235213db
--- /dev/null
+++ b/Trigger/TrigSteer/L1Decoder/src/CreateFullScanRoI.cxx
@@ -0,0 +1,41 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "CreateFullScanRoI.h"
+
+CreateFullScanRoI::CreateFullScanRoI(const std::string& name, ISvcLocator* pSvcLocator) :
+  AthReentrantAlgorithm(name, pSvcLocator)
+{
+}
+
+CreateFullScanRoI::~CreateFullScanRoI()
+{
+}
+
+StatusCode CreateFullScanRoI::initialize()
+{
+  //ATH_MSG_DEBUG("Use macros for logging!");
+  CHECK( m_roisKey.initialize() );
+
+  return StatusCode::SUCCESS;
+}
+
+StatusCode CreateFullScanRoI::finalize()
+{
+  return StatusCode::SUCCESS;
+}
+
+StatusCode CreateFullScanRoI::execute_r(const EventContext& context) const
+{
+
+  auto roisCollection = std::make_unique<TrigRoiDescriptorCollection>();
+  auto roi = new TrigRoiDescriptor( true ); // this is FullScan RoI
+  roisCollection->push_back( roi );
+
+
+  auto handle = SG::makeHandle( m_roisKey, context );
+  CHECK( handle.record( std::move( roisCollection ) ) );
+  return StatusCode::SUCCESS;
+}
+
diff --git a/Trigger/TrigSteer/L1Decoder/src/CreateFullScanRoI.h b/Trigger/TrigSteer/L1Decoder/src/CreateFullScanRoI.h
new file mode 100644
index 00000000000..884eec97ca4
--- /dev/null
+++ b/Trigger/TrigSteer/L1Decoder/src/CreateFullScanRoI.h
@@ -0,0 +1,30 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+#ifndef L1DECODER_CREATEFULLSCANROI_H
+#define L1DECODER_CREATEFULLSCANROI_H
+
+// Framework includes
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
+#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
+
+#include <string>
+
+/**
+ * @class CreateFullScanRoI
+ * @brief in every event creates collection with single FullScanRoI (for testing MET, Jet and similar FS reco)
+ **/
+class CreateFullScanRoI : public AthReentrantAlgorithm {
+public:
+  CreateFullScanRoI(const std::string& name, ISvcLocator* pSvcLocator);
+  virtual ~CreateFullScanRoI() override;
+
+  virtual StatusCode initialize() override;
+  virtual StatusCode execute_r(const EventContext& context) const override;
+  virtual StatusCode finalize() override;
+
+private:
+  SG::WriteHandleKey<TrigRoiDescriptorCollection> m_roisKey{ this, "RoIsKey", "FullScanRoIs", "name of the output"};
+};
+
+#endif // L1DECODER_CREATEFULLSCANROI_H
diff --git a/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_entries.cxx b/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_entries.cxx
index 907f6e4bbe6..93cdece0d64 100644
--- a/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_entries.cxx
+++ b/Trigger/TrigSteer/L1Decoder/src/components/L1Decoder_entries.cxx
@@ -15,6 +15,7 @@
 #include "../MURoIsUnpackingTool.h"
 #include "../RerunRoIsUnpackingTool.h"
 #include "../PrescalingEmulationTool.h"
+#include "../CreateFullScanRoI.h"
 
 
 DECLARE_COMPONENT( L1CaloDecoder )
@@ -34,3 +35,4 @@ DECLARE_COMPONENT( JRoIsUnpackingTool )
 DECLARE_COMPONENT( TAURoIsUnpackingTool )
 DECLARE_COMPONENT( PrescalingEmulationTool )
 DECLARE_COMPONENT( RerunRoIsUnpackingTool )
+DECLARE_COMPONENT( CreateFullScanRoI )
-- 
GitLab