From e427eb0f48dd9f22f2a659a3b4a2b98866e5ce07 Mon Sep 17 00:00:00 2001
From: Tamara Vazquez Schroeder <tamara.vazquez.schroeder@cern.ch>
Date: Mon, 13 Nov 2017 09:31:54 +0000
Subject: [PATCH] Merge branch '21.0-pedestalCorrectionUnderflow' into '21.0'

Fixed pedestal correction under-/overflow issue

See merge request !6346

(cherry picked from commit 49087b5d85e0b1408a3f628e33034361a534ee05 [formerly 06cdd160756ad10112a6698d613dcad50f4ff6cb])

6889018b Fixed pedestal correction under-/overflow issue

Former-commit-id: ad6f90797e5b64411fdd517e0cbc0e23f77fe6b6
---
 .../TrigT1CaloMonitoring/src/PPMSimBSMon.cxx  | 32 +++++--------------
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/Trigger/TrigT1/TrigT1CaloMonitoring/src/PPMSimBSMon.cxx b/Trigger/TrigT1/TrigT1CaloMonitoring/src/PPMSimBSMon.cxx
index 337fa1982bc..ad4aeb78d88 100644
--- a/Trigger/TrigT1/TrigT1CaloMonitoring/src/PPMSimBSMon.cxx
+++ b/Trigger/TrigT1/TrigT1CaloMonitoring/src/PPMSimBSMon.cxx
@@ -521,17 +521,13 @@ void PPMSimBSMon::simulateAndCompare(const xAOD::TriggerTowerContainer* ttIn)
       hist1 = 0;
       if (simCp && simCp == datCp) { // non-zero match
         hist1 = m_h_ppm_em_2d_etaPhi_tt_lutCp_SimEqData;
-      } else if (simCp != datCp) {  // mis-match
+      } else if (simCp != datCp && !pedCorrOverflow) {  // mis-match
         mismatch = 1;
         if (simCp && datCp) {       // non-zero mis-match
-          if (!pedCorrOverflow){		// no pedCorr over- or underflow
-	          hist1 = m_h_ppm_em_2d_etaPhi_tt_lutCp_SimNeData;
-          }else{
-            mismatch = 0;           //If the pedestal Correction overflows do not fill mismatch Event Histogram
-          }    
+	  hist1 = m_h_ppm_em_2d_etaPhi_tt_lutCp_SimNeData;
         } else if (!datCp) {        // no data
           if ((Slices >= 7) && (nPedCorr >= 3)) {
-            hist1 = m_h_ppm_em_2d_etaPhi_tt_lutCp_SimNoData;
+	    hist1 = m_h_ppm_em_2d_etaPhi_tt_lutCp_SimNoData;
           } else mismatch = 0;
         } else {                    // no sim
           hist1 = m_h_ppm_em_2d_etaPhi_tt_lutCp_DataNoSim;
@@ -545,14 +541,10 @@ void PPMSimBSMon::simulateAndCompare(const xAOD::TriggerTowerContainer* ttIn)
       hist1 = 0;
       if (simJep && simJep == datJep) { // non-zero match
         hist1 = m_h_ppm_em_2d_etaPhi_tt_lutJep_SimEqData;
-      } else if (simJep != datJep) {  // mis-match
+      } else if (simJep != datJep && !pedCorrOverflow) {  // mis-match
         mismatch = 1;
         if (simJep && datJep) {       // non-zero mis-match
-          if (!pedCorrOverflow){		// no pedCorr over- or underflow
-	          hist1 = m_h_ppm_em_2d_etaPhi_tt_lutJep_SimNeData;
-          }else{
-            mismatch = 0;           //If the pedestal Correction overflows do not fill mismatch Event Histogram
-          }
+          hist1 = m_h_ppm_em_2d_etaPhi_tt_lutJep_SimNeData;
         } else if (!datJep) {        // no data
           if ((Slices >= 7) && (nPedCorr >= 3)) {
             hist1 = m_h_ppm_em_2d_etaPhi_tt_lutJep_SimNoData;
@@ -571,14 +563,10 @@ void PPMSimBSMon::simulateAndCompare(const xAOD::TriggerTowerContainer* ttIn)
       hist1 = 0;
       if (simCp && simCp == datCp) { // non-zero match
         hist1 = m_h_ppm_had_2d_etaPhi_tt_lutCp_SimEqData;
-      } else if (simCp != datCp) {  // mis-match
+      } else if (simCp != datCp  && !pedCorrOverflow ) {  // mis-match
         mismatch = 1;
         if (simCp && datCp) {       // non-zero mis-match
-           if (!pedCorrOverflow){		// no pedCorr over- or underflow
             hist1 = m_h_ppm_had_2d_etaPhi_tt_lutCp_SimNeData;
-           }else{
-            mismatch = 0;           //If the pedestal Correction overflows do not fill mismatch Event Histogram
-          }
         } else if (!datCp) {        // no data
           if ((Slices >= 7) && (nPedCorr >= 3)) {
             hist1 = m_h_ppm_had_2d_etaPhi_tt_lutCp_SimNoData;
@@ -595,14 +583,10 @@ void PPMSimBSMon::simulateAndCompare(const xAOD::TriggerTowerContainer* ttIn)
       hist1 = 0;
       if (simJep && simJep == datJep) { // non-zero match
         hist1 = m_h_ppm_had_2d_etaPhi_tt_lutJep_SimEqData;
-      } else if (simJep != datJep) {  // mis-match
+      } else if (simJep != datJep && !pedCorrOverflow ) {  // mis-match
         mismatch = 1;
         if (simJep && datJep) {       // non-zero mis-match
-           if (!pedCorrOverflow){		// no pedCorr over- or underflow
-            hist1 = m_h_ppm_had_2d_etaPhi_tt_lutJep_SimNeData;
-           }else{
-            mismatch = 0;           //If the pedestal Correction overflows do not fill mismatch Event Histogram
-          }
+           hist1 = m_h_ppm_had_2d_etaPhi_tt_lutJep_SimNeData;
         } else if (!datJep) {        // no data
           if ((Slices >= 7) && (nPedCorr >= 3)) {
             hist1 = m_h_ppm_had_2d_etaPhi_tt_lutJep_SimNoData;
-- 
GitLab