From 75b505e2ba2cd8840b97142a998f7639fc080577 Mon Sep 17 00:00:00 2001
From: fbendebb <fatima.bendebba@cern.ch>
Date: Wed, 10 Jul 2024 11:41:26 +0200
Subject: [PATCH 1/8] Add b-jet correction decorations and define Z+jet CR

---
 bbllAnalysis/share/RunConfig-bbll.yaml   |  5 +++-
 bbllAnalysis/src/BaselineVarsbbllAlg.cxx | 13 ++++++++
 bbllAnalysis/src/HHbbllSelectorAlg.cxx   | 38 ++++++++++++++++++++++++
 bbllAnalysis/src/HHbbllSelectorAlg.h     |  6 +++-
 4 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/bbllAnalysis/share/RunConfig-bbll.yaml b/bbllAnalysis/share/RunConfig-bbll.yaml
index eadd770f9..5d81c29c1 100644
--- a/bbllAnalysis/share/RunConfig-bbll.yaml
+++ b/bbllAnalysis/share/RunConfig-bbll.yaml
@@ -30,7 +30,8 @@ small_R_jet:
   btag_extra_wps:
     - GN2v01_FixedCutBEff_77
   
-  variables_int_bjets: ["truthLabel"]
+  variables_int_bjets: ["truthLabel", "nmuons"]
+  variables_bjets: ["uncorrPt", "muonCorrPt"]
 
 Electron:
   ID: "MediumLH"
@@ -80,6 +81,8 @@ Categories :
       - IS_mm
       - IS_em
       - Pass_ll
+      - pass_ZHF_CR1
+      - pass_ZHF_CR2
 
 # Include the TTree configuration and update details
 ttree_output:
diff --git a/bbllAnalysis/src/BaselineVarsbbllAlg.cxx b/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
index 1b2262f67..5c1151d3e 100644
--- a/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
+++ b/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
@@ -106,6 +106,9 @@ namespace HHBBLL
       }
       
       static const SG::AuxElement::ConstAccessor<int>  HadronConeExclTruthLabelID("HadronConeExclTruthLabelID");
+      static const SG::AuxElement::ConstAccessor<int> cacc_NMu("n_muons");
+      static const SG::AuxElement::ConstAccessor<float> cacc_UncorrPt("uncorrPt");
+      static const SG::AuxElement::ConstAccessor<float> cacc_MuonCorrPt("muonCorrPt");
 
       TLorentzVector Leading_lep;
       TLorentzVector Subleading_lep;
@@ -352,6 +355,16 @@ namespace HHBBLL
       double mT2_bb = mt2_calculator.Compute();
       m_Fbranches.at("mT2_bb").set(*event, mT2_bb, sys);
 
+      if (bjets->size() > 1){
+        for(unsigned int i=0; i<2; i++){
+          std::string prefix = "Jet_b"+std::to_string(i+1);
+	  m_Ibranches.at(prefix+"_nmuons").set(*event, cacc_NMu(*bjets->at(i)), sys);
+          m_Fbranches.at(prefix+"_uncorrPt").set(*event, cacc_UncorrPt(*bjets->at(i)), sys);
+          m_Fbranches.at(prefix+"_muonCorrPt").set(*event, cacc_MuonCorrPt(*bjets->at(i)), sys);
+        }
+      }
+
+
     }
 
     return StatusCode::SUCCESS;
diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.cxx b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
index 0bd705c96..f2d42d26d 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.cxx
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
@@ -178,6 +178,8 @@ namespace HHBBLL
       m_bools.at(HHBBLL::VBFVETO_SR1) = false;
       m_bools.at(HHBBLL::DILEPTON_MASS_SR2) = false;
       m_bools.at(HHBBLL::DIBJET_MASS_SR2) = false;
+      m_bools.at(HHBBLL::pass_ZHF_CR1) = false;
+      m_bools.at(HHBBLL::pass_ZHF_CR2) = false;
 
       setThresholds(event, sys);
 
@@ -207,6 +209,26 @@ namespace HHBBLL
       evaluateLeptonCuts(*electrons, *muons, m_bbllCuts);
       evaluateJetCuts(*bjets, *nonbjets, m_bbllCuts);
       evaluateBJetLeptonCuts(*bjets, *electrons, *muons);
