From b32d70a951dce589769fbe48d0da7461731328e8 Mon Sep 17 00:00:00 2001
From: Robert James Ward <robert.james.ward@cern.ch>
Date: Mon, 5 Apr 2021 05:52:33 +0000
Subject: [PATCH] Revert "Merge branch 'feature-mesonGammaTrigImplimentation'
 into 'run3-mesonGammaTrig'"

This reverts commit 3a5e340bb1d5bab769a3b475c8f4535180626aa3, reversing
changes made to 73ca7e17ab85c766f5820330ed7fd5a521e0a8e9.
---
 .../TrigTauHypo/python/TrigTauHypoTool.py     |  82 ++++-
 .../src/TrigEFTauDiKaonHypoTool.cxx           | 323 ++++++++++++++++++
 .../TrigTauHypo/src/TrigEFTauDiKaonHypoTool.h |  72 ++++
 .../src/components/TrigTauHypo_entries.cxx    |   2 +
 .../share/ref_RDOtoRDOTrig_v1Dev_build.ref    | 102 ++++++
 .../share/ref_data_v1Dev_build.ref            |  10 +
 .../python/HLTMenuConfig/Menu/LS2_v1.py       |   7 +
 .../HLTMenuConfig/Menu/SignatureDicts.py      |   3 +-
 8 files changed, 583 insertions(+), 18 deletions(-)
 create mode 100644 Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauDiKaonHypoTool.cxx
 create mode 100644 Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauDiKaonHypoTool.h

diff --git a/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py b/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py
index 07795bf6363..217f267a446 100644
--- a/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py
+++ b/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py
@@ -122,6 +122,24 @@ thresholdsEF = {
     ('idperf',200): TauCuts(3,200000.,2)
     }    
 
+# ATR-22644
+GeV = 1000.0
+DiKaonCuts = namedtuple('DiKaonCuts','massTrkSysMin massTrkSysMax massTrkSysKaonMin massTrkSysKaonMax massTrkSysKaonPiMin massTrkSysKaonPiMax targetMassTrkSysKaonPi leadTrkPtMin EtCalibMin EMPOverTrkSysPMax')
+thresholdsEF_dikaon = {
+    ('dikaonmass', 25):      DiKaonCuts(0.0*GeV, 1000.0*GeV,  0.987*GeV, 1.060*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV,   15.0*GeV, 25.0*GeV, 1.5),
+    ('dikaonmass', 35):      DiKaonCuts(0.0*GeV, 1000.0*GeV,  0.987*GeV, 1.060*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV,   25.0*GeV, 35.0*GeV, 1.5),
+    ('kaonpi1', 25):         DiKaonCuts(0.0*GeV, 1000.0*GeV,  0.0*GeV, 1000.0*GeV,  0.79*GeV, 0.99*GeV,  0.89*GeV,  15.0*GeV, 25.0*GeV, 1.0),
+    ('kaonpi1', 35):         DiKaonCuts(0.0*GeV, 1000.0*GeV,  0.0*GeV, 1000.0*GeV,  0.79*GeV, 0.99*GeV,  0.89*GeV,  25.0*GeV, 35.0*GeV, 1.0),
+    ('kaonpi2', 25):         DiKaonCuts(0.0*GeV, 1000.0*GeV,  0.0*GeV, 1000.0*GeV,  1.8*GeV, 1.93*GeV,   1.865*GeV, 15.0*GeV, 25.0*GeV, 1.0),
+    ('kaonpi2', 35):         DiKaonCuts(0.0*GeV, 1000.0*GeV,  0.0*GeV, 1000.0*GeV,  1.8*GeV, 1.93*GeV,   1.865*GeV, 25.0*GeV, 35.0*GeV, 1.0),
+    ('dipion3', 25):         DiKaonCuts(0.279*GeV, 0.648*GeV, 0.0*GeV, 1000.0*GeV,  0.0*GeV, 1000.0*GeV, 0.0*GeV,   25.0*GeV, 25.0*GeV, 2.2)
+}
+SinglePionCuts = namedtuple('SinglePionCuts','leadTrkPtMin EtCalibMin nTrackMax nWideTrackMax dRmaxMax etOverPtLeadTrkMin etOverPtLeadTrkMax')
+thresholdsEF_singlepion = {
+    ('singlepion', 25): SinglePionCuts(30.0*GeV, 25.0*GeV, 1, 0, 0.06, 0.4, 0.85)
+}
+
+
 def TrigEFTauMVHypoToolFromDict( chainDict ):
 
     name = chainDict['chainName']
@@ -130,25 +148,55 @@ def TrigEFTauMVHypoToolFromDict( chainDict ):
 
     criteria  = chainPart['selection']
     threshold = chainPart['threshold']
+
     from AthenaConfiguration.ComponentFactory import CompFactory
