From 9edc58328b69ef7d8cca536e685ba5c2dfd8683e Mon Sep 17 00:00:00 2001 From: scott snyder Date: Sat, 3 Aug 2019 17:20:50 +0200 Subject: [PATCH] VrtSecInclusive: Update for Trk VKalVrtFitter interface changes. Update for interface changes in VKalVrtFitter needed to make it const. --- .../VrtSecInclusive/VrtSecInclusive.h | 2 + .../src/TrackSelectionAlgs.cxx | 2 +- .../VKalVrt/VrtSecInclusive/src/TruthAlgs.cxx | 10 +++-- .../VKalVrt/VrtSecInclusive/src/Utilities.cxx | 40 ++++++++++++------- .../VrtSecInclusive/src/VertexingAlgs.cxx | 26 ++++++------ 5 files changed, 49 insertions(+), 31 deletions(-) diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h b/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h index 883ec024cfe..9f4a5731ace 100755 --- a/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h +++ b/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h @@ -306,6 +306,8 @@ namespace VKalVrtAthena { const Trk::Perigee* GetPerigee( const xAOD::TrackParticle* i_ntrk); StatusCode RefitVertex( WrkVrt& WrkVrt, const xAOD::TrackParticleContainer* ); + StatusCode RefitVertex( WrkVrt& WrkVrt, const xAOD::TrackParticleContainer*, + Trk::IVKalState& istate); void FillCovMatrix(int iTrk, std::vector & Matrix, AmgSymMatrix(5)& ); diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/src/TrackSelectionAlgs.cxx b/Reconstruction/VKalVrt/VrtSecInclusive/src/TrackSelectionAlgs.cxx index 977886c6b1e..8019c270aa0 100644 --- a/Reconstruction/VKalVrt/VrtSecInclusive/src/TrackSelectionAlgs.cxx +++ b/Reconstruction/VKalVrt/VrtSecInclusive/src/TrackSelectionAlgs.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // Header include diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/src/TruthAlgs.cxx b/Reconstruction/VKalVrt/VrtSecInclusive/src/TruthAlgs.cxx index fa1c3d3e51f..b42830ddae2 100644 --- a/Reconstruction/VKalVrt/VrtSecInclusive/src/TruthAlgs.cxx +++ b/Reconstruction/VKalVrt/VrtSecInclusive/src/TruthAlgs.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // Header include @@ -512,8 +512,9 @@ namespace VKalVrtAthena { ATH_MSG_DEBUG( "> getNewTruthInfo() : mismatch numreco & re-fit size " << numReco << "," << ListMatBaseTracks.size() );} else{ ATH_MSG_DEBUG( "> getNewTruthInfo() : numreco & re-fit size " << numReco << "," << ListMatBaseTracks.size() ); - - m_fitSvc->setApproximateVertex( Vpos.x(), Vpos.y(), Vpos.z() ); + + std::unique_ptr state = m_fitSvc->makeState(); + m_fitSvc->setApproximateVertex( Vpos.x(), Vpos.y(), Vpos.z(), *state ); sc=m_fitSvc->VKalVrtFit( ListMatBaseTracks, dummyNeutrals, @@ -523,7 +524,8 @@ namespace VKalVrtAthena { newvrt.vertexCov, newvrt.Chi2PerTrk, newvrt.TrkAtVrt, - newvrt.Chi2 ); + newvrt.Chi2, + *state ); // // check if refit is success // diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx b/Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx index d61f14d4200..b87d036b8de 100755 --- a/Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx +++ b/Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // Header include @@ -151,9 +151,9 @@ namespace VKalVrtAthena { // Fit the new vertex ATH_MSG_VERBOSE(" >> DisassembleVertex(): > Fast Fit" ); - - m_fitSvc->setDefault(); - ATH_CHECK( m_fitSvc->VKalVrtFitFast( ListBaseTracks, newvrt.vertex ) ); + + std::unique_ptr state = m_fitSvc->makeState(); + ATH_CHECK( m_fitSvc->VKalVrtFitFast( ListBaseTracks, newvrt.vertex, *state ) ); ATH_MSG_VERBOSE( " >> DisassembleVertex(): > ApproxVertex: r = " << sqrt(newvrt.vertex[0]*newvrt.vertex[0] + newvrt.vertex[1]*newvrt.vertex[1]) << ", z = " << newvrt.vertex[2] ); @@ -161,11 +161,11 @@ namespace VKalVrtAthena { (wrkvrt.vertex[1]-newvrt.vertex[1])*(wrkvrt.vertex[1]-newvrt.vertex[1]) + (wrkvrt.vertex[2]-newvrt.vertex[2])*(wrkvrt.vertex[2]-newvrt.vertex[2]) > 100. ) { - m_fitSvc->setApproximateVertex( wrkvrt.vertex[0], wrkvrt.vertex[1], wrkvrt.vertex[2] ); + m_fitSvc->setApproximateVertex( wrkvrt.vertex[0], wrkvrt.vertex[1], wrkvrt.vertex[2], *state ); } else { - m_fitSvc->setApproximateVertex( newvrt.vertex[0], newvrt.vertex[1], newvrt.vertex[2] ); + m_fitSvc->setApproximateVertex( newvrt.vertex[0], newvrt.vertex[1], newvrt.vertex[2], *state ); } ATH_MSG_VERBOSE(" >> DisassembleVertex(): > Fit the new vertex" ); @@ -177,7 +177,8 @@ namespace VKalVrtAthena { newvrt.vertexCov, newvrt.Chi2PerTrk, newvrt.TrkAtVrt, - newvrt.Chi2 ); + newvrt.Chi2, + *state); if( sc.isFailure() ) continue; @@ -370,6 +371,13 @@ namespace VKalVrtAthena { //____________________________________________________________________________________________________ StatusCode VrtSecInclusive::RefitVertex( WrkVrt& WrkVrt, const xAOD::TrackParticleContainer* selectedTracks) + { + std::unique_ptr state = m_fitSvc->makeState(); + return RefitVertex (WrkVrt, selectedTracks, *state); + } + StatusCode VrtSecInclusive::RefitVertex( WrkVrt& WrkVrt, + const xAOD::TrackParticleContainer* selectedTracks, + Trk::IVKalState& istate) { // int i,j; @@ -391,21 +399,24 @@ namespace VKalVrtAthena { ATH_MSG_DEBUG(" >>> RefitVertex: WrkVrt.SelTrk[" << i << "] = " << j ); ListBaseTracks.emplace_back( selectedTracks->at(j) ); } +#if 0 + // Had no effect since it was followed by setDefault(). m_fitSvc->setApproximateVertex(WrkVrt.vertex[0], WrkVrt.vertex[1], - WrkVrt.vertex[2]); + WrkVrt.vertex[2], + istate); +#endif ATH_MSG_DEBUG( " >>> RefitVertex: ListBaseTracks.size = " << ListBaseTracks.size() ); for( auto *trk : ListBaseTracks ) { ATH_MSG_DEBUG( " >>> RefitVertex: ListBaseTracks = " << trk->index() ); } - - m_fitSvc->setDefault(); + ATH_MSG_DEBUG( " >>> RefitVertex: m_fitSvc is reset." ); Amg::Vector3D IniVertex; - StatusCode sc = m_fitSvc->VKalVrtFitFast( ListBaseTracks, IniVertex );/* Fast crude estimation */ + StatusCode sc = m_fitSvc->VKalVrtFitFast( ListBaseTracks, IniVertex, istate );/* Fast crude estimation */ if(sc.isFailure()) ATH_MSG_DEBUG(" >>> RefitVertex: fast crude estimation failed."); ATH_MSG_DEBUG( " >>> RefitVertex: Fast VKalVrtFit succeeded. vertex = (" << IniVertex.x() << ", " << IniVertex.y() << ", " << IniVertex.z() << ")" ); @@ -415,11 +426,11 @@ namespace VKalVrtAthena { (IniVertex.y()-OrigVertex.y())*(IniVertex.y()-OrigVertex.y()) + (IniVertex.z()-OrigVertex.z())*(IniVertex.z()-OrigVertex.z()) > 100. ) { - m_fitSvc->setApproximateVertex( OrigVertex.x(), OrigVertex.y(), OrigVertex.z() ); + m_fitSvc->setApproximateVertex( OrigVertex.x(), OrigVertex.y(), OrigVertex.z(), istate ); } else { - m_fitSvc->setApproximateVertex( IniVertex.x(), IniVertex.y(), IniVertex.z() ); + m_fitSvc->setApproximateVertex( IniVertex.x(), IniVertex.y(), IniVertex.z(), istate ); } @@ -432,7 +443,8 @@ namespace VKalVrtAthena { WrkVrt.vertexCov, WrkVrt.Chi2PerTrk, WrkVrt.TrkAtVrt, - WrkVrt.Chi2); + WrkVrt.Chi2, + istate); if(SC.isFailure()) ATH_MSG_DEBUG(" >>> RefitVertex: SC in RefitVertex returned failure "); ATH_MSG_VERBOSE(" >>> RefitVertex "<VKalVrtFitFast( ListBaseTracks, IniVertex );/* Fast crude estimation */ + std::unique_ptr state = m_fitSvc->makeState(); + StatusCode sc = m_fitSvc->VKalVrtFitFast( ListBaseTracks, IniVertex, *state );/* Fast crude estimation */ if(sc.isFailure()) ATH_MSG_DEBUG(" > extractIncompatibleTracks: fast crude estimation fails "); - m_fitSvc->setApproximateVertex( IniVertex.x(), IniVertex.y(), IniVertex.z() ); + m_fitSvc->setApproximateVertex( IniVertex.x(), IniVertex.y(), IniVertex.z(), *state ); // Vertex VKal Fitting sc = m_fitSvc->VKalVrtFit( ListBaseTracks, dummyNeutrals, FitVertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, - TrkAtVrt, Chi2 ); + TrkAtVrt, Chi2, + *state); if( sc.isFailure() ) continue; /* No fit */ @@ -225,7 +227,7 @@ namespace VKalVrtAthena { vector ListBaseTracks; vector dummyNeutrals(0); - m_fitSvc->setDefault(); + std::unique_ptr state = m_fitSvc->makeState(); auto pgraph = std::make_unique(); // Main iteration while(true) { @@ -260,7 +262,8 @@ namespace VKalVrtAthena { newvrt.vertexCov, newvrt.Chi2PerTrk, newvrt.TrkAtVrt, - newvrt.Chi2); + newvrt.Chi2, + *state); ATH_MSG_DEBUG(" > reconstruct2TrackVertices(): FoundAppVrt="<setDefault(); while( (FoundMax=MaxOfShared( WrkVrtSet, TrkInVrt, SelectedTrack, SelectedVertex))>0 ) { // std::cout << "MAX="<setDefault(); - m_fitSvc->setMomCovCalc(1); - // Loop over vertices for( auto WrkVrt : *WrkVrtSet ) { + std::unique_ptr state = m_fitSvc->makeState(); + WrkVrt.Good = false; int nth = WrkVrt.SelTrk.size(); if(nth <= 1) continue; /* Bad vertices */ - StatusCode sc = RefitVertex( WrkVrt, selectedBaseTracks); + StatusCode sc = RefitVertex( WrkVrt, selectedBaseTracks, *state); if( sc.isFailure() ) continue; /* Bad fit - goto next solution */ @@ -513,7 +514,8 @@ namespace VKalVrtAthena { // CovMtx(2,2) =WrkVrt.vertexCov[5]; std::vector CovFull; - sc = m_fitSvc->VKalGetFullCov( static_cast( nth ), CovFull); + sc = m_fitSvc->VKalGetFullCov( static_cast( nth ), CovFull, + *state); if( sc.isFailure() ) ATH_MSG_VERBOSE(" here 6 "); -- GitLab