+
+      // Z+HF control region
+      //ZHF_CR2
+      if (m_bools.at(HHBBLL::pass_trigger_SLT) && m_bools.at(HHBBLL::EXACTLY_TWO_B_JETS)){
+        if(jets->at(0)->pt() > 45. * Athena::Units::GeV && m_bools.at(HHBBLL::EXACTLY_TWO_LEPTONS)) {
+          float mll = -999.;
+          float lep1_pt = -999.;
+          if (ele1) {
+            mll = (ele0->p4() + ele1->p4()).M();
+            lep1_pt = ele1->pt();
+          }
+          else if (mu1) {
+            mll = (mu0->p4() + mu1->p4()).M();
+            lep1_pt = mu1->pt();
+          }
+          m_bools.at(HHBBLL::pass_ZHF_CR2) = mll > 75. * Athena::Units::GeV && mll < 110. * Athena::Units::GeV &&
+            lep1_pt > 40. * Athena::Units::GeV;
+
+        }
+      }
       
       bool passedall = true;
       for (const auto& [key, value] : m_boolnames) {
@@ -683,6 +705,22 @@ namespace HHBBLL
     m_bools.at(HHBBLL::IS_em) = IS_em;
     m_bools.at(HHBBLL::IS_SF) = (IS_ee || IS_mm);
     m_bools.at(HHBBLL::Pass_ll) = ((TWO_ISO_ELECTRONS || TWO_ISO_MUONS || TWO_ISO_ELECMUs) && EXACTLY_TWO_B_JETS);
+
+    // Z+HF control region
+    // ZHF_CR1
+    double mbb = -99;
+    float mll = (electrons.size() == 2 && muons.size() == 0) ? (electrons.at(0)->p4() + electrons.at(1)->p4()).M() :
+      (electrons.size() == 0 && muons.size() == 2) ? (muons.at(0)->p4() + muons.at(1)->p4()).M() :
+      (electrons.size() == 1 && muons.size() == 1 ) ? (electrons.at(0)->p4() + muons.at(0)->p4()).M() : -99;
+    if (bjets.size() >= 2){
+      mbb = (bjets.at(0)->p4() + bjets.at(1)->p4()).M();
+      if (m_bools.at(HHBBLL::IS_SF) && mll >= 75. * Athena::Units::GeV && mll < 110. * Athena::Units::GeV) {
+        if (mbb <= 40. * Athena::Units::GeV || mbb >= 210. * Athena::Units::GeV) {
+          m_bools.at(HHBBLL::pass_ZHF_CR1) = true;
+        }
+      }
+    }
+
   }  
 
   void HHbbllSelectorAlg::setThresholds(const xAOD::EventInfo* event,
diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.h b/bbllAnalysis/src/HHbbllSelectorAlg.h
index 9555072bc..9e5862195 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.h
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.h
@@ -63,7 +63,9 @@ namespace HHBBLL
     DILEPTON_MASS_SR1,
     VBFVETO_SR1,
     DILEPTON_MASS_SR2,
-    DIBJET_MASS_SR2
+    DIBJET_MASS_SR2,
+    pass_ZHF_CR1,
+    pass_ZHF_CR2,
   };
 
   /// \brief An algorithm for counting containers
@@ -177,6 +179,8 @@ namespace HHBBLL
         {HHBBLL::VBFVETO_SR1, "VBFVETO_SR1"},
         {HHBBLL::DILEPTON_MASS_SR2, "DILEPTON_MASS_SR2"},
         {HHBBLL::DIBJET_MASS_SR2, "DIBJET_MASS_SR2"},
+	{HHBBLL::pass_ZHF_CR1, "pass_ZHF_CR1"},
+	{HHBBLL::pass_ZHF_CR2, "pass_ZHF_CR2"},
       };
 
       CutManager m_bbllCuts;
-- 
GitLab


From 861b6e05b5270e5d4be01a6dfe6690ac3455fdc6 Mon Sep 17 00:00:00 2001
From: fbendebb <fatima.bendebba@cern.ch>
Date: Wed, 10 Jul 2024 14:14:07 +0200
Subject: [PATCH 2/8] Fix MR comments

---
 bbllAnalysis/src/BaselineVarsbbllAlg.cxx | 16 +++-----
 bbllAnalysis/src/HHbbllSelectorAlg.cxx   | 49 ++++++++++++------------
 bbllAnalysis/src/HHbbllSelectorAlg.h     |  2 +-
 3 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/bbllAnalysis/src/BaselineVarsbbllAlg.cxx b/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