-    currentHypo = CompFactory.TrigEFTauMVHypoTool(name)
-    currentHypo.MonTool       = ""
-
-    theThresh = thresholdsEF[(criteria, int(threshold))]
-    currentHypo.numTrackMax = theThresh.numTrackMax
-    currentHypo.EtCalibMin  = theThresh.EtCalibMin
-    currentHypo.level       = theThresh.level
-    currentHypo.method      = 2
-
-    if criteria in [ 'verylooseRNN', 'looseRNN', 'mediumRNN', 'tightRNN' ]:
-      currentHypo.numTrackMin = 0
-      currentHypo.highptidthr = 280000.
-      currentHypo.method      = 3
-    elif 'idperf' in criteria: 
-      currentHypo.AcceptAll = True
-    elif 'perf' in criteria:
-      currentHypo.method      = 0
+    if criteria in ['medium', 'loose1', 'medium1', 'tight1', 'verylooseRNN', 'looseRNN', 'mediumRNN', 'tightRNN', 'idperf', 'perf'] :
+    
+        currentHypo = CompFactory.TrigEFTauMVHypoTool(name)
+        currentHypo.MonTool       = ""
+
+        theThresh = thresholdsEF[(criteria, int(threshold))]
+        currentHypo.numTrackMax = theThresh.numTrackMax
+        currentHypo.EtCalibMin  = theThresh.EtCalibMin
+        currentHypo.level       = theThresh.level
+        currentHypo.method      = 2
+        
+        if criteria in [ 'verylooseRNN', 'looseRNN', 'mediumRNN', 'tightRNN' ]:
+            currentHypo.numTrackMin = 0
+            currentHypo.highptidthr = 280000.
+            currentHypo.method      = 3
+        elif 'idperf' in criteria: 
+            currentHypo.AcceptAll = True
+        elif 'perf' in criteria:
+            currentHypo.method      = 0
+
+    elif criteria in [ 'dikaonmass', 'kaonpi1', 'kaonpi2', 'dipion3', 'singlepion' ]: # ATR-22644
+        currentHypo = CompFactory.TrigEFTauDiKaonHypoTool(name)
+        currentHypo.MonTool       = ""
 
+        if criteria in [ 'dikaonmass', 'kaonpi1', 'kaonpi2', 'dipion3' ]:
+            theThresh = thresholdsEF_dikaon[(criteria, int(threshold))]
+            currentHypo.massTrkSysMin          = theThresh.massTrkSysMin          
+            currentHypo.massTrkSysMax          = theThresh.massTrkSysMax          
+            currentHypo.massTrkSysKaonMin      = theThresh.massTrkSysKaonMin      
+            currentHypo.massTrkSysKaonMax      = theThresh.massTrkSysKaonMax      
+            currentHypo.massTrkSysKaonPiMin    = theThresh.massTrkSysKaonPiMin    
+            currentHypo.massTrkSysKaonPiMax    = theThresh.massTrkSysKaonPiMax    
+            currentHypo.targetMassTrkSysKaonPi = theThresh.targetMassTrkSysKaonPi 
+            currentHypo.leadTrkPtMin           = theThresh.leadTrkPtMin
+            currentHypo.EtCalibMin             = theThresh.EtCalibMin 
+            currentHypo.EMPOverTrkSysPMax      = theThresh.EMPOverTrkSysPMax      
+            
+        elif criteria in ['singlepion']:
+            theThresh = thresholdsEF_singlepion[(criteria, int(threshold))]
+            currentHypo.leadTrkPtMin       = theThresh.leadTrkPtMin
+            currentHypo.EtCalibMin         = theThresh.EtCalibMin 
+            currentHypo.nTrackMax          = theThresh.nTrackMax              
+            currentHypo.nWideTrackMax      = theThresh.nWideTrackMax          
+            currentHypo.dRmaxMax           = theThresh.dRmaxMax               
+            currentHypo.etOverPtLeadTrkMin = theThresh.etOverPtLeadTrkMin     
+            currentHypo.etOverPtLeadTrkMax = theThresh.etOverPtLeadTrkMax     
+        
     return currentHypo
 
 def TrigTauTrackHypoToolFromDict( chainDict ):
diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauDiKaonHypoTool.cxx b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauDiKaonHypoTool.cxx
new file mode 100644
index 00000000000..7ce232cd550
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauDiKaonHypoTool.cxx
@@ -0,0 +1,323 @@
+/*                                                                                                                                                                                                          
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration                                                                                                                                   
+*/
+
+/********************************************************************
+ *
+ * NAME:     TrigEFTauDiKaonHypoTool.cxx
+ * PACKAGE:  Trigger/TrigHypothesis/TrigTauHypo
+ *
+ * AUTHOR:   J. Silva based on TrigEFTauMVHypoTool
+ * CREATED:  Feb. 17, 2021
+ *
+  *********************************************************************/
+
+#include <list>
+#include <iterator>
+#include <sstream>
+
+#include "GaudiKernel/StatusCode.h"
+#include "GaudiKernel/ListItem.h"
+
+#include "xAODTau/TauJetContainer.h"
+#include "xAODTracking/TrackParticle.h"
+
+#include "TrigSteeringEvent/TrigRoiDescriptor.h"
+#include <PathResolver/PathResolver.h>
+
+#include "AthenaMonitoringKernel/Monitored.h"
+
+#include "TrigEFTauDiKaonHypoTool.h"
+
+using namespace TrigCompositeUtils;
+
+/////////////////////////////////////////////////////////////////////
+// CONSTRUCTOR:
+/////////////////////////////////////////////////////////////////////
+//
+TrigEFTauDiKaonHypoTool::TrigEFTauDiKaonHypoTool( const std::string& type,
+					  const std::string& name,
+					  const IInterface* parent )
+  : base_class( type, name, parent ),
+    m_decisionId( HLT::Identifier::fromToolName( name ) )
+{
+}
+
+/////////////////////////////////////////////////////////////////////
+// DESTRUCTOR:
+/////////////////////////////////////////////////////////////////////
+//
+TrigEFTauDiKaonHypoTool::~TrigEFTauDiKaonHypoTool()
+{
+}
+
+/////////////////////////////////////////////////////////////////////
+// INITIALIZE:
+/////////////////////////////////////////////////////////////////////
+//
+
+// ----------------------------------------------------------------------
+StatusCode TrigEFTauDiKaonHypoTool::initialize()
+  // ----------------------------------------------------------------------
+{
+  
+  msg() << MSG::INFO << "in initialize()" << endmsg;
+  
+  msg() << MSG::INFO << " REGTEST: EFTauDiKaonHypo will cut on "<<endmsg;
+  msg() << MSG::INFO << " REGTEST: param massTrkSysMin " << m_massTrkSysMin <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param massTrkSysMax " << m_massTrkSysMax <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param massTrkSysKaonMin " << m_massTrkSysKaonMin <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param massTrkSysKaonMax " << m_massTrkSysKaonMax <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param massTrkSysKaonPiMin " << m_massTrkSysKaonPiMin <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param massTrkSysKaonPiMax " << m_massTrkSysKaonPiMax <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param targetMassTrkSysKaonPi " << m_targetMassTrkSysKaonPi <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param leadTrkPtMin " << m_leadTrkPtMin <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param EtCalibMin " << m_EtCalibMin <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param nTrackMin (included) " << m_nTrackMin <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param nTrackMax (included) " << m_nTrackMax <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param nWideTrackMax (included) " << m_nWideTrackMax <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param EMPOverTrkSysPMax " << m_EMPOverTrkSysPMax <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param dRmaxMax " << m_dRmaxMax <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param etOverPtLeadTrkMin " << m_etOverPtLeadTrkMin <<endmsg;
+  msg() << MSG::INFO << " REGTEST: param etOverPtLeadTrkMax " << m_etOverPtLeadTrkMax <<endmsg;
+
+  msg() << MSG::INFO << " REGTEST: ------ "<<endmsg;
+
+  
+  if( ( m_massTrkSysKaonPiMin >  m_massTrkSysKaonPiMax ) ||  ( m_massTrkSysKaonMin >  m_massTrkSysKaonMax ) || ( m_massTrkSysMin >  m_massTrkSysMax ) || ( m_nTrackMin > m_nTrackMax )  || (m_etOverPtLeadTrkMin > m_etOverPtLeadTrkMax) )
+    {
+      msg() << MSG::ERROR << "EFTauDiKaonHypo is uninitialized! " << endmsg;
+      return StatusCode::FAILURE;
+    }
+  
+  msg() << MSG::INFO
+	<< "Initialization of EFTauDiKaonHypo completed successfully"
+	<< endmsg;
+  
+  return StatusCode::SUCCESS;
+}
+
+
+
+bool TrigEFTauDiKaonHypoTool::decide(const ITrigEFTauMVHypoTool::TauJetInfo& input ) const
+{
+
+  ATH_MSG_DEBUG("REGTEST:"<< name() << ": in execute()" );
+  bool pass=false;
+
+  using namespace Monitored;
+
+  auto PassedCuts         = Monitored::Scalar<int>( "CutCounter", 0 );
+  auto massTrkSysAccepted = Monitored::Scalar<float>("massTrkSysAccepted", -10);
+  auto massTrkSysKaonAccepted     = Monitored::Scalar<float>( "massTrkSysKaonAccepted", -10);
+  auto massTrkSysKaonPiAccepted = Monitored::Scalar<float>( "massTrkSysKaonPiAccepted", -10);
+  auto leadTrkPtAccepted         = Monitored::Scalar<float>( "leadTrkPtAccepted", -10);
+  auto ptAccepted          = Monitored::Scalar<float>( "ptAccepted", -10);
+  auto nTrackAccepted          = Monitored::Scalar<float>( "nTrackAccepted", -1);
+  auto nWideTrackAccepted          = Monitored::Scalar<float>( "nWideTrackAccepted", -1);
+  auto dRAccepted          = Monitored::Scalar<float>( "dRAccepted", -10);
+  auto etOverPtLeadTrkAccepted          = Monitored::Scalar<float>( "etOverPtLeadTrkAccepted", -10);
+  auto EMOverTrkSysPAccepted          = Monitored::Scalar<float>( "EMOverTrkSysPAccepted", -10);
+  auto ninputTaus         = Monitored::Scalar<int>( "nInputTaus", -1);
+
+  PassedCuts = 0;
+
+  if ( m_acceptAll ) {
+    pass = true;
+    ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" );
+  } else {
+    pass = false;
+    ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" );
+  }
+
+
+  
+  //get RoI descriptor                                                                                                                                                                                      
+  auto roiDescriptor = input.roi;
+  float roIZ   = roiDescriptor->zed();
+  float roIEta = roiDescriptor->eta();
+  float roIPhi = roiDescriptor->phi();
+
+  ATH_MSG_DEBUG( "Input RoI eta: " << roIEta << " Input RoI phi: " << roIPhi << " Input RoI z: " << roIZ);
+
+  
+  // get tau objects from the trigger element:
+  //--------------------------------------------------
+  
+  auto TauContainer = input.taujetcontainer;
+  ninputTaus = TauContainer->size();
+  
+  for(auto Tau: *TauContainer){  
+    
+    ATH_MSG_DEBUG( " tauRec candidate ");
+    PassedCuts++;    
+    
+    // cut on calibrated pt:
+
+    double EFet = Tau->pt()*1e-3;
+    ATH_MSG_DEBUG( " REGTEST: Et Calib "<<EFet);
+    
+    if(!( EFet > m_EtCalibMin*1e-3)) continue;
+    PassedCuts++;
+    ptAccepted = EFet;
+    
+    int numTrack     = -100;
+    int numWideTrack = -100;
+    // cut on core and wide tracks:
+    numTrack = Tau->nTracks();
+    #ifndef XAODTAU_VERSIONS_TAUJET_V3_H
+    numWideTrack = Tau->nWideTracks();
+    #else
+    numWideTrack = Tau->nTracksIsolation();
+    #endif
+
+    ATH_MSG_DEBUG( " REGTEST: Track size "<<numTrack );
+    ATH_MSG_DEBUG( " REGTEST: Wide Track size "<<numWideTrack );
+ 
+    if (!( (numTrack >= m_nTrackMin) && (numTrack <= m_nTrackMax)))  continue;
+    if (!( numWideTrack <= m_nWideTrackMax ))  continue;
+    PassedCuts++;
+    nTrackAccepted = numTrack;
+    nWideTrackAccepted = numWideTrack;
+
+    // cut on leading track pt:     
+    float leadTrkPt = -1.;
+    Tau->detail(xAOD::TauJetParameters::leadTrkPt, leadTrkPt);
+    ATH_MSG_DEBUG( " REGTEST: leadTrkPt "<< leadTrkPt);
+    if(!( leadTrkPt > m_leadTrkPtMin)) continue;
+    PassedCuts++;
+    leadTrkPtAccepted = leadTrkPt;
+
+    // cut on massTrkSys:     
+    float massTrkSys = -1.;
+    Tau->detail(xAOD::TauJetParameters::massTrkSys, massTrkSys);
+
+    ATH_MSG_DEBUG(" REGTEST: massTrkSys "<< massTrkSys );
+    // for dikaon mass hypothesis, compute invariant mass with kaon mass
+    TLorentzVector my_kaons(0.,0.,0.,0.);
+    std::vector<TLorentzVector> my_trks;
+    // need to add checks for valid link
+    for (unsigned int i=0;i<Tau->nTracks();++i) {
+      const xAOD::TrackParticle* trk = 0;
+      TLorentzVector tmpKaon(0.,0.,0.,0.);
+
+      try 
+      {
+        #ifndef XAODTAU_VERSIONS_TAUJET_V3_H
+        trk = Tau->track(i);
+	#else
+	trk = Tau->track(i)->track();
+	#endif
+      }
+      catch(const std::exception& e)
+      {
+        msg() << MSG::WARNING << " REGTEST: EFTauDiKaonHypo, failed to get tau track link! " <<endmsg;
+      } 
+
+      if(trk) {
+         tmpKaon.SetPtEtaPhiM(trk->pt(), trk->eta(), trk->phi(), 493.677);
+         my_trks.push_back(trk->p4());
+      }
+      my_kaons = my_kaons + tmpKaon;
+    }
+    float massTrkSysKaon = my_kaons.M();
+    ATH_MSG_DEBUG( " REGTEST: massTrkSys with kaon mass hypo "<< massTrkSysKaon );
+    // kaon+pi mass hypo
+    double finalKPiMass = 0;
+    if(my_trks.size()==2){
+
+          TLorentzVector tmpKaon;
+          tmpKaon.SetPtEtaPhiM(my_trks.at(0).Pt(), my_trks.at(0).Eta(), my_trks.at(0).Phi(), 493.677);
+          TLorentzVector tmpPion = my_trks.at(1);
+
+          double kPiMass1 = (tmpKaon+tmpPion).M();
+
+          tmpKaon.SetPtEtaPhiM(my_trks.at(1).Pt(), my_trks.at(1).Eta(), my_trks.at(1).Phi(), 493.677);
+          tmpPion = my_trks.at(0);
+
+          double kPiMass2 = (tmpKaon+tmpPion).M();
+
+          if(std::abs(kPiMass1 - m_targetMassTrkSysKaonPi) < std::abs(kPiMass2 - m_targetMassTrkSysKaonPi))
+          {
+            finalKPiMass = kPiMass1;
+          }else{
+            finalKPiMass = kPiMass2;
+          }
+    }
+    float massTrkSysKaonPi = finalKPiMass;
+    ATH_MSG_DEBUG( " REGTEST: massTrkSys with kaon+pi mass hypo "<< massTrkSysKaonPi );
+    if (!( (massTrkSys > m_massTrkSysMin) && (massTrkSys < m_massTrkSysMax) ) )  continue;
+    PassedCuts++;
+    massTrkSysAccepted = massTrkSys;
+
+    if (!( (massTrkSysKaon > m_massTrkSysKaonMin) && (massTrkSysKaon < m_massTrkSysKaonMax) ) )  continue;
+    PassedCuts++;   
+    massTrkSysKaonAccepted = massTrkSysKaon;
+
+    if (!( (massTrkSysKaonPi >= m_massTrkSysKaonPiMin) && (massTrkSysKaonPi < m_massTrkSysKaonPiMax) ) )  continue; //use >= otherwise singlepion chain would fail here!
+    PassedCuts++;
+    massTrkSysKaonPiAccepted = massTrkSysKaonPi;
+
+    // cut on EMPOverTrkSysP:     
+    float EMPOverTrkSysP = -1.;
+    Tau->detail(xAOD::TauJetParameters::EMPOverTrkSysP, EMPOverTrkSysP);
+    ATH_MSG_DEBUG( " REGTEST: EMPOverTrkSysP "<< EMPOverTrkSysP);               
+    if ( !(EMPOverTrkSysP < m_EMPOverTrkSysPMax) )  continue;
+    PassedCuts++;
+    EMOverTrkSysPAccepted = EMPOverTrkSysP;
+
+    // cut on etOverPtLeadTrk:
+    float etOverPtLeadTrk = -1.;
+    Tau->detail(xAOD::TauJetParameters::etOverPtLeadTrk, etOverPtLeadTrk);
+    ATH_MSG_DEBUG( " REGTEST: etOverPtLeadTrk "<< etOverPtLeadTrk);
+    if( !( (etOverPtLeadTrk > m_etOverPtLeadTrkMin) && (etOverPtLeadTrk < m_etOverPtLeadTrkMax)  ) ) continue;
+    PassedCuts++;
+    etOverPtLeadTrkAccepted = etOverPtLeadTrk;
+
+    // cut on dRmax:
+    float dRmax = -1.;
+    Tau->detail(xAOD::TauJetParameters::dRmax, dRmax);
+
+    ATH_MSG_DEBUG( " REGTEST: dRmax "<< dRmax);
+    if( !( dRmax < m_dRmaxMax ) ) continue;
+    PassedCuts++;    
+    dRAccepted = dRmax; 
+
+
+    //-------------------------------------------------
+    // At least one Tau matching passed all cuts.
+    // Accept the event!
+    //-------------------------------------------------
+    
+    pass=true;
+    
+    ATH_MSG_DEBUG(" REGTEST: pass taurec is "<<pass);
+  } // end of loop in    int numWideTrack = -100; tau objects.
+  
+  if(pass)
+    {
+
+
+      ATH_MSG_DEBUG( " REGTEST: TE accepted !! ");
+      // activate Trigger Element.
+    }
+  else
+    {
+      ATH_MSG_DEBUG( " REGTEST: No good tau found !! TE rejected ");
+    }
+  
+  return pass;
+  
+}
+
+StatusCode TrigEFTauDiKaonHypoTool::decide(  std::vector<TauJetInfo>& input )  const {
+
+  for ( auto& i: input ) {
+    if ( passed ( m_decisionId.numeric(), i.previousDecisionIDs ) ) {
+      if ( decide( i ) ) {
+	addDecisionID( m_decisionId, i.decision );
+      }
+    }
+  }
+  return StatusCode::SUCCESS;
+}
diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauDiKaonHypoTool.h b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauDiKaonHypoTool.h
new file mode 100644
index 00000000000..5a2f103751f
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigEFTauDiKaonHypoTool.h
@@ -0,0 +1,72 @@
+/*                                                                                                                                                                                                          
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration                                                                                                                                   
+*/
+
+/********************************************************************
+ *
+ * NAME:     TrigEFTauDiKaonHypoTool.h
+ * PACKAGE:  Trigger/TrigHypothesis/TrigTauHypo
+ *
+ * AUTHOR:   J. Silva based on TrigEFTauMVHypoTool
+ * CREATED:  Feb. 17, 2021
+ *
+  *********************************************************************/
+#ifndef TRIGEFTAUDIKAONHYPOTOOL_H
+#define TRIGEFTAUDIKAONHYPOTOOL_H
+
+#include "AthenaMonitoringKernel/GenericMonitoringTool.h"
+#include "TrigCompositeUtils/HLTIdentifier.h"
+#include "TrigCompositeUtils/TrigCompositeUtils.h"
+#include "ITrigEFTauMVHypoTool.h"
+
+class StoreGateSvc;
+namespace HLT {
+  class TriggerElement;
+}
+
+class TrigEFTauDiKaonHypoTool : public extends<AthAlgTool, ITrigEFTauMVHypoTool> {
+
+ public:
+
+  TrigEFTauDiKaonHypoTool( const std::string& type,
+		       const std::string& name,
+		       const IInterface* parent );
+
+  virtual ~TrigEFTauDiKaonHypoTool();
+
+  virtual StatusCode initialize() override;
+
+  virtual StatusCode decide( std::vector<ITrigEFTauMVHypoTool::TauJetInfo>& input )  const override;
+
+  virtual bool decide( const ITrigEFTauMVHypoTool::TauJetInfo& i ) const override;
+
+
+ private:
+
+  /** Cuts to be applied */
+
+  HLT::Identifier m_decisionId;
+
+  Gaudi::Property<float>  m_massTrkSysMin{ this, "massTrkSysMin", 0., "Minimum DiTrack mass value" };
+  Gaudi::Property<float>  m_massTrkSysMax{ this, "massTrkSysMax", 1000000000., "Maximum DiTrack mass value" };
+  Gaudi::Property<float>  m_massTrkSysKaonMin{ this, "massTrkSysKaonMin", 0., "Minimum DiKaon mass value" };
+  Gaudi::Property<float>  m_massTrkSysKaonMax{ this, "massTrkSysKaonMax", 1000000000., "Maximum DiKaon mass value" };
+  Gaudi::Property<float>  m_massTrkSysKaonPiMin{ this, "massTrkSysKaonPiMin", 0., "Minimum KaonPi mass value" };
+  Gaudi::Property<float>  m_massTrkSysKaonPiMax{ this, "massTrkSysKaonPiMax", 1000000000., "Maximum KaonPi mass value" };
+  Gaudi::Property<float>  m_targetMassTrkSysKaonPi{ this, "targetMassTrkSysKaonPi", 0., "Target KaonPi mass value" };
+  Gaudi::Property<float>  m_EtCalibMin{ this, "EtCalibMin", 0., "Minimum Et value" };
+  Gaudi::Property<float>  m_leadTrkPtMin{ this, "leadTrkPtMin", 0., "Minimum Pt of Lead Track" };
+  Gaudi::Property<int>  m_nTrackMax{ this, "nTrackMax", 2, "Maximum number of Tracks" };
+  Gaudi::Property<int>  m_nTrackMin{ this, "nTrackMin", 1, "Minimum number of Tracks" };
+  Gaudi::Property<int>  m_nWideTrackMax{ this, "nWideTrackMax", 1, "Maximum number of wide Tracks" };
+  Gaudi::Property<float>  m_EMPOverTrkSysPMax{ this, "EMPOverTrkSysPMax", 5., "Maximum Cluster pt over ditrack pt" };
+  Gaudi::Property<float>  m_dRmaxMax{ this, "dRmaxMax", 10., "Maximum dRmax value" };
+  Gaudi::Property<float>  m_etOverPtLeadTrkMax{ this, "etOverPtLeadTrkMax", 10., "Maximum et/pt(lead track)" };
+  Gaudi::Property<float>  m_etOverPtLeadTrkMin{ this, "etOverPtLeadTrkMin", 0., "Minimum et/pt(lead track)" };
+  Gaudi::Property<bool>  m_acceptAll{ this, "AcceptAll", false, "Ignore selection" };
+
+  ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Monitoring tool" };
+
+};
+#endif
+
diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/components/TrigTauHypo_entries.cxx b/Trigger/TrigHypothesis/TrigTauHypo/src/components/TrigTauHypo_entries.cxx
index 5a507eb40dd..0fb4d4c0360 100644
--- a/Trigger/TrigHypothesis/TrigTauHypo/src/components/TrigTauHypo_entries.cxx
+++ b/Trigger/TrigHypothesis/TrigTauHypo/src/components/TrigTauHypo_entries.cxx
@@ -9,6 +9,7 @@
 #include "../TrigTrkPrecHypoAlgMT.h"
 #include "../TrigTrkPrecHypoTool.h"
 #include "../TrigTauXComboHypoTool.h"
