From 3e08318c9971cd76bcee645c0827938edbbbda93 Mon Sep 17 00:00:00 2001
From: Denis Oliveira Damazio <damazio@mail.cern.ch>
Date: Thu, 6 Dec 2018 16:07:37 +0100
Subject: [PATCH] Fix for ATR-19129, TopoCluster issues

Former-commit-id: c676c98f80fe9411d437e80d9eab1e61a6ce4f8f
---
 .../TrigCaloRec/src/HLTCaloCellMaker.cxx           | 14 ++++++++++----
 .../TrigCaloRec/src/HLTCaloCellMaker.h             |  3 ++-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/HLTCaloCellMaker.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/HLTCaloCellMaker.cxx
index e225e256a0e..5583f602f6d 100644
--- a/Trigger/TrigAlgorithms/TrigCaloRec/src/HLTCaloCellMaker.cxx
+++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/HLTCaloCellMaker.cxx
@@ -55,12 +55,18 @@ StatusCode HLTCaloCellMaker::execute_r( const EventContext& context ) const {
     if ( roiCollection->size() > 1 ) 
       ATH_MSG_INFO ( "roiMode but multiple rois found, will only use the first one");
 
-    SG::WriteHandle<ConstDataVector<CaloCellContainer> > cellContainer = SG::WriteHandle<ConstDataVector<CaloCellContainer> > ( m_cellContainerKey, context );
-    auto cdv = CxxUtils::make_unique<ConstDataVector<CaloCellContainer> >(SG::VIEW_ELEMENTS);
+    //SG::WriteHandle<ConstDataVector<CaloCellContainer> > cellContainer = SG::WriteHandle<ConstDataVector<CaloCellContainer> > ( m_cellContainerKey, context );
+    SG::WriteHandle<CaloConstCellContainer > cellContainer = SG::WriteHandle< CaloConstCellContainer > ( m_cellContainerKey, context );
+    auto cdv = CxxUtils::make_unique<CaloConstCellContainer>(SG::VIEW_ELEMENTS);
     for( const TrigRoiDescriptor* roiDescriptor : *roiCollection) {
       ATH_MSG_INFO ( "Running on RoI " << *roiDescriptor<< " FS="<<roiDescriptor->isFullscan());
       if ( roiDescriptor->isFullscan() ) {
         ATH_CHECK(m_dataAccessSvc->loadFullCollections( context, *cdv ));
+	cdv->setHasCalo(CaloCell_ID::LAREM);
+	cdv->setHasCalo(CaloCell_ID::LARHEC);
+	cdv->setHasCalo(CaloCell_ID::LARFCAL);
+	cdv->setHasCalo(CaloCell_ID::TILE);
+	cdv->updateCaloIterators();
 	
       } else {
 	LArTT_Selector<LArCellCont> sel;
@@ -80,14 +86,14 @@ StatusCode HLTCaloCellMaker::execute_r( const EventContext& context ) const {
     ATH_CHECK( cellContainerV.record( std::move(cdv) ) );
     for( const TrigRoiDescriptor* roiDescriptor : *roiCollection) {
       if ( roiDescriptor->isFullscan() ) {
-	auto c = std::make_unique<ConstDataVector<CaloCellContainer> >(SG::VIEW_ELEMENTS);
+	auto c = std::make_unique<CaloConstCellContainer >(SG::VIEW_ELEMENTS);
 	ATH_CHECK(m_dataAccessSvc->loadFullCollections( context, *c ));
 	cellContainerV->push_back( c.release()->asDataVector() );
 		
       } else {
 	LArTT_Selector<LArCellCont> sel;
 	ATH_CHECK(m_dataAccessSvc->loadCollections( context, *roiDescriptor, TTEM, 2, sel ));
-	auto c = std::make_unique<ConstDataVector<CaloCellContainer> >(SG::VIEW_ELEMENTS);
+	auto c = std::make_unique<CaloConstCellContainer >(SG::VIEW_ELEMENTS);
 	int cc(0);
 	for( const auto cell : sel ) {c->push_back( cell ); cc++;}
 	cellContainerV->push_back( c.release()->asDataVector() );
diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/HLTCaloCellMaker.h b/Trigger/TrigAlgorithms/TrigCaloRec/src/HLTCaloCellMaker.h
index 066be31f2ef..8bc57f09856 100644
--- a/Trigger/TrigAlgorithms/TrigCaloRec/src/HLTCaloCellMaker.h
+++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/HLTCaloCellMaker.h
@@ -25,6 +25,7 @@
 #include "StoreGate/ReadCondHandleKey.h"
 #include "CaloEvent/CaloCellContainerVector.h"
 #include "AthContainers/ConstDataVector.h"
+#include "CaloEvent/CaloConstCellContainer.h"
 #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
 #include "TileConditions/TileEMScale.h"
 
@@ -44,7 +45,7 @@ class HLTCaloCellMaker: public AthReentrantAlgorithm {
 
 	SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey;
 	SG::WriteHandleKey<ConstDataVector<CaloCellContainerVector> > m_cellContainerVKey;
-	SG::WriteHandleKey<ConstDataVector<CaloCellContainer> > m_cellContainerKey;
+	SG::WriteHandleKey<CaloConstCellContainer > m_cellContainerKey;
         /// FIXME: Temporary (i hope) to get dependency needed by BS converter.
         SG::ReadCondHandleKey<TileEMScale> m_tileEMScaleKey;
 
-- 
GitLab