From 8f3159b3fad8428dfbca23b9fef4fd0ce313342a Mon Sep 17 00:00:00 2001
From: Neil Warrack <neil.warrack@cern.ch>
Date: Sun, 23 Dec 2018 11:20:14 +0000
Subject: [PATCH] Decouple BS conversion in TGCs from RDO->PRD decoding tool

In preparation for the migration of the Athena code to the multi-threaded AthenaMT, remove the (scheduler-unsafe) dependency of the TGC RDO->PRD tool on the existence of the RDOs which are in some cases produced from the BS using a decoding function called by the RDO-PRD process itself.

The RawDataProviderTool which can perform the BS decoding is removed from the Muon Spectrometer TGC RDO->PRD convenience tool and can now be used directly by trigger and offline in a similar manner. Changes have been made to the tigger validation unit tests to reflect these changes.
---
 .../src/TgcRdoToPrepDataTool.cxx              | 37 +------------------
 .../src/TgcRdoToPrepDataTool.h                |  7 ----
 .../MuonConfig/python/MuonRdoDecodeConfig.py  |  3 +-
 .../python/MuonPrdProviderToolsConfig.py      |  7 ----
 .../TrigL2MuonSA/TgcDataPreparator.h          |  6 +++
 .../TrigL2MuonSA/python/TrigL2MuonSAConfig.py |  6 +++
 .../TrigL2MuonSA/src/TgcDataPreparator.cxx    | 19 +++++++++-
 .../TrigMuonEF/python/TrigMuonEFConfig.py     |  2 +
 .../src/TrigMuonEFStandaloneTrackTool.cxx     | 26 +++++++++++++
 .../src/TrigMuonEFStandaloneTrackTool.h       |  2 +
 .../TrigUpgradeTest/python/MuonSetup.py       | 10 ++---
 11 files changed, 65 insertions(+), 60 deletions(-)

diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx
index cd9d6c15fb7..6baeb30a0f3 100644
--- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx
@@ -27,8 +27,7 @@
 #include "MuonCnvToolInterfaces/IDC_Helper.h"
 
 #include "EventPrimitives/EventPrimitives.h"
-// BS access
-#include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h"
+
 #include "GaudiKernel/ThreadLocalContext.h"
 
 #include <cfloat>