+#include "../TrigEFTauDiKaonHypoTool.h"
 
 DECLARE_COMPONENT( TrigTauCaloRoiUpdaterMT )
 DECLARE_COMPONENT( TrigTauGenericHypoMT )
@@ -21,3 +22,4 @@ DECLARE_COMPONENT( TrigTrkPrecHypoAlgMT )
 DECLARE_COMPONENT( TrigEFTauMVHypoAlgMT )
 DECLARE_COMPONENT( TrigEFTauMVHypoTool )
 DECLARE_COMPONENT( TrigTauXComboHypoTool )
+DECLARE_COMPONENT( TrigEFTauDiKaonHypoTool )
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
index 4867a23e098..e53f45e7966 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
@@ -2101,6 +2101,88 @@ HLT_g25_medium_mu24_L1MU20:
     5: 1
     6: 1
     7: 1
+HLT_g25_medium_tau25_dikaonmass_tracktwoMVA_L1EM22VHI:
+  eventCount: 0
+  stepCounts:
+    0: 5
+    1: 5
+    2: 5
+    3: 5
+    4: 5
+    5: 5
+    6: 5
+    7: 5
+  stepFeatures:
+    0: 5
+    1: 5
+    2: 5
+    3: 5
+    4: 17
+    5: 17
+    6: 17
+    7: 17
+HLT_g25_medium_tau25_kaonpi1_tracktwoMVA_L1EM22VHI:
+  eventCount: 1
+  stepCounts:
+    0: 5
+    1: 5
+    2: 5
+    3: 5
+    4: 5
+    5: 5
+    6: 5
+    7: 5
+    8: 1
+  stepFeatures:
+    0: 5
+    1: 5
+    2: 5
+    3: 5
+    4: 17
+    5: 17
+    6: 17
+    7: 17
+    8: 1
+HLT_g25_medium_tau25_kaonpi2_tracktwoMVA_L1EM22VHI:
+  eventCount: 0
+  stepCounts:
+    0: 5
+    1: 5
+    2: 5
+    3: 5
+    4: 5
+    5: 5
+    6: 5
+    7: 5
+  stepFeatures:
+    0: 5
+    1: 5
+    2: 5
+    3: 5
+    4: 17
+    5: 17
+    6: 17
+    7: 17
+HLT_g25_medium_tau25_singlepion_tracktwoMVA_L1EM22VHI:
+  eventCount: 0
+  stepCounts:
+    0: 5
+    1: 5
+    2: 5
+    3: 5
+    4: 5
+    5: 5
+    6: 5
+    7: 5
+  stepFeatures:
+    0: 5
+    1: 5
+    2: 5
+    3: 5
+    4: 17
+    5: 17
+    6: 17
+    7: 17
 HLT_g25_tight_L1EM20VH:
   eventCount: 5
   stepCounts:
