From d246566cdf9da5b1e73ca0cdc3f2d79d0a72b5f0 Mon Sep 17 00:00:00 2001
From: Tomasz Bold <tomasz.bold@gmail.com>
Date: Tue, 16 Apr 2019 12:08:31 +0200
Subject: [PATCH] changed place where cache loader resides

---
 .../src/PixelRawDataProvider.cxx              | 37 +++++++++++--------
 .../TrigUpgradeTest/share/full_menu.py        | 11 ++++++
 .../TrigUpgradeTest/share/testHLT_MT.py       | 10 +++++
 .../CommonSequences/InDetSetup.py             | 34 ++++++++---------
 4 files changed, 60 insertions(+), 32 deletions(-)

diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRawDataProvider.cxx b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRawDataProvider.cxx
index f7761e4012c..0847a601c31 100644
--- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRawDataProvider.cxx
+++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRawDataProvider.cxx
@@ -106,7 +106,10 @@ StatusCode PixelRawDataProvider::execute() {
   if(!ExternalCacheMode) rdoContainer = std::make_unique<PixelRDO_Container>(m_pixel_id->wafer_hash_max()); 
   else{
     SG::UpdateHandle<PixelRDO_Cache> updateh(m_rdoCacheKey);
-    if(!updateh.isValid()) ATH_MSG_FATAL("Failure to retrieve cache " << m_rdoCacheKey.key());
+    if( ! updateh.isValid() ) {
+      ATH_MSG_FATAL("Failure to retrieve cache " << m_rdoCacheKey.key());
+      return StatusCode::FAILURE;
+    }    
     rdoContainer = std::make_unique<PixelRDO_Container>(updateh.ptr());
     ATH_MSG_DEBUG("Created container " << m_rdoContainerKey.key() << " using external cache " << m_rdoCacheKey.key());
   }
@@ -120,23 +123,26 @@ StatusCode PixelRawDataProvider::execute() {
 
 
   if (!m_roiSeeded) {
+    ATH_MSG_DEBUG("No RoI seed, fetching all ROBs");
     listOfRobs = m_pixelCabling->getAllRobs();  // need ROB id (not ROD)
   }
   else {//Enter RoI-seeded mode
-      SG::ReadHandle<TrigRoiDescriptorCollection> roiCollection(m_roiCollectionKey);
-      ATH_CHECK(roiCollection.isValid());
-
-      TrigRoiDescriptorCollection::const_iterator roi = roiCollection->begin();
-      TrigRoiDescriptorCollection::const_iterator roiE = roiCollection->end();
-      TrigRoiDescriptor superRoI;//add all RoIs to a super-RoI
-      superRoI.setComposite(true);
-      superRoI.manageConstituents(false);
-      for (; roi!=roiE; ++roi) {
-        superRoI.push_back(*roi);
-      }
-      m_regionSelector->DetROBIDListUint( PIXEL, 
-					  superRoI,
-					  listOfRobs);
+     ATH_MSG_DEBUG("RoI seed, fetching regions infromation");
+     SG::ReadHandle<TrigRoiDescriptorCollection> roiCollection(m_roiCollectionKey);
+     ATH_CHECK(roiCollection.isValid());
+     
+     TrigRoiDescriptorCollection::const_iterator roi = roiCollection->begin();
+     TrigRoiDescriptorCollection::const_iterator roiE = roiCollection->end();
+     TrigRoiDescriptor superRoI;//add all RoIs to a super-RoI
+     superRoI.setComposite(true);
+     superRoI.manageConstituents(false);
+     for (; roi!=roiE; ++roi) {
+       ATH_MSG_DEBUG("Adding RoI "<< **roi);
+       superRoI.push_back(*roi);
+     }
+     m_regionSelector->DetROBIDListUint( PIXEL, 
+					 superRoI,
+					 listOfRobs);
   }
   std::vector<const ROBFragment*> listOfRobf;
   m_robDataProvider->getROBData( listOfRobs, listOfRobf);
@@ -152,6 +158,7 @@ StatusCode PixelRawDataProvider::execute() {
 
   IPixelRDO_Container *containerInterface = tempcont ? static_cast< IPixelRDO_Container* >(tempcont.get()) :
          static_cast< IPixelRDO_Container* >(rdoContainer.ptr());
+  ATH_MSG_DEBUG( "Container interface ptr: " << containerInterface );
   // ask PixelRawDataProviderTool to decode it and to fill the IDC
   if (m_rawDataTool->convert(listOfRobf,  containerInterface).isFailure())
     ATH_MSG_ERROR("BS conversion into RDOs failed");
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py
index 97e5eb76e66..0337fd64990 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py
@@ -227,3 +227,14 @@ import DecisionHandling
 for a in AthSequencer("HLTAllSteps").getChildren():
     if isinstance(a, DecisionHandling.DecisionHandlingConf.TriggerSummaryAlg):
         a.OutputLevel = DEBUG
+
+
+AthSequencer("AthAlgSeq").InDetCacheCreatorTrig.OutputLevel = DEBUG
+
+
+
+def d(alg):
+    alg.OutputLevel = DEBUG
+    alg.ProviderTool.OutputLevel = DEBUG
+d(AthSequencer("electronInViewAlgs").InDetPixelRawDataProvider)
+d(AthSequencer("efcbViewNode_FS").InDetPixelRawDataProvider_MuonFS)
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/testHLT_MT.py b/Trigger/TrigValidation/TrigUpgradeTest/share/testHLT_MT.py
index 0c72a842390..75bc12030ec 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/testHLT_MT.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/testHLT_MT.py
@@ -481,6 +481,7 @@ if opt.doL1Unpacking:
         from TrigUpgradeTest.TestUtils import L1EmulationTest
         topSequence += L1EmulationTest()
 
+
 # ---------------------------------------------------------------
 # Monitoring
 # ---------------------------------------------------------------
@@ -519,3 +520,12 @@ if svcMgr.MessageSvc.OutputLevel<INFO:
     from AthenaCommon.JobProperties import jobproperties
     jobproperties.print_JobProperties('tree&value')
     print svcMgr
+
+
+from AthenaCommon.Configurable import Configurable
+Configurable.configurableRun3Behavior=True
+from TriggerJobOpts.TriggerConfig import triggerIDCCacheCreatorsCfg
+from AthenaConfiguration.AllConfigFlags import ConfigFlags
+ConfigFlags.lock()
+triggerIDCCacheCreatorsCfg(ConfigFlags).appendToGlobals()
+Configurable.configurableRun3Behavior=False
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py
index be9e210916f..c2391e93734 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py
@@ -2,6 +2,17 @@
 #  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 #
 
+# this is copy paste from Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py
+# once the cunction below is moved to the destination pkg, will eliminate this duplication
+class InDetCacheNames:
+  Pixel_ClusterKey   = "PixelTrigClustersCache"
+  SCT_ClusterKey     = "SCT_ClustersCache"
+  SpacePointCachePix = "PixelSpacePointCache"
+  SpacePointCacheSCT = "SctSpacePointCache"
+  SCTRDOCacheKey     = "SctRDOCache"
+  PixRDOCacheKey     = "PixRDOCache"
+
+
 def makeInDetAlgs( whichSignature='' ):
   #If signature specified add suffix to the algorithms
   signature =  "_" + whichSignature if whichSignature else ''
@@ -12,17 +23,6 @@ def makeInDetAlgs( whichSignature='' ):
   from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
   from InDetRecExample.InDetKeys import InDetKeys
 
-  #Create IdentifiableCaches
-  from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__CacheCreator
-  InDetCacheCreatorTrigViews = InDet__CacheCreator(name = "InDetCacheCreatorTrigViews" + signature,
-                                                   Pixel_ClusterKey = "PixelTrigClustersCache" + signature,
-                                                   SCT_ClusterKey   = "SCT_ClustersCache" + signature,
-                                                   SpacePointCachePix = "PixelSpacePointCache" + signature,
-                                                   SpacePointCacheSCT   = "SctSpacePointCache" + signature,
-                                                   SCTRDOCacheKey       = "SctRDOCache" + signature,
-                                                   PixRDOCacheKey = "PixRDOCache" + signature)
-  eventAlgs.append(InDetCacheCreatorTrigViews)
-
   from AthenaCommon.AppMgr import ToolSvc
   from AthenaCommon.AppMgr import ServiceMgr
 
@@ -50,7 +50,7 @@ def makeInDetAlgs( whichSignature='' ):
                                                      ProviderTool = InDetPixelRawDataProviderTool,)
     InDetPixelRawDataProvider.isRoI_Seeded = True
     InDetPixelRawDataProvider.RoIs = "EMViewRoIs"
-    InDetPixelRawDataProvider.RDOCacheKey = InDetCacheCreatorTrigViews.PixRDOCacheKey
+    InDetPixelRawDataProvider.RDOCacheKey = InDetCacheNames.PixRDOCacheKey
     
     viewAlgs.append(InDetPixelRawDataProvider)
     
@@ -78,7 +78,7 @@ def makeInDetAlgs( whichSignature='' ):
                                                  ProviderTool = InDetSCTRawDataProviderTool)
     InDetSCTRawDataProvider.isRoI_Seeded = True
     InDetSCTRawDataProvider.RoIs = "EMViewRoIs"
-    InDetSCTRawDataProvider.RDOCacheKey = InDetCacheCreatorTrigViews.SCTRDOCacheKey
+    InDetSCTRawDataProvider.RDOCacheKey = InDetCacheNames.SCTRDOCacheKey
     
     viewAlgs.append(InDetSCTRawDataProvider)
 
@@ -157,7 +157,7 @@ def makeInDetAlgs( whichSignature='' ):
                                                         ClustersName            = "PixelTrigClusters",)
   InDetPixelClusterization.isRoI_Seeded = True
   InDetPixelClusterization.RoIs = "EMViewRoIs"