index 5c1151d3e..78b8c3304 100644
--- a/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
+++ b/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
@@ -253,6 +253,12 @@ namespace HHBBLL
         m_Fbranches.at(prefix+"_eta").set(*event, bjets->at(i)->eta(), sys);
         m_Fbranches.at(prefix+"_phi").set(*event, bjets->at(i)->phi(), sys);
         m_Fbranches.at(prefix+"_E").set(*event, bjets->at(i)->e(), sys);
+	if (i > 1){
+        m_Ibranches.at(prefix+"_nmuons").set(*event, cacc_NMu(*bjets->at(i)), sys);
+        m_Fbranches.at(prefix+"_uncorrPt").set(*event, cacc_UncorrPt(*bjets->at(i)), sys);
+        m_Fbranches.at(prefix+"_muonCorrPt").set(*event, cacc_MuonCorrPt(*bjets->at(i)), sys);
+	}
+
         if (m_isMC) {
           int truthLabel = HadronConeExclTruthLabelID(*bjets->at(i));
           m_Ibranches.at(prefix+"_truthLabel").set(*event, truthLabel, sys);
@@ -355,16 +361,6 @@ namespace HHBBLL
       double mT2_bb = mt2_calculator.Compute();
       m_Fbranches.at("mT2_bb").set(*event, mT2_bb, sys);
 
-      if (bjets->size() > 1){
-        for(unsigned int i=0; i<2; i++){
-          std::string prefix = "Jet_b"+std::to_string(i+1);
-	  m_Ibranches.at(prefix+"_nmuons").set(*event, cacc_NMu(*bjets->at(i)), sys);
-          m_Fbranches.at(prefix+"_uncorrPt").set(*event, cacc_UncorrPt(*bjets->at(i)), sys);
-          m_Fbranches.at(prefix+"_muonCorrPt").set(*event, cacc_MuonCorrPt(*bjets->at(i)), sys);
-        }
-      }
-
-
     }
 
     return StatusCode::SUCCESS;
diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.cxx b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
index f2d42d26d..9f74e52d5 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.cxx
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
@@ -208,28 +208,8 @@ namespace HHBBLL
       evaluateTriggerCuts(event, ele0, ele1, mu0, mu1, m_bbllCuts, sys);
       evaluateLeptonCuts(*electrons, *muons, m_bbllCuts);
       evaluateJetCuts(*bjets, *nonbjets, m_bbllCuts);
