14#include "Acts/Geometry/TrackingGeometry.hpp"
15#include "Acts/Geometry/GeometryIdentifier.hpp"
16#include "Acts/Utilities/TrackHelpers.hpp"
17#include "Acts/TrackFitting/MbfSmoother.hpp"
18#include "Acts/Utilities/Logger.hpp"
33#include <Acts/Propagator/StandardAborters.hpp>
43 static std::optional<ActsTrk::detail::RecoTrackStateContainerProxy> getFirstMeasurementFromTrack(
typename ActsTrk::detail::RecoTrackContainer::TrackProxy trackProxy) {
44 std::optional<ActsTrk::detail::RecoTrackStateContainerProxy>
firstMeasurement {std::nullopt};
45 for (
auto st : trackProxy.trackStatesReversed()) {
49 if (not
st.typeFlags().hasMeasurement())
continue;
50 if (
st.typeFlags().isOutlier())
continue;
99 return StatusCode::FAILURE;
104 Acts::GreedyAmbiguityResolution::Config cfg;
115 return StatusCode::FAILURE;
119 return StatusCode::SUCCESS;
126 return StatusCode::SUCCESS;
144 std::vector<const ActsTrk::SeedContainer *> seedContainers;
145 std::size_t total_seeds = 0;
149 std::vector< std::unique_ptr< std::vector<int> > > destinies {};
151 destinies.reserve( seedContainers.size() );
152 for (std::size_t i(0); i<seedContainers.size(); ++i) {
153 destinies.push_back( std::make_unique< std::vector<int> >( seedContainers.at(i)->size(),
DestinyType::UNKNOWN) );
158 std::vector<const xAOD::UncalibratedMeasurementContainer *> uncalibratedMeasurementContainers;
159 std::size_t total_measurements = 0;
166 std::vector< const InDet::SiDetectorElementStatus *> det_el_status_arr;
167 const std::vector<const InDetDD::SiDetectorElementCollection*> &det_el_collections =volumeIdToDetectorElementCollMap->collections();
168 det_el_status_arr.resize( det_el_collections.size(),
nullptr);
172 const std::vector<const InDetDD::SiDetectorElementCollection*>::const_iterator
173 det_el_col_iter = std::find(det_el_collections.begin(),
174 det_el_collections.end(),
175 &det_el_status->getDetectorElements());
176 det_el_status_arr.at(det_el_col_iter - det_el_collections.begin()) = det_el_status.
cptr();
180 for (std::size_t icontainer = 0; icontainer < uncalibratedMeasurementContainers.size(); ++icontainer) {
181 measurementIndex.
addMeasurements(*uncalibratedMeasurementContainers[icontainer]);
185 for (std::size_t icontainer = 0; icontainer < uncalibratedMeasurementContainers.size(); ++icontainer) {
188 *uncalibratedMeasurementContainers[icontainer],
204 for (std::size_t icontainer = 0; icontainer < seedContainers.size(); ++icontainer)
206 duplicateSeedDetector.
addSeeds(icontainer, *seedContainers[icontainer], measurementIndex,
209 const bool reverseSearch = m_autoReverseSearch && shouldReverseSearch(seed);
210 const bool refitSeeds = icontainer < m_refitSeeds.size() && m_refitSeeds[icontainer];
211 const bool useTopSp = reverseSearch && !refitSeeds;
222 Acts::Vector3 beamPos( beamSpotData->
beamPos().x() * Acts::UnitConstants::mm,
223 beamSpotData->
beamPos().y() * Acts::UnitConstants::mm,
227 std::shared_ptr<Acts::PerigeeSurface> pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(beamPos);
237 Acts::VectorTrackContainer actsTrackBackend;
238 Acts::VectorMultiTrajectory actsTrackStateBackend;
240 std::lock_guard<std::mutex>
lock( m_mutex );
241 actsTrackBackend.reserve(m_nTrackReserve);
242 actsTrackStateBackend.reserve(m_nTrackStateReserve);
245 actsTrackStateBackend);
252 event_stat.resize(m_stat.size());
262 std::optional<std::vector<unsigned int>> trackCategories;
263 if (
m_ambi) trackCategories.emplace();
266 for (std::size_t icontainer = 0; icontainer < seedContainers.size(); ++icontainer)
273 duplicateSeedDetector,
274 *seedContainers.at(icontainer),
284 ATH_MSG_DEBUG(
" \\__ Created " << actsTracksContainer.size() <<
" tracks");
286 mon_nTracks = actsTracksContainer.size();
295 for (std::size_t i(0); i<destinies.size(); ++i) {
304 std::lock_guard<std::mutex>
lock( m_mutex );
306 if (actsTrackBackend.size() > m_nTrackReserve) {
307 m_nTrackReserve =
static_cast<std::size_t
>( std::ceil(
m_memorySafetyMargin * actsTrackBackend.size()) );
309 if (actsTrackStateBackend.size() > m_nTrackStateReserve) {
310 m_nTrackStateReserve =
static_cast<std::size_t
>( std::ceil(
m_memorySafetyMargin * actsTrackStateBackend.size()) );
319 ATH_MSG_DEBUG(
" \\__ Created " << actsTracksContainer.size() <<
" resolved tracks");
321 std::move(actsTrackBackend),
322 std::move(actsTrackStateBackend) ) );
323 return StatusCode::SUCCESS;
328 Acts::VectorTrackContainer resolvedTrackBackend;
329 Acts::VectorMultiTrajectory resolvedTrackStateBackend;
330 resolvedTrackBackend.reserve( actsTrackBackend.size() );
331 resolvedTrackStateBackend.reserve( actsTrackStateBackend.size() );
338 Acts::GreedyAmbiguityResolution::State state;
349 for (
auto iTrack : state.selectedTracks) {
350 int actsTrackIndex = state.trackTips.at(iTrack);
351 auto destProxy = resolvedTracksContainer.makeTrack();
352 destProxy.copyFrom(actsTracksContainer.getTrack(actsTrackIndex));
354 unsigned int category_i = trackCategories->at(actsTrackIndex);
358 auto [nShared, nBadTrackMeasurements] = sharedHits_forFinalAmbi.
computeSharedHits(destProxy, resolvedTracksContainer, measurementIndex);
359 if (nBadTrackMeasurements > 0)
360 ATH_MSG_ERROR(
"computeSharedHits: " << nBadTrackMeasurements <<
" track measurements not found in input track");
364 ATH_MSG_DEBUG(
" \\__ Created " << resolvedTracksContainer.size() <<
" resolved tracks");
368 std::move(resolvedTrackBackend),
369 std::move(resolvedTrackStateBackend)) );
371 return StatusCode::SUCCESS;
375 Acts::VectorTrackContainer&& originalTrackBackend,
376 Acts::VectorMultiTrajectory&& originalTrackStateBackend)
const
379 Acts::ConstVectorTrackContainer constTrackBackend( std::move(originalTrackBackend) );
380 Acts::ConstVectorMultiTrajectory constTrackStateBackend( std::move(originalTrackStateBackend) );
381 std::unique_ptr< ActsTrk::TrackContainer> constTracksContainer = std::make_unique< ActsTrk::TrackContainer >( std::move(constTrackBackend),
382 std::move(constTrackStateBackend) );
386 ATH_CHECK(trackContainerHandle.
record(std::move(constTracksContainer)));
387 return StatusCode::SUCCESS;
393 const double r = bottom_sp->
radius();
394 const double z = std::abs(bottom_sp->
z());
399 return r > rBoundary ||
z > zBoundary;
413 std::size_t typeIndex,
414 const char *seedType,
416 std::vector<int>* destiny,
417 const Acts::PerigeeSurface& pSurface,
418 std::optional<std::vector<unsigned int>>& trackCategories)
const
422 auto [options, secondOptions, measurementSelector] =
getDefaultOptions(ctx, detContext, measurements, &pSurface);
425 Acts::VectorTrackContainer trackBackend;
426 Acts::VectorMultiTrajectory trackStateBackend;
433 std::size_t category_i = 0;
435 auto stopBranchProxy = [&](
const detail::RecoTrackContainer::TrackProxy &track,
437 return stopBranch(track, trackState, trackSelectorCfg, detContext.
geometry, measurementIndex, typeIndex, event_stat[category_i]);
439 options.extensions.branchStopper.connect(stopBranchProxy);
441 Acts::PropagatorOptions<detail::Stepper::Options, detail::Navigator::Options,
442 Acts::ActorList<Acts::MaterialInteractor>>
445 Acts::TrackExtrapolationStrategy extrapolationStrategy =
446 Acts::TrackExtrapolationStrategy::first;
449 ATH_MSG_DEBUG(
"Invoke track finding with " << seeds.
size() <<
' ' << seedType <<
" seeds.");
452 std::size_t nPrinted = 0;
455 auto retrieveSurfaceFunction =
461 if (geoid_iter == detectorElementToGeometryIdMapPtr->end()) {
462 throw std::runtime_error(
"measurement not linked to Acts surface.");
472 for (
unsigned int iseed = 0; iseed < seeds.
size(); ++iseed)
478 tracksContainerTemp.clear();
482 const bool useTopSp = reverseSearch && !refitSeeds;
485 const bool isDupSeed = duplicateSeedDetector.
isDuplicate(typeIndex, iseed);
490 ATH_MSG_DEBUG(
"skip " << seedType <<
" seed " << iseed <<
" - already found");
499 options.propagatorPlainOptions.direction = reverseSearch ? Acts::Direction::Backward() : Acts::Direction::Forward();
500 secondOptions.propagatorPlainOptions.direction = options.propagatorPlainOptions.direction.invert();
501 options.targetSurface = reverseSearch ? &pSurface :
nullptr;
502 secondOptions.targetSurface = reverseSearch ? nullptr : &pSurface;
506 std::optional<Acts::BoundTrackParameters> optTrackParams =
511 retrieveSurfaceFunction);
513 if (!optTrackParams) {
514 ATH_MSG_DEBUG(
"Failed to estimate track parameters for seed " << iseed);
524 Acts::BoundTrackParameters *initialParameters = &(*optTrackParams);
525 printSeed(iseed, detContext, seeds, *initialParameters, measurementIndex, nPrinted, seedType);
526 if (isDupSeed)
continue;
528 double etaInitial = -std::log(std::tan(0.5 * initialParameters->theta()));
534 std::unique_ptr<Acts::BoundTrackParameters> refitSeedParameters;
536 refitSeedParameters =
doRefit(seed, *initialParameters, detContext, reverseSearch);
537 if (refitSeedParameters.get() ==
nullptr) {
542 if (refitSeedParameters.get() != initialParameters) {
543 initialParameters = refitSeedParameters.get();
544 printSeed(iseed, detContext, seeds, *initialParameters, measurementIndex, nPrinted, seedType,
true);
548 auto measurementRangesForced =
550 : std::unique_ptr<ActsTrk::detail::MeasurementRangeListFlat>();
551 measurementSelector->setMeasurementRangesForced(measurementRangesForced.get());
552 if (measurementRangesForced)
556 Acts::Result<std::vector<TrkProxy> > result =
557 trackFinder().
ckf.findTracks(*initialParameters, options, tracksContainerTemp);
560 if (not result.ok()) {
561 ATH_MSG_WARNING(
"Track finding failed for " << seedType <<
" seed " << iseed <<
" with error" << result.error());
565 auto &tracksForSeed = result.value();
569 std::size_t ntracks = 0ul;
572 std::size_t nfirst = 0;
573 for (
TrkProxy &firstTrack : tracksForSeed) {
576 auto smoothingResult = Acts::smoothTrack(detContext.
geometry, firstTrack,
logger(), Acts::MbfSmoother());
577 if (!smoothingResult.ok()) {
579 << iseed <<
" and first track " << firstTrack.index()
580 <<
" failed with error " << smoothingResult.error());
590 extrapolationStrategy,
595 duplicateSeedDetector,
609 std::optional<detail::RecoTrackStateContainerProxy> firstMeas = getFirstMeasurementFromTrack(firstTrack);
611 if (not firstMeas.has_value()) {
612 ATH_MSG_ERROR(
"Could not retrieve first measurement from track proxy. Is it ill-formed?");
613 return StatusCode::FAILURE;
618 std::vector<typename detail::RecoTrackContainer::TrackProxy> secondTracksForSeed =
624 if ( secondTracksForSeed.empty() ) {
625 ATH_MSG_DEBUG(
"No viable result from second track finding for " << seedType <<
" seed " << iseed <<
" track " << nfirst);
630 extrapolationStrategy,
635 duplicateSeedDetector,
648 auto originalFirstMeasurementPrevious = firstMeasurement.previous();
649 for (
auto &secondTrack : secondTracksForSeed) {
650 secondTrack.reverseTrackStates(
true);
652 firstMeasurement.previous() = secondTrack.outermostTrackState().index();
653 secondTrack.tipIndex() = firstTrack.tipIndex();
657 auto secondSmoothingResult = Acts::smoothTrack(detContext.
geometry,
660 if ( not secondSmoothingResult.ok() ) {
663 secondTrack.reverseTrackStates(
true);
670 extrapolationStrategy,
675 duplicateSeedDetector,
687 firstMeasurement.previous() = originalFirstMeasurementPrevious;
701 ATH_MSG_DEBUG(
"Track finding found no track candidates for " << seedType <<
" seed " << iseed);
703 }
else if (ntracks >= 2) {
708 std::cout << std::flush;
713 return StatusCode::SUCCESS;
722 const auto lastMeasurementIndex = track.tipIndex();
725 tracksContainer.trackStateContainer().visitBackwards(
726 lastMeasurementIndex,
727 [&duplicateSeedDetector,&measurementIndex](
const detail::RecoTrackStateContainer::ConstTrackStateProxy &state) ->
void
730 if (not state.hasUncalibratedSourceLink())
740 const std::vector< const InDet::SiDetectorElementStatus *> &det_el_status_arr,
742 const Acts::TrackingGeometry *
744 ATH_CHECK(acts_tracking_geometry !=
nullptr);
746 using Counter =
struct {
unsigned int n_volumes, n_volumes_with_status, n_missing_detector_elements, n_detector_elements, n_disabled_detector_elements;};
747 Counter counter {0u,0u,0u,0u,0u};
748 acts_tracking_geometry->visitVolumes([&counter,
749 &volume_id_to_det_el_coll,
752 this](
const Acts::TrackingVolume *volume_ptr) {
754 if (!volume_ptr)
return;
757 det_el_status = det_el_status_arr.at(volume_id_to_det_el_coll.
collecionMap().at(volume_ptr->geometryId().volume()));
759 ++counter.n_volumes_with_status;
760 volume_ptr->visitSurfaces([&counter, det_el_status, &measurements,
this](
const Acts::Surface *surface_ptr) {
763 if (!acts_detector_element) {
766 ++counter.n_detector_elements;
768 if (!det_el_status->
isGood( acts_detector_element->identifyHash() )) {
770 if (!old_range.
empty()) {
771 auto geoid_to_string = [](
const Acts::GeometryIdentifier &id) -> std::string {
772 std::stringstream amsg;
776 std::string a_msg ( geoid_to_string(surface_ptr->geometryId()));
778 <<
" measurements because surface " << a_msg);
780 ++counter.n_disabled_detector_elements;
786 ++counter.n_missing_detector_elements;
789 ATH_MSG_DEBUG(
"Volumes with detector element status " << counter.n_volumes_with_status <<
" / " << counter.n_volumes
790 <<
" disabled detector elements " << counter.n_disabled_detector_elements
791 <<
" / " << counter.n_detector_elements
792 <<
" missing detector elements "
793 << counter.n_missing_detector_elements);
794 return StatusCode::SUCCESS;
803 double etaSeed = std::atanh(pos[2] / pos.norm());
810 const Acts::BoundTrackParameters &seedParameters,
812 std::size_t& nPrinted,
813 const char *seedType,
819 ATH_MSG_INFO(
"CKF results for " << seeds.
size() <<
' ' << seedType <<
" seeds:");
829 template <
typename propagator_state_t,
typename stepper_t,
830 typename navigator_t>
831 Acts::Result<void> act(propagator_state_t& state,
const stepper_t& ,
832 const navigator_t& navigator, result_type& result,
833 const Acts::Logger& )
const {
834 const Acts::Surface* currentSurface = navigator.currentSurface(state.navigation);
835 if (currentSurface ==
nullptr) {
836 return Acts::Result<void>::success();
839 assert(result !=
nullptr &&
"Result type is nullptr");
841 if(detElem !=
nullptr) {
846 return Acts::Result<void>::success();
854 const Acts::Surface &referenceSurface,
856 Acts::TrackExtrapolationStrategy strategy,
859 Acts::PropagatorOptions<detail::Stepper::Options, detail::Navigator::Options,
860 Acts::ActorList<Acts::MaterialInteractor, Collector>>
863 auto findResult = findTrackStateForExtrapolation(
864 options.geoContext, track, referenceSurface, strategy,
logger());
866 if (!findResult.ok()) {
868 return findResult.error();
871 auto &[trackState, distance] = *findResult;
873 options.direction = Acts::Direction::fromScalarZeroAsPositive(distance);
875 Acts::BoundTrackParameters parameters = track.createParametersFromState(trackState);
876 ATH_MSG_VERBOSE(
"Extrapolating track to reference surface at distance "
877 << distance <<
" with direction " << options.direction
878 <<
" with starting parameters " << parameters);
880 auto state = propagator.makeState<
decltype(options), Acts::ForcedSurfaceReached>(referenceSurface, options);
882 collectorResult = &expectedLayerPattern;
884 auto initRes = propagator.initialize(state, parameters);
886 ATH_MSG_WARNING(
"Failed to initialize propagation state: " << initRes.error().message());
887 return initRes.error();
891 auto propagateOnlyResult =
892 propagator.propagate(state);
894 if (!propagateOnlyResult.ok()) {
895 ATH_MSG_WARNING(
"Failed to extrapolate track: " << propagateOnlyResult.error().message());
896 return propagateOnlyResult.error();
899 auto propagateResult = propagator.makeResult(
900 std::move(state), propagateOnlyResult, options,
true, &referenceSurface);
902 if (!propagateResult.ok()) {
903 ATH_MSG_WARNING(
"Failed to extrapolate track: " << propagateResult.error().message());
904 return propagateResult.error();
907 track.setReferenceSurface(referenceSurface.getSharedPtr());
908 track.parameters() = propagateResult->endParameters.value().parameters();
910 propagateResult->endParameters.value().covariance().value();
912 return Acts::Result<void>::success();
917 const Acts::Surface& pSurface,
918 const Acts::TrackExtrapolationStrategy& extrapolationStrategy,
924 std::vector<int>* destiny,
926 std::size_t& ntracks,
928 std::size_t category_i,
929 const char *seedType,
930 std::optional<std::vector<unsigned int>>& trackCategories)
const
933 std::array<unsigned int, 4> expectedLayerPattern{};
938 if (not track.hasReferenceSurface()) {
939 auto extrapolationResult =
943 extrapolationStrategy,
944 expectedLayerPattern);
946 if (not extrapolationResult.ok()) {
948 << iseed <<
" and " << track.index()
949 <<
" failed with error " << extrapolationResult.error()
950 <<
" dropping track candidate.");
952 return StatusCode::SUCCESS;
957 for(
const auto ts : track.trackStatesReversed()) {
959 if(detElem !=
nullptr) {
969 Acts::trimTrack(track,
true,
true,
true,
true);
970 Acts::calculateTrackQuantities(track);
973 for (
const auto trackState : track.trackStatesReversed()) {
984 if ( not
trackFinder().trackSelector.isValidTrack(track) or
986 ATH_MSG_DEBUG(
"Track " << ntracks <<
" from " << seedType <<
" seed " << iseed <<
" failed track selection");
990 return StatusCode::SUCCESS;
997 storeSeedInfo(tracksContainerTemp, track, duplicateSeedDetector, measurementIndex);
1000 auto actsDestProxy = actsTracksContainer.makeTrack();
1001 actsDestProxy.copyFrom(track);
1005 auto setTrackCategory = [&]() {
1006 if (!trackCategories)
return;
1007 if (!(actsDestProxy.index() < trackCategories->size())) trackCategories->resize(actsDestProxy.index()+1);
1008 trackCategories->at(actsDestProxy.index()) = category_i;
1012 return StatusCode::SUCCESS;
1015 auto [nShared, nBadTrackMeasurements] = sharedHits.
computeSharedHits(actsDestProxy, actsTracksContainer, measurementIndex);
1017 if (nBadTrackMeasurements > 0) {
1018 ATH_MSG_ERROR(
"computeSharedHits: " << nBadTrackMeasurements <<
" track measurements not found in input for " << seedType <<
" seed " << iseed <<
" track");
1021 ATH_MSG_DEBUG(
"found " << actsDestProxy.nSharedHits() <<
" shared hits in " << seedType <<
" seed " << iseed <<
" track");
1033 ATH_MSG_DEBUG(
"found " << actsDestProxy.nSharedHits() <<
" shared hits in " << seedType <<
" seed " << iseed <<
" track");
1037 auto [nSharedRemoved, nRemoveBadTrackMeasurements] = sharedHits.
computeSharedHits(actsDestProxy, actsTracksContainer, measurementIndex,
true);
1039 ATH_MSG_DEBUG(
"Removed " << nSharedRemoved <<
" shared hits in " << seedType <<
" seed " << iseed <<
" track and the matching track");
1041 if (nRemoveBadTrackMeasurements > 0) {
1042 ATH_MSG_ERROR(
"computeSharedHits with remove flag ON: " << nRemoveBadTrackMeasurements <<
1043 " track measurements not found in input for " << seedType <<
" seed " << iseed <<
" track");
1046 if (actsDestProxy.nSharedHits() != 0) {
1047 ATH_MSG_ERROR(
"computeSharedHits with remove flag ON returned " <<
1048 actsDestProxy.nSharedHits()<<
" while expecting 0 for" <<
1049 seedType <<
" seed " << iseed <<
" track");
1053 actsTracksContainer.removeTrack(actsDestProxy.index());
1054 ATH_MSG_DEBUG(
"Track " << ntracks <<
" from " << seedType <<
" seed " << iseed <<
" failed shared hit selection");
1065 return StatusCode::SUCCESS;
const ActsDetectorElement * getActsDetectorElement(const Acts::Surface &surf)
Attempts to retrieve the ActsDetectorElement associated to the passed ActsSurface.
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
Header file to be included by clients of the Monitored infrastructure.
size_t size() const
Number of registered mappings.
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
const std::array< unsigned char, 256 > & collecionMap() const
SG::WriteHandleKeyArray< std::vector< int > > m_seedDestiny
StatusCode findTracks(const EventContext &ctx, const DetectorContextHolder &detContext, const detail::TrackFindingMeasurements &measurements, const detail::MeasurementIndex &measurementIndex, detail::SharedHitCounter &sharedHits, detail::DuplicateSeedDetector &duplicateSeedDetector, const ActsTrk::SeedContainer &seeds, detail::RecoTrackContainer &actsTracksContainer, std::size_t seedCollectionIndex, const char *seedType, EventStats &event_stat, std::vector< int > *destiny, const Acts::PerigeeSurface &pSurface, std::optional< std::vector< unsigned int > > &trackCategories) const
invoke track finding procedure
Gaudi::Property< bool > m_countSharedHits
Gaudi::Property< unsigned int > m_maximumSharedHits
Gaudi::Property< float > m_memorySafetyMargin
SG::ReadHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_uncalibratedMeasurementContainerKeys
SG::ReadHandleKeyArray< ActsTrk::SeedContainer > m_seedContainerKeys
std::size_t getSeedCategory(std::size_t typeIndex, const ActsTrk::Seed &seed, bool useTopSp) const
SG::ReadCondHandleKey< ActsTrk::ActsVolumeIdToDetectorElementCollectionMap > m_volumeIdToDetectorElementCollMapKey
TrackFindingAlg(const std::string &name, ISvcLocator *pSvcLocator)
void printSeed(unsigned int iseed, const DetectorContextHolder &detContext, const ActsTrk::SeedContainer &seeds, const Acts::BoundTrackParameters &seedParameters, const detail::MeasurementIndex &measurementIndex, std::size_t &nPrinted, const char *seedType, bool isKF=false) const
Gaudi::Property< std::vector< bool > > m_refitSeeds
void storeSeedInfo(const detail::RecoTrackContainer &tracksContainer, const detail::RecoTrackContainerProxy &track, detail::DuplicateSeedDetector &duplicateSeedDetector, const detail::MeasurementIndex &measurementIndex) const
std::optional< Acts::GreedyAmbiguityResolution > m_ambi
StatusCode propagateDetectorElementStatusToMeasurements(const ActsTrk::ActsVolumeIdToDetectorElementCollectionMap &volume_id_to_det_el_coll, const std::vector< const InDet::SiDetectorElementStatus * > &det_el_status_arr, detail::TrackFindingMeasurements &measurements) const
Gaudi::Property< unsigned int > m_nMeasurementsMin
ToolHandle< ActsTrk::ITrackParamsEstimationTool > m_paramEstimationTool
Gaudi::Property< unsigned int > m_seedMeasOffset
virtual StatusCode initialize() override
Gaudi::Property< std::vector< double > > m_useTopSpRZboundary
Acts::Result< void > extrapolateTrackToReferenceSurface(const DetectorContextHolder &detContext, detail::RecoTrackContainerProxy &track, const Acts::Surface &referenceSurface, const detail::Extrapolator &propagator, Acts::TrackExtrapolationStrategy strategy, ExpectedLayerPattern &expectedLayerPattern) const
Gaudi::Property< bool > m_autoReverseSearch
StatusCode storeTrackCollectionToStoreGate(const EventContext &ctx, Acts::VectorTrackContainer &&originalTrackBackend, Acts::VectorMultiTrajectory &&originalTrackStateBackend) const
Gaudi::Property< unsigned int > m_maximumIterations
std::array< unsigned int, 4 > ExpectedLayerPattern
Gaudi::Property< bool > m_forceTrackOnSeed
Gaudi::Property< bool > m_skipDuplicateSeeds
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode finalize() override
StatusCode addTrack(const DetectorContextHolder &detContext, detail::RecoTrackContainerProxy &track, const Acts::Surface &pSurface, const Acts::TrackExtrapolationStrategy &extrapolationStrategy, detail::SharedHitCounter &sharedHits, detail::RecoTrackContainer &actsTracksContainer, const detail::MeasurementIndex &measurementIndex, const detail::RecoTrackContainer &tracksContainerTemp, detail::DuplicateSeedDetector &duplicateSeedDetector, std::vector< int > *destiny, EventStats &event_stat, std::size_t &ntracks, std::size_t iseed, std::size_t category_i, const char *seedType, std::optional< std::vector< unsigned int > > &trackCategories) const
Gaudi::Property< std::size_t > m_ambiStrategy
bool shouldReverseSearch(const ActsTrk::Seed &seed) const
SG::ReadHandleKeyArray< InDet::SiDetectorElementStatus > m_detElStatus
Gaudi::Property< std::vector< float > > m_statEtaBins
Gaudi::Property< bool > m_doTwoWay
Gaudi::Property< bool > m_dumpAllStatEtaBins
static xAOD::UncalibMeasType measurementType(const detail::RecoTrackContainer::TrackStateProxy &trackState)
ToolHandle< ActsTrk::TrackStatePrinterTool > m_trackStatePrinter
SG::WriteHandleKey< ActsTrk::TrackContainer > m_trackContainerKey
detail::RecoTrackContainer::TrackProxy TrkProxy
void copyStats(const EventStats &event_stat) const
CKF_pimpl & trackFinder()
std::size_t getStatCategory(std::size_t seed_collection, float eta) const
ToolHandle< GenericMonitoringTool > m_monTool
std::vector< typename detail::RecoTrackContainer::TrackProxy > doTwoWayTrackFinding(const detail::RecoTrackStateContainerProxy &firstMeasurement, const TrkProxy &trackProxy, detail::RecoTrackContainer &tracksContainerTemp, const TrackFinderOptions &options) const
Perform two-way track finding.
TrackFindingBaseAlg(const std::string &name, ISvcLocator *pSvcLocator)
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
@ kNForcedSeedMeasurements
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
std::size_t computeStatSum(std::size_t seed_collection, EStat counter_i, const EventStats &stat) const
virtual StatusCode initialize() override
StatusCode getContainersFromKeys(const EventContext &ctx, HandleArrayKeyType &handleKeyArray, std::vector< const ContainerType * > &outputContainers, std::size_t &sum) const
Take the array of handle keys and for each key retrieve containers, then append them to the output ve...
void checkCounts(const detail::RecoTrackContainer::TrackProxy &track) const
static void addCountsAndProperties(detail::RecoTrackContainer &tracksContainer, bool add_counts)
const Acts::Logger & logger() const
Private access to the logger.
BranchStopperResult stopBranch(const detail::RecoTrackContainer::TrackProxy &track, const detail::RecoTrackContainer::TrackStateProxy &trackState, const Acts::TrackSelector::EtaBinnedConfig &trackSelectorCfg, const Acts::GeometryContext &tgContext, const detail::MeasurementIndex &measurementIndex, const std::size_t typeIndex, EventStats::value_type &event_stat_category_i) const
Branch stopper.
static void initCounts(const detail::RecoTrackContainer::TrackProxy &track)
Gaudi::Property< bool > m_checkCounts
TrackFindingDefaultOptions getDefaultOptions(const EventContext &ctx, const DetectorContextHolder &detContext, const detail::TrackFindingMeasurements &measurements, const Acts::PerigeeSurface *pSurface) const
Get CKF options for first and second pass + pointer to MeasurementSelector.
std::unique_ptr< Acts::BoundTrackParameters > doRefit(const MeasurementSource &measurement, const Acts::BoundTrackParameters &initialParameters, const DetectorContextHolder &detContext, const bool paramsAtOutermostSurface) const
Perform Kalman Filter fit and update given initialParameters.
virtual StatusCode finalize() override
std::vector< std::array< unsigned int, kNStat > > EventStats
static void updateCounts(const detail::RecoTrackContainer::TrackProxy &track, Acts::ConstTrackStateTypeMap typeFlags, xAOD::UncalibMeasType detType)
Gaudi::Property< bool > m_addCounts
Acts::CombinatorialKalmanFilterBranchStopperResult BranchStopperResult
bool selectCountsFinal(const detail::RecoTrackContainer::TrackProxy &track) const
Gaudi::Property< std::vector< std::string > > m_seedLabels
bool isDuplicate(std::size_t typeIndex, index_t iseed)
void addMeasurement(const xAOD::UncalibratedMeasurement *sl, const MeasurementIndex &measurementIndex)
void addSeeds(std::size_t typeIndex, const ActsTrk::SeedContainer &seeds, const MeasurementIndex &measurementIndex)
void addMeasurements(const xAOD::UncalibratedMeasurementContainer &clusterContainer)
auto computeSharedHits(typename track_container_t::TrackProxy &track, track_container_t &tracks, const MeasurementIndex &measurementIndex, bool removeSharedHits=false) -> ReturnSharedAndBad
const std::vector< std::size_t > & measurementOffsets() const
std::unique_ptr< MeasurementRangeListFlat > createMeasurementRangesForced(const ActsTrk::Seed &seed, const MeasurementIndex &measurementIndex) const
void addMeasurements(std::size_t typeIndex, const xAOD::UncalibratedMeasurementContainer &clusterContainer, const DetectorElementToActsGeometryIdMap &detectorElementToGeoid, const MeasurementIndex *measurementIndex=nullptr)
MeasurementRange markSurfaceInsensitive(const Acts::GeometryIdentifier &identifier)
static const xAOD::UncalibratedMeasurement * unpack(const Acts::SourceLink &sl)
Helper method to unpack an Acts source link to an uncalibrated measurement.
const Amg::Vector3D & beamPos() const noexcept
bool isGood(IdentifierHash hash) const
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
const_pointer_type cptr()
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
Property holding a SG store/key/clid from which a WriteHandle is made.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Eigen::Map< const Eigen::Matrix< float, 3, 1 > > ConstVectorMap
DetectorIDHashType identifierHash() const
Returns the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash).
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
bool sourceLinkEquality(const Acts::SourceLink &a, const Acts::SourceLink &b)
Returns whether two source links are equal.
std::size_t sourceLinkHash(const Acts::SourceLink &sl)
Calculates the source link hash which is evaluated to be the identifier of the underlying sourcelink.
RecoTrackStateContainer::TrackStateProxy RecoTrackStateContainerProxy
Acts::TrackContainer< Acts::VectorTrackContainer, Acts::VectorMultiTrajectory > RecoTrackContainer
void addToExpectedLayerPattern(std::array< unsigned int, 4 > &pattern, const ActsDetectorElement &detElement)
RecoTrackContainer::TrackProxy RecoTrackContainerProxy
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Acts::CalibrationContext getCalibrationContext(const EventContext &ctx)
The Acts::Calibration context is piped through the Acts fitters to (re)calibrate the Acts::SourceLink...
DetectorElementKey makeDetectorElementKey(xAOD::UncalibMeasType meas_type, unsigned int identifier_hash)
const xAOD::UncalibratedMeasurement * firstMeasurement(const xAOD::MuonSegment &segment, const bool skipOutlier=true)
Retrieves the first measurement associated with the segment.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
TrackFitter
Enums to identify who created this track and which properties does it have.
@ KalmanFitter
tracks produced by the Kalman Fitter
static const Acts::GeometryIdentifier & getValue(const value_type &element)
std::size_t size() const noexcept
static void setFitterType(trackproxy_t &trackProxy, xAOD::TrackFitter fitterType)
set fitter type of a track
Acts::GeometryContext geometry
Acts::MagneticFieldContext magField
Acts::TrackSelector trackSelector
static void add(track_container_t &trackContainer)
static void set(track_proxy_t &track, std::array< unsigned int, 4 > values)
unsigned int elementEndIndex() const
unsigned int elementBeginIndex() const