-  InDetPixelClusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.Pixel_ClusterKey 
+  InDetPixelClusterization.ClusterContainerCacheKey = InDetCacheNames.Pixel_ClusterKey 
 
   viewAlgs.append(InDetPixelClusterization)
 
@@ -205,7 +205,7 @@ def makeInDetAlgs( whichSignature='' ):
                                                       conditionsTool          = InDetSCT_ConditionsSummaryToolWithoutFlagged)
   InDetSCT_Clusterization.isRoI_Seeded = True
   InDetSCT_Clusterization.RoIs = "EMViewRoIs"
-  InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.SCT_ClusterKey 
+  InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheNames.SCT_ClusterKey 
   
   viewAlgs.append(InDetSCT_Clusterization)
   
@@ -228,8 +228,8 @@ def makeInDetAlgs( whichSignature='' ):
                                                                     ProcessPixels          = DetFlags.haveRIO.pixel_on(),
                                                                     ProcessSCTs            = DetFlags.haveRIO.SCT_on(),
                                                                     ProcessOverlaps        = DetFlags.haveRIO.SCT_on(),
-                                                                    SpacePointCacheSCT = InDetCacheCreatorTrigViews.SpacePointCacheSCT,
-                                                                    SpacePointCachePix = InDetCacheCreatorTrigViews.SpacePointCachePix,)
+                                                                    SpacePointCacheSCT = InDetCacheNames.SpacePointCacheSCT,
+                                                                    SpacePointCachePix = InDetCacheNames.SpacePointCachePix,)
 
   viewAlgs.append(InDetSiTrackerSpacePointFinder)
 
-- 
GitLab