From ffd18c568c22ebe7de7c79df93a4c1e6155e1ca0 Mon Sep 17 00:00:00 2001
From: Niklas Nolte <niklas.nolte@cern.ch>
Date: Thu, 9 Jan 2020 13:45:14 +0100
Subject: [PATCH] Revert "hack forwardfitted tracks to also give me other
 entries of the covariance matrix, this only works because i fill them from
 the packers, so don"t use this in hlt1 production or what not"

This reverts commit 5f61aa21480edb22a413e4d1e30133e36ce11de7.
---
 .../TrackEvent/Event/PrFittedForwardTracks.h  |  9 +-------
 .../Event/PrIterableFittedForwardTracks.h     | 23 +++++++++----------
 2 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/Event/TrackEvent/Event/PrFittedForwardTracks.h b/Event/TrackEvent/Event/PrFittedForwardTracks.h
index 5b3e3e32cd4..9164e428bb1 100644
--- a/Event/TrackEvent/Event/PrFittedForwardTracks.h
+++ b/Event/TrackEvent/Event/PrFittedForwardTracks.h
@@ -88,13 +88,6 @@ namespace LHCb::Pr::Fitted::Forward {
     VEC3_SOA_ACCESSOR( covY, &( m_data[12 * max_tracks].f ), &( m_data[13 * max_tracks].f ),
                        &( m_data[14 * max_tracks].f ) )
 
-    VEC3_SOA_ACCESSOR( cov1, &( m_data[15 * max_tracks].f ), &( m_data[16 * max_tracks].f ),
-                       &( m_data[17 * max_tracks].f ) )
-    VEC3_SOA_ACCESSOR( cov2, &( m_data[18 * max_tracks].f ), &( m_data[19 * max_tracks].f ),
-                       &( m_data[20 * max_tracks].f ) )
-    VEC3_SOA_ACCESSOR( cov3, &( m_data[21 * max_tracks].f ), &( m_data[22 * max_tracks].f ),
-                       &( m_data[23 * max_tracks].f ) )
-
     /// Retrieve the momentum
     template <typename T>
     inline T p( int t ) const {
@@ -105,7 +98,7 @@ namespace LHCb::Pr::Fitted::Forward {
     template <typename simd, typename maskT>
     inline void copy_back( const Tracks& from, int at, maskT mask ) {
       using intT = typename simd::int_v;
-      for ( int i = 0; i < 24; i++ ) {
+      for ( int i = 0; i < 15; i++ ) {
         intT( &( from.m_data[i * max_tracks + at].i ) ).compressstore( mask, &( m_data[i * max_tracks + m_size].i ) );
       }
       m_size += simd::popcount( mask );
diff --git a/Event/TrackEvent/Event/PrIterableFittedForwardTracks.h b/Event/TrackEvent/Event/PrIterableFittedForwardTracks.h
index ee54b31a14c..5aeaf5b42fe 100644
--- a/Event/TrackEvent/Event/PrIterableFittedForwardTracks.h
+++ b/Event/TrackEvent/Event/PrIterableFittedForwardTracks.h
@@ -72,26 +72,25 @@ namespace LHCb::Pr::Fitted::Forward {
 
     auto closestToBeamStateCovariance() const {
       MatrixSym5x5 cov{ROOT::Math::SMatrixNoInit{}};
+      auto const   qop  = qOverP();
       auto const   covX = this->m_tracks->template covX<FType>( this->offset() );
       auto const   covY = this->m_tracks->template covY<FType>( this->offset() );
-      auto const   cov1 = this->m_tracks->template cov1<FType>( this->offset() );
-      auto const   cov2 = this->m_tracks->template cov2<FType>( this->offset() );
-      auto const   cov3 = this->m_tracks->template cov3<FType>( this->offset() );
       cov( 0, 0 )       = cast( covX.x ); // x error
       cov( 0, 2 )       = cast( covX.y ); // x-tx covariance
       cov( 2, 2 )       = cast( covX.z ); // tx error
       cov( 1, 1 )       = cast( covY.x ); // y error
       cov( 1, 3 )       = cast( covY.y ); // y-ty covariance
       cov( 3, 3 )       = cast( covY.z ); // ty error
-      cov( 0, 1 )       = cast( cov1.x ); // x-y covariance
-      cov( 0, 3 )       = cast( cov1.y ); // x-ty covariance
-      cov( 0, 4 )       = cast( cov1.z ); // x-qop covariance
-      cov( 1, 2 )       = cast( cov2.x ); // y-tx covariance
-      cov( 1, 4 )       = cast( cov2.y ); // y-qop covariance
-      cov( 2, 3 )       = cast( cov2.z ); // tx-ty covariance
-      cov( 2, 4 )       = cast( cov3.x ); // tx-qop covariance
-      cov( 3, 4 )       = cast( cov3.y ); // ty-qop covariance
-      cov( 4, 4 )       = cast( cov3.z ); // qop-qop covariance
+      cov( 0, 1 )       = 0.f;            // x-y covariance
+      cov( 0, 3 )       = 0.f;            // x-ty covariance
+      cov( 0, 4 )       = 0.f;            // x-qop covariance
+      cov( 1, 2 )       = 0.f;            // y-tx covariance
+      cov( 1, 4 )       = 0.f;            // y-qop covariance
+      cov( 2, 3 )       = 0.f;            // tx-ty covariance
+      cov( 2, 4 )       = 0.f;            // tx-qop covariance
+      cov( 3, 4 )       = 0.f;            // ty-qop covariance
+      // FIXME this hack should not be hardcoded
+      cov( 4, 4 ) = .1f * qop * qop; // qop erro
       return cov;
     }
 
-- 
GitLab