-      evaluateBJetLeptonCuts(*bjets, *electrons, *muons);
-
-      // Z+HF control region
-      //ZHF_CR2
-      if (m_bools.at(HHBBLL::pass_trigger_SLT) && m_bools.at(HHBBLL::EXACTLY_TWO_B_JETS)){
-        if(jets->at(0)->pt() > 45. * Athena::Units::GeV && m_bools.at(HHBBLL::EXACTLY_TWO_LEPTONS)) {
-          float mll = -999.;
-          float lep1_pt = -999.;
-          if (ele1) {
-            mll = (ele0->p4() + ele1->p4()).M();
-            lep1_pt = ele1->pt();
-          }
-          else if (mu1) {
-            mll = (mu0->p4() + mu1->p4()).M();
-            lep1_pt = mu1->pt();
-          }
-          m_bools.at(HHBBLL::pass_ZHF_CR2) = mll > 75. * Athena::Units::GeV && mll < 110. * Athena::Units::GeV &&
-            lep1_pt > 40. * Athena::Units::GeV;
+      evaluateBJetLeptonCuts(*bjets, *jets,  *electrons, *muons);
 
-        }
-      }
-      
       bool passedall = true;
       for (const auto& [key, value] : m_boolnames) {
         auto it = std::find(m_STANDARD_CUTS.begin(), m_STANDARD_CUTS.end(), value);
@@ -689,6 +669,7 @@ namespace HHBBLL
 
   void HHbbllSelectorAlg::evaluateBJetLeptonCuts
   (const ConstDataVector<xAOD::JetContainer>& bjets,
+   const xAOD::JetContainer& jets,
    const xAOD::ElectronContainer& electrons, const xAOD::MuonContainer& muons)
   {
     bool TWO_ISO_ELECTRONS = (electrons.size() >= 2);
@@ -709,9 +690,10 @@ namespace HHBBLL
     // Z+HF control region
     // ZHF_CR1
     double mbb = -99;
-    float mll = (electrons.size() == 2 && muons.size() == 0) ? (electrons.at(0)->p4() + electrons.at(1)->p4()).M() :
-      (electrons.size() == 0 && muons.size() == 2) ? (muons.at(0)->p4() + muons.at(1)->p4()).M() :
-      (electrons.size() == 1 && muons.size() == 1 ) ? (electrons.at(0)->p4() + muons.at(0)->p4()).M() : -99;
+    float mll = -99;
+    if(IS_ee) mll = (electrons.at(0)->p4() + electrons.at(1)->p4()).M();
+    else if(IS_mm) mll = (muons.at(0)->p4() + muons.at(1)->p4()).M();
+    else if(IS_em) mll = (electrons.at(0)->p4() + muons.at(0)->p4()).M();
     if (bjets.size() >= 2){
       mbb = (bjets.at(0)->p4() + bjets.at(1)->p4()).M();
       if (m_bools.at(HHBBLL::IS_SF) && mll >= 75. * Athena::Units::GeV && mll < 110. * Athena::Units::GeV) {
@@ -720,6 +702,25 @@ namespace HHBBLL
         }
       }
     }
+    //ZHF_CR2
+    if (m_bools.at(HHBBLL::pass_trigger_SLT) && m_bools.at(HHBBLL::EXACTLY_TWO_B_JETS)){
+      if(jets.at(0)->pt() > 45. * Athena::Units::GeV && m_bools.at(HHBBLL::EXACTLY_TWO_LEPTONS) &&
+        m_bools.at(HHBBLL::TWO_OPPOSITE_CHARGE_LEPTONS)) {
+        float mll = -999.;
+        float lep1_pt = -999.;
+        if (electrons.size() >= 2) {
+          mll = (electrons.at(0)->p4() + electrons.at(1)->p4()).M();
+          lep1_pt = electrons.at(1)->pt();
+        }
+        else if (muons.size() >= 2) {
+          mll = (muons.at(0)->p4() + muons.at(1)->p4()).M();
+          lep1_pt = muons.at(1)->pt();
+        }
+        m_bools.at(HHBBLL::pass_ZHF_CR2) = mll > 75. * Athena::Units::GeV && mll < 110. * Athena::Units::GeV &&
+          lep1_pt > 40. * Athena::Units::GeV;
+
+      }
+    }
 
   }  
 
diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.h b/bbllAnalysis/src/HHbbllSelectorAlg.h
index 9e5862195..de7ff5208 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.h
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.h
@@ -214,7 +214,7 @@ namespace HHBBLL
                           const xAOD::MuonContainer& muons, CutManager& bbllCuts);
       void evaluateJetCuts(const ConstDataVector<xAOD::JetContainer>& bjets,
                           const ConstDataVector<xAOD::JetContainer>& nonbjets, CutManager& bbllCuts);
