From f41a43f52bfa6582121822982bae5eb342dca992 Mon Sep 17 00:00:00 2001
From: Sascha Stahl <sascha.stahl@cern.ch>
Date: Sun, 29 May 2016 15:40:40 +0200
Subject: [PATCH] Change warnings from failing PV refits Silence warning in
 DVCommonBase when a PV refit fails, repetition rate set to 0. Switch on
 warnings in LoKi::PVReFitter when a PV refit fails with a repitition rate of
 0.

---
 Phys/DaVinciKernel/doc/release.notes         |  4 ++++
 Phys/DaVinciKernel/src/Lib/DVCommonBase.icpp |  2 +-
 Phys/LoKiFitters/doc/release.notes           |  3 +++
 Phys/LoKiFitters/src/PVReFitter.cpp          | 12 ++++++------
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/Phys/DaVinciKernel/doc/release.notes b/Phys/DaVinciKernel/doc/release.notes
index a1b11cc8f..8c1fab5cc 100755
--- a/Phys/DaVinciKernel/doc/release.notes
+++ b/Phys/DaVinciKernel/doc/release.notes
@@ -4,6 +4,10 @@
 ! Responsible : DV Maintainer
 !============================================================================
 
+! 2016-05-29 - Sascha Stahl
+ - DVCommonBase: Silence warning when PV refit fails. Rely on more detailed 
+   warnings in fitter itself.
+
 !==================== DaVinciKernel v12r4p1 2016-03-18 ======================
 
 ! 2016-03-30 - Vanya Belyaev
diff --git a/Phys/DaVinciKernel/src/Lib/DVCommonBase.icpp b/Phys/DaVinciKernel/src/Lib/DVCommonBase.icpp
index 7d9072d2a..4907e7a13 100644
--- a/Phys/DaVinciKernel/src/Lib/DVCommonBase.icpp
+++ b/Phys/DaVinciKernel/src/Lib/DVCommonBase.icpp
@@ -1087,7 +1087,7 @@ DVCommonBase<PBASE>::calculateRelatedPV(const LHCb::Particle* p) const
       else
       {
         delete reFittedPV;
-        this->Warning( "PV re-fit failed", StatusCode::FAILURE, 1 ).ignore() ;
+        this->Warning( "PV re-fit failed", StatusCode::FAILURE, 0 ).ignore() ;
       }
     }
     if ( reFittedPVs.empty() )
diff --git a/Phys/LoKiFitters/doc/release.notes b/Phys/LoKiFitters/doc/release.notes
index d338c1fa5..c41d1591f 100755
--- a/Phys/LoKiFitters/doc/release.notes
+++ b/Phys/LoKiFitters/doc/release.notes
@@ -5,6 +5,9 @@
 ! Purpose     : collection of various kinematical LoKi-based fitters 
 ! -----------------------------------------------------------------------------
 
+! 2016-05-29 - Sascha Stahl
+ - PVRefitter: Switch on some warnings for debugging purposes.
+
 !===================== Phys/LoKiFitters v5r1 2016-05-19 =======================
 
 ! 2016-05-11 - Sascha Stahl
diff --git a/Phys/LoKiFitters/src/PVReFitter.cpp b/Phys/LoKiFitters/src/PVReFitter.cpp
index 4bb5e923a..833542e3e 100644
--- a/Phys/LoKiFitters/src/PVReFitter.cpp
+++ b/Phys/LoKiFitters/src/PVReFitter.cpp
@@ -589,7 +589,7 @@ StatusCode LoKi::PVReFitter::_remove_
   // - too many tracks to remove 
   if ( removed.size () +  m_minTracksInPV  > pv.tracks().size() ) 
   { return _Warning( "Less than "+m_minTS+" tracks in vertex remain",
-                     StatusCode::FAILURE, 0 ) ; }
+                     StatusCode::FAILURE, 1 ) ; }
   // 
   // - too many tracks to remove
   if ( removed.size () + 10  > pv.tracks().size() ) 
@@ -626,7 +626,7 @@ StatusCode LoKi::PVReFitter::_remove_
       LoKi::KalmanFilter::load ( s , m_entries.back() , -1*weight ) ;
     if ( sc.isFailure() ) 
     {
-      _Warning ( "Error from KalmanFilter::load, skip", sc, 0 ) ;
+      _Warning ( "Error from KalmanFilter::load, skip", sc, 1 ) ;
       m_entries.pop_back() ; 
     }
   }
@@ -647,7 +647,7 @@ StatusCode LoKi::PVReFitter::_remove_
   //// int ifail = 0 
   //// const Gaudi::SymMatrix3x3 ci = pv.covMatrix().Inverse( ifail );
   if ( 0 != ifail ) { return _Warning( "Non-invertible covariance matrix!",
-                                       StatusCode::FAILURE, 0 ) ; }
+                                       StatusCode::FAILURE, 1 ) ; }
   //
   // 2) make (multi-step) of Kalman filter 
   const StatusCode sc = LoKi::KalmanFilter::step ( m_entries     , 
@@ -655,7 +655,7 @@ StatusCode LoKi::PVReFitter::_remove_
                                                    ci            ,
                                                    0             ) ;
   if ( sc.isFailure() ) 
-  { return _Warning("Error from KalmanFilter::step", sc, 0 ) ; }   // RETURN 
+  { return _Warning("Error from KalmanFilter::step", sc, 1 ) ; }   // RETURN 
   //
   // 3) finally update the vertex
   for ( LHCb::Track::ConstVector::const_iterator it = removed.begin() ; 
@@ -769,7 +769,7 @@ StatusCode LoKi::PVReFitter::_reFit_ ( LHCb::RecVertex& pv ) const
     { return _Warning ( "Not enough good tracks in the vertex!" ) ; }  // RETURN
     else if ( m_minTracksInPV > nTracks ) 
     { _Warning        ( "Less than "+m_minTS+" good tracks in vertex!", 
-                        StatusCode::SUCCESS, 0 ).ignore() ; }
+                        StatusCode::SUCCESS, 1 ).ignore() ; }
     //
     // make Kalman-Filter step 
     //
@@ -801,7 +801,7 @@ StatusCode LoKi::PVReFitter::_reFit_ ( LHCb::RecVertex& pv ) const
   } // iterations 
   //
   if ( iIter >= m_maxIter ) { _Warning ( "No convergency has been reached",
-                                         StatusCode::SUCCESS, 0 ) ; }
+                                         StatusCode::SUCCESS, 1 ) ; }
   //
   const TrEntry& last = m_entries.back() ;
   //
-- 
GitLab