@@ -41,8 +40,6 @@ Muon::TgcRdoToPrepDataTool::TgcRdoToPrepDataTool(const std::string& t, const std
     m_muonMgr(0),
     m_tgcHelper(0),
     m_tgcCabling(0),
-    m_useBStoRdoTool(false), // true if running trigger (EF) on BS input
-    m_rawDataProviderTool("Muon::TGC_RawDataProviderTool/TGC_RawDataProviderTool", this),
     m_nHitRDOs(0), 
     m_nHitPRDs(0), 
     m_nTrackletRDOs(0), 
@@ -58,14 +55,11 @@ Muon::TgcRdoToPrepDataTool::TgcRdoToPrepDataTool(const std::string& t, const std
     m_outputprepdataKeys{"dummy", "dummy", "dummy", "dummy"}
 {
   // tools
-  declareProperty("RawDataProviderTool", m_rawDataProviderTool);
-  
   declareProperty("TGCHashIdOffset", m_tgcOffset = 26000);  
   declareProperty("FillCoinData", m_fillCoinData = true);
   declareProperty("OutputCollection", m_outputCollectionLocation="TGC_Measurements");
   declareProperty("OutputCoinCollection", m_outputCoinCollectionLocation="TrigT1CoinDataCollection");
   declareProperty("DecodeData", m_decodeData = true);  // !< toggle on/off the decoding of TGC RDO into TgcPrepData 
-  declareProperty("useBStoRdoTool", m_useBStoRdoTool = false);
   declareProperty("show_warning_level_invalid_A09_SSW6_hit", m_show_warning_level_invalid_A09_SSW6_hit = false); 
   declareProperty("dropPrdsWithZeroWidth", m_dropPrdsWithZeroWidth = true);
   declareProperty("outputCoinKey", m_outputCoinKeys);
@@ -132,9 +126,6 @@ StatusCode Muon::TgcRdoToPrepDataTool::initialize()
   ATH_CHECK(m_outputCoinKeys.initialize());
   ATH_CHECK(m_outputprepdataKeys.initialize());
  
-  // Get TgcRawDataProviderTool
-  ATH_CHECK( m_rawDataProviderTool.retrieve( DisableTool{ !m_useBStoRdoTool } ));
-  
   // check if initializing of DataHandle objects success
   ATH_CHECK( m_rdoContainerKey.initialize() );
   
@@ -299,33 +290,7 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque
 
     ATH_MSG_DEBUG("Decoding TGC RDO into TGC PrepRawData");
 
-    // If at least one BC has not yet been fully processed, fullEventDoneForAllBC should be false.  
-    bool fullEventDoneForAllBC = true;
-    for(int ibc=0; ibc<NBC; ibc++) {
-      if(!m_fullEventDone[ibc]) fullEventDoneForAllBC = false;
-    } 
-
     // retrieve the collection of RDO
-    if(m_useBStoRdoTool) {
-      // we come here if the entire rdo container is not yet in SG (i.e. in EF with BS input) 
-      // ask TgcRawDataProviderTool to decode the list of robs and to fill the rdo IDC
-      if(fullEventDoneForAllBC) {
-        StatusCode status = m_rawDataProviderTool->convert();
-        if(status.isFailure()) {
-	  ATH_MSG_FATAL("BS conversion into RDOs for the entire event failed");
-	  return StatusCode::FAILURE;
-        }
-        ATH_MSG_DEBUG("BS conversion into RDOs for the entire event done");
-      } else {
-        StatusCode status = m_rawDataProviderTool->convert(requestedIdHashVect);
-        if(status.isFailure()) {
-	  ATH_MSG_FATAL("BS conversion into RDOs for the selected collections failed");
-	  return StatusCode::FAILURE;
-        }
-        ATH_MSG_DEBUG("BS conversion into RDOs for the selected collections done !");
-      }
-    }
-
     ATH_MSG_DEBUG("Retriving TGC RDO container from the store");
     auto rdoContainer = SG::makeHandle(m_rdoContainerKey);
     if(!rdoContainer.isValid()) {
diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h
index 4166b567b30..f755b759c61 100644
--- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h
+++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h
@@ -14,7 +14,6 @@
 #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
 
 #include "GaudiKernel/ToolHandle.h"
-
 #include "MuonPrepRawData/MuonPrepDataContainer.h"
 #include "MuonRDO/TgcRdo.h"
 #include "MuonTrigCoinData/TgcCoinDataContainer.h"
@@ -35,7 +34,6 @@ namespace MuonGM
 
 namespace Muon 
 {
-  class IMuonRawDataProviderTool;
   class TgcCoinData;
 
   /** @class TgcRdoToPrepDataTool 
@@ -334,16 +332,11 @@ namespace Muon
       /** Identifier hash offset */
       int m_tgcOffset;
 
-      /** Switch for the decoding of TGC BS into RDO for EF */
-      bool m_useBStoRdoTool;                
       /** Switch for the decoding of TGC RDO into TgcPrepData */
       bool m_decodeData; 
       /** Switch for the coincince decoding */
       bool m_fillCoinData; 
       
-      /** ToolHandle of the TGC_RawDataProviderTool */
-      ToolHandle<IMuonRawDataProviderTool> m_rawDataProviderTool;
-
       /** Switch for keeping Track of FullEvent Decoding */
       bool m_fullEventDone[NBC+1];
 
diff --git a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py
index 0f169aa5935..ab4baa7f57b 100644
--- a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py
+++ b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py
@@ -50,8 +50,7 @@ def TgcRDODecodeCfg(flags, forTrigger=False):
 
     # Get the RDO -> PRD tool
     from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TgcRdoToPrepDataTool
-    TgcRdoToTgcPrepDataTool = Muon__TgcRdoToPrepDataTool(name           = "TgcRdoToTgcPrepDataTool",
-                                                         useBStoRdoTool = True )
+    TgcRdoToTgcPrepDataTool = Muon__TgcRdoToPrepDataTool(name           = "TgcRdoToTgcPrepDataTool")
     acc.addPublicTool( TgcRdoToTgcPrepDataTool ) # This should be removed, but now defined as PublicTool at MuFastSteering 
     
     # Get the RDO -> PRD alorithm
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonPrdProviderToolsConfig.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonPrdProviderToolsConfig.py
index 68fd3c51c46..00b7c569d19 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonPrdProviderToolsConfig.py
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonPrdProviderToolsConfig.py
@@ -54,13 +54,6 @@ def TgcPrepDataProviderTool(name="TgcPrepDataProviderTool", **kwargs):
   # setup dependencies which are not yet in C++  
   import MuonCnvExample.MuonCablingConfig
 
-  # If we run trigger from BS, then the RDO to PRD tools need to automatically run BS to RDO tools
-  kwargs.setdefault("useBStoRdoTool", DetFlags.readRDOBS.TGC_on() and recAlgs.doTrigger())
-  #kwargs.setdefault("RawDataProviderTool", "TgcRawDataProviderTool")
-### TODO: in C++ do not retrieve tool if useBStoRdoTool==False
-##  if not kwargs["useBStoRdoTool"]:
-##    kwargs["RawDataProviderTool"] = None # empty tool
-
   from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TgcRdoToPrepDataTool
   return Muon__TgcRdoToPrepDataTool(name, **kwargs)
   
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h
index c36c7f0e177..f1cf6dc9169 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h
@@ -98,6 +98,9 @@ class TgcDataPreparator: public AthAlgTool
       // Cabling (new)
       MuonTGC_CablingSvc* m_tgcCabling;	
 
+      // Tool handles for BS conversion and Rdo to Prep Data conversion
+      ToolHandle<Muon::IMuonRawDataProviderTool> m_rawDataProviderTool;
+
       // Tool for Rdo to Prep Data conversion
       ToolHandle<Muon::IMuonRdoToPrepDataTool> m_tgcPrepDataProvider;
       //ToolHandle<Muon::IMuonRdoToPrepDataTool> m_tgcPrepDataProvider {
@@ -121,6 +124,9 @@ class TgcDataPreparator: public AthAlgTool
 
       bool m_use_RoIBasedDataAccess;
 
+      // Flag to decide whether or not to run BS decoding
+      Gaudi::Property< bool > m_decodeBS { this, "DecodeBS", true, "Flag to decide whether or not to run BS->RDO decoding" };
+
       // vector of the TGC hash ID list
       std::vector<IdentifierHash> m_tgcHashList;         
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py
index 3cfff383871..501f6b61296 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py
@@ -28,6 +28,12 @@ ToolSvc += mdtDataPreparator
 
 theDataPreparator.MDTDataPreparator = mdtDataPreparator
 
+tgcDataPreparator = TrigL2MuonSA__TgcDataPreparator()
+tgcDataPreparator.DecodeBS = DetFlags.readRDOBS.TGC_on()
+ToolSvc += tgcDataPreparator
+
+theDataPreparator.TGCDataPreparator = tgcDataPreparator
+
 ToolSvc += theDataPreparator
 ToolSvc += thePatternFinder
 ToolSvc += theStationFitter
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx
index 6c9b39b00a2..7857583c2ef 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx
@@ -43,12 +43,14 @@ TrigL2MuonSA::TgcDataPreparator::TgcDataPreparator(const std::string& type,
   AthAlgTool(type,name,parent),
    m_storeGateSvc( "StoreGateSvc", name ),
    m_activeStore( "ActiveStoreSvc", name ), 
+   m_rawDataProviderTool("Muon::TGC_RawDataProviderTool/TGC_RawDataProviderTool"),
    m_tgcPrepDataProvider("Muon::TgcRdoToPrepDataTool/TgcPrepDataProviderTool"),
    m_regionSelector( "RegSelSvc", name ), 
    m_robDataProvider( "ROBDataProviderSvc", name ),
    m_options(), m_recMuonRoIUtils()
 {
    declareInterface<TrigL2MuonSA::TgcDataPreparator>(this);
+   declareProperty("TgcRawDataProvider", m_rawDataProviderTool);
    declareProperty("TgcPrepDataProvider", m_tgcPrepDataProvider);
 }
 
@@ -91,6 +93,14 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::initialize()
    ATH_CHECK( m_activeStore.retrieve() ); 
    ATH_MSG_DEBUG("Retrieved ActiveStoreSvc." );
 
+   // Retreive TGC raw data provider tool
+   ATH_MSG_DEBUG("Decode BS set to " << m_decodeBS);
+   if (m_rawDataProviderTool.retrieve(DisableTool{ !m_decodeBS }).isFailure()) {
+     msg (MSG::FATAL) << "Failed to retrieve " << m_rawDataProviderTool << endmsg;
+     return StatusCode::FAILURE;
+   } else
+     msg (MSG::INFO) << "Retrieved Tool " << m_rawDataProviderTool << endmsg;
+
    ATH_CHECK( m_tgcPrepDataProvider.retrieve() );
    ATH_MSG_DEBUG("Retrieved tool " << m_tgcPrepDataProvider );
 
@@ -156,7 +166,14 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI*
    if (iroi) m_regionSelector->DetHashIDList(TGC, *iroi, m_tgcHashList);
    else m_regionSelector->DetHashIDList(TGC, m_tgcHashList);
    if(roi) delete roi;
-   
+
+   // Decode BS
+   if (m_decodeBS){
+     if ( m_rawDataProviderTool->convert(m_tgcHashList).isFailure()) {
+       ATH_MSG_WARNING("Conversion of BS for decoding of TGCs failed");
+     }
+   }
+
    // now convert from RDO to PRD
    std::vector<IdentifierHash> inhash, outhash;
    inhash = m_tgcHashList; 
diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py
index 87f2e8c05b0..e18cacaa8d3 100755
--- a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py
+++ b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py
@@ -425,8 +425,10 @@ class TrigMuonEFStandaloneTrackToolConfig (TrigMuonEFStandaloneTrackTool):
 
         self.MdtRawDataProvider = "MdtRawDataProviderTool"
         self.RpcRawDataProvider = "RpcRawDataProviderTool"
+        self.TgcRawDataProvider = "TgcRawDataProviderTool"
         self.DecodeMdtBS = DetFlags.readRDOBS.MDT_on()
         self.DecodeRpcBS = DetFlags.readRDOBS.RPC_on()
+        self.DecodeTgcBS = DetFlags.readRDOBS.TGC_on()
 
         # use seeded decoding
         if (TriggerFlags.MuonSlice.doEFRoIDrivenAccess()):
diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx
index b72032796d2..eb6272c55c5 100644
--- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx
+++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx
@@ -90,6 +90,7 @@ TrigMuonEFStandaloneTrackTool::TrigMuonEFStandaloneTrackTool(const std::string&
     m_trackSummaryTool("Trk::TrackSummaryTool/MuidTrackSummaryTool"),
     m_mdtRawDataProvider("Muon::MDT_RawDataProviderTool/MDT_RawDataProviderTool"),
     m_rpcRawDataProvider("Muon::RPC_RawDataProviderTool/RPC_RawDataProviderTool"),
+    m_tgcRawDataProvider("Muon::TGC_RawDataProviderTool/TGC_RawDataProviderTool"),
     m_cscPrepDataProvider("Muon::CscRdoToCscPrepDataTool/CscPrepDataProviderTool"),
     m_mdtPrepDataProvider("Muon::MdtRdoToPrepDataTool/MdtPrepDataProviderTool"),
     m_rpcPrepDataProvider("Muon::RpcRdoToPrepDataTool/RpcPrepDataProviderTool"),
@@ -161,6 +162,7 @@ TrigMuonEFStandaloneTrackTool::TrigMuonEFStandaloneTrackTool(const std::string&
 
   declareProperty ("MdtRawDataProvider",m_mdtRawDataProvider);
   declareProperty ("RpcRawDataProvider",m_rpcRawDataProvider);
+  declareProperty ("TgcRawDataProvider",m_tgcRawDataProvider);
 
   declareProperty("CscPrepDataProvider", m_cscPrepDataProvider);
   declareProperty("MdtPrepDataProvider", m_mdtPrepDataProvider);
@@ -236,6 +238,8 @@ StatusCode TrigMuonEFStandaloneTrackTool::initialize()
 	  << "MdtRawDataProvider             " << m_mdtRawDataProvider << endmsg;
     msg() << MSG::DEBUG
 	  << "RpcRawDataProvider             " << m_rpcRawDataProvider << endmsg;
+    msg() << MSG::DEBUG
+	  << "TgcRawDataProvider             " << m_tgcRawDataProvider << endmsg;
     msg() << MSG::DEBUG
 	  << "CscPrepDataProvider            " << m_cscPrepDataProvider << endmsg;
     msg() << MSG::DEBUG
@@ -275,6 +279,8 @@ StatusCode TrigMuonEFStandaloneTrackTool::initialize()
           << m_decodeMdtBS.name() << "       " << m_decodeMdtBS << endmsg;
     msg() << MSG::DEBUG
           << m_decodeRpcBS.name() << "       " << m_decodeRpcBS << endmsg;
+    msg() << MSG::DEBUG
+          << m_decodeTgcBS.name() << "       " << m_decodeTgcBS << endmsg;
     msg() << MSG::DEBUG
 	  << "doTimeOutChecks                " << m_doTimeOutChecks << endmsg;
     msg() << MSG::DEBUG
@@ -325,6 +331,14 @@ StatusCode TrigMuonEFStandaloneTrackTool::initialize()
     return StatusCode::FAILURE;
   }
 
+  // Retrieve TGC raw data provider tool if needed
+  if (m_tgcRawDataProvider.retrieve(DisableTool{ !m_decodeTgcBS }).isSuccess()) {
+    msg (MSG::INFO) << "Retrieved " << m_tgcRawDataProvider << endmsg;
+  }
+  else {
+    msg (MSG::FATAL) << "Could not get " << m_tgcRawDataProvider << endmsg;
+    return StatusCode::FAILURE;
+  }
 
   // Retrieve segment maker tool
   status = m_segmentsFinderTool.retrieve();
@@ -970,6 +984,13 @@ if (m_useMdtData>0) {
       if (m_useTgcRobDecoding) {// ROB-based seeded decoding of TGC is neither available nor needed
         ATH_MSG_DEBUG("ROB-based seeded decoding of TGC requested, which is neither available nor needed. Calling the PRD-based seeded decoding.");
       }
+      if (m_decodeTgcBS) {// bytesream conversion
+	if (m_tgcRawDataProvider->convert( getTgcRobList(muonRoI) ).isSuccess()) {
+	  ATH_MSG_DEBUG("TGC BS conversion for ROB-based seeded PRD decoding done successfully");
+	} else {
+	  ATH_MSG_WARNING("TGC BS conversion for ROB-based seeded PRD decoding failed");
+	}
+      }
       
       if (m_tgcPrepDataProvider->decode(tgc_hash_ids, hash_ids_withData).isSuccess()) {
         ATH_MSG_DEBUG("PRD-based seeded decoding of TGC done successfully");
@@ -986,6 +1007,11 @@ if (m_useMdtData>0) {
       
     }
     else {// full decoding of TGC
+      if (m_tgcRawDataProvider->convert().isSuccess()) {
+	ATH_MSG_DEBUG("TGC BS conversion for full decoding done successfully");
+      } else {
+	ATH_MSG_WARNING("TGC BS conversion for full decoding failed");
+      }
       
       std::vector<IdentifierHash> input_hash_ids;
       input_hash_ids.reserve(0);
diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h
index 96c558e5f36..eb6e01ba67c 100644
--- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h
+++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h
@@ -271,6 +271,7 @@ class TrigMuonEFStandaloneTrackTool : public AthAlgTool,
   // handles to the RoI driven data access
   ToolHandle<Muon::IMuonRawDataProviderTool> m_mdtRawDataProvider;
   ToolHandle<Muon::IMuonRawDataProviderTool> m_rpcRawDataProvider;
+  ToolHandle<Muon::IMuonRawDataProviderTool> m_tgcRawDataProvider;
   ToolHandle<Muon::IMuonRdoToPrepDataTool> m_cscPrepDataProvider;
   ToolHandle<Muon::IMuonRdoToPrepDataTool> m_mdtPrepDataProvider;
   ToolHandle<Muon::IMuonRdoToPrepDataTool> m_rpcPrepDataProvider;
@@ -308,6 +309,7 @@ class TrigMuonEFStandaloneTrackTool : public AthAlgTool,
   // Flag to decide whether or not to run BS decoding
   Gaudi::Property< bool > m_decodeMdtBS { this, "DecodeMdtBS", true, "Flag to decide whether or not to run BS->RDO decoding for MTDs" };
   Gaudi::Property< bool > m_decodeRpcBS { this, "DecodeRpcBS", true, "Flag to decide whether or not to run BS->RDO decoding for RPCs" };
+  Gaudi::Property< bool > m_decodeTgcBS { this, "DecodeTgcBS", true, "Flag to decide whether or not to run BS->RDO decoding for TGCs" };
 
   bool m_useCscData;
   bool m_useRpcData;
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/MuonSetup.py b/Trigger/TrigValidation/TrigUpgradeTest/python/MuonSetup.py
index f6b784768f3..40ac54bc2ff 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/MuonSetup.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/MuonSetup.py
@@ -142,9 +142,7 @@ def makeMuonPrepDataAlgs():
   ToolSvc += MuonTgcRawDataProviderTool
     
   from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TgcRdoToPrepDataTool
-  TgcRdoToTgcPrepDataTool = Muon__TgcRdoToPrepDataTool(name                = "TgcRdoToPrepDataTool",
-                                                       RawDataProviderTool = MuonTgcRawDataProviderTool,
-                                                       useBStoRdoTool      = True)
+  TgcRdoToTgcPrepDataTool = Muon__TgcRdoToPrepDataTool(name                = "TgcRdoToPrepDataTool")
   ToolSvc += TgcRdoToTgcPrepDataTool
 
   from MuonRdoToPrepData.MuonRdoToPrepDataConf import TgcRdoToTgcPrepData
@@ -158,10 +156,11 @@ def makeMuonPrepDataAlgs():
   TgcRawDataProvider = Muon__TgcRawDataProvider(name         = "TgcRawDataProvider",
                                                 ProviderTool = MuonTgcRawDataProviderTool )
 
+  eventAlgs_MuonPRD.append( TgcRawDataProvider )
   eventAlgs_MuonPRD.append( TgcRdoToTgcPrepData )
+  viewAlgs_MuonPRD.append( TgcRawDataProvider )
   viewAlgs_MuonPRD.append( TgcRdoToTgcPrepData )
 
-
   if muonRecFlags.doCreateClusters():  
     #Run clustering
     from MuonClusterization.MuonClusterizationConf import MuonClusterizationTool
@@ -316,11 +315,8 @@ def muFastRecoSequence( RoIs, OutputLevel=INFO ):
     
   from MuonTGC_CnvTools.MuonTGC_CnvToolsConf import Muon__TgcRdoToPrepDataTool
   TgcRdoToTgcPrepDataTool = Muon__TgcRdoToPrepDataTool(name                 = "TgcRdoToPrepDataTool_L2SA",
-                                                       RawDataProviderTool  = MuonTgcRawDataProviderTool,
-                                                       RDOContainer         = MuonTgcRawDataProviderTool.RdoLocation,
                                                        OutputCollection     = "TGC_Measurements_L2SA",
                                                        OutputCoinCollection = "TrigT1CoinDataCollection_L2SA",
-                                                       useBStoRdoTool       = True,
                                                        OutputLevel = OutputLevel )
 
   ToolSvc += TgcRdoToTgcPrepDataTool
-- 
GitLab