From 48d71884344f6a3bb95b1db6556c68b5e60e17f6 Mon Sep 17 00:00:00 2001
From: yoyamagu <yohei.yamaguchi@cern.ch>
Date: Wed, 23 Dec 2020 22:57:03 +0900
Subject: [PATCH] modify element index

---
 .../TrigMuonHypoMT/src/TrigMufastHypoTool.cxx               | 6 +++---
 .../TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx               | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMufastHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMufastHypoTool.cxx
index d975a6c2cfd4..602d47ce93aa 100644
--- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMufastHypoTool.cxx
+++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMufastHypoTool.cxx
@@ -322,18 +322,17 @@ StatusCode TrigMufastHypoTool::inclusiveSelection(std::vector<TrigMufastHypoTool
 StatusCode TrigMufastHypoTool::multiplicitySelection(std::vector<TrigMufastHypoTool::MuonClusterInfo>& toolInput) const{
 
    HLT::Index2DVec passingSelection( m_ptBins.size() );
-   size_t elementIndex{ 0 };
 
    for ( size_t cutIndex=0; cutIndex < m_ptBins.size(); ++cutIndex ) {
+      size_t elementIndex{ 0 };
       for ( auto& i: toolInput ) {
 
 	if(!m_acceptAll && m_applyOR && !i.passOR) {
 	  ATH_MSG_DEBUG("skip due to overap, DecisionID " << m_decisionId );
+	  elementIndex++;
 	  continue;
 	}
 
-	elementIndex = &i - &toolInput.front();
-
          // If muon event has difference DecisionID, it shouldn't apply.
          if ( TrigCompositeUtils::passed( m_decisionId.numeric(), i.previousDecisionIDs ) ) {
             if ( decideOnSingleObject( i, cutIndex ) == true ) {
@@ -345,6 +344,7 @@ StatusCode TrigMufastHypoTool::multiplicitySelection(std::vector<TrigMufastHypoT
          } else {
             ATH_MSG_DEBUG("Not match DecisionID " << m_decisionId );
          }
+         elementIndex++;
       }
 
       // If no object passes the selection, multipul selection should stop.
diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx
index dc4323fef1c0..78c4ede02600 100644
--- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx
+++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx
@@ -275,18 +275,17 @@ StatusCode TrigmuCombHypoTool::inclusiveSelection(std::vector<TrigmuCombHypoTool
 StatusCode TrigmuCombHypoTool::multiplicitySelection(std::vector<TrigmuCombHypoTool::CombinedMuonInfo>& input) const
 {
    HLT::Index2DVec passingSelection( m_ptBins.size() );
-   size_t elementIndex{ 0 };
 
    for ( size_t cutIndex=0; cutIndex < m_ptBins.size(); ++cutIndex ) {
+      size_t elementIndex{ 0 };
       for ( auto& i: input ) {
 
 	if(!m_acceptAll && m_applyOR && !i.passOR) {
 	  ATH_MSG_DEBUG("skip due to overap, DecisionID " << m_decisionId );
+	  elementIndex++;
 	  continue;
 	}
 
-	elementIndex = &i - &input.front();
-
          // If muon event has difference DecisionID, it shouldn't apply.
          if ( TrigCompositeUtils::passed( m_decisionId.numeric(), i.previousDecisionIDs ) ) {
             if ( decideOnSingleObject( i, cutIndex ) == true ) {
@@ -298,6 +297,7 @@ StatusCode TrigmuCombHypoTool::multiplicitySelection(std::vector<TrigmuCombHypoT
          } else {
             ATH_MSG_DEBUG("Not match DecisionID " << m_decisionId );
          }
+         elementIndex++;
       }
 
       // If no object passes the selection, multipul selection should stop.
-- 
GitLab