From 6619d2d83b8f269fe425246397bb4d182dd8f35c Mon Sep 17 00:00:00 2001
From: Valeriia Lukashenko <valeriia.lukashenko@cern.ch>
Date: Tue, 11 Jan 2022 16:21:16 +0100
Subject: [PATCH 1/6] catch a mullptr in hypotheses

---
 Phys/ParticleMaker/src/NeutralMakers.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Phys/ParticleMaker/src/NeutralMakers.cpp b/Phys/ParticleMaker/src/NeutralMakers.cpp
index 43d39bdea1a..8ac6be0032e 100644
--- a/Phys/ParticleMaker/src/NeutralMakers.cpp
+++ b/Phys/ParticleMaker/src/NeutralMakers.cpp
@@ -322,6 +322,9 @@ namespace LHCb::Phys::ParticleMakers {
 
     //  ---- Check the hypothesis. Nothing wrong if it's not matched to a photon, just skip
     const auto& hypo = hypos.front();
+    if (!hypo){
+      return {};
+    }
     if ( LHCb::CaloHypo::Hypothesis::Photon != hypo->hypothesis() ) { return {}; }
 
     // ---- skip negative energy
@@ -537,6 +540,9 @@ namespace LHCb::Phys::ParticleMakers {
 
     //  ---- Check the hypothesis. Nothing wrong if it's not matched to a photon, just skip
     const auto& hypo = hypos.front();
+    if (!hypo){
+      return {};
+    } 
     if ( LHCb::CaloHypo::Hypothesis::Pi0Merged != hypo->hypothesis() ) { return {}; }
 
     // Add to total pi0s
-- 
GitLab


From 9025788c3575c3fba4cf028e6eb679520ff8f399 Mon Sep 17 00:00:00 2001
From: Gitlab CI <noreply@cern.ch>
Date: Tue, 11 Jan 2022 15:21:46 +0000
Subject: [PATCH 2/6] Fixed formatting

patch generated by https://gitlab.cern.ch/lhcb/Phys/-/jobs/18717855
---
 Phys/ParticleMaker/src/NeutralMakers.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/Phys/ParticleMaker/src/NeutralMakers.cpp b/Phys/ParticleMaker/src/NeutralMakers.cpp
index 8ac6be0032e..68835e25bfd 100644
--- a/Phys/ParticleMaker/src/NeutralMakers.cpp
+++ b/Phys/ParticleMaker/src/NeutralMakers.cpp
@@ -322,9 +322,7 @@ namespace LHCb::Phys::ParticleMakers {
 
     //  ---- Check the hypothesis. Nothing wrong if it's not matched to a photon, just skip
     const auto& hypo = hypos.front();
-    if (!hypo){
-      return {};
-    }
+    if ( !hypo ) { return {}; }
     if ( LHCb::CaloHypo::Hypothesis::Photon != hypo->hypothesis() ) { return {}; }
 
     // ---- skip negative energy
@@ -540,9 +538,7 @@ namespace LHCb::Phys::ParticleMakers {
 
     //  ---- Check the hypothesis. Nothing wrong if it's not matched to a photon, just skip
     const auto& hypo = hypos.front();
-    if (!hypo){
-      return {};
-    } 
+    if ( !hypo ) { return {}; }
     if ( LHCb::CaloHypo::Hypothesis::Pi0Merged != hypo->hypothesis() ) { return {}; }
 
     // Add to total pi0s
-- 
GitLab


From 6d5a996fe958ed1d87a661083cf51cbdeb5c5f89 Mon Sep 17 00:00:00 2001
From: Valeriia Lukashenko <valeriia.lukashenko@cern.ch>
Date: Thu, 13 Jan 2022 16:23:08 +0100
Subject: [PATCH 3/6] add MsgCounter

---
 Phys/ParticleMaker/src/NeutralMakers.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/Phys/ParticleMaker/src/NeutralMakers.cpp b/Phys/ParticleMaker/src/NeutralMakers.cpp
index 68835e25bfd..ba636b57ff5 100644
--- a/Phys/ParticleMaker/src/NeutralMakers.cpp
+++ b/Phys/ParticleMaker/src/NeutralMakers.cpp
@@ -322,7 +322,10 @@ namespace LHCb::Phys::ParticleMakers {
 
     //  ---- Check the hypothesis. Nothing wrong if it's not matched to a photon, just skip
     const auto& hypo = hypos.front();
-    if ( !hypo ) { return {}; }
+    if ( !hypo ) {
+      ++m_null_calohypo; 
+      return {}; 
+      }
     if ( LHCb::CaloHypo::Hypothesis::Photon != hypo->hypothesis() ) { return {}; }
 
     // ---- skip negative energy
@@ -461,7 +464,7 @@ namespace LHCb::Phys::ParticleMakers {
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_not_neutral{this, "Track(s) found. Particle must be neutral"};
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_empty_hypotheses{this, "No hypotheses found"};
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_null_caloposition{this, "CaloPosition point to null"};
-
+    mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_null_calohypo{this, "CaloHypos point to null"};
     // ====================
     // List of functions
   public:
@@ -538,7 +541,11 @@ namespace LHCb::Phys::ParticleMakers {
 
     //  ---- Check the hypothesis. Nothing wrong if it's not matched to a photon, just skip
     const auto& hypo = hypos.front();
-    if ( !hypo ) { return {}; }
+    if ( !hypo ) {
+      ++m_null_calohypo; 
+      return {}; 
+      }
+ 
     if ( LHCb::CaloHypo::Hypothesis::Pi0Merged != hypo->hypothesis() ) { return {}; }
 
     // Add to total pi0s
-- 
GitLab


From 6de2a67c0e92701eae430f9ca184429054f434a6 Mon Sep 17 00:00:00 2001
From: Gitlab CI <noreply@cern.ch>
Date: Thu, 13 Jan 2022 15:23:48 +0000
Subject: [PATCH 4/6] Fixed formatting

patch generated by https://gitlab.cern.ch/lhcb/Rec/-/jobs/18775643
---
 Phys/ParticleMaker/src/NeutralMakers.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Phys/ParticleMaker/src/NeutralMakers.cpp b/Phys/ParticleMaker/src/NeutralMakers.cpp
index ba636b57ff5..e1cd97dfef3 100644
--- a/Phys/ParticleMaker/src/NeutralMakers.cpp
+++ b/Phys/ParticleMaker/src/NeutralMakers.cpp
@@ -323,9 +323,9 @@ namespace LHCb::Phys::ParticleMakers {
     //  ---- Check the hypothesis. Nothing wrong if it's not matched to a photon, just skip
     const auto& hypo = hypos.front();
     if ( !hypo ) {
-      ++m_null_calohypo; 
-      return {}; 
-      }
+      ++m_null_calohypo;
+      return {};
+    }
     if ( LHCb::CaloHypo::Hypothesis::Photon != hypo->hypothesis() ) { return {}; }
 
     // ---- skip negative energy
@@ -542,10 +542,10 @@ namespace LHCb::Phys::ParticleMakers {
     //  ---- Check the hypothesis. Nothing wrong if it's not matched to a photon, just skip
     const auto& hypo = hypos.front();
     if ( !hypo ) {
-      ++m_null_calohypo; 
-      return {}; 
-      }
- 
+      ++m_null_calohypo;
+      return {};
+    }
+
     if ( LHCb::CaloHypo::Hypothesis::Pi0Merged != hypo->hypothesis() ) { return {}; }
 
     // Add to total pi0s
-- 
GitLab


From 86ad5ee2cb3aa5d4f6014e9cbe41fbdc3c716ef5 Mon Sep 17 00:00:00 2001
From: Valeriia Lukashenko <valeriia.lukashenko@cern.ch>
Date: Thu, 13 Jan 2022 16:45:17 +0100
Subject: [PATCH 5/6] ass forgotten counter

---
 Phys/ParticleMaker/src/NeutralMakers.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Phys/ParticleMaker/src/NeutralMakers.cpp b/Phys/ParticleMaker/src/NeutralMakers.cpp
index e1cd97dfef3..f94f0386b8f 100644
--- a/Phys/ParticleMaker/src/NeutralMakers.cpp
+++ b/Phys/ParticleMaker/src/NeutralMakers.cpp
@@ -246,7 +246,8 @@ namespace LHCb::Phys::ParticleMakers {
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_invalid_energy{this, "Negative energies are not allowed"};
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_not_neutral{this, "Track(s) found. Particle must be neutral"};
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_empty_hypotheses{this, "No hypotheses found"};
-
+    mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_null_calohypo{this, "CaloHypos point to null"};
+ 
     // ====================
     // List of functions
   public:
@@ -465,6 +466,7 @@ namespace LHCb::Phys::ParticleMakers {
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_empty_hypotheses{this, "No hypotheses found"};
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_null_caloposition{this, "CaloPosition point to null"};
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_null_calohypo{this, "CaloHypos point to null"};
+ 
     // ====================
     // List of functions
   public:
-- 
GitLab


From 405329ca9f94c917dda39f4b5e32077f8ee1e32b Mon Sep 17 00:00:00 2001
From: Gitlab CI <noreply@cern.ch>
Date: Thu, 13 Jan 2022 15:45:59 +0000
Subject: [PATCH 6/6] Fixed formatting

patch generated by https://gitlab.cern.ch/lhcb/Rec/-/jobs/18776540
---
 Phys/ParticleMaker/src/NeutralMakers.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Phys/ParticleMaker/src/NeutralMakers.cpp b/Phys/ParticleMaker/src/NeutralMakers.cpp
index f94f0386b8f..036d35204d4 100644
--- a/Phys/ParticleMaker/src/NeutralMakers.cpp
+++ b/Phys/ParticleMaker/src/NeutralMakers.cpp
@@ -247,7 +247,7 @@ namespace LHCb::Phys::ParticleMakers {
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_not_neutral{this, "Track(s) found. Particle must be neutral"};
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_empty_hypotheses{this, "No hypotheses found"};
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_null_calohypo{this, "CaloHypos point to null"};
- 
+
     // ====================
     // List of functions
   public:
@@ -466,7 +466,7 @@ namespace LHCb::Phys::ParticleMakers {
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_empty_hypotheses{this, "No hypotheses found"};
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_null_caloposition{this, "CaloPosition point to null"};
     mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_null_calohypo{this, "CaloHypos point to null"};
- 
+
     // ====================
     // List of functions
   public:
-- 
GitLab