-      void evaluateBJetLeptonCuts(const ConstDataVector<xAOD::JetContainer>& bjets,
+      void evaluateBJetLeptonCuts(const ConstDataVector<xAOD::JetContainer>& bjets, const xAOD::JetContainer& jets,
                           const xAOD::ElectronContainer& electrons, const xAOD::MuonContainer& muons);
       void setThresholds(const xAOD::EventInfo* event,
 			 const CP::SystematicSet& sys);
-- 
GitLab


From eb5b906d6ca19f474e4905e59b484a0aa79e8703 Mon Sep 17 00:00:00 2001
From: fbendebb <fatima.bendebba@cern.ch>
Date: Wed, 10 Jul 2024 17:35:13 +0200
Subject: [PATCH 3/8] Fix MR comments

---
 bbllAnalysis/share/RunConfig-bbll.yaml |  2 ++
 bbllAnalysis/src/HHbbllSelectorAlg.cxx | 45 +++++++++++---------------
 2 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/bbllAnalysis/share/RunConfig-bbll.yaml b/bbllAnalysis/share/RunConfig-bbll.yaml
index 5d81c29c1..a5a9a179e 100644
--- a/bbllAnalysis/share/RunConfig-bbll.yaml
+++ b/bbllAnalysis/share/RunConfig-bbll.yaml
@@ -33,6 +33,8 @@ small_R_jet:
   variables_int_bjets: ["truthLabel", "nmuons"]
   variables_bjets: ["uncorrPt", "muonCorrPt"]
 
+  runBJetPtCalib: False
+
 Electron:
   ID: "MediumLH"
   Iso: "Loose_VarRad"
diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.cxx b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
index 9f74e52d5..0a76e5124 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.cxx
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
@@ -688,37 +688,30 @@ namespace HHBBLL
     m_bools.at(HHBBLL::Pass_ll) = ((TWO_ISO_ELECTRONS || TWO_ISO_MUONS || TWO_ISO_ELECMUs) && EXACTLY_TWO_B_JETS);
 
     // Z+HF control region
-    // ZHF_CR1
-    double mbb = -99;
+    double mbb = -99.;
     float mll = -99;
-    if(IS_ee) mll = (electrons.at(0)->p4() + electrons.at(1)->p4()).M();
-    else if(IS_mm) mll = (muons.at(0)->p4() + muons.at(1)->p4()).M();
-    else if(IS_em) mll = (electrons.at(0)->p4() + muons.at(0)->p4()).M();
+    float lep1_pt = -99.;
+    if(IS_ee){
+       mll = (electrons.at(0)->p4() + electrons.at(1)->p4()).M();
+       lep1_pt = electrons.at(1)->pt();
+    }
+    else if(IS_mm){
+       mll = (muons.at(0)->p4() + muons.at(1)->p4()).M();
+       lep1_pt = muons.at(1)->pt();
+    }
+
     if (bjets.size() >= 2){
       mbb = (bjets.at(0)->p4() + bjets.at(1)->p4()).M();
-      if (m_bools.at(HHBBLL::IS_SF) && mll >= 75. * Athena::Units::GeV && mll < 110. * Athena::Units::GeV) {
-        if (mbb <= 40. * Athena::Units::GeV || mbb >= 210. * Athena::Units::GeV) {
+      if (m_bools.at(HHBBLL::IS_SF) && m_bools.at(HHBBLL::TWO_OPPOSITE_CHARGE_LEPTONS) &&
+	  mll > 75. * Athena::Units::GeV && mll < 110. * Athena::Units::GeV) {
+
+        if (mbb < 40. * Athena::Units::GeV || mbb > 210. * Athena::Units::GeV)
           m_bools.at(HHBBLL::pass_ZHF_CR1) = true;
-        }
-      }
-    }
-    //ZHF_CR2
-    if (m_bools.at(HHBBLL::pass_trigger_SLT) && m_bools.at(HHBBLL::EXACTLY_TWO_B_JETS)){
-      if(jets.at(0)->pt() > 45. * Athena::Units::GeV && m_bools.at(HHBBLL::EXACTLY_TWO_LEPTONS) &&
-        m_bools.at(HHBBLL::TWO_OPPOSITE_CHARGE_LEPTONS)) {
-        float mll = -999.;
-        float lep1_pt = -999.;
-        if (electrons.size() >= 2) {
-          mll = (electrons.at(0)->p4() + electrons.at(1)->p4()).M();
-          lep1_pt = electrons.at(1)->pt();
-        }
-        else if (muons.size() >= 2) {
-          mll = (muons.at(0)->p4() + muons.at(1)->p4()).M();
-          lep1_pt = muons.at(1)->pt();
-        }
-        m_bools.at(HHBBLL::pass_ZHF_CR2) = mll > 75. * Athena::Units::GeV && mll < 110. * Athena::Units::GeV &&
-          lep1_pt > 40. * Athena::Units::GeV;
 
+        if (m_bools.at(HHBBLL::pass_trigger_SLT) && m_bools.at(HHBBLL::EXACTLY_TWO_B_JETS) &&
+            jets.at(0)->pt() > 45. * Athena::Units::GeV &&
+            m_bools.at(HHBBLL::EXACTLY_TWO_LEPTONS) && lep1_pt > 40. * Athena::Units::GeV)
+           m_bools.at(HHBBLL::pass_ZHF_CR2) = true;
       }
     }
 
-- 
GitLab


From 7109f7f67e001e3037eee5ac433a16a905c5efc5 Mon Sep 17 00:00:00 2001
From: fbendebb <fatima.bendebba@cern.ch>
Date: Thu, 11 Jul 2024 08:33:38 +0200
Subject: [PATCH 4/8] Fix Z+HF definition

---
 bbllAnalysis/src/BaselineVarsbbllAlg.cxx | 2 --
 bbllAnalysis/src/HHbbllSelectorAlg.cxx   | 7 +++----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/bbllAnalysis/src/BaselineVarsbbllAlg.cxx b/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
index 78b8c3304..b58c8f347 100644
--- a/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
+++ b/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
@@ -253,11 +253,9 @@ namespace HHBBLL
         m_Fbranches.at(prefix+"_eta").set(*event, bjets->at(i)->eta(), sys);
         m_Fbranches.at(prefix+"_phi").set(*event, bjets->at(i)->phi(), sys);
         m_Fbranches.at(prefix+"_E").set(*event, bjets->at(i)->e(), sys);
-	if (i > 1){
         m_Ibranches.at(prefix+"_nmuons").set(*event, cacc_NMu(*bjets->at(i)), sys);
         m_Fbranches.at(prefix+"_uncorrPt").set(*event, cacc_UncorrPt(*bjets->at(i)), sys);
         m_Fbranches.at(prefix+"_muonCorrPt").set(*event, cacc_MuonCorrPt(*bjets->at(i)), sys);
-	}
 
         if (m_isMC) {
           int truthLabel = HadronConeExclTruthLabelID(*bjets->at(i));
diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.cxx b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
index 0a76e5124..0ccc25e90 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.cxx
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
@@ -708,10 +708,9 @@ namespace HHBBLL
         if (mbb < 40. * Athena::Units::GeV || mbb > 210. * Athena::Units::GeV)
           m_bools.at(HHBBLL::pass_ZHF_CR1) = true;
 
-        if (m_bools.at(HHBBLL::pass_trigger_SLT) && m_bools.at(HHBBLL::EXACTLY_TWO_B_JETS) &&
-            jets.at(0)->pt() > 45. * Athena::Units::GeV &&
-            m_bools.at(HHBBLL::EXACTLY_TWO_LEPTONS) && lep1_pt > 40. * Athena::Units::GeV)
-           m_bools.at(HHBBLL::pass_ZHF_CR2) = true;
+	if (jets.at(0)->pt() > 45. * Athena::Units::GeV &&
+            lep1_pt > 40. * Athena::Units::GeV)
+
       }
     }
 
-- 
GitLab


From e51e681447b1c67656f0dbf60fc67e601c4428ba Mon Sep 17 00:00:00 2001
From: fbendebb <fatima.bendebba@cern.ch>
Date: Thu, 11 Jul 2024 08:51:13 +0200
Subject: [PATCH 5/8] Fix Z+HF definition

---
 bbllAnalysis/src/HHbbllSelectorAlg.cxx | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.cxx b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
index 0ccc25e90..83fc4722a 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.cxx
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
@@ -710,6 +710,7 @@ namespace HHBBLL
 
 	if (jets.at(0)->pt() > 45. * Athena::Units::GeV &&
             lep1_pt > 40. * Athena::Units::GeV)
+	  m_bools.at(HHBBLL::pass_ZHF_CR2) = true;
 
       }
     }
