From e7e38e812a791f1cf1be878e3ef1d2d7a3cb2b09 Mon Sep 17 00:00:00 2001
From: Monir Hadji <monir.hadji@cern.ch>
Date: Thu, 5 Oct 2017 11:09:21 +0200
Subject: [PATCH] Fix track event fitter output

---
 Tr/TrackFitter/src/TrackEventFitter.cpp | 40 ++++++++++++-------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/Tr/TrackFitter/src/TrackEventFitter.cpp b/Tr/TrackFitter/src/TrackEventFitter.cpp
index 489e4e0b1ea..17103a00389 100644
--- a/Tr/TrackFitter/src/TrackEventFitter.cpp
+++ b/Tr/TrackFitter/src/TrackEventFitter.cpp
@@ -42,7 +42,7 @@ StatusCode TrackEventFitter::initialize() {
 
   m_tracksFitter.retrieve().ignore() ;
   // = tool<ITrackFitter>( m_fitterName, "Fitter", this );
-
+  
   // Print out the user-defined settings
   // -----------------------------------
   info() << inputLocation<0>() << " -> "<< outputLocation<0>() << " using "<<  m_tracksFitter->name() << endmsg;
@@ -55,7 +55,7 @@ StatusCode TrackEventFitter::initialize() {
 //=============================================================================
 LHCb::Tracks TrackEventFitter::operator()(const std::vector<LHCb::Track>& tracksCont) const {
   if ( msgLevel( MSG::DEBUG ) ) debug() << "==> Execute" << endmsg;
-
+  
   LHCb::Tracks tracks;
 
   // Loop over the tracks and fit them
@@ -75,9 +75,9 @@ LHCb::Tracks TrackEventFitter::operator()(const std::vector<LHCb::Track>& tracks
 
   std::for_each(trackReferences.begin(), trackReferences.end(), [&] (LHCb::Track& track) {
     if ( msgLevel( MSG::DEBUG ) ) {
-      debug() << "#### Fitting Track # " << track.key() << " ####" << endmsg
-              << "  # of states before fit:" << track.nStates() << endmsg ;
-      if(  track.nStates()>0 ) {
+      debug() << "#### Fitting Track # " << track->key() << " ####" << endmsg
+              << "  # of states before fit:" << track->nStates() << endmsg ;
+      if(  track->nStates()>0 ) {
         if( msgLevel( MSG::VERBOSE ) ) {
           verbose() << "  States are: " << endmsg;
           const std::vector<LHCb::State*>& allstates = track.states();
@@ -89,9 +89,9 @@ LHCb::Tracks TrackEventFitter::operator()(const std::vector<LHCb::Track>& tracks
                       << allstates[it]->covariance() << endmsg;
           }
         } else {
-          if ( msgLevel( MSG::DEBUG ) )
-            debug() << "  First state vector = " << track.firstState().stateVector()
-                    << " at z = " << track.firstState().z() << endmsg ;
+          if ( msgLevel( MSG::DEBUG ) ) 
+            debug() << "  First state vector = " << track->firstState().stateVector()
+                    << " at z = " << track->firstState().z() << endmsg ;
         }
       }
     }
@@ -117,29 +117,29 @@ LHCb::Tracks TrackEventFitter::operator()(const std::vector<LHCb::Track>& tracks
   for (auto zipped : ranges::view::zip(fittingTracks, qopBeforeVector)) {
     LHCb::Track& track = zipped.first;
     double& qopBefore = zipped.second;
-
+    
     if (track.fitStatus() == LHCb::Track::FitStatus::Fitted) {
-      std::string prefix = Gaudi::Utils::toString(track.type()) ;
+        std::string prefix = Gaudi::Utils::toString(track->type()) ;
       if( msgLevel( MSG::INFO ) ) {
         if ( msgLevel( MSG::DEBUG ) ) {
-          debug() << "Fitted successfully track # " << track.key() << endmsg;
+            debug() << "Fitted successfully track # " << track->key() << endmsg;
         }
         // Update counters
         if( track.checkFlag( LHCb::Track::Flags::Backward ) ) prefix += "Backward" ;
         prefix += '.' ;
-        if( track.nDoF()>0) {
-          double chisqprob = track.probChi2() ;
+          if( track->nDoF()>0) {
+            double chisqprob = track->probChi2() ;
           counter(prefix + "chisqprobSum") += chisqprob ;
           counter(prefix + "badChisq") += bool(chisqprob<0.01) ;
         }
-        counter(prefix + "flipCharge") += bool( qopBefore * track.firstState().qOverP() <0) ;
-        counter(prefix + "numOutliers") += track.nMeasurementsRemoved() ;
+          counter(prefix + "flipCharge") += bool( qopBefore * track->firstState().qOverP() <0) ;
+          counter(prefix + "numOutliers") += track->nMeasurementsRemoved() ;
       }
       // Add the track to the new Tracks container if it passes the chi2-cut
       // -----------------------------------------
       if ( m_maxChi2DoF > track.chi2PerDoF() ) tracks.add( &track );
       else{
-        delete &track;
+          delete track;
         counter(prefix + "RejectedChisqCut") += 1 ;
       }
     }
@@ -147,7 +147,7 @@ LHCb::Tracks TrackEventFitter::operator()(const std::vector<LHCb::Track>& tracks
       track.setFlag( LHCb::Track::Flags::Invalid, true );
       ++nFitFail;
       if ( msgLevel( MSG::DEBUG ) )
-        debug() << "Unable to fit the track # " << track.key() << endmsg;
+          debug() << "Unable to fit the track # " << track->key() << endmsg;
     }
   }
 
@@ -158,7 +158,7 @@ LHCb::Tracks TrackEventFitter::operator()(const std::vector<LHCb::Track>& tracks
     counter("nTracks") += nTracks;
     counter("nFitted") += ( nTracks - nFitFail - nBadInput);
     counter("nBadInput") += nBadInput ;
-
+    
     if ( msgLevel( MSG::DEBUG ) ) {
       if ( nFitFail == 0 )
         debug() << "All " << nTracks << " tracks fitted succesfully." << endmsg;
@@ -167,7 +167,7 @@ LHCb::Tracks TrackEventFitter::operator()(const std::vector<LHCb::Track>& tracks
                 << " out of " << nTracks-nBadInput << endmsg;
     }
   }
-
+  
   return tracks;
 }
 
@@ -183,7 +183,7 @@ StatusCode TrackEventFitter::finalize() {
     double nTracks = counter("nTracks").flag();
     if ( nTracks > 1e-3 )
       perf = float(100.0*counter("nFitted").flag() / nTracks);
-
+    
     info() << "  Fitting performance   : "
 	   << format( " %7.2f %%", perf ) << endmsg;
   }
-- 
GitLab