@@ -2223,6 +2305,26 @@ HLT_g35_medium_g25_medium_L12EM20VH:
   eventCount: 0
   stepFeatures:
     0: 3
+HLT_g35_medium_tau25_dipion3_tracktwoMVA_L1EM22VHI:
+  eventCount: 0
+  stepCounts:
+    0: 5
+    1: 5
+    2: 5
+    3: 5
+    4: 5
+    5: 5
+    6: 5
+    7: 5
+  stepFeatures:
+    0: 5
+    1: 5
+    2: 5
+    3: 5
+    4: 17
+    5: 17
+    6: 17
+    7: 17
 HLT_g35_tight_L1EM15VHI:
   eventCount: 5
   stepCounts:
diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
index 3982d2553a5..2ee8214027f 100644
--- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
@@ -1055,6 +1055,14 @@ HLT_g25_medium_L1EM20VH:
   eventCount: 0
 HLT_g25_medium_mu24_L1MU20:
   eventCount: 0
+HLT_g25_medium_tau25_dikaonmass_tracktwoMVA_L1EM22VHI:
+  eventCount: 0
+HLT_g25_medium_tau25_kaonpi1_tracktwoMVA_L1EM22VHI:
+  eventCount: 0
+HLT_g25_medium_tau25_kaonpi2_tracktwoMVA_L1EM22VHI:
+  eventCount: 0
+HLT_g25_medium_tau25_singlepion_tracktwoMVA_L1EM22VHI:
+  eventCount: 0
 HLT_g25_tight_L1EM20VH:
   eventCount: 0
 HLT_g300_etcut_L1EM22VHI:
@@ -1073,6 +1081,8 @@ HLT_g35_medium_L1EM15VHI:
   eventCount: 0
 HLT_g35_medium_g25_medium_L12EM20VH:
   eventCount: 0
+HLT_g35_medium_tau25_dipion3_tracktwoMVA_L1EM22VHI:
+  eventCount: 0
 HLT_g35_tight_L1EM15VHI:
   eventCount: 0
 HLT_g35_tight_icaloloose_L1EM15VHI:
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index 5f2245145cb..44daa72112f 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -691,6 +691,13 @@ def setupMenu():
         ChainProp(name='HLT_tau25_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_j70_0eta320_j50_0eta490_j0_dijetSEP50j12etSEP900djmass_L1MJJ-500-NFF',l1SeedThresholds=['TAU12IM','TAU12IM','FSNOSEED','FSNOSEED','FSNOSEED'],stream=[PhysicsStream], groups=TauJetGroup),
         ChainProp(name='HLT_tau25_mediumRNN_tracktwoMVABDT_tau20_mediumRNN_tracktwoMVABDT_j70_0eta320_j50_0eta490_j0_dijetSEP50j12etSEP900djmass_L1MJJ-500-NFF',l1SeedThresholds=['TAU12IM','TAU12IM','FSNOSEED','FSNOSEED','FSNOSEED'],stream=[PhysicsStream], groups=TauJetGroup),
         ChainProp(name='HLT_j70_0eta320_j50_0eta490_j0_dijetSEP50j12etSEP1000djmassSEPdjdphi240_xe90_tcpufit_xe50_cell_L1MJJ-500-NFF',l1SeedThresholds=['FSNOSEED']*5,stream=[PhysicsStream], groups=JetMETGroup),
