diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GSFTsos.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GSFTsos.h index d3ab66a5df1bbe8301d1e947c07478eee0d23563..ee0d9ab0035084dc649f8bbd0ca72652eefaeabe 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GSFTsos.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GSFTsos.h @@ -2,6 +2,13 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ +/** + * @file /GSFTsos.h + * @begin September 2023 + * @author Christos Anastopoulos + * @brief Simplified TSos for internal GSF use + */ + #ifndef TrkGsfTsos_H #define TrkGsfTsos_H @@ -9,10 +16,15 @@ struct GSFTsos { + // Full state Trk::MultiComponentState multiComponentState{}; + // Collapsed to single Parameters state std::unique_ptr<Trk::TrackParameters> trackParameters{}; + // Measurement std::unique_ptr<Trk::MeasurementBase> measurementOnTrack{}; + // FitQuality Trk::FitQualityOnSurface fitQualityOnSurface{}; + // Type of TSOS std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typeFlags{}; @@ -24,7 +36,7 @@ struct GSFTsos { // implement copy and copy assignment GSFTsos(const GSFTsos& rhs) = delete; - GSFTsos& operator=(const GSFTsos& rhs) =delete; + GSFTsos& operator=(const GSFTsos& rhs) = delete; // Full constructor with passing of type flags GSFTsos( @@ -52,7 +64,7 @@ struct GSFTsos { if (measurementOnTrack) { typeFlags.set(Trk::TrackStateOnSurface::Measurement); } - if (trackParameters) { + if (!multiComponentState.empty()) { typeFlags.set(Trk::TrackStateOnSurface::Parameter); } if (fitQualityOnSurface) { @@ -61,6 +73,9 @@ struct GSFTsos { } // convert pass ownership to MTSOS std::unique_ptr<const Trk::MultiComponentStateOnSurface> convert(bool slim) { + if (!trackParameters) { + trackParameters = multiComponentState.front().first->uniqueClone(); + } if (slim) { multiComponentState.clear(); } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx index 04cd9b6c23a56d3746278ed78f7dcef1ac3b48e1..354b32d0c3b8fab8bb571c2ad8d4713a4459e8f6 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx @@ -71,13 +71,11 @@ GSFTsos smootherHelper( Trk::MultiComponentState&& updatedState, std::unique_ptr<Trk::MeasurementBase>&& measurement, const Trk::FitQualityOnSurface& fitQuality, - bool islast, + bool combineToSingle, bool useMode) { - // If is the last we want also to combine - // the Multi component state in a single TrackParameter - if (islast) { + if (combineToSingle) { auto combinedLastState = Trk::MultiComponentStateCombiner::combineToSingle( updatedState, useMode); if (combinedLastState) { @@ -85,8 +83,7 @@ GSFTsos smootherHelper( std::move(updatedState)}; } } - return {fitQuality, std::move(measurement), - updatedState.front().first->uniqueClone(), std::move(updatedState)}; + return {fitQuality, std::move(measurement), nullptr, std::move(updatedState)}; } } // end of anonymous namespace @@ -821,7 +818,7 @@ Trk::GaussianSumFitter::stepForwardFit( forwardTrajectory.emplace_back( fitQuality, std::move(measurement), - extrapolatedState.front().first->uniqueClone(), + nullptr, // used below for the updated state so clone Trk::MultiComponentStateHelpers::clone(extrapolatedState), type); @@ -831,7 +828,7 @@ Trk::GaussianSumFitter::stepForwardFit( } else { forwardTrajectory.emplace_back(fitQuality, std::move(measurement), - extrapolatedState.front().first->uniqueClone(), + nullptr, std::move(extrapolatedState)); } return true; @@ -972,7 +969,7 @@ Trk::GaussianSumFitter::smootherFit( smoothedTrajectory.emplace_back( FitQualityOnSurface(1, 1), std::move(measurement), - extrapolatedState.front().first->uniqueClone(), + nullptr, std::move(extrapolatedState), type); loopUpdatedState = &(smoothedTrajectory.back().multiComponentState); @@ -1086,7 +1083,7 @@ Trk::GaussianSumFitter::addCCOT( smoothedTrajectory.emplace_back( fitQuality, std::unique_ptr<Trk::CaloCluster_OnTrack>(ccot->clone()), - updatedState.front().first->uniqueClone(), + nullptr, std::move(updatedState)); // Now build a dummy measurement .... we dont want to a double count the