-- 
GitLab


From dc62702e4fbd159abc86efca78514671e6348163 Mon Sep 17 00:00:00 2001
From: fbendebb <fatima.bendebba@cern.ch>
Date: Thu, 11 Jul 2024 09:44:18 +0200
Subject: [PATCH 6/8] Fix ZHF definition

---
 bbllAnalysis/src/BaselineVarsbbllAlg.cxx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/bbllAnalysis/src/BaselineVarsbbllAlg.cxx b/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
index b58c8f347..78fd44320 100644
--- a/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
+++ b/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
@@ -253,9 +253,6 @@ namespace HHBBLL
         m_Fbranches.at(prefix+"_eta").set(*event, bjets->at(i)->eta(), sys);
         m_Fbranches.at(prefix+"_phi").set(*event, bjets->at(i)->phi(), sys);
         m_Fbranches.at(prefix+"_E").set(*event, bjets->at(i)->e(), sys);
-        m_Ibranches.at(prefix+"_nmuons").set(*event, cacc_NMu(*bjets->at(i)), sys);
-        m_Fbranches.at(prefix+"_uncorrPt").set(*event, cacc_UncorrPt(*bjets->at(i)), sys);
-        m_Fbranches.at(prefix+"_muonCorrPt").set(*event, cacc_MuonCorrPt(*bjets->at(i)), sys);
 
         if (m_isMC) {
           int truthLabel = HadronConeExclTruthLabelID(*bjets->at(i));
@@ -267,6 +264,11 @@ namespace HHBBLL
           new_var.erase(new_var.length() - 11, new_var.length());
           m_Ibranches.at(prefix+"_pcbt_"+new_var).set(*event, m_PCBTs.at(var).get(*bjets->at(i), sys), sys);
         }
