668 if (not fitResult.ok()) {
672 std::unique_ptr<Trk::Track> newtrack =
nullptr;
675 const auto& acts_track = fitResult.value();
676 auto finalTrajectory = std::make_unique<Trk::TrackStates>();
679 int numberOfDeadPixel = 0;
680 int numberOfDeadSCT = 0;
682 std::vector<std::unique_ptr<const Acts::BoundTrackParameters>>
685 tracks.trackStateContainer().visitBackwards(
686 acts_track.tipIndex(), [&](
const auto& state) ->
void {
689 auto flag = state.typeFlags();
690 const auto* associatedDetEl =
691 state.referenceSurface().associatedDetectorElement();
692 if (not associatedDetEl) {
696 const auto* actsElement =
698 if (not actsElement) {
702 const auto* upstreamDetEl = actsElement->upstreamDetectorElement();
703 if (not upstreamDetEl) {
711 const auto* trkDetElem =
713 if (not trkDetElem) {
719 <<
static_cast<std::underlying_type_t<Trk::DetectorElemType>
>(
720 trkDetElem->detectorType()));
723 const auto* detElem =
731 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes>
733 std::unique_ptr<Trk::TrackParameters> parm;
736 if (
flag.test(Acts::TrackStateFlag::HoleFlag)) {
738 const Acts::BoundTrackParameters actsParam(
739 state.referenceSurface().getSharedPtr(), state.smoothed(),
740 state.smoothedCovariance(), acts_track.particleHypothesis());
742 actsParam, tgContext);
747 "Check if this is a hole, a dead sensors or a state outside the "
750 if (detElem->isPixel()) {
752 }
else if (detElem->isSCT()) {
762 }
else if (
flag.test(Acts::TrackStateFlag::OutlierFlag)) {
764 const Acts::BoundTrackParameters actsParam(
765 state.referenceSurface().getSharedPtr(), state.smoothed(),
766 state.smoothedCovariance(), acts_track.particleHypothesis());
768 actsParam, tgContext);
773 const Acts::BoundTrackParameters actsParam(
774 state.referenceSurface().getSharedPtr(), state.smoothed(),
775 state.smoothedCovariance(), acts_track.particleHypothesis());
777 actsSmoothedParam.push_back(
778 std::make_unique<const Acts::BoundTrackParameters>(
779 Acts::BoundTrackParameters(actsParam)));
781 actsParam, tgContext);
785 std::unique_ptr<Trk::MeasurementBase> measState;
786 if (state.hasUncalibratedSourceLink() && !SourceLinkType) {
788 state.getUncalibratedSourceLink().template get<ATLASSourceLink>();
791 }
else if (state.hasUncalibratedSourceLink() && SourceLinkType) {
794 auto sl = state.getUncalibratedSourceLink()
795 .template get<PRDSourceLinkGX2F>()
799 const IdentifierHash idHash = sl->detectorElement()->identifyHash();
800 int dim = state.calibratedSize();
801 std::unique_ptr<Trk::RIO_OnTrack> rot;
809 rot = std::make_unique<InDet::SCT_ClusterOnTrack>(
812 state.template calibrated<1>()[0],
Trk::loc1)),
813 state.template calibratedCovariance<1>(), idHash);
814 }
else if (
dim == 2) {
821 "Dimension is 2 but we need SCT_Cluster for this "
825 rot = std::make_unique<InDet::SCT_ClusterOnTrack>(
828 state.template calibrated<1>()[0],
Trk::loc1)),
829 state.template calibratedCovariance<1>(), idHash);
831 rot = std::make_unique<InDet::PixelClusterOnTrack>(
834 state.template calibratedCovariance<2>(), idHash);
837 throw std::domain_error(
"Cannot handle measurement dim>2");
842 double nDoF = state.calibratedSize();
846 std::move(parm),
nullptr, typePattern);
850 "State successfully created, adding it to the trajectory");
851 finalTrajectory->insert(finalTrajectory->begin(), perState);
856 const Acts::BoundTrackParameters actsPer(
857 acts_track.referenceSurface().getSharedPtr(), acts_track.parameters(),
858 acts_track.covariance(), acts_track.particleHypothesis());
859 std::unique_ptr<Trk::TrackParameters> per =
862 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes>
866 nullptr, std::move(per),
nullptr, typePattern);
868 finalTrajectory->insert(finalTrajectory->begin(), perState);
876 newtrack = std::make_unique<Trk::Track>(newInfo, std::move(finalTrajectory),