diff --git a/Event/xAOD/xAODTrigger/CMakeLists.txt b/Event/xAOD/xAODTrigger/CMakeLists.txt
index d17cde620896397a048b4617ee83377f8900bcee..65c91c4d1c952c41c2f6b9e48ca2d56223efbf37 100644
--- a/Event/xAOD/xAODTrigger/CMakeLists.txt
+++ b/Event/xAOD/xAODTrigger/CMakeLists.txt
@@ -17,7 +17,7 @@ atlas_add_library( xAODTrigger
    xAODTrigger/*.h xAODTrigger/versions/*.h xAODTrigger/versions/*.icc
    Root/*.cxx
    PUBLIC_HEADERS xAODTrigger
-   LINK_LIBRARIES AthContainers AthLinks xAODCore xAODBase TrigNavStructure CxxUtils
+   LINK_LIBRARIES AthContainers AthLinks xAODCore xAODBase TrigNavStructure CxxUtils TrigT1MuctpiBits
    ${extra_libs} )
 
 atlas_add_xaod_smart_pointer_dicts(
diff --git a/Event/xAOD/xAODTrigger/Root/MuonRoI_v1.cxx b/Event/xAOD/xAODTrigger/Root/MuonRoI_v1.cxx
index 6982f6fa6e0721cfacc9db2795867cd8709eceb7..604203161879df6769cb9f13190c9cb34ab705da 100644
--- a/Event/xAOD/xAODTrigger/Root/MuonRoI_v1.cxx
+++ b/Event/xAOD/xAODTrigger/Root/MuonRoI_v1.cxx
@@ -10,6 +10,9 @@
 // Local include(s):
 #include "xAODTrigger/versions/MuonRoI_v1.h"
 
+// get bitsmasks from common definition source:
+#include "TrigT1MuctpiBits/MuCTPI_Bits.h"
+
 namespace xAOD{
 
    MuonRoI_v1::MuonRoI_v1()
@@ -70,7 +73,8 @@ namespace xAOD{
    ///
    int MuonRoI_v1::getThrNumber() const {
 
-      return ( ( roiWord() >> 11 ) & 0x7 );
+     if (isRun3()) return ( ( roiWord() >> RUN3_CAND_PT_SHIFT ) & RUN3_CAND_PT_MASK );
+     else return ( ( roiWord() >> CAND_PT_SHIFT ) & CAND_PT_MASK );
    }
 
    /// A muon's spacial location is identified from the sector number and the
@@ -82,15 +86,26 @@ namespace xAOD{
    ///
    int MuonRoI_v1::getRoI() const {
 
-      if( this->getSource() == Forward ) {
-         return ( ( roiWord() >> 2 ) & 0x3f );
-      } else if( this->getSource() == Endcap ) {
-         return ( ( roiWord() >> 2 ) & 0xff );
-      } else if( this->getSource() == Barrel ) {
-         return ( ( roiWord() >> 2 ) & 0x1f );
-      }
-
-      return 0;
+     if (isRun3()) {
+       if( this->getSource() == Forward ) {
+	 return ( ( roiWord() >> RUN3_ROI_SHIFT ) & FORWARD_ROI_MASK );
+       } else if( this->getSource() == Endcap ) {
+	 return ( ( roiWord() >> RUN3_ROI_SHIFT ) & ENDCAP_ROI_MASK );
+       } else if( this->getSource() == Barrel ) {
+	 return ( ( roiWord() >> RUN3_ROI_SHIFT ) & BARREL_ROI_MASK );
+       }
+     }
+     else
+     {
+       if( this->getSource() == Forward ) {
+	 return ( ( roiWord() >> ROI_SHIFT ) & FORWARD_ROI_MASK );
+       } else if( this->getSource() == Endcap ) {
+	 return ( ( roiWord() >> ROI_SHIFT ) & ENDCAP_ROI_MASK );
+       } else if( this->getSource() == Barrel ) {
+	 return ( ( roiWord() >> ROI_SHIFT ) & BARREL_ROI_MASK );
+       }
+     }
+     return 0;
    }
 
    /// The sector address is an 8-bit identifier of the sector. For its detailed
@@ -105,7 +120,8 @@ namespace xAOD{
    ///
    int MuonRoI_v1::getSectorAddress() const {
 
-      return ( ( roiWord() >> 14 ) & 0xff );
+     if (isRun3()) return ( ( roiWord() >> RUN3_CAND_SECTOR_ADDRESS_SHIFT ) & CAND_SECTOR_ADDRESS_MASK );
+     else return ( ( roiWord() >> CAND_SECTOR_ADDRESS_SHIFT ) & CAND_SECTOR_ADDRESS_MASK );
    }
 
    /// Each muon trigger sector can only send information about a maximum of
@@ -114,9 +130,11 @@ namespace xAOD{
    /// assigned to it in its sector. If it's <code>false</code>, it was the
    /// <i>second candidate</i> in its sector.
    ///
+   /// actually v1 only ... 
    bool MuonRoI_v1::isFirstCandidate() const {
 
-      return ( ( roiWord() >> 22 ) & 0x1 );
+     if (isRun3()) return true; // undefined in run3, return default true
+     else return ( ( roiWord() >> CAND_HIGHEST_PT_SHIFT ) & CAND_HIGHEST_PT_MASK );
    }
 
    /// One RoI (one part of the trigger sector) can only send information about
@@ -126,7 +144,10 @@ namespace xAOD{
    ///
    bool MuonRoI_v1::isMoreCandInRoI() const {
 
-      return ( ( roiWord() >> 1 ) & 0x1 );
+     if (isRun3()) {
+       if (getSource() == Barrel) return ( ( roiWord() >> RUN3_ROI_OVERFLOW_SHIFT ) & ROI_OVERFLOW_MASK );
+       else return false; // Endcap + Fwd have no flag for this
+     } else return ( ( roiWord() >> ROI_OVERFLOW_SHIFT ) & ROI_OVERFLOW_MASK );
    }
 
    /// This flag is set to <code>true</code> if the sector that this muon
@@ -136,7 +157,8 @@ namespace xAOD{
    ///
    bool MuonRoI_v1::isMoreCandInSector() const {
 
-      return ( roiWord() & 0x1 );
+     if (isRun3()) return ( ( roiWord() >> RUN3_CAND_OVERFLOW_SHIFT ) & CAND_OVERFLOW_MASK );
+     else return ( ( roiWord() >> CAND_OVERFLOW_SHIFT ) & CAND_OVERFLOW_MASK );
    }
 
    /// The function decodes the sector type encoded in the 8-bit sector address
@@ -147,9 +169,10 @@ namespace xAOD{
    ///
    MuonRoI_v1::RoISource MuonRoI_v1::getSource() const {
 
-      if( this->getSectorAddress() & 0x80 ) {
+     //same mask for run2 and run3
+     if( this->getSectorAddress() & ENDCAP_ADDRESS_MASK ) {
          return Endcap;
-      } else if( this->getSectorAddress() & 0x40 ) {
+     } else if( this->getSectorAddress() & FORWARD_ADDRESS_MASK ) {
          return Forward;
       } else {
          return Barrel;
@@ -164,7 +187,8 @@ namespace xAOD{
    ///
    MuonRoI_v1::Hemisphere MuonRoI_v1::getHemisphere() const {
 
-      if( this->getSectorAddress() & 0x1 ) {
+     //same mask for run2 and run3
+     if( this->getSectorAddress() & SECTOR_HEMISPHERE_MASK ) {
          return Positive;
       } else {
          return Negative;
@@ -181,10 +205,18 @@ namespace xAOD{
 
       if( getSource() == Barrel ) return Undef;
 
-      if( roiWord() & 0x8000000 ) {
-         return Pos;
+      if (isRun3()) {
+	if( ( roiWord() >> RUN3_CAND_TGC_CHARGE_SIGN_SHIFT) & 0x1 ) {
+	  return Pos;
+	} else {
+	  return Neg;
+	}
       } else {
-         return Neg;
+	if( ( roiWord() >> CAND_TGC_CHARGE_SIGN_SHIFT) & 0x1 ) {
+	  return Pos;
+	} else {
+	  return Neg;
+	}
       }
    }
 
@@ -194,7 +226,16 @@ namespace xAOD{
    ///
    bool MuonRoI_v1::isVetoed() const {
 
-      return ( roiWord() & 0x10000000 );
+     if (isRun3()) return ( ( roiWord() >> RUN3_CAND_VETO_SHIFT) & 0x1 );
+     else return ( ( roiWord() >> CAND_VETO_SHIFT) & 0x1 );
+   }
+
+   /// An extra bit is added at the end of the RoI word for run3 candidates
+   /// in the EDM for technical purposes to distinguish whether we want to use
+   /// the run2 or run3 bitmasks in decoding the word
+   bool MuonRoI_v1::isRun3() const {
+
+      return ( roiWord() >> 31 & 0x1 );
    }
 
    //
diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/versions/MuonRoI_v1.h b/Event/xAOD/xAODTrigger/xAODTrigger/versions/MuonRoI_v1.h
index 0976fec9c85f952ba4443024d28a37ecd23ffbfd..d017a9ec9230743800a78eb0ac6b3d066e8fe507 100644
--- a/Event/xAOD/xAODTrigger/xAODTrigger/versions/MuonRoI_v1.h
+++ b/Event/xAOD/xAODTrigger/xAODTrigger/versions/MuonRoI_v1.h
@@ -111,6 +111,8 @@ namespace xAOD {
       Charge getCharge() const;
       /// Returns the veto flag for the candidate
       bool isVetoed() const;
+      /// Returns extra flag at end of RoI word indicating that it's in Run3 format
+      bool isRun3() const;
 
       /// @}
 
diff --git a/Projects/AnalysisBase/package_filters.txt b/Projects/AnalysisBase/package_filters.txt
index b83b59bc01c3b407939963b18e3ff717469c9122..042da7766479858823e78e34db4f7e38768ff29e 100644
--- a/Projects/AnalysisBase/package_filters.txt
+++ b/Projects/AnalysisBase/package_filters.txt
@@ -125,6 +125,7 @@
 + Trigger/TrigEvent/TrigRoiConversion
 + Trigger/TrigEvent/TrigSteeringEvent
 + Trigger/TrigSteer/TrigCompositeUtils
++ Trigger/TrigT1/TrigT1MuctpiBits
 #+ Trigger/TrigValidation/TrigAnalysisTest
 
 #
diff --git a/Projects/AthAnalysis/package_filters.txt b/Projects/AthAnalysis/package_filters.txt
index dee4753b679ef9a44fa5a89f590cf68b7c7e31c7..ec30b4691749359d88b54fac6b03b128cc6152d6 100644
--- a/Projects/AthAnalysis/package_filters.txt
+++ b/Projects/AthAnalysis/package_filters.txt
@@ -128,6 +128,7 @@
 + Trigger/TrigEvent/TrigRoiConversion
 + Trigger/TrigEvent/TrigSteeringEvent
 + Trigger/TrigSteer/TrigCompositeUtils
++ Trigger/TrigT1/TrigT1MuctpiBits
 + Trigger/TrigValidation/TrigAnalysisTest
 #+ Trigger/TriggerSimulation/TrigBtagEmulationTool
 #+ Reconstruction/RecoTools/IsolationTool
diff --git a/Simulation/Digitization/share/LVL1Digitization.py b/Simulation/Digitization/share/LVL1Digitization.py
index 08b7003db7c407720f0e616445c8ea14ee9aefeb..92f0ce869753f8ba3e3ff03f349ba913a5ed40ec 100755
--- a/Simulation/Digitization/share/LVL1Digitization.py
+++ b/Simulation/Digitization/share/LVL1Digitization.py
@@ -114,8 +114,13 @@ if DetFlags.digitize.LVL1_on():
     # TrigT1Muctpi Algos
     #--------------------------------------------------------------
     if DetFlags.simulateLVL1.RPC_on() or DetFlags.simulateLVL1.TGC_on():
-        from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi
-        topSequence += L1Muctpi()
+        from AthenaConfiguration.AllConfigFlags import ConfigFlags
+        if ConfigFlags.Trigger.enableL1Phase1:
+            from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import L1MuctpiPhase1
+            topSequence += L1MuctpiPhase1()
+        else:
+            from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi
+            topSequence += L1Muctpi()
 
     #-------------------------------------------------------
     # TrigT1CaloSim Algos
diff --git a/Trigger/TrigConfiguration/TrigConfMuctpi/CMakeLists.txt b/Trigger/TrigConfiguration/TrigConfMuctpi/CMakeLists.txt
index 9fb13604754f652faa44a9a0a8230701b55503da..c45939b247f5b294a12de0891ffac492a1d63ba7 100644
--- a/Trigger/TrigConfiguration/TrigConfMuctpi/CMakeLists.txt
+++ b/Trigger/TrigConfiguration/TrigConfMuctpi/CMakeLists.txt
@@ -23,3 +23,4 @@ atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_scripts( scripts/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_xmls( data/*.dtd )
 
+
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions.py b/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions.py
index 00ff054f95a82ee4c67e377db001c23a572538bc..db46dee51cd8ebbcc291eab8d16d3939c0b70bd6 100644
--- a/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions.py
+++ b/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions.py
@@ -200,8 +200,13 @@ elif RunSimOnData:
     #rederive MuCTPI inputs to CTP from muon RDO
     #writes this to the usual MuCTPICTP storegate location
 
-    from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi_on_Data
-    topSequence += L1Muctpi_on_Data()
+    from AthenaConfiguration.AllConfigFlags import ConfigFlags
+    if ConfigFlags.Trigger.enableL1Phase1:
+        from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import L1MuctpiPhase1
+        topSequence += L1MuctpiPhase1_on_Data()
+    else:
+        from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi
+        topSequence += L1Muctpi_on_Data()
     
     from TrigT1CTMonitoring.TrigT1CTMonitoringConf import TrigT1CTMonitoring__DeriveSimulationInputs as DeriveSimulationInputs
  
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py b/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py
index c5ad2d9d396943a14e2597f57433a6d091a6719b..cebacd448a397ee13869ac81bf486cc47bb379b3 100644
--- a/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py
+++ b/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py
@@ -184,8 +184,13 @@ if not athenaCommonFlags.isOnline() and jp.ConcurrencyFlags.NumThreads() == 0:
         #svcMgr.DSConfigSvc.readLVL1Thr=True
         #svcMgr.DSConfigSvc.readLVL1BG=True
 
-        from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi_on_Data
-        topSequence += L1Muctpi_on_Data()
+        from AthenaConfiguration.AllConfigFlags import ConfigFlags
+        if ConfigFlags.Trigger.enableL1Phase1:
+            from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import L1MuctpiPhase1_on_Data
+            topSequence += L1MuctpiPhase1_on_Data()
+        else:
+            from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi_on_Data
+            topSequence += L1Muctpi_on_Data()
 
         from TrigT1CTMonitoring.TrigT1CTMonitoringConf import TrigT1CTMonitoring__DeriveSimulationInputs as DeriveSimulationInputs
         topSequence += DeriveSimulationInputs(do_MuCTPI_input=True,
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/src/BSMonitoring.cxx b/Trigger/TrigT1/TrigT1CTMonitoring/src/BSMonitoring.cxx
index 8fa5384ec267fb774e9d7b7469a7b715d77c04f1..2cc5dc070c644033c0c4855a5d6ce50a913b6832 100644
--- a/Trigger/TrigT1/TrigT1CTMonitoring/src/BSMonitoring.cxx
+++ b/Trigger/TrigT1/TrigT1CTMonitoring/src/BSMonitoring.cxx
@@ -802,11 +802,11 @@ doMuctpi(const DataHandle<MuCTPI_RDO> theMuCTPI_RDO, const DataHandle<MuCTPI_RIO
 		<< "-Pt" << dataWord.getPt();
     } 
 
-    
+    /*
     if (dataWord.getBCID() == multWord.getBCID()) {
       // Fill the muctpi map for later comparision to RPC and TGC
       muctpiCandidates.insert ( std::pair<std::string,MuCTPI_DataWord_Decoder>(keystring.str(),dataWord) );
- 
+    
      //Use only candidates from the same BCID for overlap histograms
       if (dataWord.getOverlapBits()) {
 	if (dataWord.getSectorLocation() == MuCTPI_RDO::ENDCAP) {
@@ -825,6 +825,7 @@ doMuctpi(const DataHandle<MuCTPI_RDO> theMuCTPI_RDO, const DataHandle<MuCTPI_RIO
 	}
       }
     }
+*/
   }
 
   for ( int y = 0; y < 96; y++ ) {
@@ -866,7 +867,7 @@ doMuctpi(const DataHandle<MuCTPI_RDO> theMuCTPI_RDO, const DataHandle<MuCTPI_RIO
    * BCIDs 
    */
   uint16_t mictpBcid = multWord.getBCID();
-  uint16_t candidateBcid = 0;
+  //uint16_t candidateBcid = 0;
   uint16_t headerBcid =
     (theMuCTPI_RIO) ? theMuCTPI_RIO->getHeaderBCID() : 0;
   bcidMictpHeader->Fill(mictpBcid - (headerBcid & 7));
@@ -896,7 +897,7 @@ doMuctpi(const DataHandle<MuCTPI_RDO> theMuCTPI_RDO, const DataHandle<MuCTPI_RIO
       forwardRoiSectorIDAll->Fill(dataWord.getSectorID()+24*dataWord.getHemisphere(), dataWord.getRoiNumber());
     }
 
-    candidateBcid = dataWord.getBCID();
+/*    candidateBcid = dataWord.getBCID();
 
     int candbcdiff = candidateBcid - mictpBcid;	
     if (candbcdiff > 3) candbcdiff -= 8; 
@@ -911,9 +912,10 @@ doMuctpi(const DataHandle<MuCTPI_RDO> theMuCTPI_RDO, const DataHandle<MuCTPI_RIO
       errorPerLumiBlock->Fill(m_currentLumiBlock);
     }
     else errorSummary->Fill(8,0);
-    
+*/  
     //Use only non-vetoed candidates from the same BCID for multiplicity calculation
-    if ( (dataWord.getBCID() == multWord.getBCID()) && !dataWord.getVetoed() ) {
+    if ( //(dataWord.getBCID() == multWord.getBCID()) && 
+	 !dataWord.getVetoed() ) {
       uint16_t candPt = dataWord.getPt();
       pt->Fill(candPt);
       if (0 < candPt && candPt <= MuCTPI_RDO::MULT_THRESH_NUM) {
@@ -1066,7 +1068,7 @@ doMuctpi(const DataHandle<MuCTPI_RDO> theMuCTPI_RDO, const DataHandle<MuCTPI_RIO
     int rpcnum = rpcCandidates.count(it_mui->first); 
     if (tgcnum > 0 || rpcnum > 0 ) {
       ATH_MSG(DEBUG) << "MuCTPI to RPC/TGC match found: MuCTPI key/ MuCTPI BCID / #TGC matches / #RPC matches: "
-		     << it_mui->first << " / " << it_mui->second.getBCID() << " / " 
+		     << it_mui->first << " / " << /*it_mui->second.getBCID() <<*/ " / " 
 		     << tgcnum << " / " << rpcnum << endmsg;
     } else {
       if ( (it_mui->first).substr(0,2) == "BA" )  { 
@@ -1089,7 +1091,7 @@ doMuctpi(const DataHandle<MuCTPI_RDO> theMuCTPI_RDO, const DataHandle<MuCTPI_RIO
 			 << (it_mui->first).substr(0,2) << endmsg;
       }
       ATH_MSG(WARNING) << "No Muctpi to RPC/TGC match found: MuCTPI key / MuCTPI BCID: " 
-		       << it_mui->first  << " / " << it_mui->second.getBCID() << endmsg;
+		       << it_mui->first  << " / " << /*it_mui->second.getBCID() <<*/ endmsg;
     }
   }
 
@@ -1707,8 +1709,9 @@ doMuonRoI(const DataHandle<MuCTPI_RDO> theMuCTPI_RDO,
 	    if (dataWord.getSectorLocation() == MuCTPI_RDO::BARREL)
 	      sectorID=dataWord.getSectorID(1);
 	    
-	    if ((dataWord.getBCID() == theMuCTPI_RIO->getBCID())
-		&& (sectorID == secID)
+	    if (//(dataWord.getBCID() == theMuCTPI_RIO->getBCID())
+		//&& 
+		(sectorID == secID)
 		&& (dataWord.getRoiNumber() == roInum)
 		&& (dataWord.getSectorLocation() == sysID)
 		&& (dataWord.getHemisphere() == hemisphere)) {
diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.cxx
index 8ccdae03b793e07feb5599d62efc018d4b571f81..4f2f93bd06e342a2c1c7796554551a281b8e848e 100644
--- a/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.cxx
+++ b/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.cxx
@@ -67,6 +67,13 @@ namespace LVL1CTP {
 
    }
 
+   int CTPUtil::getMult( const std::vector<unsigned int>& words, unsigned int startbit, unsigned int endbit ) {
+      std::bitset<256> bits = convertToBitset(words);
+      std::bitset<256> mask = pow( 2, endbit - startbit + 1 ) - 1;
+      bits >>= startbit;
+      return static_cast<int>((bits&mask).to_ulong());
+   }
+
    unsigned int CTPUtil::getMultTopo( uint64_t word, unsigned int cableStart, unsigned int cableEnd, unsigned int clock ) {
 
       unsigned int mult = 0;
diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.h b/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.h
index c666b2db66cb08ffdc8602d780d1b200470475e2..14495854268c484bef77e484824e93892089b7ff 100644
--- a/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.h
+++ b/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.h
@@ -50,6 +50,7 @@ namespace LVL1CTP {
 
       //! extract multiplicities using new trigger configuration interface
       static int getMult( uint64_t word, unsigned int startbit, unsigned int endbit );
+      static int getMult( const std::vector<unsigned int>& words, unsigned int startbit, unsigned int endbit );
 
       //! extract multiplicities from Topo words, were the encoding is different
       static unsigned int getMultTopo( uint64_t word, unsigned int startbit, unsigned int endbit, unsigned int clock );
diff --git a/Trigger/TrigT1/TrigT1Interfaces/CMakeLists.txt b/Trigger/TrigT1/TrigT1Interfaces/CMakeLists.txt
index e7b9dd1baab4eedcbc1d1ddb11696872a15f2433..a2c9c39cb23c6960ffec3a2f7aef51ecc790396c 100644
--- a/Trigger/TrigT1/TrigT1Interfaces/CMakeLists.txt
+++ b/Trigger/TrigT1/TrigT1Interfaces/CMakeLists.txt
@@ -12,8 +12,8 @@ atlas_add_library( TrigT1Interfaces
                    src/*.cxx
                    PUBLIC_HEADERS TrigT1Interfaces
                    INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${XERCESC_LIBRARIES} AthContainers AthenaBaseComps AthenaKernel GaudiKernel
-                   PRIVATE_LINK_LIBRARIES TrigConfL1Data )
+                   LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${XERCESC_LIBRARIES} AthContainers AthenaBaseComps AthenaKernel GaudiKernel TrigT1MuctpiBits
+                   PRIVATE_LINK_LIBRARIES TrigConfL1Data)
 
 atlas_add_dictionary( TrigT1InterfacesDict
                       TrigT1Interfaces/TrigT1InterfacesDict.h
diff --git a/Trigger/TrigT1/TrigT1MuonRecRoiTool/TrigT1MuonRecRoiTool/ITrigT1MuonRecRoiTool.h b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/ITrigT1MuonRecRoiTool.h
similarity index 98%
rename from Trigger/TrigT1/TrigT1MuonRecRoiTool/TrigT1MuonRecRoiTool/ITrigT1MuonRecRoiTool.h
rename to Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/ITrigT1MuonRecRoiTool.h
index b706f35fe18ee8a9dc4fbba055e4da74ded97595..e2c9ddd1a280d077520fa98dcef2ad94e4b90924 100644
--- a/Trigger/TrigT1/TrigT1MuonRecRoiTool/TrigT1MuonRecRoiTool/ITrigT1MuonRecRoiTool.h
+++ b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/ITrigT1MuonRecRoiTool.h
@@ -6,7 +6,7 @@
 #define ITRIGT1MUONRECROITOOL_H
 
 #include "GaudiKernel/IAlgTool.h"
-#include "TrigT1MuonRecRoiTool/TrigT1MuonRecRoiData.h"
+#include "TrigT1MuonRecRoiData.h"
 
 namespace LVL1 {
 
diff --git a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/Lvl1MuCTPIInputPhase1.h b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/Lvl1MuCTPIInputPhase1.h
index d67fce5fd8a5be318e59b1242153c2e1dbd135ee..b25aa0904ffb58a5fb6a1b5f770da498b4b6c187 100644
--- a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/Lvl1MuCTPIInputPhase1.h
+++ b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/Lvl1MuCTPIInputPhase1.h
@@ -68,10 +68,14 @@ namespace LVL1MUONIF {
 
 
       const Lvl1MuSectorLogicDataPhase1& getSectorLogicData( size_t systemAddress,
-                                                       size_t subSystemAddress,
-                                                       size_t sectorAddress,
-						       int    bcid=0        ) const;
-
+							     size_t subSystemAddress,
+							     size_t sectorAddress,
+							     int    bcid=0        ) const;
+      std::shared_ptr<Lvl1MuSectorLogicDataPhase1> getSectorLogicDataPtr( size_t systemAddress,
+									  size_t subSystemAddress,
+									  size_t sectorAddress,
+									  int    bcid=0        );
+      
       void setSectorLogicData( const Lvl1MuSectorLogicDataPhase1& data,
                                size_t systemAddress,
                                size_t subSystemAddress,
@@ -126,7 +130,6 @@ namespace LVL1MUONIF {
      typedef std::vector<std::shared_ptr <Lvl1MuSectorLogicDataPhase1> > Lvl1MuVect;
      typedef std::pair<int, Lvl1MuVect>  Lvl1MuVectWithBC; 
      std::vector<Lvl1MuVectWithBC> m_data[ NumberOfMuonSystem ];
-
    }; // class Lvl1MuCTPIInputPhase1
    
    inline size_t Lvl1MuCTPIInputPhase1::idBarrelSystem() { return Barrel; }
diff --git a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/Lvl1MuSectorLogicDataPhase1.h b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/Lvl1MuSectorLogicDataPhase1.h
index 4e1b7ed66eba8070798b435bfa83e1cba284745e..7e02999622351fa284c5da6f4a7c82d04126747f 100644
--- a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/Lvl1MuSectorLogicDataPhase1.h
+++ b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/Lvl1MuSectorLogicDataPhase1.h
@@ -54,6 +54,7 @@ namespace LVL1MUONIF {
       int goodmf( size_t id) const { return m_goodmf[ id ]; }
       int innercoin( size_t id) const { return m_innercoin[ id ]; }
       int bw2or3( size_t id) const { return m_bw2or3[ id ]; }
+      int veto( size_t id) const {return m_veto[ id ]; } // veto candidate for multiplicity counting due to overlap removal
 
       void set2candidatesInSector() { m_2candidatesInSector = true; }
       void clear2candidatesInSector() { m_2candidatesInSector = false;}
@@ -67,6 +68,7 @@ namespace LVL1MUONIF {
       void goodmf( size_t id, int value) {m_goodmf[ id ] = value; }
       void innercoin( size_t id, int value) {m_innercoin[ id ] = value; }
       void bw2or3( size_t id, int value) {m_bw2or3[ id ] = value; }
+      void veto( size_t id, int value) {m_veto[ id ] = value; }
 
       void clear();
 
@@ -95,6 +97,7 @@ namespace LVL1MUONIF {
       std::vector<int> m_goodmf; //[m_ncand]
       std::vector<int> m_innercoin; //[m_ncand]
       std::vector<int> m_bw2or3; //[m_ncand]
+      std::vector<int> m_veto; //[m_ncand]
 
    }; // class Lvl1MuSectorLogicDataPhase1
 
diff --git a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/MuCTPICTP.h b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/MuCTPICTP.h
index a1e82a74728a96b5e644a0d5cab3f1a5a7190278..46314d5ae2a354e0fd60fa680640ab6f4fca057a 100644
--- a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/MuCTPICTP.h
+++ b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/MuCTPICTP.h
@@ -1,10 +1,12 @@
 // Dear emacs, this is -*- c++ -*-
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef TRIGT1INTERFACES_MUCTPICTP_H
 #define TRIGT1INTERFACES_MUCTPICTP_H
 
+#include <vector>
+
 namespace LVL1 {
 
    /**
@@ -23,16 +25,17 @@ namespace LVL1 {
    public:
       /* constructor and destructor */
       MuCTPICTP( unsigned int word = 0 );
+      MuCTPICTP( std::vector<unsigned int> word);
       ~MuCTPICTP();
 
       /**
        * Return the muon data i.e. <code>(xxxxx|thr6|thr5|thr4|thr3|thr2|thr1)</code>
        */
-      unsigned int muCTPIWord() const;
+      std::vector<unsigned int> muCTPIWord() const;
 
    private:
       /// The only data member
-      const unsigned int m_MuCTPICTPWord;
+     std::vector<unsigned int> m_MuCTPICTPWord;
 
    }; // class MuCTPICTP
 
diff --git a/Trigger/TrigT1/TrigT1MuonRecRoiTool/TrigT1MuonRecRoiTool/TrigT1MuonRecRoiData.h b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/TrigT1MuonRecRoiData.h
similarity index 100%
rename from Trigger/TrigT1/TrigT1MuonRecRoiTool/TrigT1MuonRecRoiTool/TrigT1MuonRecRoiData.h
rename to Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/TrigT1MuonRecRoiData.h
diff --git a/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/ITrigT1MuonRecRoiTool.cxx b/Trigger/TrigT1/TrigT1Interfaces/src/ITrigT1MuonRecRoiTool.cxx
similarity index 98%
rename from Trigger/TrigT1/TrigT1MuonRecRoiTool/src/ITrigT1MuonRecRoiTool.cxx
rename to Trigger/TrigT1/TrigT1Interfaces/src/ITrigT1MuonRecRoiTool.cxx
index a5e4762ec7ed14baecab5829e017cb7e6402e5c5..3d22cf0b28ce7dc9400e5d83abfa343efc751172 100644
--- a/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/ITrigT1MuonRecRoiTool.cxx
+++ b/Trigger/TrigT1/TrigT1Interfaces/src/ITrigT1MuonRecRoiTool.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigT1MuonRecRoiTool/ITrigT1MuonRecRoiTool.h"
+#include "TrigT1Interfaces/ITrigT1MuonRecRoiTool.h"
 
 namespace LVL1{
 
diff --git a/Trigger/TrigT1/TrigT1Interfaces/src/Lvl1MuCTPIInputPhase1.cxx b/Trigger/TrigT1/TrigT1Interfaces/src/Lvl1MuCTPIInputPhase1.cxx
index b93409ace6c438ac83157b0c48a8efeebd4767a9..2ae2ab1eba7907ac5570a4d6ebf8547afe2db0c1 100644
--- a/Trigger/TrigT1/TrigT1Interfaces/src/Lvl1MuCTPIInputPhase1.cxx
+++ b/Trigger/TrigT1/TrigT1Interfaces/src/Lvl1MuCTPIInputPhase1.cxx
@@ -44,10 +44,9 @@ namespace LVL1MUONIF {
 
   /////////////
   const Lvl1MuSectorLogicDataPhase1& Lvl1MuCTPIInputPhase1::getSectorLogicData( size_t systemAddress,
-								    size_t subSystemAddress,
-								    size_t sectorAddress,
-								    int    bcid             ) const {
-
+										size_t subSystemAddress,
+										size_t sectorAddress,
+										int    bcid             ) const {
     static const Lvl1MuBarrelSectorLogicDataPhase1 dummy;
     for( size_t ip=0; ip<m_data[systemAddress].size(); ip++){
       int bc=((m_data[systemAddress]).at(ip)).first;
@@ -58,6 +57,19 @@ namespace LVL1MUONIF {
     return dummy;
   }
 
+  /////////////
+  std::shared_ptr<Lvl1MuSectorLogicDataPhase1> Lvl1MuCTPIInputPhase1::getSectorLogicDataPtr( size_t systemAddress,
+											     size_t subSystemAddress,
+											     size_t sectorAddress,
+											     int    bcid             ) {
+    for( size_t ip=0; ip<m_data[systemAddress].size(); ip++){
+      int bc=((m_data[systemAddress]).at(ip)).first;
+      if (bc != bcid) continue;
+      return m_data[systemAddress].at(ip).second.at(getSystemIndex(systemAddress,subSystemAddress,sectorAddress));
+    }
+    return nullptr;
+  }
+
   /////////////
   void Lvl1MuCTPIInputPhase1::setSectorLogicData( const Lvl1MuSectorLogicDataPhase1& data,
 					    size_t systemAddress,
diff --git a/Trigger/TrigT1/TrigT1Interfaces/src/Lvl1MuSectorLogicDataPhase1.cxx b/Trigger/TrigT1/TrigT1Interfaces/src/Lvl1MuSectorLogicDataPhase1.cxx
index c9d9822076856ba533a8d2e1eeb1623170578791..58a1078fbde7d572b5680be3053e0adc6715164c 100644
--- a/Trigger/TrigT1/TrigT1Interfaces/src/Lvl1MuSectorLogicDataPhase1.cxx
+++ b/Trigger/TrigT1/TrigT1Interfaces/src/Lvl1MuSectorLogicDataPhase1.cxx
@@ -28,6 +28,7 @@ namespace LVL1MUONIF {
     m_goodmf.clear();
     m_innercoin.clear();
     m_bw2or3.clear();
+    m_veto.clear();
   }
 
   void Lvl1MuSectorLogicDataPhase1::initialize()
@@ -44,6 +45,7 @@ namespace LVL1MUONIF {
       m_goodmf.push_back(-1);
       m_innercoin.push_back(-1);
       m_bw2or3.push_back(-1);
+      m_veto.push_back(0);
     }
   }
 
@@ -66,6 +68,7 @@ namespace LVL1MUONIF {
         m_goodmf[ i ] = right.m_goodmf[ i ];
         m_innercoin[ i ] = right.m_innercoin[ i ];
         m_bw2or3[ i ] = right.m_bw2or3[ i ];
+        m_veto[ i ] = right.m_veto[ i ];
       }
     }
     return *this;
@@ -90,6 +93,7 @@ namespace LVL1MUONIF {
       m_goodmf[ i ] = -1;
       m_innercoin[ i ] = -1;
       m_bw2or3[ i ] = -1;
+      m_veto[ i ] = 0;
     }
   }
 
diff --git a/Trigger/TrigT1/TrigT1Interfaces/src/MuCTPICTP.cxx b/Trigger/TrigT1/TrigT1Interfaces/src/MuCTPICTP.cxx
index 094f9e987e87b1cba1611b4ef1bfdfdae93c7f07..5731aaf03438c9e25218f86385a3972ebd350062 100644
--- a/Trigger/TrigT1/TrigT1Interfaces/src/MuCTPICTP.cxx
+++ b/Trigger/TrigT1/TrigT1Interfaces/src/MuCTPICTP.cxx
@@ -7,15 +7,20 @@
 namespace LVL1 {
 
   MuCTPICTP::MuCTPICTP( unsigned int word )
-    : m_MuCTPICTPWord( word ) {
+  {
+    m_MuCTPICTPWord.push_back(word);
+  }
 
+  MuCTPICTP::MuCTPICTP( std::vector<unsigned int> word )
+    : m_MuCTPICTPWord(word)
+  {
   }
 
   MuCTPICTP::~MuCTPICTP() {
 
   }
 
-  unsigned int MuCTPICTP::muCTPIWord() const {
+  std::vector<unsigned int> MuCTPICTP::muCTPIWord() const {
     return m_MuCTPICTPWord;
   }
 
diff --git a/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1MuonRecRoiData.cxx b/Trigger/TrigT1/TrigT1Interfaces/src/TrigT1MuonRecRoiData.cxx
similarity index 96%
rename from Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1MuonRecRoiData.cxx
rename to Trigger/TrigT1/TrigT1Interfaces/src/TrigT1MuonRecRoiData.cxx
index 9e701535b27c9df0d657e5b1ccdd06f3eae1a310..2db017756b0294e9382169fa62e84b88060fcfde 100644
--- a/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1MuonRecRoiData.cxx
+++ b/Trigger/TrigT1/TrigT1Interfaces/src/TrigT1MuonRecRoiData.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigT1MuonRecRoiTool/TrigT1MuonRecRoiData.h"
+#include "TrigT1Interfaces/TrigT1MuonRecRoiData.h"
 #include <math.h>  /* M_PI */
 
 namespace LVL1{
diff --git a/Trigger/TrigT1/TrigT1MuctpiBits/CMakeLists.txt b/Trigger/TrigT1/TrigT1MuctpiBits/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6203d37d539715c9d2b0f6fd4587120014380759
--- /dev/null
+++ b/Trigger/TrigT1/TrigT1MuctpiBits/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+# Declare the package name.
+atlas_subdir( TrigT1MuctpiBits )
+
+# Component(s) in the package.
+atlas_add_library( TrigT1MuctpiBits
+                   TrigT1MuctpiBits/*.h
+		   INTERFACE
+		   PUBLIC_HEADERS TrigT1MuctpiBits )
diff --git a/Trigger/TrigT1/TrigT1MuctpiBits/TrigT1MuctpiBits/MuCTPI_Bits.h b/Trigger/TrigT1/TrigT1MuctpiBits/TrigT1MuctpiBits/MuCTPI_Bits.h
new file mode 100755
index 0000000000000000000000000000000000000000..c5cb9436a02f069516d38ec5a94822da5fb36721
--- /dev/null
+++ b/Trigger/TrigT1/TrigT1MuctpiBits/TrigT1MuctpiBits/MuCTPI_Bits.h
@@ -0,0 +1,133 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGT1RESULT_MUCTPI_BITS_H
+#define TRIGT1RESULT_MUCTPI_BITS_H
+
+  /// Binary 111 representing the maximal multiplicity value for a given threshold
+   static constexpr uint32_t MULT_VAL = 7;
+  /// Number of multiplicity bits reserved per threshold
+   static constexpr uint32_t MULT_BITS = 3;
+  /// Defining the number of p<sub>T</sub> thresholds in the system
+   static constexpr uint32_t RUN3_MULT_THRESH_NUM = 32;
+   static constexpr uint32_t MULT_THRESH_NUM = 6;
+  /// Telling that the 3-bit BCID comes at "position 7" in the multiplicity word
+   static constexpr uint32_t RUN3_MULT_BCID_POS = 26;
+   static constexpr uint32_t MULT_BCID_POS = 7;
+
+  /// Mask for the bit showing if more than two muon candidates were in the trigger sector
+   static constexpr uint32_t CAND_OVERFLOW_MASK = 0x1;
+  /// Position of the candidate overflow mask
+   static constexpr uint32_t RUN3_CAND_OVERFLOW_SHIFT = 17;
+   static constexpr uint32_t CAND_OVERFLOW_SHIFT = 0;
+
+  /// Mask for the bit showing if more than one muon candidates were in the sector RoI
+   static constexpr uint32_t ROI_OVERFLOW_MASK = 0x1;
+  /// Position of the RoI overflow mask
+   static constexpr uint32_t RUN3_ROI_OVERFLOW_SHIFT = 13;
+   static constexpr uint32_t ROI_OVERFLOW_SHIFT = 1;
+
+  /// Mask for the full potential ROI word from the data words
+   static constexpr uint32_t ROI_MASK = 0xff; /// new in v2
+  /// Mask for extracting the RoI for barrel candidates from the data words
+   static constexpr uint32_t BARREL_ROI_MASK = 0x1f;
+  /// Mask for extracting the RoI for endcap candidates from the data words
+   static constexpr uint32_t ENDCAP_ROI_MASK = 0xff;
+  /// Mask for extracting the RoI for forward candidates from the data words
+   static constexpr uint32_t FORWARD_ROI_MASK = 0x3f;
+  /// Position of the RoI bits in the data word
+   static constexpr uint32_t RUN3_ROI_SHIFT = 0;
+   static constexpr uint32_t ROI_SHIFT = 2;
+
+//===== Need to double check that the run3 positions are correct for the OL flags=====
+  /// Mask for extracting the overlap bits for barrel candidates from the data words
+   static constexpr uint32_t RUN3_BARREL_OL_MASK = 0x1; // only the phi ovl is used in the run3 format
+   static constexpr uint32_t BARREL_OL_MASK = 0x3;
+  /// Position of the overlap bits in barrel data words
+   static constexpr uint32_t RUN3_BARREL_OL_SHIFT = 12; // this is now part of the 4 "candidate flags" bits
+   static constexpr uint32_t BARREL_OL_SHIFT = 9;
+  /// Mask for extracting the overlap bits for endcap candidates from the data words
+   static constexpr uint32_t ENDCAP_OL_MASK = 0x1;
+  /// Position of the overlap bits in endcap data words
+   //static constexpr uint32_t RUN3_ENDCAP_OL_SHIFT = 8; // 10-2 = 8 // not used in run3 format
+   static constexpr uint32_t ENDCAP_OL_SHIFT = 10;
+
+  /// Mask for extracting the p<sub>T</sub> threshold passed by the candidate from the data word
+   static constexpr uint32_t RUN3_CAND_PT_MASK = 0xf;
+   static constexpr uint32_t CAND_PT_MASK = 0x7;
+  /// Position of the p<sub>T</sub> threshold bits in the data words
+   static constexpr uint32_t RUN3_CAND_PT_SHIFT = 8;
+   static constexpr uint32_t CAND_PT_SHIFT = 11;
+
+/// gone in v2
+//These aren't part of the LVL2 word in run 2, but part of the DAQ word
+  /// Mask for extracting the last 3 bits of the BCID of the muon candidate from the data word
+   static constexpr uint32_t CAND_BCID_MASK = 0x7;
+  /// Position of the BCID bits in the data words
+   static constexpr uint32_t CAND_BCID_SHIFT = 14;
+
+  /// Mask for extracting the address of the muon candidate from the data word
+  /// This is the mask and shift for the full sector address, including the hemisphere as the least significant bit
+   static constexpr uint32_t CAND_SECTOR_ADDRESS_MASK = 0xff;
+  /// Mask for the bit showing which hemisphere the candidate came from.(1: positive; 0: negative)
+   static constexpr uint32_t SECTOR_HEMISPHERE_MASK = 0x1;
+  /// Position of the muon candidate's address in the data word
+   static constexpr uint32_t RUN3_CAND_SECTOR_ADDRESS_SHIFT = 21;
+   static constexpr uint32_t CAND_SECTOR_ADDRESS_SHIFT = 14;//17; 17 is for the DAQ word, not LVL2
+
+//====The shift doesn't correspond to the mask here (the mask corresponds to the SECTOR_ADDRESS_SHIFT above) === 
+  /// Bit in the candidate's address turned on for endcap candidates
+   static constexpr uint32_t ENDCAP_ADDRESS_MASK = 0x80;
+  /// Bit in the candidate's address turned on for forward candidates
+   static constexpr uint32_t FORWARD_ADDRESS_MASK = 0x40;
+   /// Mask for both forward and endcap bits
+   static constexpr uint32_t SUBSYS_ADDRESS_MASK = 0xc0;
+/// Position in the data word of the subsystem bits
+   static constexpr uint32_t RUN3_SUBSYS_ADDRESS_SHIFT = 27;
+   static constexpr uint32_t SUBSYS_ADDRESS_SHIFT = 20;
+
+  /// Mask for extracting the sector ID for endcap candidates from the data word
+   static constexpr uint32_t ENDCAP_SECTORID_MASK = 0x3f;
+  /// Mask for extracting the sector ID for forward candidates from the data word
+   static constexpr uint32_t FORWARD_SECTORID_MASK = 0x1f;
+  /// Mask for extracting the sector ID for barrel candidates from the data word
+   static constexpr uint32_t BARREL_SECTORID_MASK = 0x1f;
+  /// Position of the sector ID itself, which is one bit left of the full sector address
+   static constexpr uint32_t RUN3_CAND_SECTORID_SHIFT = 22;
+   static constexpr uint32_t CAND_SECTORID_SHIFT = 15;
+
+/// gone in v2
+  /// Mask for extracting the bit from the data word showing whether the candidate had the highest p<sub>T</sub> in the sector
+   static constexpr uint32_t CAND_HIGHEST_PT_MASK = 0x1;
+  /// Position of the "highest p<sub>T</sub>" bit
+   static constexpr uint32_t CAND_HIGHEST_PT_SHIFT = 22;
+
+/// gone in v2
+//These aren't part of the LVL2 word in run 2, but part of the DAQ word
+  /// Mask for extracting the bit from the data word showing if the muon candidate was sent to the RoIB
+   static constexpr uint32_t CAND_SENT_ROI_MASK = 0x1;
+  /// Position of the "candidate sent to RoIB" bit.
+   static constexpr uint32_t CAND_SENT_ROI_SHIFT = 26;
+
+  /// Position of the bit turned on for the multiplicity words that distinguishes them from the data words
+   static constexpr uint32_t RUN3_MULT_WORD_FLAG_SHIFT = 31; // is 31 correct? - check with Stefan
+   static constexpr uint32_t MULT_WORD_FLAG_SHIFT = 29;
+
+  /// Position of the bit specifying the candidate's sign
+   static constexpr uint32_t RUN3_CAND_TGC_CHARGE_SIGN_SHIFT = 12;
+   static constexpr uint32_t CAND_TGC_CHARGE_SIGN_SHIFT = 27;
+  /// Position of the bit specifying 3-station coincidence from the big wheel
+   static constexpr uint32_t RUN3_CAND_TGC_BW2OR3_SHIFT = 13;
+  /// Position of the bit specifying coincidence with inner detectors
+   static constexpr uint32_t RUN3_CAND_TGC_INNERCOIN_SHIFT = 14;
+  /// Position of the bit specifying if RoI is in a good b-field region (1=good, 0=bad)
+   static constexpr uint32_t RUN3_CAND_TGC_GOODMF_SHIFT = 15;
+
+  /// Position of the bit specifying if a candidate was vetoed in the multiplicity sum
+   static constexpr uint32_t RUN3_CAND_VETO_SHIFT = 16;
+   static constexpr uint32_t CAND_VETO_SHIFT = 28;
+
+#endif 
diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt b/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt
index b6d5d0e6957b00c7cf5bec2e0362e6aae7336cbd..02d2d0637b34ddabd1fc468efce99d4d3b3dc097 100644
--- a/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt
+++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt
@@ -11,7 +11,12 @@ atlas_add_component( TrigT1MuctpiPhase1
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                     LINK_LIBRARIES AnalysisTriggerEvent AthenaBaseComps CxxUtils GaudiKernel PathResolver StoreGateLib TrigConfInterfaces TrigConfL1Data TrigConfMuctpi TrigT1Interfaces TrigT1Result xAODTrigger )
+                     LINK_LIBRARIES AnalysisTriggerEvent 
+		     AthenaBaseComps CxxUtils GaudiKernel 
+		     PathResolver StoreGateLib TrigConfInterfaces 
+		     TrigConfData TrigConfL1Data TrigConfMuctpi 
+		     TrigT1Interfaces TrigT1Result
+		     xAODTrigger )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/MUCTPI_AthTool.h b/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/MUCTPI_AthTool.h
index 37cd244926c598ce462a9ef133881ca4f6cc59b9..2135de4d7ff04e8910a4d5129f9ebe99e087b780 100644
--- a/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/MUCTPI_AthTool.h
+++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/MUCTPI_AthTool.h
@@ -16,26 +16,15 @@ class description
 #include "TrigT1Interfaces/MuCTPICTP.h"
 #include "TrigT1Interfaces/MuCTPIL1Topo.h"
 
-#include "TrigT1Result/MuCTPI_RDO.h"
 #include "xAODTrigger/MuonRoIContainer.h"
 
-#include "TrigT1MuctpiPhase1/Configuration.h"
-
-#include "TrigConfInterfaces/ILVL1ConfigSvc.h"
-
-//#include "TrigConfL1Data/Run3MuonTriggerThreshold.h"
-#include "TrigConfL1Data/TriggerThresholdValue.h"
-#include "TrigConfL1Data/L1DataDef.h"
-#include "TrigConfL1Data/L1DataBaseclass.h"
-
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/IIncidentListener.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "StoreGate/DataHandle.h"
 
-namespace TrigConf {
-   class ILVL1ConfigSvc;
-   class TriggerThreshold;
+namespace LVL1 {
+  class ITrigT1MuonRecRoiTool;
 }
 
 namespace LVL1MUCTPIPHASE1 {
@@ -54,6 +43,7 @@ namespace LVL1MUCTPIPHASE1 {
 
     virtual void handle(const Incident&) override;
     virtual StatusCode initialize() override;
+    virtual StatusCode start() override;
     virtual StatusCode execute() override;
 
     virtual StatusCode fillMuCTPIL1Topo(LVL1::MuCTPIL1Topo& l1topoCandidates, int bcidOffset) const override;
@@ -85,8 +75,7 @@ namespace LVL1MUCTPIPHASE1 {
 
     SG::ReadHandleKey<LVL1MUONIF::Lvl1MuCTPIInputPhase1> m_muctpiPhase1KeyRPC{this, "MuctpiPhase1LocationRPC", "L1MuctpiStoreRPC", "Location of muctpiPhase1 for Rpc"};
     SG::ReadHandleKey<LVL1MUONIF::Lvl1MuCTPIInputPhase1> m_muctpiPhase1KeyTGC{this, "MuctpiPhase1LocationTGC", "L1MuctpiStoreTGC", "Location of muctpiPhase1 for Tgc"};
-    SG::ReadHandleKey<MuCTPI_RDO> m_MuCTPI_RDOReadKey{this, "MUCTPI_RDOReadKey", "MUCTPI_RDO", "Location of MuCTPI_RDO"};
-    SG::WriteHandleKey<MuCTPI_RDO> m_MuCTPI_RDOWriteKey{this, "MUCTPI_RDOWriteKey", "MUCTPI_RDO", "Location of MuCTPI_RDO"};
+    SG::WriteHandleKey<LVL1::MuCTPICTP> m_MuCTPICTPWriteKey{this, "MuCTPICTPLocation", "MuCTPICTP", "Location of MuCTPICTP"};
     SG::WriteHandleKey<xAOD::MuonRoIContainer> m_MuCTPI_xAODWriteKey{this, "MUCTPI_xAODLocation", "LVL1MuonRoIs", "Location of xAOD::MuonRoIContainer"};
     SG::WriteHandleKey<LVL1::MuCTPIL1Topo> m_MuCTPIL1TopoKey;
     SG::WriteHandleKey<LVL1::MuCTPIL1Topo> m_MuCTPIL1TopoKey_m2;
@@ -94,6 +83,8 @@ namespace LVL1MUCTPIPHASE1 {
     SG::WriteHandleKey<LVL1::MuCTPIL1Topo> m_MuCTPIL1TopoKey_p1;
     SG::WriteHandleKey<LVL1::MuCTPIL1Topo> m_MuCTPIL1TopoKey_p2;
 
+
+
     // These properties control how the multiplicity summation happens:
     std::string m_multiplicityStrategyName;
     std::string m_multiplicityXMLFile;
@@ -116,8 +107,12 @@ namespace LVL1MUCTPIPHASE1 {
     static const std::string m_DEFAULT_roibLocation;
     static const std::string m_DEFAULT_geometryXMLFile;
     
-    ServiceHandle< TrigConf::ILVL1ConfigSvc > m_configSvc;
+    ServiceHandle<StoreGateSvc> m_detStore { this, "DetectorStore", "StoreGateSvc/DetectorStore", "Detector store to get the menu" };
+
     SimController* m_theMuctpi;
+    ToolHandle<LVL1::ITrigT1MuonRecRoiTool> m_rpcTool;
+    ToolHandle<LVL1::ITrigT1MuonRecRoiTool> m_tgcTool;
+
 
     /// Function pointer to the execute function we want to use:
     StatusCode ( LVL1MUCTPIPHASE1::MUCTPI_AthTool::*m_executeFunction )( void );
diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/MuonSectorProcessor.h b/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/MuonSectorProcessor.h
index 97f675dba836c332e44925aca5f1cefb6c5a8df0..6090650ae48989be410687246f89d4ea4bc08a72 100644
--- a/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/MuonSectorProcessor.h
+++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/MuonSectorProcessor.h
@@ -20,6 +20,8 @@ namespace LVL1 {
 }
 
 namespace LVL1MUCTPIPHASE1 {
+  class OverlapHelper;
+
   class ROIObject
   {
   public:
@@ -38,12 +40,13 @@ namespace LVL1MUCTPIPHASE1 {
     
   public:
     
-    MuonSectorProcessor(int subSystem);
+    MuonSectorProcessor(bool side /*1=A,0=C*/);
     ~MuonSectorProcessor();
     
-    void configure(const std::string& xmlName);
+    void configureTopo(const std::string& xmlName);
+    void configureOverlapRemoval(const std::string& lutFile);
     void setInput(LVL1MUONIF::Lvl1MuCTPIInputPhase1* input);
-    void removeOverlap();
+    void runOverlapRemoval();
     void makeTriggerObjectSelections();
     void makeL1TopoData();
     LVL1::MuCTPIL1Topo getL1TopoData(int bcidOffset);
@@ -54,6 +57,8 @@ namespace LVL1MUCTPIPHASE1 {
     LVL1MUONIF::Lvl1MuCTPIInputPhase1* m_muctpiInput;
     LVL1::MuCTPIL1Topo* m_l1topo;
     std::map<std::string, std::map<unsigned int, ROIObject> > m_roiConfig;
+    OverlapHelper* m_overlapHelper;
+    bool m_side;
   };
 }
 
diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/SimController.h b/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/SimController.h
index fb26282913021961c4291d9b73316077d8132d44..aedc20152c2b1c6d4b4e27ce3b2be4837b4b7c40 100644
--- a/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/SimController.h
+++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/SimController.h
@@ -34,18 +34,13 @@ namespace LVL1MUCTPIPHASE1 {
     SimController();
     ~SimController();
 
-    void configureMSP(const std::string& xmlName);
+    void configureTopo(const std::string& geoFile);
+    void configureOverlapRemoval(const std::string& lutFile);
 
     void processData(LVL1MUONIF::Lvl1MuCTPIInputPhase1* input, int bcid=0);
     void setConfiguration( const Configuration& conf );
 
-    const std::vector<unsigned int>& getCTPData();
     LVL1::MuCTPIL1Topo getL1TopoData(int bcidOffset);
-    const std::vector<unsigned int>& getDAQData();
-    std::list< unsigned int > getRoIBData();
-
-    bool hasBarrelCandidate();
-    bool hasEndcapCandidate();
 
     TriggerProcessor* getTriggerProcessor();
 
diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/TriggerProcessor.h b/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/TriggerProcessor.h
index 984f9acea26e673f95e7bf6d33a5ff77f3273a4c..3a440d57e7ebacd4c323b5b0ef0b755e9041f93d 100644
--- a/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/TriggerProcessor.h
+++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/TrigT1MuctpiPhase1/TriggerProcessor.h
@@ -8,9 +8,12 @@
 
 #include <vector>
 #include <list>
+#include <map>
+#include <string>
+#include <utility>
 
 namespace TrigConf {
-  class TriggerThreshold;
+  class L1Menu;
 }
 
 namespace LVL1MUONIF {
@@ -27,20 +30,26 @@ namespace LVL1MUCTPIPHASE1 {
     TriggerProcessor();
     ~TriggerProcessor();
 
-    void setThresholds(const std::vector<TrigConf::TriggerThreshold*>& thresholds);
+    void setMenu(const TrigConf::L1Menu* l1menu);
     void mergeInputs(std::vector<LVL1MUONIF::Lvl1MuCTPIInputPhase1*> inputs);
     void computeMultiplicities(int bcid);
     void makeTopoSelections();
     const std::vector<unsigned int>& getCTPData();
-    const std::vector<unsigned int>& getDAQData();
+
+    //subsystem - daq word pairs
+    const std::vector<std::pair<int, unsigned int> >& getDAQData();
 
   private:
 
+    std::vector<std::string> parseString(std::string str, std::string sep);
+
     std::vector<unsigned int> m_ctp_words;
-    std::vector<unsigned int> m_daq_data;
+    std::vector<std::pair<int, unsigned int> > m_daq_data;
 
     LVL1MUONIF::Lvl1MuCTPIInputPhase1* m_mergedInputs;
-    std::vector<TrigConf::TriggerThreshold*> m_thresholds;
+    const TrigConf::L1Menu* m_l1menu;
+
+    std::map<std::string, std::vector<std::vector<std::string> > > m_parsed_tgcFlags;
   };
 }
 
diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/python/TrigT1MuctpiPhase1Config.py b/Trigger/TrigT1/TrigT1MuctpiPhase1/python/TrigT1MuctpiPhase1Config.py
index b83cd57f11138ca25d4e15aca2c18c27e24c1f5f..f7e4509413084a7a46d30f806ab3ab74d100fc85 100644
--- a/Trigger/TrigT1/TrigT1MuctpiPhase1/python/TrigT1MuctpiPhase1Config.py
+++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/python/TrigT1MuctpiPhase1Config.py
@@ -62,7 +62,7 @@ class L1MuctpiPhase1_on_Data( DefaultL1MuctpiPhase1 ):
     self.RoIOutputLocID = "not_used_1"
     self.CTPOutputLocID = "/Run/L1MuCTPItoCTPLocation"
     self.OverlapStrategyName = "LUT"
-    self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB_crc_3385316356.xml"
+    self.LUTXMLFile = "TrigConfMuctpi/overlapRun3_20201214.xml"
     self.IsData=1
     self.FlaggingMode = False
 
@@ -106,45 +106,18 @@ class DefaultL1MuctpiPhase1Tool( LVL1MUCTPIPHASE1__MUCTPI_AthTool ):
     # Set properties of the LUT overlap handling:
     self.OverlapStrategyName = "LUT"
     self.DumpLUT = False
-    self.LUTXMLFile = "UNDEFINED"
-    self.RunPeriod = "UNDEFINED"
     self.FlaggingMode = False
     self.MultiplicityStrategyName = "INCLUSIVE"
     self.GeometryXMLFile = "TrigConfMuctpi/L1MuonGeometry_20200629.xml"
 
     # Decide which LUT to use, based on which run we are simulating:
-    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
-    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
-    if ( commonGeoFlags.Run() == "RUN1" ) or ( ( commonGeoFlags.Run() == "UNDEFINED" ) and
-                                               ( geoFlags.isIBL() is False ) ):
-      self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml"
-      self.RunPeriod = "RUN1"
-      logger.info( "Configuring MuCTPI simulation with Run 1 configuration file:" )
-      logger.info( "  TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml" )
-      logger.info( "  with a RunPeriod=RUN1" )
-    elif ( commonGeoFlags.Run() == "RUN2" ) or ( ( commonGeoFlags.Run() == "UNDEFINED" ) and
-                                                 ( geoFlags.isIBL() is True ) ):
-      self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml"
-      self.RunPeriod = "RUN2"
-      logger.info( "Configuring MuCTPI simulation with Run 2 configuration file:" )
-      logger.info( "  TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml" )
-      logger.info( "  with a RunPeriod=RUN2" )
-    else:
-      self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml"
-      self.RunPeriod = "RUN2"
-      logger.warning( "Couldn't determine which run to simulate, using Run 2 configuration file:" )
-      logger.warning( "  TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml" )
-      logger.warning( "  with a RunPeriod=RUN2" )
-
-      pass
-
-
-    # Turn on the NIM output creation by default:
-    self.DoNIMOutput = True
-    # The bit settings were extracted from here:
-    #   https://savannah.cern.ch/bugs/?90300#comment14
-    self.NIMBarrelBit = 29
-    self.NIMEndcapBit = 30
+    #from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
+    #from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
+    self.LUTXMLFile = "TrigConfMuctpi/overlapRun3_20201214.xml"
+    self.RunPeriod  = "RUN3"
+    logger.info( "Configuring MuCTPI simulation with " + self.RunPeriod +" configuration file:" )
+    logger.info( "  "+self.LUTXMLFile )
+    logger.info( "  with a RunPeriod=" + self.RunPeriod )
 
 
 class L1MuctpiPhase1Tool( DefaultL1MuctpiPhase1Tool ):
@@ -194,7 +167,7 @@ class L1MuctpiPhase1Tool_on_Data( DefaultL1MuctpiPhase1Tool ):
     self.RoIOutputLocID = "not_used_1"
     self.CTPOutputLocID = "/Run/L1MuCTPItoCTPLocation"
     self.OverlapStrategyName = "LUT"
-    self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB_crc_3385316356.xml"
+    self.LUTXMLFile = "TrigConfMuctpi/overlapRun3_20201214.xml"
     self.IsData=1
     self.FlaggingMode = False
 
diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MUCTPI_AthTool.cxx b/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MUCTPI_AthTool.cxx
index 569cfea8c2fffce773f92f2dfcf99c7dbded8c35..b29da504279bfb398ee8c667b614e197076f8be6 100644
--- a/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MUCTPI_AthTool.cxx
+++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MUCTPI_AthTool.cxx
@@ -14,11 +14,7 @@
 // Headers from external packages.
 
 // The new trigger configuration
-#include "TrigConfInterfaces/ILVL1ConfigSvc.h"
-#include "TrigConfL1Data/Muctpi.h"
-#include "TrigConfL1Data/ThresholdConfig.h"
-#include "TrigConfL1Data/TriggerThreshold.h"
-#include "TrigConfL1Data/L1DataDef.h"
+#include "TrigConfData/L1Menu.h"
 
 // Interfaces used by the simulation
 #include "TrigT1Interfaces/MuCTPICTP.h"
@@ -28,10 +24,10 @@
 #include "TrigT1Interfaces/Lvl1MuCTPIInputPhase1.h"
 #include "TrigT1Interfaces/MuCTPIL1Topo.h"
 
-#include "TrigT1Result/MuCTPI_RDO.h"
 #include "TrigT1Result/MuCTPIRoI.h"
 #include "xAODTrigger/MuonRoI.h"
 #include "xAODTrigger/MuonRoIAuxContainer.h"
+#include "TrigT1Interfaces/ITrigT1MuonRecRoiTool.h"
 
 #include "AnalysisTriggerEvent/LVL1_ROI.h"
 
@@ -54,9 +50,9 @@ namespace LVL1MUCTPIPHASE1 {
     :
     base_class(type, name, parent),
     m_MuCTPIL1TopoKey(LVL1MUCTPI::DEFAULT_MuonL1TopoLocation),
-    m_MuCTPIL1TopoKey_p1(""),
-    m_configSvc( "TrigConf::TrigConfigSvc/TrigConfigSvc", name ),
-    m_theMuctpi(new SimController())
+    m_theMuctpi(new SimController()),
+    m_rpcTool("LVL1::TrigT1RPCRecRoiTool/LVL1__TrigT1RPCRecRoiTool"),
+    m_tgcTool("LVL1::TrigT1TGCRecRoiTool/LVL1__TrigT1TGCRecRoiTool")
   {
     
     // Init message
@@ -64,9 +60,6 @@ namespace LVL1MUCTPIPHASE1 {
     ATH_MSG_INFO( "Constructor for Phase1 MUCTPI_AthTool."  );
     ATH_MSG_INFO( "=======================================" );
 
-    // Declare the service handles as properties:
-    declareProperty( "LVL1ConfigSvc", m_configSvc, "LVL1 Config Service" );
-
     // Declare the properties of the overlap treatment:
     declareProperty( "OverlapStrategyName", m_overlapStrategyName = "NULL" );
     declareProperty( "LUTXMLFile", m_lutXMLFile = "" );
@@ -91,6 +84,9 @@ namespace LVL1MUCTPIPHASE1 {
     declareProperty( "TGCLocID", m_tgcLocId = m_DEFAULT_L1MuctpiStoreLocationTGC );
     declareProperty( "RPCLocID", m_rpcLocId = m_DEFAULT_L1MuctpiStoreLocationRPC );
    
+    // Declare the MuonRecRoiTools
+    declareProperty( "RPCRecRoiTool", m_rpcTool, "Tool to get the eta/phi coordinates in the RPC");
+    declareProperty( "TGCRecRoiTool", m_tgcTool, "Tool to get the eta/phi coordinates in the TGC");
   }
   
   MUCTPI_AthTool::~MUCTPI_AthTool()
@@ -140,15 +136,10 @@ namespace LVL1MUCTPIPHASE1 {
       return StatusCode::FAILURE;
 
     }
-    ATH_MSG_INFO( "Retrieving trigger config service" << m_configSvc );
-    CHECK(m_configSvc.retrieve());
 
     //initialize MSP ROI configuration
     const std::string fullFileName = PathResolverFindCalibFile( m_geometryXMLFile );
-    m_theMuctpi->configureMSP(fullFileName);
-
-    m_theMuctpi->getTriggerProcessor()->setThresholds(m_configSvc->thresholdConfig()->getThresholdVector(TrigConf::L1DataDef::MUON));
-    //m_theMuctpi->getTriggerProcessor()->setThresholds(m_configSvc->muctpiConfig()->thresholds()); // maybe better to switch to this once new config is implemented
+    m_theMuctpi->configureTopo(fullFileName);
 
     //                                                                                                                                                                                        
     // Set up the overlap handling of the simulation:                                                                                                                                         
@@ -157,12 +148,10 @@ namespace LVL1MUCTPIPHASE1 {
     if( m_overlapStrategyName == "NULL" ) {
 
       ATH_MSG_DEBUG( "Setting overlap strategy: \"NULL\"" );
-      //m_theMuctpi->setOverlapStrategy( NO_OVERLAP ); // overlap removal to be implemented later
 
     } else if( m_overlapStrategyName == "LUT" ) {
 
       ATH_MSG_DEBUG( "Setting overlap strategy: \"LUT\"" );
-      //m_theMuctpi->setOverlapStrategy( LUT_OVERLAP ); // overlap removal to be implemented later
 
       if( m_flagMode ) {
 	ATH_MSG_INFO( "Using 'flagging mode' in the overlap handling" );
@@ -171,8 +160,8 @@ namespace LVL1MUCTPIPHASE1 {
       ATH_MSG_INFO( "XML LUT file defined in jobO: " << m_lutXMLFile << " with a RunPeriod=" << m_runPeriod );
       const std::string fullFileName = PathResolverFindCalibFile( m_lutXMLFile );
       ATH_MSG_DEBUG( "Full path to XML LUT file: " << fullFileName );
-      //CHECK( m_theMuctpi->initializeLUTOverlapStrategy( fullFileName, m_flagMode,
-      //                                                        m_dumpLut, m_runPeriod ) ); // overlap removal to be implemented later
+
+      m_theMuctpi->configureOverlapRemoval(fullFileName);
 
     } else {
 
@@ -188,8 +177,7 @@ namespace LVL1MUCTPIPHASE1 {
     //Initialize Read/WriteHandleKeys
     ATH_CHECK(m_muctpiPhase1KeyRPC.initialize());
     ATH_CHECK(m_muctpiPhase1KeyTGC.initialize());
-    ATH_CHECK(m_MuCTPI_RDOReadKey.initialize(m_inputSource == "RDO"));
-    ATH_CHECK(m_MuCTPI_RDOWriteKey.initialize(m_inputSource != "RDO"));
+    ATH_CHECK(m_MuCTPICTPWriteKey.initialize());
     ATH_CHECK(m_MuCTPI_xAODWriteKey.initialize());
     ATH_CHECK(m_MuCTPIL1TopoKey.initialize());
 
@@ -202,11 +190,26 @@ namespace LVL1MUCTPIPHASE1 {
     m_MuCTPIL1TopoKey_p2 = m_MuCTPIL1TopoKey.key()+std::to_string(2);
     ATH_CHECK(m_MuCTPIL1TopoKey_p2.initialize());
 
+    CHECK( m_rpcTool.retrieve() );
+    CHECK( m_tgcTool.retrieve() );
 
     return StatusCode::SUCCESS;
   }
 
+  StatusCode MUCTPI_AthTool::start()
+  {
+    ATH_MSG_INFO( "=======================================" );
+    ATH_MSG_INFO( "Start for Phase1 MUCTPI_AthTool"  );
+    ATH_MSG_INFO( "=======================================" );
+
 
+    ATH_MSG_INFO( "initialize(): use L1 trigger menu from detector store" );
+    const TrigConf::L1Menu * l1menu = nullptr;
+    ATH_CHECK( m_detStore->retrieve(l1menu) ); 
+    m_theMuctpi->getTriggerProcessor()->setMenu(l1menu);
+
+    return StatusCode::SUCCESS;
+  }
 
   //----------------------------------------------
   // execute() method called once per event
@@ -394,15 +397,12 @@ namespace LVL1MUCTPIPHASE1 {
     /// the standart processing is done for the central slice, with no Bcid offset
     if (bcidOffset == 0 ) {
       // store CTP result in interface object and put to StoreGate
-      std::vector<unsigned int> ctpData = m_theMuctpi->getCTPData();
-    //TEMPORARILY REMOVED UNTIL MUCTPICTP UPDATED TO VECTOR!
-      //LVL1::MuCTPICTP* theCTPResult = new LVL1::MuCTPICTP( ctpData );
-      //CHECK( evtStore()->record( theCTPResult, m_ctpOutputLocId ) );
-      //ATH_MSG_DEBUG( "CTP word recorded to StoreGate with key: "
-      //               << m_ctpOutputLocId );
+      const std::vector<unsigned int>& ctpData = m_theMuctpi->getTriggerProcessor()->getCTPData();
 
-      // create MuCTPI RDO
-      const std::vector<unsigned int>& daqData = m_theMuctpi->getDAQData();
+      LVL1::MuCTPICTP* theCTPResult = new LVL1::MuCTPICTP( ctpData );
+      SG::WriteHandle<LVL1::MuCTPICTP> wh_muctpi_ctp(m_MuCTPICTPWriteKey);
+      ATH_CHECK(wh_muctpi_ctp.record(std::make_unique<LVL1::MuCTPICTP>(*theCTPResult)));
+      ATH_MSG_DEBUG( "CTP word recorded to StoreGate" );
 
       // size check
       // check that the multiplicity was properly filled
@@ -413,23 +413,21 @@ namespace LVL1MUCTPIPHASE1 {
 	return StatusCode::FAILURE;
       }
 
-      // data word
-      std::vector<unsigned int> dataWords= daqData;
-
       // create MuCTPI RDO
-      auto muCTPI_RDO = std::make_unique< MuCTPI_RDO >( std::move(ctpData), std::move(dataWords) );
-      SG::WriteHandle<MuCTPI_RDO> wh_muctpi_rdo(m_MuCTPI_RDOWriteKey);
-      ATH_CHECK(wh_muctpi_rdo.record(std::move(muCTPI_RDO)));
-      ATH_MSG_DEBUG( "MuCTPI_RDO object recorded to StoreGate");
+      const std::vector<std::pair<int, unsigned int> >& daqData = m_theMuctpi->getTriggerProcessor()->getDAQData();
 
       // create MuCTPI xAOD
       auto xAODRoIs = SG::makeHandle(m_MuCTPI_xAODWriteKey);
       ATH_CHECK(xAODRoIs.record(std::make_unique<xAOD::MuonRoIContainer>(), std::make_unique<xAOD::MuonRoIAuxContainer>()));
       ATH_MSG_DEBUG("Recorded MuonRoIContainer with key " << m_MuCTPI_xAODWriteKey.key());
-      for (const unsigned int word : daqData) {
+      for (std::pair<int, unsigned int> word : daqData) {
         xAODRoIs->push_back(new xAOD::MuonRoI);
-        // RB: dummy values just to have the objects for downstream code development
-        xAODRoIs->back()->initialize(word, 99, 99, "DummyThreshold", 99);
+
+	LVL1::TrigT1MuonRecRoiData roiData;
+	if (word.first == 0) roiData = m_rpcTool->roiData(word.second); // barrel
+	else roiData = m_tgcTool->roiData(word.second); // endcap/forward
+
+        xAODRoIs->back()->initialize(word.second, roiData.eta(), roiData.phi(), "DummyThreshold", 99);
       }
 
       // get outputs for L1Topo and store into Storegate
diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MuonSectorProcessor.cxx b/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MuonSectorProcessor.cxx
index 09342a8a8103a42b4dd2a7523a1cc52619d97361..d1e9ee101cd52d8bca1583045955414a8facf097 100644
--- a/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MuonSectorProcessor.cxx
+++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MuonSectorProcessor.cxx
@@ -5,7 +5,6 @@
 // First the corresponding header.
 #include "TrigT1MuctpiPhase1/MuonSectorProcessor.h"
 
-
 // The headers from other ATLAS packages,
 // from most to least dependent.
 #include "TrigT1Interfaces/Lvl1MuCTPIInputPhase1.h"
@@ -20,24 +19,222 @@
 // System headers.
 #include <string>
 #include <sstream>
+#include <iostream>
+#include <map>
+#include <set>
+#include <array>
+#include <vector>
+
 
 using boost::property_tree::ptree;
 
-namespace LVL1MUCTPIPHASE1 {
-  MuonSectorProcessor::MuonSectorProcessor(int /*subSystem*/)
+namespace LVL1MUCTPIPHASE1 { 
+  struct SectorNumberConverter {
+    
+    std::pair<int,int> barrel_global2local(int sector){
+      auto inoct_sector = ((sector + 2) % 4);
+      auto mioct_number = ((sector + 2) / 4) % 8;
+      return std::make_pair(inoct_sector,mioct_number);
+    }
+    
+    int barrel_local2global(int number,int mioct){
+      return ((30 + 4 * mioct)  + number) % 32;
+    }
+    
+    std::pair<int,int>  endcap_global2local(int sector){
+      auto inoct_sector = ((sector + 1) % 6);
+      auto mioct_number = ((sector + 1) / 6) % 8;
+      return std::make_pair(inoct_sector,mioct_number);
+      
+    }
+    
+    int endcap_local2global(int number,int mioct){
+      return ((47 + 6 * mioct)  + number) % 48;
+    }
+    std::pair<int,int> forward_global2local(int sector){
+      auto inoct_sector = (sector % 3);
+      auto mioct_number = (sector / 3) % 8;
+      return std::make_pair(inoct_sector,mioct_number);
+      
+    }
+    
+    int forward_local2global(int number,int mioct){
+      return ((0 + 3 * mioct)  + number) % 24;
+    }
+  };
+
+  struct OverlapHelper
+  {
+    int active_side = -1;
+    std::string sub_left="";
+    std::string sub_right="";
+    int sec_left = -1;
+    int sec_right = -1;
+    std::map<int,std::set<std::string> > global_pairs;
+    
+    std::array<std::map<std::string,std::vector<std::string>>,2> lhs_index;
+    std::array<std::map<std::string,std::vector<std::string>>,2> rhs_index;
+    
+    std::string make_key(std::string prefix, int global_sec, int roi){
+      prefix += std::to_string(global_sec) + "_" + std::to_string(roi);
+      return prefix;
+    }
+    
+    std::string make_pair(std::string lhs, std::string rhs){
+      return lhs + ":" + rhs;
+    }
+
+
+    void create_indices(){
+      for(auto side_regions : global_pairs ){
+	for(auto region : side_regions.second){
+	  auto split = region.find(':');
+	  auto left = region.substr(0,split);
+	  auto right = region.substr(split+1,std::string::npos);
+	  lhs_index[side_regions.first][left].push_back(right);
+	  rhs_index[side_regions.first][right].push_back(left);
+	}
+      }
+    }
+    
+    std::vector<std::string> get_lhs_keys(std::string dettype, int roi, int sector){
+      std::vector<std::string>  r;
+      r.push_back(dettype + std::to_string(sector) + "_" + std::to_string(roi));
+      return r;   
+    }
+    
+    std::vector<std::string> get_rhs_keys(std::string dettype, int roi, int sector){
+      std::vector<std::string>  r;
+      r.push_back(dettype + std::to_string(sector) + "_" + std::to_string(roi));
+      return r;   
+    }
+    
+    std::vector<std::string> relevant_regions(int side, const std::string& dettype, int roi, int sector){
+      std::vector<std::string>  r;
+      for(auto key : get_lhs_keys(dettype,roi,sector)){
+	auto x = lhs_index[side].find(key);
+	if(x != lhs_index[side].end()){
+	  for(auto rr : lhs_index[side][key]){
+	    r.push_back(make_pair(key,rr));
+	  }
+	}
+      }
+      for(auto key : get_rhs_keys(dettype,roi,sector)){
+	auto x = rhs_index[side].find(key);
+	if(x != rhs_index[side].end()){
+	  for(auto rr : rhs_index[side][key]){
+	    r.push_back(make_pair(rr,key));
+	  }
+	}
+      }
+      return r;
+    }
+
+    void configure(const std::string& lutFile)
+    {
+      ptree inputTree;
+      read_xml(lutFile, inputTree);
+      
+      boost::property_tree::ptree topEle = inputTree.get_child("MUCTPI_LUT");
+      
+      // iterate through elements of the XML
+      for(const boost::property_tree::ptree::value_type &x: topEle) {
+	
+	std::string topElementName = x.first;
+	ptree lut = x.second;
+	
+	
+	if (topElementName != "LUT") continue;
+
+	std::string SectorId1 = MuctpiXMLHelper::getAttribute(lut,"SectorId1");
+	std::string SectorId2 = MuctpiXMLHelper::getAttribute(lut,"SectorId2");
+	
+	unsigned left_mod = 32;
+	unsigned right_mod = 32;
+	if (SectorId1[0] == 'E') left_mod = 48;
+	if (SectorId1[0] == 'F') left_mod = 24;
+	if (SectorId2[0] == 'E') right_mod = 48;
+	if (SectorId2[0] == 'F') right_mod = 24;
+	
+	std::string snum_left = std::string(1,SectorId1[1])+std::string(1,SectorId1[2]);
+	sub_left = std::string(1,SectorId1[0]);
+	sec_left = std::stoi(snum_left) % left_mod;
+	
+	std::string snum_right = std::string(1,SectorId2[1])+std::string(1,SectorId2[2]);
+	sub_right = std::string(1,SectorId2[0]);
+	sec_right = std::stoi(snum_right) % right_mod;
+	
+	std::string side = MuctpiXMLHelper::getAttribute(lut,"Side");
+	if (side == "C") active_side = 0;
+	else active_side = 1;
+	
+	for(const boost::property_tree::ptree::value_type &z: lut) {
+	  std::string menuElementName = z.first;
+	  ptree ele = z.second;
+	  
+	  if (std::string("BBElement").compare(menuElementName) == 0){
+	    auto roi1 = MuctpiXMLHelper::getIntAttribute(ele, "RoI1");
+	    auto roi2 = MuctpiXMLHelper::getIntAttribute(ele, "RoI2");
+	    auto lhs_key = make_key("B",sec_left,roi1);
+	    auto rhs_key = make_key("B",sec_right,roi2);
+	    auto region = make_pair(lhs_key,rhs_key);
+	    global_pairs[active_side].insert(region);
+	  }
+	  else if (std::string("BEElement").compare(menuElementName) == 0){
+	    auto roi1 = MuctpiXMLHelper::getIntAttribute(ele, "BRoI");
+	    auto roi2 = MuctpiXMLHelper::getIntAttribute(ele, "ERoI");
+	    auto lhs_key = make_key("B",sec_left,roi1);
+	    auto rhs_key = make_key("E",sec_right,roi2);
+	    auto region = make_pair(lhs_key,rhs_key);
+	    global_pairs[active_side].insert(region);
+	  }
+	  else if (std::string("EEElement").compare(menuElementName) == 0){
+	    auto roi1 = MuctpiXMLHelper::getIntAttribute(ele, "RoI1");
+	    auto roi2 = MuctpiXMLHelper::getIntAttribute(ele, "RoI2");
+	    auto lhs_key = make_key("E",sec_left,roi1);
+	    auto rhs_key = make_key("E",sec_right,roi2);
+	    auto region = make_pair(lhs_key,rhs_key);
+	    global_pairs[active_side].insert(region);
+	  }
+	  else if (std::string("EFElement").compare(menuElementName) == 0){
+	    auto roi1 = MuctpiXMLHelper::getIntAttribute(ele, "ERoI");
+	    auto roi2 = MuctpiXMLHelper::getIntAttribute(ele, "FRoI");
+	    auto lhs_key = make_key("E",sec_left,roi1);
+	    auto rhs_key = make_key("F",sec_right,roi2);
+	    auto region = make_pair(lhs_key,rhs_key);
+	    global_pairs[active_side].insert(region);
+	  }
+	  else if (std::string("FFElement").compare(menuElementName) == 0){
+	    auto roi1 = MuctpiXMLHelper::getIntAttribute(ele, "RoI1");
+	    auto roi2 = MuctpiXMLHelper::getIntAttribute(ele, "RoI2");
+	    auto lhs_key = make_key("F",sec_left,roi1);
+	    auto rhs_key = make_key("F",sec_right,roi2);
+	    auto region = make_pair(lhs_key,rhs_key);
+	    global_pairs[active_side].insert(region);
+	  }
+	}
+      }
+      create_indices();
+    }
+  };
+  
+
+  MuonSectorProcessor::MuonSectorProcessor(bool side)
     :
     m_muctpiInput(nullptr),
-    m_l1topo(nullptr)
+    m_l1topo(nullptr),
+    m_overlapHelper(new OverlapHelper),
+    m_side(side)
   {
     
   }
   
   MuonSectorProcessor::~MuonSectorProcessor()
   {
-    
+    delete m_overlapHelper;
   }
 
-  void MuonSectorProcessor::configure(const std::string& xmlName)
+  void MuonSectorProcessor::configureTopo(const std::string& xmlName)
   {
     ptree inputTree;
     read_xml(xmlName, inputTree);
@@ -79,15 +276,66 @@ namespace LVL1MUCTPIPHASE1 {
       }
     }
   }
+
+  void MuonSectorProcessor::configureOverlapRemoval(const std::string& lutFile)
+  {
+    m_overlapHelper->configure(lutFile);
+  }
   
   void MuonSectorProcessor::setInput(LVL1MUONIF::Lvl1MuCTPIInputPhase1* input)
   {
     m_muctpiInput=input;
   }
   
-  void MuonSectorProcessor::removeOverlap()
+  void MuonSectorProcessor::runOverlapRemoval()
   {
+    std::map<std::string,std::vector<std::pair<std::shared_ptr<LVL1MUONIF::Lvl1MuSectorLogicDataPhase1>, unsigned> > > buckets;
+
+    for (size_t isys=0;isys<LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSystems();isys++)
+    {
+      // Sectors per system
+      LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSystem system = static_cast<LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSystem>(isys);
+      for (size_t isec=0;isec<LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSector(system);isec++)
+      {
+	// A+C sides
+	for (size_t isub=0;isub<2;isub++)
+	{
+	  if (isub != size_t(m_side)) continue;
+	  unsigned int bcid=0;//temporary
+
+	  //get a pointer to this since we'll need to modify the 'veto' flag of the SL data
+	  std::shared_ptr<LVL1MUONIF::Lvl1MuSectorLogicDataPhase1> sectorData = m_muctpiInput->getSectorLogicDataPtr(isys, isub, isec, bcid);
+	  if (!sectorData) continue;
+	  
+	  for (unsigned int icand=0;icand<LVL1MUONIF::NCAND[isys];icand++)
+	  {
+	    //build the sector name
+	    std::string sectorName="";
+	    if (isys == 0) sectorName="B";
+	    else if (isys == 1) sectorName="E";
+	    else if (isys == 2) sectorName="F";
+	    
+	    int roiID = sectorData->roi(icand);
+	    if (roiID < 0) continue;
+	    int ptword = sectorData->pt(icand);
+	    if (ptword < 0) continue;
+
+	    for(auto rr : m_overlapHelper->relevant_regions(m_side,sectorName,roiID,isec))
+	    {
+	      buckets[rr].push_back(std::make_pair(sectorData, icand));
+	    }
+	  }
+	}
+      }
+    }
 
+    for(auto candidate_vector : buckets){ // loop over candidates in OL region pair
+      //for each candidate above the first, mark them as overlapping
+      for (unsigned i=1;i<candidate_vector.second.size();i++)
+      {
+	candidate_vector.second[i].first->veto(candidate_vector.second[i].second, 1);
+      }
+    }
   }
   
   void MuonSectorProcessor::makeTriggerObjectSelections()
@@ -109,6 +357,7 @@ namespace LVL1MUCTPIPHASE1 {
 	// A+C sides
 	for (size_t isub=0;isub<2;isub++)
 	{
+	  if (isub != size_t(m_side)) continue;
 	  unsigned int bcid=0;//temporary
 	  const LVL1MUONIF::Lvl1MuSectorLogicDataPhase1* sectorData = &m_muctpiInput->getSectorLogicData(isys, isub, isec, bcid);
 	  if (!sectorData)
@@ -124,7 +373,7 @@ namespace LVL1MUCTPIPHASE1 {
 	    else if (isys == 1) sectorName<<"E";
 	    else if (isys == 2) sectorName<<"F";
 	    
-	    LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSubSystem side = static_cast<LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSubSystem>(isec);
+	    LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSubSystem side = static_cast<LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSubSystem>(isub);
 	    if (isys == 0)
 	    {
 	      int sectorNumber=isec;
@@ -149,6 +398,8 @@ namespace LVL1MUCTPIPHASE1 {
 
 	    int roiID = sectorData->roi(icand);
 	    if (roiID < 0) continue;
+	    int ptword = sectorData->pt(icand);
+	    if (ptword < 0) continue;
 
 	    //find the ROI object
 	    std::map<unsigned int, ROIObject>::iterator roiItr = secItr->second.find(roiID);
@@ -159,7 +410,6 @@ namespace LVL1MUCTPIPHASE1 {
 
 	    
 
-	    //unsigned int bcid=0;
 	    unsigned int ptThresholdID=0;
 	    unsigned int ptL1TopoCode=0;
 	    unsigned int ptValue=0;
@@ -203,6 +453,6 @@ namespace LVL1MUCTPIPHASE1 {
   LVL1::MuCTPIL1Topo MuonSectorProcessor::getL1TopoData(int bcidOffset)
   {
     if (bcidOffset > -5 && bcidOffset < 5) return *m_l1topo;
-    return LVL1::MuCTPIL1Topo(); // return junk for now but fix this when we have an established procedure for handling bcid offsets
+    return LVL1::MuCTPIL1Topo();
   }
 }
diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/src/SimController.cxx b/Trigger/TrigT1/TrigT1MuctpiPhase1/src/SimController.cxx
index 8695dcfd3b45d2b66358d24fc83c194a5b87f722..506eeff9aaac53ec2632b36231b4fc68c4148fb6 100644
--- a/Trigger/TrigT1/TrigT1MuctpiPhase1/src/SimController.cxx
+++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/src/SimController.cxx
@@ -35,9 +35,14 @@ namespace LVL1MUCTPIPHASE1 {
     delete m_triggerProcessor;
   }
 
-  void SimController::configureMSP(const std::string& xmlFile)
+  void SimController::configureTopo(const std::string& geoFile)
   {
-    for (int i=0;i<(int)m_muonSectorProcessors.size();i++) m_muonSectorProcessors[i]->configure(xmlFile);
+    for (int i=0;i<(int)m_muonSectorProcessors.size();i++) m_muonSectorProcessors[i]->configureTopo(geoFile);
+  }
+
+  void SimController::configureOverlapRemoval(const std::string& lutFile)
+  {
+    for (int i=0;i<(int)m_muonSectorProcessors.size();i++) m_muonSectorProcessors[i]->configureOverlapRemoval(lutFile);
   }
 
   // set Configuration                                                                                                                                      
@@ -65,7 +70,7 @@ namespace LVL1MUCTPIPHASE1 {
     for (int i=0;i<nMSP;i++)
     {
       m_muonSectorProcessors[i]->setInput(input);
-      m_muonSectorProcessors[i]->removeOverlap();
+      m_muonSectorProcessors[i]->runOverlapRemoval();
       m_muonSectorProcessors[i]->makeTriggerObjectSelections();
       m_muonSectorProcessors[i]->makeL1TopoData();
       processedInputs.push_back(m_muonSectorProcessors[i]->getOutput());
@@ -78,11 +83,6 @@ namespace LVL1MUCTPIPHASE1 {
     m_triggerProcessor->makeTopoSelections();
   }
 
-  const std::vector<uint32_t>& SimController::getCTPData()
-  {
-    return m_triggerProcessor->getCTPData();
-  }
-  
   LVL1::MuCTPIL1Topo SimController::getL1TopoData(int bcidOffset)
   {
     LVL1::MuCTPIL1Topo l1topo;
@@ -94,27 +94,6 @@ namespace LVL1MUCTPIPHASE1 {
     return l1topo;
   }
 
-  const std::vector<unsigned int>& SimController::getDAQData()
-  {
-    return m_triggerProcessor->getDAQData();
-  }
-
-  std::list<unsigned int> SimController::getRoIBData()
-  {
-    std::list<unsigned int> dummy;
-    return dummy;
-  }
-
-  bool SimController::hasBarrelCandidate()
-  {
-    return false;
-  }
-
-  bool SimController::hasEndcapCandidate()
-  {
-    return false;
-  }
-
   TriggerProcessor* SimController::getTriggerProcessor()
   {
     return m_triggerProcessor;
diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/src/TriggerProcessor.cxx b/Trigger/TrigT1/TrigT1MuctpiPhase1/src/TriggerProcessor.cxx
index 648d7ee90886483386f7eb12915daa293b0da81e..3aa3a4c5cd7c5d459b3147a67e0fda600a6f6c3c 100644
--- a/Trigger/TrigT1/TrigT1MuctpiPhase1/src/TriggerProcessor.cxx
+++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/src/TriggerProcessor.cxx
@@ -1,5 +1,5 @@
-/*                                                                                                                      
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration                                               
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // First the corresponding header.
@@ -12,17 +12,22 @@
 #include "TrigT1Interfaces/Lvl1MuSectorLogicConstantsPhase1.h"
 #include "TrigT1Result/MuCTPI_RDO.h"
 #include "TrigT1MuctpiPhase1/Configuration.h"
-#include "TrigConfL1Data/TriggerThreshold.h"
+#include "TrigConfData/L1ThrExtraInfo.h"
+#include "TrigConfData/L1Threshold.h"
+#include "TrigConfData/L1Menu.h"
 
 // Headers from external packages.
 #include <math.h>
+#include <bitset>
+#include <sstream>
 
 // System headers.
 
 namespace LVL1MUCTPIPHASE1 {
   TriggerProcessor::TriggerProcessor()
     :
-    m_mergedInputs(new LVL1MUONIF::Lvl1MuCTPIInputPhase1())
+    m_mergedInputs(new LVL1MUONIF::Lvl1MuCTPIInputPhase1()),
+    m_l1menu(nullptr)
   {
     
   }
@@ -33,9 +38,9 @@ namespace LVL1MUCTPIPHASE1 {
   }
 
 
-  void TriggerProcessor::setThresholds(const std::vector<TrigConf::TriggerThreshold*>& thresholds)
+  void TriggerProcessor::setMenu(const TrigConf::L1Menu* l1menu)
   {
-    m_thresholds = thresholds;
+    m_l1menu = l1menu;
   }
   
   void TriggerProcessor::mergeInputs(std::vector<LVL1MUONIF::Lvl1MuCTPIInputPhase1*> inputs)
@@ -51,8 +56,9 @@ namespace LVL1MUCTPIPHASE1 {
     m_daq_data.clear();
 
     //initialize the vector to hold the threshold multiplicities
-    int nThresholds = m_thresholds.size();
-    std::vector<int> multiplicities(nThresholds, 0);
+    const std::vector<std::shared_ptr<TrigConf::L1Threshold> >* thresholds = &m_l1menu->thresholds("MU");
+    int nThresholds = thresholds->size();
+    std::vector<int> multiplicities(nThresholds,0);
 
 
     // Barrel + EC + Fwd
@@ -73,48 +79,25 @@ namespace LVL1MUCTPIPHASE1 {
 	  {
 	    int thresh = sectorData->pt(icand);
 	    if (thresh == -1) continue; // no candidate
+	    int roiID = sectorData->roi(icand);
+	    if (roiID < 0) continue;
 
-	    //loop over each muon threshold and see if this candidate satisfies it
-/*This will be migrated later along with the changes needed in the TrigConfL1Data package
-	    for (int ithresh=0;ithresh<nThresholds;ithresh++)
-	    {
-	      const TrigConf::TriggerThreshold* thr = m_thresholds[ithresh];
-	      const TrigConf::Run3MuonTriggerThreshold* muthr = thr->run3MuonTriggerThreshold();
-	      bool passed=false;
-	      if (isys == LVL1MUONIF::Lvl1MuCTPIInputPhase1::idBarrelSystem())
-	      {
-		if ((int)muthr->rpcThr()+1 >= thresh) passed=true;
-	      }
-	      else
-	      {
-		if ((int)muthr->tgcThr()+1 >= thresh) passed=true;
-	      }
-	      if (passed) multiplicities[ithresh]++;
-	    }
-*/
-
-	    //build the daq word here
+	    // Build the DAQ word
 	    uint32_t daq_word=0;
+
+	    // Some definitions that are different between subsystems
 	    uint32_t ROI_MASK=0;
-	    uint32_t OL_MASK=0;
-	    uint32_t OL_SHIFT=0;
 	    uint32_t SECTOR_MASK = 0;
-	    uint32_t SECTORID_SHIFT = MuCTPI_RDO::CAND_SECTOR_ADDRESS_SHIFT+1;
-	    uint32_t SUBSYS_SHIFT = MuCTPI_RDO::CAND_SECTOR_ADDRESS_SHIFT+6;
 	    uint32_t SUBSYS_MASK = 0x3;
 	    uint32_t SUBSYS_ID = 0; // default for barrel
 	    if (isys == 0) 
 	    {
 	      ROI_MASK = MuCTPI_RDO::BARREL_ROI_MASK;
-	      OL_MASK = MuCTPI_RDO::BARREL_OL_MASK;
-	      OL_SHIFT = MuCTPI_RDO::BARREL_OL_SHIFT;
 	      SECTOR_MASK = MuCTPI_RDO::BARREL_SECTORID_MASK;
 	    }
 	    else if (isys == 1) 
 	    {
 	      ROI_MASK = MuCTPI_RDO::ENDCAP_ROI_MASK;
-	      OL_MASK = MuCTPI_RDO::ENDCAP_OL_MASK;
-	      OL_SHIFT = MuCTPI_RDO::ENDCAP_OL_SHIFT;
 	      SECTOR_MASK = MuCTPI_RDO::ENDCAP_SECTORID_MASK;
 	      SUBSYS_ID = 2; // not a typo!
 	    }
@@ -124,89 +107,183 @@ namespace LVL1MUCTPIPHASE1 {
 	      SECTOR_MASK = MuCTPI_RDO::FORWARD_SECTORID_MASK;
 	      SUBSYS_ID = 1; // not a typo!
 	    }
+
 	    //General formula for each subword:
 	    //daq_word |= (subword & MuCTPI_RDO::MASK) << MuCTPI_RDO::SHIFT
-	    daq_word |= (sectorData->is2candidatesInSector() & MuCTPI_RDO::CAND_OVERFLOW_MASK) << MuCTPI_RDO::CAND_OVERFLOW_SHIFT;
-	    daq_word |= (sectorData->is2candidates(icand)    & MuCTPI_RDO::ROI_OVERFLOW_MASK)  << MuCTPI_RDO::ROI_OVERFLOW_SHIFT;
-	    daq_word |= (sectorData->roi(icand)              & ROI_MASK)                       << MuCTPI_RDO::ROI_SHIFT;
-	    daq_word |= (sectorData->ovl(icand)              & OL_MASK)                        << OL_SHIFT;
-	    daq_word |= (thresh                              & MuCTPI_RDO::CAND_PT_MASK)       << MuCTPI_RDO::CAND_PT_SHIFT;
-	    //	    daq_word |= (sectorData->bcid()                  & MuCTPI_RDO::CAND_BCID_MASK)     << MuCTPI_RDO::CAND_BCID_SHIFT; // bcid not included in this word (yet?)
-
-	    //set the address information
-	    daq_word |= (isub      & MuCTPI_RDO::SECTOR_HEMISPHERE_MASK) << MuCTPI_RDO::CAND_SECTOR_ADDRESS_SHIFT;
-	    daq_word |= (isec      & SECTOR_MASK)                        << SECTORID_SHIFT;
-	    daq_word |= (SUBSYS_ID & SUBSYS_MASK)                        << SUBSYS_SHIFT;
 	    
-	    //there are other items that are less important. let's ignore them for the moment
-	    m_daq_data.push_back(daq_word);
+	    //ROI word
+	    daq_word |= (sectorData->roi(icand)              & ROI_MASK)                       << MuCTPI_RDO::RUN3_ROI_SHIFT;
+
+	    //PT word
+	    daq_word |= (thresh                              & MuCTPI_RDO::CAND_PT_MASK)       << MuCTPI_RDO::RUN3_CAND_PT_SHIFT;
+
+	    //CANDIDIATE FLAGS
+	    if (isys == 0) 
+	    {
+	      daq_word |= (sectorData->ovl(icand)              & MuCTPI_RDO::RUN3_BARREL_OL_MASK) << MuCTPI_RDO::RUN3_BARREL_OL_SHIFT;
+	      daq_word |= (sectorData->is2candidates(icand)    & MuCTPI_RDO::ROI_OVERFLOW_MASK)   << MuCTPI_RDO::RUN3_ROI_OVERFLOW_SHIFT;
+	    }
+	    else
+	    {
+	      daq_word |= (sectorData->charge(icand)           & 0x1) << MuCTPI_RDO::RUN3_CAND_TGC_CHARGE_SIGN_SHIFT;
+	      daq_word |= (sectorData->bw2or3(icand)           & 0x1) << MuCTPI_RDO::RUN3_CAND_TGC_BW2OR3_SHIFT;
+	      daq_word |= (sectorData->innercoin(icand)        & 0x1) << MuCTPI_RDO::RUN3_CAND_TGC_INNERCOIN_SHIFT;
+	      daq_word |= (sectorData->goodmf(icand)           & 0x1) << MuCTPI_RDO::RUN3_CAND_TGC_GOODMF_SHIFT;
+	    }
+
+	    //CANDIDATE VETO FLAG
+	    daq_word |= (sectorData->veto(icand)             & 0x1)                            << MuCTPI_RDO::RUN3_CAND_VETO_SHIFT;
+
+	    //SECTOR FLAGS
+	    daq_word |= (sectorData->is2candidatesInSector() & MuCTPI_RDO::CAND_OVERFLOW_MASK) << MuCTPI_RDO::RUN3_CAND_OVERFLOW_SHIFT;
+
+	    //SECTOR ADDRESS
+	    daq_word |= (isub      & MuCTPI_RDO::SECTOR_HEMISPHERE_MASK)   << MuCTPI_RDO::RUN3_CAND_SECTOR_ADDRESS_SHIFT;
+	    daq_word |= (isec      & SECTOR_MASK)                          << MuCTPI_RDO::RUN3_CAND_SECTORID_SHIFT;
+	    daq_word |= (SUBSYS_ID & SUBSYS_MASK)                          << MuCTPI_RDO::RUN3_SUBSYS_ADDRESS_SHIFT;
+
+
+	    // Add extra bit in front to flag that this is a RUN3 RoI
+	    daq_word |= 0x1 << 31;
+
+	    m_daq_data.push_back(std::make_pair(SUBSYS_ID, daq_word));
+
+
+	    //
+	    // Perform multiplicity counting
+	    //
+
+	    //if this candidate has been flagged as overlapping, stop here and don't count it in the multiplicity
+	    if (sectorData->veto(icand)) continue;
+
+	    //loop over each muon threshold and see if this candidate satisfies it.
+	    //if so, increment the multiplicity of this threshold
+	    for (int ithresh=0;ithresh<nThresholds;ithresh++)
+	    {
+	      const TrigConf::L1Threshold_MU* thr = (const TrigConf::L1Threshold_MU*)(*thresholds)[ithresh].get();
+	      bool passed=false;
+	      if (isys == LVL1MUONIF::Lvl1MuCTPIInputPhase1::idBarrelSystem())
+	      {
+		if (thr->region().find("ALL") == std::string::npos &&
+		    thr->region().find("BA") == std::string::npos) continue;
+		
+		//veto this candidate from this multiplicity if it's part of the excluded ROI list
+		std::string rpcExclROIList = thr->rpcExclROIList();
+		if (rpcExclROIList != "")
+		{
+		  const std::map<std::string, std::vector<unsigned int> >* exclList = &m_l1menu->thrExtraInfo().MU().exclusionList(rpcExclROIList);
+		  if (exclList->size() != 0)
+		  {
+		    std::stringstream sectorName;
+		    sectorName<<"B";
+		    int sectorNumber=isec;
+		    LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSubSystem side = static_cast<LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSubSystem>(isec);
+		    if (side == LVL1MUONIF::Lvl1MuCTPIInputPhase1::idSideC()) sectorNumber += 32;
+		    if (sectorNumber < 10) sectorName << "0";
+		    sectorName << sectorNumber;
+		    
+		    auto exclROIs = exclList->find(sectorName.str());
+		    if (exclROIs != exclList->end())
+		    {
+		      bool found = false;
+		      for (auto roi_itr=exclROIs->second.begin();roi_itr!=exclROIs->second.end();roi_itr++)
+		      {
+			if (int(*roi_itr) == sectorData->roi(icand))
+			{
+			  found=true;
+			  break;
+			}
+		      }
+		      if (found) continue;
+		    }
+		  }
+		}
+
+		if ((int)thr->idxBarrel()+1 >= thresh) passed=true;
+	      }
+	      else 
+	      {
+		if (isys == LVL1MUONIF::Lvl1MuCTPIInputPhase1::idEndcapSystem())
+		{
+		  if (thr->region().find("ALL") == std::string::npos &&
+		      thr->region().find("EC") == std::string::npos) continue;
+		  if ((int)thr->idxEndcap()+1 >= thresh) passed=true;
+		}
+		else
+		{
+		  if (thr->region().find("ALL") == std::string::npos &&
+		      thr->region().find("FW") == std::string::npos) continue;
+		  if ((int)thr->idxForward()+1 >= thresh) passed=true;
+		}
+
+		//check tgc quality flags
+		bool F = sectorData->bw2or3(icand);
+		bool C = sectorData->innercoin(icand);
+		bool H = sectorData->goodmf(icand);
+
+		//parse the logic of the quality flag into a 2D vector, where outer layer contains the logic |'s and inner layer contains the logical &'s.
+		//save the 2D vector in a map so we don't have to parse it each time we want to check the flags.
+		std::string tgcFlags = thr->tgcFlags();
+		if (m_parsed_tgcFlags.find(tgcFlags) == m_parsed_tgcFlags.end())
+		{
+		  std::vector<std::string> vec_ors = parseString(tgcFlags, "|");
+		  std::vector<std::vector<std::string> > vec_flags;
+		  for (unsigned ior=0;ior<vec_ors.size();ior++)
+		  {
+		    vec_flags.push_back(parseString(vec_ors[ior],"&"));
+		  }
+		  m_parsed_tgcFlags[tgcFlags] = vec_flags;
+		}
+	      
+		//check the quality based on the flags.
+		//loop over outer layer of "ors" and 'or' the results
+		bool passedFlags = false;
+		const std::vector<std::vector<std::string> >* vec_flags = &m_parsed_tgcFlags[tgcFlags];
+		for (auto or_itr = vec_flags->begin();or_itr!=vec_flags->end();or_itr++)
+		{
+		  //loop over the inner layer of "ands" and 'and' the results
+		  bool passedAnd = true;
+		  for (auto and_itr = or_itr->begin();and_itr!=or_itr->end();and_itr++)
+		  {
+		    if (*and_itr == "F") passedAnd = passedAnd && F;
+		    else if (*and_itr == "C") passedAnd = passedAnd && C;
+		    else if (*and_itr == "H") passedAnd = passedAnd && H;
+		  }
+		  passedFlags = passedFlags || passedAnd;
+		}
+	      
+		if (!passedFlags) continue;
+	      }
+	      
+	      if (passed) multiplicities[ithresh]++;
+	    }
 	  }
 	}
       }
     }
-  
-    //build the CTP words
-    unsigned int current_ctp_word=0;
-    int pos=0;
-    int word_size = sizeof(current_ctp_word)*8;
+
+    //build the CTP words with bitset:
+    //first build the bitset that contains the full word
+    std::bitset<256> full_ctp_word = 0;
+    unsigned pos = 0;
     for (int i=0;i<nThresholds;i++)
     {
-      //buffer to add at the word at the end of the block, if necessary
-      unsigned int word_to_add=0;
-      bool add_word=false; // need this in case the word needs to be added but its empty
-
-      //truncate the thresholds if they're over the number of specified bits
-      int nbits = m_thresholds[i]->bitnum();
-      int maxsize = std::pow(2,nbits)-1;
-      if (multiplicities[i] > maxsize) multiplicities[i] = maxsize; 
-
-      //assign the individual multiplicity word to the CTP word
-      if (pos+nbits <= word_size) 
-      {
-	//assign the word
-	current_ctp_word |= multiplicities[i] << pos;
-
-	//add it to the word list if its full (or we're at the end of the threshold list) and reset
-	if (pos+nbits == word_size || i == nThresholds-1)
-	{
-	  word_to_add=current_ctp_word;
-	  add_word=true;
-	  pos=0;
-	}
-	else
-	{
-	  //increment the position
-	  pos += nbits;
-	}
-      }
-      else
-      {//handle cases where the individual multiplicity word is split between two 32-bit words
-	//truncate the multiplicity by the remaining length
-	int remaining_length = word_size-pos;
-	int mask = 0;
-	for (int j=0;j<remaining_length;j++) mask |= 0x1 << j;
-	int mult_trunc = multiplicities[i] & mask;
-
-	//add this to the current word
-	current_ctp_word |= mult_trunc << pos;
-
-	//add the current word to the CTP word list
-	word_to_add=current_ctp_word;
-	add_word=true;
-
-	//reset the current word and add the remainder to the new word
-	current_ctp_word = multiplicities[i] >> remaining_length;
-
-	//recalculate the position
-	pos += nbits;
-	pos -= word_size;
-      }
+      auto & triggerline = m_l1menu->connector("MuCTPiOpt0").triggerLine((*thresholds)[i]->name());
+      unsigned nbits = triggerline.endbit() - triggerline.startbit() + 1;
+      std::bitset<256> mult = (multiplicities[i] << pos);
+      full_ctp_word |= mult;
+      pos += nbits;
+    }
 
-      //add the word if its not empty, or if we're at the end of the loop;
-      if (add_word || i == nThresholds-1) 
-      {
-	m_ctp_words.push_back(word_to_add);
-      }
+    //divide up into a vector of 32-bit unsigned ints
+    std::bitset<256> u32i_mask = 0xffffffff;
+    unsigned n32_ints = pos/32;
+    if (pos % 32 != 0) n32_ints += 1;
+    for (unsigned i=0;i<n32_ints;i++)
+    {
+      unsigned int word = static_cast<unsigned int>((full_ctp_word & u32i_mask).to_ulong());
+      m_ctp_words.push_back(word);
+      full_ctp_word >>= 32;
     }
   }
   
@@ -222,8 +299,37 @@ namespace LVL1MUCTPIPHASE1 {
   }
 
 
-  const std::vector<unsigned int>& TriggerProcessor::getDAQData()
+  const std::vector<std::pair<int, unsigned int> >& TriggerProcessor::getDAQData()
   {
     return m_daq_data;
   }
+
+  std::vector<std::string> TriggerProcessor::parseString(std::string str, std::string sep)
+  {
+    std::vector<std::string> parsed;
+    int pos = 0;
+    bool first = true;
+    if (str.size() == 0) return parsed;
+    if (str.find(sep) == std::string::npos)
+    {
+      parsed.push_back(str);
+      return parsed;
+    }
+    while (true)
+    {
+      int newPos = str.find(sep, pos);
+      if (str.find(sep, pos) == std::string::npos)
+      {
+	if (!first) parsed.push_back(str.substr(pos, newPos-pos));
+	break;
+      }
+      std::string sub = str.substr(pos, newPos-pos);
+      parsed.push_back(sub);
+      pos = newPos+1;
+      first = false;
+    }
+    return parsed;
+  }
+
 }
+
diff --git a/Trigger/TrigT1/TrigT1MuonRecRoiTool/CMakeLists.txt b/Trigger/TrigT1/TrigT1MuonRecRoiTool/CMakeLists.txt
index 169d388e76c6f98d6d1221ccb4c2438fa4d2e3ff..27558362b0411008edc4fe98a14902d382d90fcd 100644
--- a/Trigger/TrigT1/TrigT1MuonRecRoiTool/CMakeLists.txt
+++ b/Trigger/TrigT1/TrigT1MuonRecRoiTool/CMakeLists.txt
@@ -3,13 +3,10 @@
 # Declare the package name:
 atlas_subdir( TrigT1MuonRecRoiTool )
 
-# Component(s) in the package:
-atlas_add_library( TrigT1MuonRecRoiToolLib
-                   src/*.cxx
-                   PUBLIC_HEADERS TrigT1MuonRecRoiTool
-                   LINK_LIBRARIES AthenaKernel GaudiKernel MuonIdHelpersLib MuonReadoutGeometry TGCcablingInterfaceLib RPCcablingInterfaceLib RPC_CondCablingLib )
-
 atlas_add_component( TrigT1MuonRecRoiTool
+                     src/*.cxx 
                      src/components/*.cxx
-                     LINK_LIBRARIES TrigT1MuonRecRoiToolLib )
+                     LINK_LIBRARIES AthenaKernel GaudiKernel TrigT1Interfaces MuonIdHelpersLib MuonReadoutGeometry TGCcablingInterfaceLib RPCcablingInterfaceLib RPC_CondCablingLib )
 
+# Install files from the package:
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Trigger/TrigT1/TrigT1MuonRecRoiTool/python/TrigT1MuonRecRoiToolConfig.py b/Trigger/TrigT1/TrigT1MuonRecRoiTool/python/TrigT1MuonRecRoiToolConfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..80696cbaa96062ae42110c577c62e67ca6d7330d
--- /dev/null
+++ b/Trigger/TrigT1/TrigT1MuonRecRoiTool/python/TrigT1MuonRecRoiToolConfig.py
@@ -0,0 +1,16 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+
+# Local (generated) configurable(s):
+from TrigT1MuonRecRoiTool.TrigT1MuonRecRoiToolConf import LVL1__TrigT1RPCRecRoiTool
+from TrigT1MuonRecRoiTool.TrigT1MuonRecRoiToolConf import LVL1__TrigT1TGCRecRoiTool
+
+def getRun3RPCRecRoiTool(name = "RPCRecRoiTool"):
+    tool = LVL1__TrigT1RPCRecRoiTool(name)
+    tool.UseRun3Config=True
+    return tool
+
+def getRun3TGCRecRoiTool(name = "TGCRecRoiTool"):
+    tool = LVL1__TrigT1TGCRecRoiTool(name)
+    tool.UseRun3Config=True
+    return tool
diff --git a/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1RPCRecRoiTool.h b/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1RPCRecRoiTool.h
index 0becbc352a4b7866be4fe7f2a16f7c58eadbb3a9..aa128bddcef1bfb94ef7307bb5d35b956a0740c9 100644
--- a/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1RPCRecRoiTool.h
+++ b/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1RPCRecRoiTool.h
@@ -5,7 +5,7 @@
 #ifndef TRIGT1RPCRECROITOOL_H
 #define TRIGT1RPCRECROITOOL_H
 
-#include "TrigT1MuonRecRoiTool/ITrigT1MuonRecRoiTool.h"
+#include "TrigT1Interfaces/ITrigT1MuonRecRoiTool.h"
 #include "AthenaBaseComps/AthAlgTool.h"
 
 namespace Muon{
diff --git a/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1TGCRecRoiTool.h b/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1TGCRecRoiTool.h
index 7a30990d09c5d74d2f4c5935505bea23a77545a6..6cf6077fb54b08beb8b141a79eacccb3814a6553 100644
--- a/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1TGCRecRoiTool.h
+++ b/Trigger/TrigT1/TrigT1MuonRecRoiTool/src/TrigT1TGCRecRoiTool.h
@@ -5,7 +5,7 @@
 #ifndef TRIGT1TGCRECROITOOL_H
 #define TRIGT1TGCRECROITOOL_H
 
-#include "TrigT1MuonRecRoiTool/ITrigT1MuonRecRoiTool.h"
+#include "TrigT1Interfaces/ITrigT1MuonRecRoiTool.h"
 #include "AthenaBaseComps/AthAlgTool.h"
 
 class TGCIdBase;
diff --git a/Trigger/TrigT1/TrigT1Result/CMakeLists.txt b/Trigger/TrigT1/TrigT1Result/CMakeLists.txt
index 971d822fa801e690863f1526fbcd3715ee053dc7..e538f9a9105db387b9f5c0d475db2a86bcb9464c 100644
--- a/Trigger/TrigT1/TrigT1Result/CMakeLists.txt
+++ b/Trigger/TrigT1/TrigT1Result/CMakeLists.txt
@@ -11,7 +11,7 @@ atlas_add_library( TrigT1Result
                    src/*.cxx
                    PUBLIC_HEADERS TrigT1Result
                    INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaKernel L1TopoRDO TrigT1Interfaces
+                   LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaKernel L1TopoRDO TrigT1Interfaces TrigT1MuctpiBits
                    PRIVATE_LINK_LIBRARIES GaudiKernel )
 
 atlas_add_dictionary( TrigT1ResultDict
diff --git a/Trigger/TrigT1/TrigT1Result/TrigT1Result/MuCTPI_RDO.h b/Trigger/TrigT1/TrigT1Result/TrigT1Result/MuCTPI_RDO.h
index d671081166fad31a4402e275ac83177e706ab7f6..25ee090f678bbd272552578c3f85d3671808ad98 100755
--- a/Trigger/TrigT1/TrigT1Result/TrigT1Result/MuCTPI_RDO.h
+++ b/Trigger/TrigT1/TrigT1Result/TrigT1Result/MuCTPI_RDO.h
@@ -1,7 +1,7 @@
 // Dear emacs, this is -*- c++ -*-
 
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRIGT1RESULT_MUCTPI_RDO_H
@@ -44,6 +44,7 @@ public:
   /// Enumeration defining the different sources for the muon candidates
   enum SectorLocation { BARREL = 0, ENDCAP = 1, FORWARD = 2 };
 
+
   /// "Intermediate" constructor
   /**
    * This constructor is tipically used for filling the object with information
@@ -140,90 +141,8 @@ public:
   const std::vector< uint32_t >& dataWord() const {
     return m_dataWord;
   }
-
-  /// Binary 111 representing the maximal multiplicity value for a given threshold
-  static constexpr uint32_t MULT_VAL = 7;
-  /// Number of multiplicity bits reserved per threshold
-  static constexpr uint32_t MULT_BITS = 3;
-  /// Defining the number of p<sub>T</sub> thresholds in the system
-  static constexpr uint32_t MULT_THRESH_NUM = 6;
-  /// Telling that the 3-bit BCID comes at "position 7" in the multiplicity word
-  static constexpr uint32_t MULT_BCID_POS = 7;
-
-  /// Weird mask for the bit showing if more than two muon candidates were in the trigger sector
-  static constexpr uint32_t CAND_OVERFLOW_MASK = 0x1;
-  /// Position of the candidate overflow mask
-  static constexpr uint32_t CAND_OVERFLOW_SHIFT = 0;
-  /// Weird mask for the bit showing if more than one muon candidates were in the sector RoI
-  static constexpr uint32_t ROI_OVERFLOW_MASK = 0x1;
-  /// Position of the RoI overflow mask
-  static constexpr uint32_t ROI_OVERFLOW_SHIFT = 1;
-
-  /// Bit in the candidate's address turned on for endcap candidates
-  static constexpr uint32_t ENDCAP_ADDRESS_MASK = 0x80;
-  /// Bit in the candidate's address turned on for forward candidates
-  static constexpr uint32_t FORWARD_ADDRESS_MASK = 0x40;
-
-  /// Mask for extracting the sector ID for endcap candidates from the data word
-  static constexpr uint32_t ENDCAP_SECTORID_MASK = 0x3f;
-  /// Mask for extracting the sector ID for forward candidates from the data word
-  static constexpr uint32_t FORWARD_SECTORID_MASK = 0x1f;
-  /// Mask for extracting the sector ID for barrel candidates from the data word
-  static constexpr uint32_t BARREL_SECTORID_MASK = 0x1f;
-  /// Mask for the bit showing which hemisphere the candidate came from.(1: positive; 0: negative)
-  static constexpr uint32_t SECTOR_HEMISPHERE_MASK = 0x1;
-
-  /// Mask for extracting the RoI for barrel candidates from the data words
-  static constexpr uint32_t BARREL_ROI_MASK = 0x1f;
-  /// Mask for extracting the RoI for endcap candidates from the data words
-  static constexpr uint32_t ENDCAP_ROI_MASK = 0xff;
-  /// Mask for extracting the RoI for forward candidates from the data words
-  static constexpr uint32_t FORWARD_ROI_MASK = 0x3f;
-  /// Position of the RoI bits in the data word
-  static constexpr uint32_t ROI_SHIFT = 2;
-
-  /// Mask for extracting the overlap bits for barrel candidates from the data words
-  static constexpr uint32_t BARREL_OL_MASK = 0x3;
-  /// Position of the overlap bits in barrel data words
-  static constexpr uint32_t BARREL_OL_SHIFT = 9;
-  /// Mask for extracting the overlap bits for endcap candidates from the data words
-  static constexpr uint32_t ENDCAP_OL_MASK = 0x1;
-  /// Position of the overlap bits in endcap data words
-  static constexpr uint32_t ENDCAP_OL_SHIFT = 10;
-
-  /// Mask for extracting the p<sub>T</sub> threshold passed by the candidate from the data word
-  static constexpr uint32_t CAND_PT_MASK = 0x7;
-  /// Position of the p<sub>T</sub> threshold bits in the data words
-  static constexpr uint32_t CAND_PT_SHIFT = 11;
-
-  /// Mask for extracting the last 3 bits of the BCID of the muon candidate from the data word
-  static constexpr uint32_t CAND_BCID_MASK = 0x7;
-  /// Position of the BCID bits in the data words
-  static constexpr uint32_t CAND_BCID_SHIFT = 14;
-
-  /// Mask for extracting the address of the muon candidate from the data word
-  static constexpr uint32_t CAND_SECTOR_ADDRESS_MASK = 0xff;
-  /// Position of the muon candidate's address in the data word
-  static constexpr uint32_t CAND_SECTOR_ADDRESS_SHIFT = 17;
-
-  /// Mask for extracting the bit from the data word showing whether the candidate had the highest p<sub>T</sub> in the sector
-  static constexpr uint32_t CAND_HIGHEST_PT_MASK = 0x1;
-  /// Position of the "highest p<sub>T</sub>" bit
-  static constexpr uint32_t CAND_HIGHEST_PT_SHIFT = 25;
-
-  /// Mask for extracting the bit from the data word showing if the muon candidate was sent to the RoIB
-  static constexpr uint32_t CAND_SENT_ROI_MASK = 0x1;
-  /// Position of the "candidate sent to RoIB" bit.
-  static constexpr uint32_t CAND_SENT_ROI_SHIFT = 26;
-
-  /// Position of the bit turned on for the multiplicity words that distinguishes them from the data words
-  static constexpr uint32_t MULT_WORD_FLAG_SHIFT = 29;
-
-  /// Position of the bit specifying the candidate's sign
-  static constexpr uint32_t CAND_TGC_CHARGE_SIGN_SHIFT = 27;
-
-  /// Position of the bit specifying if a candidate was vetoed in the multiplicity sum
-  static constexpr uint32_t CAND_VETO_SHIFT = 28;
+  
+#include<TrigT1MuctpiBits/MuCTPI_Bits.h>
 
 private:
   /// Variable storing the multiplicity word(s) sent to the CTP
diff --git a/Trigger/TrigT1/TrigT1Result/TrigT1Result/selection.xml b/Trigger/TrigT1/TrigT1Result/TrigT1Result/selection.xml
index ea78cd9018421e2b8fc42aa62a4be86d53e8c25f..7245c3e8a68615073bd9b60a53e6f66fd278e493 100755
--- a/Trigger/TrigT1/TrigT1Result/TrigT1Result/selection.xml
+++ b/Trigger/TrigT1/TrigT1Result/TrigT1Result/selection.xml
@@ -1,7 +1,7 @@
 <lcgdict>
 
   <!-- MuCTPI RDO -->
-  <class name="MuCTPI_RDO" id="5BE3FA7E-CC70-4842-A095-CA046164764D" />
+  <!--class name="MuCTPI_RDO" id="5BE3FA7E-CC70-4842-A095-CA046164764D" /-->
 
   <!-- CTP RDO -->
   <class name="CTP_RDO" id="56C714CC-DC17-4927-B413-9151C82792BB" />
diff --git a/Trigger/TrigT1/TrigT1Result/src/MuCTPIResult.cxx b/Trigger/TrigT1/TrigT1Result/src/MuCTPIResult.cxx
index 2b4e380dffab891b57aeea5d18c3ae07ffd2e410..4d6669d2677d1d37e407a9d2d0de1550c7d5096a 100755
--- a/Trigger/TrigT1/TrigT1Result/src/MuCTPIResult.cxx
+++ b/Trigger/TrigT1/TrigT1Result/src/MuCTPIResult.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 
@@ -121,8 +121,8 @@ namespace ROIB {
       s << " " << roIVec()[i].getRoiOverflow();
       if (longFormat) s << std::setw(12) << "\n RoI number:";
       s << " " << roIVec()[i].getRoiNumber();
-      if (longFormat) s << std::setw(12) << "\n IsHighestPt:";
-      s << " " << roIVec()[i].getCandidateIsHighestPt();
+      //if (longFormat) s << std::setw(12) << "\n IsHighestPt:";
+      //s << " " << roIVec()[i].getCandidateIsHighestPt();
       if (longFormat) s << std::setw(12) << "\n Overlap:";
       s << " " << roIVec()[i].getOverlapBits();
       s << "] ";
@@ -185,7 +185,7 @@ namespace ROIB {
       log << MSG::DEBUG << "Sector overflow         :  " << it->getSectorOverflow() << endmsg;
       log << MSG::DEBUG << "RoI overflow            :  " << it->getRoiOverflow() << endmsg;
       log << MSG::DEBUG << "RoI number              :  " << it->getRoiNumber() << endmsg;
-      log << MSG::DEBUG << "IsHighestPt             :  " << it->getCandidateIsHighestPt() << endmsg;
+      //log << MSG::DEBUG << "IsHighestPt             :  " << it->getCandidateIsHighestPt() << endmsg;
       log << MSG::DEBUG << "Overlap                 :  " << it->getOverlapBits() << endmsg;
 
     }
diff --git a/Trigger/TrigT1/TrigT1Result/src/MuCTPIRoI.cxx b/Trigger/TrigT1/TrigT1Result/src/MuCTPIRoI.cxx
index 4a68f823a2b54b7cd3934c6b0cfbc7df49ba7f5b..2ccfb817977f54e8ebb954003a49497d648d774f 100755
--- a/Trigger/TrigT1/TrigT1Result/src/MuCTPIRoI.cxx
+++ b/Trigger/TrigT1/TrigT1Result/src/MuCTPIRoI.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 
diff --git a/Trigger/TrigT1/TrigT1Result/src/MuCTPI_DataWord_Decoder.cxx b/Trigger/TrigT1/TrigT1Result/src/MuCTPI_DataWord_Decoder.cxx
index 751d959aef58221f7a947df4c66576a509b77a46..a795fd3b5b619708d834d71cb2bfef47a0ce1ec5 100755
--- a/Trigger/TrigT1/TrigT1Result/src/MuCTPI_DataWord_Decoder.cxx
+++ b/Trigger/TrigT1/TrigT1Result/src/MuCTPI_DataWord_Decoder.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 
@@ -150,6 +150,7 @@ uint16_t MuCTPI_DataWord_Decoder::getPt() const {
 /**
  * @return 3-bit BCID fragment saved with the candidate
  */
+
 uint16_t MuCTPI_DataWord_Decoder::getBCID() const {
   return ((m_dataWord >> MuCTPI_RDO::CAND_BCID_SHIFT) &
 	  MuCTPI_RDO::CAND_BCID_MASK);
@@ -158,6 +159,7 @@ uint16_t MuCTPI_DataWord_Decoder::getBCID() const {
 /**
  * @return flag showing whether the candidate had the highest p<sub>T</sub> in its sector
  */
+
 uint16_t MuCTPI_DataWord_Decoder::getCandidateIsHighestPt() const {
   return ((m_dataWord >> MuCTPI_RDO::CAND_HIGHEST_PT_SHIFT) &
 	  MuCTPI_RDO::CAND_HIGHEST_PT_MASK);
@@ -166,6 +168,7 @@ uint16_t MuCTPI_DataWord_Decoder::getCandidateIsHighestPt() const {
 /**
  * @return flag showing whether the candidate was sent to the RoIB
  */
+
 uint16_t MuCTPI_DataWord_Decoder::getSentRoi() const {
   return ((m_dataWord >> MuCTPI_RDO::CAND_SENT_ROI_SHIFT) &
 	  MuCTPI_RDO::CAND_SENT_ROI_MASK);
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py
index 3ff97c437a6bd13b55c14dc39e40014d84da6094..991c6be2ca25afe411ad08c987b98612d9849b8c 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py
@@ -195,10 +195,14 @@ class HLTSimulationGetter(Configured):
             if hasattr(TrigSteer_HLT.LvlTopoConverter, 'MuonInputProvider'):
 
                 try: # this is temporary until TrigT1Muctpi-00-06-29 is in the release
-                    from TrigT1Muctpi.TrigT1MuctpiConfig import L1MuctpiTool
+                    from AthenaConfiguration.AllConfigFlags import ConfigFlags
+                    if ConfigFlags.Trigger.enableL1Phase1:
+                        from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import L1MuctpiPhase1Tool as l1MuctpiTool
+                    else:
+                        from TrigT1Muctpi.TrigT1MuctpiConfig import L1MuctpiTool as l1MuctpiTool
                     from AthenaCommon.AppMgr import ToolSvc
-                    ToolSvc += L1MuctpiTool()
-                    TrigSteer_HLT.LvlTopoConverter.MuonInputProvider.MuctpiSimTool = L1MuctpiTool()
+                    ToolSvc += l1MuctpiTool()
+                    TrigSteer_HLT.LvlTopoConverter.MuonInputProvider.MuctpiSimTool = l1MuctpiTool()
                 except ImportError:
                     pass
 
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
index 614fc8765886daebb1911338a490094ce956fff1..7c79021290520ef90caf61d6528f29b400e2644d 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
@@ -130,6 +130,16 @@ def Lvl1SimulationSequence( flags = None ):
         ToolSvc += L1MuctpiPhase1Tool("MUCTPI_AthTool")
         ToolSvc.MUCTPI_AthTool.LVL1ConfigSvc = svcMgr.LVL1ConfigSvc
 
+        #Add the RecRoiTools
+        from TrigT1MuonRecRoiTool.TrigT1MuonRecRoiToolConfig import getRun3RPCRecRoiTool
+        from TrigT1MuonRecRoiTool.TrigT1MuonRecRoiToolConfig import getRun3TGCRecRoiTool
+        ToolSvc += getRun3RPCRecRoiTool("RPCRecRoiTool")
+        ToolSvc += getRun3TGCRecRoiTool("TGCRecRoiTool")
+
+        ToolSvc.MUCTPI_AthTool.RPCRecRoiTool = ToolSvc.RPCRecRoiTool
+        ToolSvc.MUCTPI_AthTool.TGCRecRoiTool = ToolSvc.TGCRecRoiTool
+
+        #Add the LVL1 config service to the MUCTPI algorithm
         muctpi = L1MuctpiPhase1()
         muctpi.LVL1ConfigSvc = svcMgr.LVL1ConfigSvc
 
@@ -148,7 +158,7 @@ def Lvl1SimulationSequence( flags = None ):
     from MuonRecExample import MuonAlignConfig # noqa: F401
 
     l1MuonSim = seqAND("l1MuonSim", [
-        
+
         MuonRdoToMuonDigit( "MuonRdoToMuonDigit",
                             MuonRdoToMuonDigitTool = ToolSvc.MuonRdoToMuonDigitTool),
 
@@ -158,7 +168,7 @@ def Lvl1SimulationSequence( flags = None ):
                   RPCbytestream     = False,
                   RPCbytestreamFile = "",
                   RPCDigitContainer = "RPC_DIGITS_L1"),
-        
+
         # based on Trigger/TrigT1/TrigT1TGC/python/TrigT1TGCConfig.py
         # interesting is that this JO sets inexisting properties, commented out below
         LVL1TGCTrigger__LVL1TGCTrigger("LVL1TGCTrigger",
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py
index 5f5e2a9bf8840593430fe94584bc842ab3bb7dbf..217100317d657342b219a1cffd03c18f583ab686 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py
@@ -100,8 +100,13 @@ class Lvl1SimulationGetter (Configured):
                 import TrigT1TGCRecRoiSvc.TrigT1TGCRecRoiConfig   # noqa: F401
                 import TrigT1RPCsteering.TrigT1RPCsteeringConfig  # noqa: F401
                 import TrigT1TGC.TrigT1TGCConfig                  # noqa: F401
-                from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi                
-                topSequence += L1Muctpi()
+                from AthenaConfiguration.AllConfigFlags import ConfigFlags
+                if ConfigFlags.Trigger.enableL1Phase1:
+                    from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import L1MuctpiPhase1
+                    topSequence += L1MuctpiPhase1()
+                else:
+                    from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi
+                    topSequence += L1Muctpi()
 
             if TriggerFlags.doBcm():
                 from TrigT1BCM.TrigT1BCMConf import LVL1__TrigT1BCM
@@ -167,10 +172,14 @@ class Lvl1SimulationGetter (Configured):
                 topSequence += L1TopoSimulation()
 
                 try: # this is temporary until TrigT1Muctpi-00-06-29 is in the release
-                    from TrigT1Muctpi.TrigT1MuctpiConfig import L1MuctpiTool
+                    from AthenaConfiguration.AllConfigFlags import ConfigFlags
+                    if ConfigFlags.Trigger.enableL1Phase1:
+                        from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import L1MuctpiPhase1Tool as l1MuctpiTool
+                    else:
+                        from TrigT1Muctpi.TrigT1MuctpiConfig import L1MuctpiTool as l1MuctpiTool
                     from AthenaCommon.AppMgr import ToolSvc
-                    ToolSvc += L1MuctpiTool()
-                    topSequence.L1TopoSimulation.MuonInputProvider.MuctpiSimTool = L1MuctpiTool()
+                    ToolSvc += l1MuctpiTool()
+                    topSequence.L1TopoSimulation.MuonInputProvider.MuctpiSimTool = l1MuctpiTool()
                 except ImportError:
                     pass
 
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py
index 5727d0bb3bcd639846526fb557579cdfdf1a0148..3c5cc3f12863ac97e07e620f8571ce102ebc820e 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py
@@ -658,7 +658,11 @@ class rerunLVL1(_modifier):
 
         #rederive MuCTPI inputs to CTP from muon RDO
         #writes this to the usual MuCTPICTP storegate location
-        from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi_on_RDO
+        from AthenaConfiguration.AllConfigFlags import ConfigFlags
+        if ConfigFlags.Trigger.enableL1Phase1:
+            from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import L1MuctpiPhase1_on_RDO as L1Muctpi_on_RDO
+        else:
+            from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi_on_RDO
         topSequence += L1Muctpi_on_RDO()
         topSequence.L1Muctpi_on_RDO.CTPOutputLocID = "L1MuCTPItoCTPLocation"
         topSequence.L1Muctpi_on_RDO.RoIOutputLocID = "L1MuCTPItoRoIBLocation"
@@ -670,7 +674,10 @@ class rerunLVL1(_modifier):
             topSequence += L1TopoSimulation()
             log.info( "adding L1TopoSimulation() to topSequence" )
 
-            from TrigT1Muctpi.TrigT1MuctpiConfig import L1MuctpiTool
+            if ConfigFlags.Trigger.enableL1Phase1:
+                from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import L1MuctpiPhase1Tool as L1MuctpiTool
+            else:
+                from TrigT1Muctpi.TrigT1MuctpiConfig import L1MuctpiTool
             from AthenaCommon.AppMgr import ToolSvc
             ToolSvc += L1MuctpiTool()
             topSequence.L1TopoSimulation.MuonInputProvider.MuctpiSimTool = L1MuctpiTool()
@@ -754,7 +761,11 @@ class rerunDMLVL1(_modifier):
          #Run MuCTPI simulation (before or after importing DeriveSim??)
          #rederive MuCTPI inputs to CTP from muon RDO
          #writes this to the usual MuCTPICTP storegate location
-         from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi_on_RDO
+         from AthenaConfiguration.AllConfigFlags import ConfigFlags
+         if ConfigFlags.Trigger.enableL1Phase1:
+             from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import L1MuctpiPhase1_on_RDO as L1Muctpi_on_RDO
+         else:
+             from TrigT1Muctpi.TrigT1MuctpiConfig import L1MuctpiPhase1_on_RDO as L1Muctpi_on_RDO
          topSequence += L1Muctpi_on_RDO()
          topSequence.L1Muctpi_on_RDO.CTPOutputLocID = "L1MuCTPItoCTPLocation"
          topSequence.L1Muctpi_on_RDO.RoIOutputLocID = "L1MuCTPItoRoIBLocation"