+
+        # meson + photon (ATR-22644) - note: each of these chains requires a photon+tau cut that will be included in a later update
+        ChainProp(name='HLT_g25_medium_tau25_dikaonmass_tracktwoMVA_L1EM22VHI', l1SeedThresholds=['EM22VHI','TAU12'], stream=[PhysicsStream], groups=['RATE:TauGamma', 'BW:Tau', 'BW:Egamma']),
+        ChainProp(name='HLT_g25_medium_tau25_kaonpi1_tracktwoMVA_L1EM22VHI', l1SeedThresholds=['EM22VHI','TAU12'], stream=[PhysicsStream], groups=['RATE:TauGamma', 'BW:Tau', 'BW:Egamma']),
+        ChainProp(name='HLT_g25_medium_tau25_kaonpi2_tracktwoMVA_L1EM22VHI', l1SeedThresholds=['EM22VHI','TAU12'], stream=[PhysicsStream], groups=['RATE:TauGamma', 'BW:Tau', 'BW:Egamma']),
+        ChainProp(name='HLT_g25_medium_tau25_singlepion_tracktwoMVA_L1EM22VHI', l1SeedThresholds=['EM22VHI','TAU12'], stream=[PhysicsStream], groups=['RATE:TauGamma', 'BW:Tau', 'BW:Egamma']),
+        ChainProp(name='HLT_g35_medium_tau25_dipion3_tracktwoMVA_L1EM22VHI', l1SeedThresholds=['EM22VHI','TAU12'], stream=[PhysicsStream], groups=['RATE:TauGamma', 'BW:Tau', 'BW:Egamma']),
     ]
     TriggerFlags.HeavyIonSlice.signatures  = TriggerFlags.HeavyIonSlice.signatures() + []
     TriggerFlags.BeamspotSlice.signatures  = TriggerFlags.BeamspotSlice.signatures() + [
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
index ddb90de3aa7..be29949d596 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
@@ -320,7 +320,8 @@ TauChainParts = {
     'chainPartName' : '',
     'threshold'     : '',
     'preselection'  : ['track', 'tracktwo', 'tracktwoEF', 'tracktwoMVA', 'tracktwoMVABDT' , 'tracktwoEFmvaTES', 'ptonly', ],
-    'selection'     : ['medium1', 'verylooseRNN', 'looseRNN', 'mediumRNN', 'tightRNN', 'perf', 'idperf'],
+    'selection'     : ['medium1', 'verylooseRNN', 'looseRNN', 'mediumRNN', 'tightRNN', 'perf', 'idperf',
+                       'kaonpi1', 'kaonpi2', 'dipion3', 'dikaonmass', 'singlepion'],
     'multiplicity'  : '',
     'trigType'      : ['tau'],
     'trkInfo'       : '',
-- 
GitLab