+	if (i>1){
+	  m_Ibranches.at(prefix+"_nmuons").set(*event, cacc_NMu(*bjets->at(i)), sys);
+	  m_Fbranches.at(prefix+"_uncorrPt").set(*event, cacc_UncorrPt(*bjets->at(i)), sys);
+	  m_Fbranches.at(prefix+"_muonCorrPt").set(*event, cacc_MuonCorrPt(*bjets->at(i)), sys);
+	}
       }
 
       if (bjets->size()>=2) {
-- 
GitLab


From 0361c6de354dcb62b1d8eaef4b8891f63dc674d3 Mon Sep 17 00:00:00 2001
From: fbendebb <fatima.bendebba@cern.ch>
Date: Thu, 11 Jul 2024 12:43:52 +0200
Subject: [PATCH 7/8] Fix MR comments

---
 bbllAnalysis/share/RunConfig-bbll.yaml   | 2 +-
 bbllAnalysis/src/BaselineVarsbbllAlg.cxx | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/bbllAnalysis/share/RunConfig-bbll.yaml b/bbllAnalysis/share/RunConfig-bbll.yaml
index a5a9a179e..a6210db46 100644
--- a/bbllAnalysis/share/RunConfig-bbll.yaml
+++ b/bbllAnalysis/share/RunConfig-bbll.yaml
@@ -33,7 +33,7 @@ small_R_jet:
   variables_int_bjets: ["truthLabel", "nmuons"]
   variables_bjets: ["uncorrPt", "muonCorrPt"]
 
-  runBJetPtCalib: False
+  runBJetPtCalib: true
 
 Electron:
   ID: "MediumLH"
diff --git a/bbllAnalysis/src/BaselineVarsbbllAlg.cxx b/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
index 78fd44320..9a66045df 100644
--- a/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
+++ b/bbllAnalysis/src/BaselineVarsbbllAlg.cxx
@@ -264,11 +264,9 @@ namespace HHBBLL
           new_var.erase(new_var.length() - 11, new_var.length());
           m_Ibranches.at(prefix+"_pcbt_"+new_var).set(*event, m_PCBTs.at(var).get(*bjets->at(i), sys), sys);
         }
-	if (i>1){
-	  m_Ibranches.at(prefix+"_nmuons").set(*event, cacc_NMu(*bjets->at(i)), sys);
-	  m_Fbranches.at(prefix+"_uncorrPt").set(*event, cacc_UncorrPt(*bjets->at(i)), sys);
-	  m_Fbranches.at(prefix+"_muonCorrPt").set(*event, cacc_MuonCorrPt(*bjets->at(i)), sys);
-	}
+	m_Ibranches.at(prefix+"_nmuons").set(*event, cacc_NMu(*bjets->at(i)), sys);
+	m_Fbranches.at(prefix+"_uncorrPt").set(*event, cacc_UncorrPt(*bjets->at(i)), sys);
+	m_Fbranches.at(prefix+"_muonCorrPt").set(*event, cacc_MuonCorrPt(*bjets->at(i)), sys);
       }
 
       if (bjets->size()>=2) {
-- 
GitLab


From 41e8a81fbecc03d26d3f6fc9dc8e0c3ac060550d Mon Sep 17 00:00:00 2001
From: fbendebb <fatima.bendebba@cern.ch>
Date: Thu, 11 Jul 2024 12:46:24 +0200
Subject: [PATCH 8/8] Fix MR comments

---
 bbllAnalysis/share/RunConfig-bbll.yaml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/bbllAnalysis/share/RunConfig-bbll.yaml b/bbllAnalysis/share/RunConfig-bbll.yaml
index a6210db46..5d81c29c1 100644
--- a/bbllAnalysis/share/RunConfig-bbll.yaml
+++ b/bbllAnalysis/share/RunConfig-bbll.yaml
@@ -33,8 +33,6 @@ small_R_jet:
   variables_int_bjets: ["truthLabel", "nmuons"]
   variables_bjets: ["uncorrPt", "muonCorrPt"]
 
-  runBJetPtCalib: true
-
 Electron:
   ID: "MediumLH"
   Iso: "Loose_VarRad"
-- 
GitLab