From d0987dac397121c12addf1d5b742620cef336e37 Mon Sep 17 00:00:00 2001
From: Christos Anastopoulos <christos.anastopoulos@cern.ch>
Date: Tue, 11 Jul 2023 18:15:04 +0200
Subject: [PATCH] SCTRawDataProvider, TRT_RIO_Maker allow DataPool for the
 cache Online case

SCTRawDataProvider, TRT_RIO_Maker allow DataPool for the cache Online case
---
 .../src/SCTRawDataProvider.cxx                   |  4 ++++
 .../src/SCTRawDataProvider.h                     |  4 ++++
 .../InDetPrepRawDataFormation/TRT_RIO_Maker.h    |  4 ++++
 .../src/TRT_RIO_Maker.cxx                        | 16 +++++-----------
 4 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx
index 4b6236a402ed..b0ac604005b2 100644
--- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx
+++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx
@@ -156,7 +156,11 @@ StatusCode SCTRawDataProvider::execute(const EventContext& ctx) const
   if(!externalCacheRDO){
     dataItemsPool = std::make_unique<DataPool<SCT3_RawData>>(ctx);
     dataItemsPool->reserve(10000);  // Some large default size
+  } else if (m_useDataPoolWithCache) {
+    dataItemsPool = std::make_unique<DataPool<SCT3_RawData>>(ctx);
+    // for now a default size 1024.
   }
+
   // Ask SCTRawDataProviderTool to decode it and to fill the IDC
   StatusCode statConv = m_rawDataTool->convert(vecROBFrags,
 					       *(rdoContainer.ptr()),
diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h
index 6f86b678b14b..ea0d93fb0604 100644
--- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h
+++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h
@@ -91,6 +91,10 @@ class SCTRawDataProvider : public AthReentrantAlgorithm
   /** Boolean to determine if SCT Raw Data Provider should be run in RoI seeded mode. */
   BooleanProperty m_roiSeeded{this, "isRoI_Seeded", false, "Use RoI"};
 
+  /** Boolean to Use DataPool with IDC online Cache */
+  Gaudi::Property<bool> m_useDataPoolWithCache{
+      this, "useDataPoolWithCache", false, "use DataPool With Cache"};
+
   /** Read handle for Trigger ROI descriptor collection. */
   SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey{this,
                                                                     "RoIs",
diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/TRT_RIO_Maker.h b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/TRT_RIO_Maker.h
index ca76abb53594..309e0c0592b4 100644
--- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/TRT_RIO_Maker.h
+++ b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/TRT_RIO_Maker.h
@@ -72,8 +72,12 @@ namespace InDet{
 
     SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey{this, "RoIs", "", "RoIs to read in"};
     BooleanProperty m_roiSeeded{this, "isRoI_Seeded", false, "Use RoI"};
+    Gaudi::Property<bool> m_useDataPoolWithCache{
+        this, "useDataPoolWithCache", false, "use DataPool With Cache"};
+
     ToolHandle<IRegSelTool>     m_regionSelector { this, "RegSelTool", "RegSelTool/RegSelTool_TRT" };     //!< region selector tool
     SG::UpdateHandleKey<InDet::TRT_DriftCircleContainerCache> m_rioContainerCacheKey;
+    
 
   };
 }//end of namespace
diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/TRT_RIO_Maker.cxx b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/TRT_RIO_Maker.cxx
index 0dbd4d9943a2..eff8aabc0bb6 100644
--- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/TRT_RIO_Maker.cxx
+++ b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/TRT_RIO_Maker.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -95,6 +95,9 @@ namespace InDet {
     if (!hasExternalCache) {
       dataItemsPool = std::make_unique<DataPool<TRT_DriftCircle>>(ctx);
       dataItemsPool->reserve(100000);  // Some large default size
+    }else if(m_useDataPoolWithCache){
+      dataItemsPool = std::make_unique<DataPool<TRT_DriftCircle>>(ctx);
+      //Default size for now 1024 let it expand on its own
     }
 
     // Get TRT_RDO and produce TRT_RIO collections
@@ -122,11 +125,6 @@ namespace InDet {
          
          listOfTRTIds.clear(); //Prevents needless memory reallocations
          m_regionSelector->HashIDList( *roi, listOfTRTIds);
-#ifndef NDEBUG
-          ATH_MSG_VERBOSE(*roi);
-          ATH_MSG_VERBOSE( "REGTEST: SCT : Roi contains " 
-		     << listOfTRTIds.size() << " det. Elements" );
-#endif   
          for(auto &id : listOfTRTIds){
             const InDetRawDataCollection<TRT_RDORawData>* RDO_Collection (rdoContainer->indexFindPtr(id));
             if (!RDO_Collection) continue;
@@ -141,11 +139,7 @@ namespace InDet {
                                             RDO_Collection, ctx, dataItemsPool.get(),
                                             m_trtBadChannels));
             if (p_rio && !p_rio->empty()) {
-#ifndef NDEBUG               
-                 ATH_MSG_VERBOSE( "REGTEST: TRT : DriftCircleCollection contains "
-                 << p_rio->size() << " clusters" );
-#endif
-                 ATH_CHECK(lock.addOrDelete(std::move(p_rio)));
+              ATH_CHECK(lock.addOrDelete(std::move(p_rio)));
             }
          }
       }
-- 
GitLab