From 7de619cd9f8707892e3faba62fb2e7fd0f3ae10a Mon Sep 17 00:00:00 2001
From: Tomasz Bold <tomasz.bold@gmail.com>
Date: Mon, 12 Nov 2018 13:41:45 +0100
Subject: [PATCH] added recording of the deserialised EDM

Former-commit-id: 314303160802c3703015a6b2b784cb1682a52e0f
---
 .../src/TriggerEDMDeserialiserAlg.cxx                | 12 ++++++++----
 .../src/TriggerEDMDeserialiserAlg.h                  |  2 +-
 .../TrigUpgradeTest/share/egamma.withViews.py        |  8 ++++++--
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMDeserialiserAlg.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMDeserialiserAlg.cxx
index e782e40dc1a..97506098fba 100644
--- a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMDeserialiserAlg.cxx
+++ b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMDeserialiserAlg.cxx
@@ -7,6 +7,7 @@
 #include "SGTools/DataProxy.h"
 #include "TrigSerializeResult/StringSerializer.h"
 #include "TriggerEDMDeserialiserAlg.h"
+#include "BareDataBucket.h"
 
 
 
@@ -75,11 +76,14 @@ StatusCode TriggerEDMDeserialiserAlg::execute_r(const EventContext& context) con
     // for the moment I do not know what do with the raw prt
 
     if ( obj ) {
-      // TODO, here will be recording of that object, for now just destroy it
-      classDesc.Destruct( obj );
-
+      BareDataBucket* dataBucket = new BareDataBucket( obj, usedBytes, clid, classDesc);
+      const std::string outputName = m_prefix + name;
+      auto proxyPtr = evtStore()->recordObject( SG::DataObjectSharedPtr<BareDataBucket>( dataBucket ), outputName, false, false );
+      if ( proxyPtr == nullptr )  {
+	ATH_MSG_WARNING( "Recording of object of CLID " << clid << " and name " << name << " failed" );
+      }
     } else {
-      ATH_MSG_WARNING( "Deserialisation of obejcts of CLID " << clid << " and name " << name << " failed" );
+      ATH_MSG_WARNING( "Deserialisation of object of CLID " << clid << " and name " << name << " failed" );
     }
     
     start = toNextFragment( start );
diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMDeserialiserAlg.h b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMDeserialiserAlg.h
index d0fd5a7f56e..b5dd0bd519e 100644
--- a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMDeserialiserAlg.h
+++ b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMDeserialiserAlg.h
@@ -41,7 +41,7 @@ private:
   SG::ReadHandleKey<HLT::HLTResultMT> m_resultKey { this, "ResultKey", "HLTResultMT", "Key of object that is read"  };
   Gaudi::Property<std::string > m_prefix{ this, "Prefix", "", "Set for testing to avoid clash with the input collections" };
   Gaudi::Property<int > m_moduleID{ this, "ModuleID", 0, "Module ID of HLT result ROB, default 0 is the main HLT result, others are for TLA, calibration etc." };
-  Gaudi::Property<int> m_initialSerialisationBufferSize{ this, "InitialSerialisationBufferSize", 1024*1024, "Initial serialisation buffer size (1MB), can be set large to avoid reallocations" };
+  Gaudi::Property<int> m_initialSerialisationBufferSize{ this, "InitialSerialisationBufferSize", 1024*1024, "Initial serialisation buffer size in bytes, can be set large to avoid reallocations in every event" };
   
   ServiceHandle<IClassIDSvc> m_clidSvc{ this, "ClassIDSvc", "ClassIDSvc", "Service to translate CLID to class namex" };
 
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py
index 1d3cd76998f..4c445c3b8bd 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py
@@ -347,9 +347,9 @@ print summMaker
 
 serialiser = TriggerEDMSerialiserTool(OutputLevel=VERBOSE)
 
-serialiser.CollectionsToSerialize = [ "xAOD::TrigCompositeContainer_v1#EgammaCaloDecisions",
+serialiser.CollectionsToSerialize = [ "xAOD::TrigCompositeContainer_v1#EgammaCaloDecisions_remap",
                                       "xAOD::TrigCompositeAuxContainer_v1#EgammaCaloDecisionsAux.",
-                                      "xAOD::TrigElectronContainer_v1#HLT_xAOD__TrigElectronContainer_L2ElectronFex",
+                                      "xAOD::TrigElectronContainer_v1#HLT_xAOD__TrigElectronContainer_L2ElectronFex_remap",
                                       "xAOD::TrigElectronAuxContainer_v1#HLT_xAOD__TrigElectronContainer_L2ElectronFexAux."  ]
 
 stmaker = StreamTagMakerTool()
@@ -388,6 +388,10 @@ deserialiser = TriggerEDMDeserialiserAlg()
 deserialiser.Prefix="SERIALISED_"
 deserialiser.OutputLevel=DEBUG
 
+# add prefix + remove version to class name
+l = [ c.split("#")[0].split("_")[0] + "#" + deserialiser.Prefix + c.split("#")[1] for c in serialiser.CollectionsToSerialize ] 
+StreamESD.ItemList += l
+
 
 
 ################################################################################
-- 
GitLab