14#include "Acts/Geometry/TrackingGeometry.hpp"
15#include "Acts/Geometry/GeometryIdentifier.hpp"
16#include "Acts/Utilities/Helpers.hpp"
17#include "Acts/Utilities/TrackHelpers.hpp"
18#include "Acts/TrackFitting/MbfSmoother.hpp"
19#include "Acts/Utilities/Logger.hpp"
34#include <Acts/Propagator/StandardAborters.hpp>
44 static std::optional<ActsTrk::detail::RecoTrackStateContainerProxy> getFirstMeasurementFromTrack(
typename ActsTrk::detail::RecoTrackContainer::TrackProxy trackProxy) {
45 std::optional<ActsTrk::detail::RecoTrackStateContainerProxy>
firstMeasurement {std::nullopt};
46 for (
auto st : trackProxy.trackStatesReversed()) {
50 if (not
st.typeFlags().hasMeasurement())
continue;
51 if (
st.typeFlags().isOutlier())
continue;
100 Acts::GreedyAmbiguityResolution::Config cfg;
111 return StatusCode::FAILURE;
115 return StatusCode::SUCCESS;
122 return StatusCode::SUCCESS;
140 std::vector<const ActsTrk::SeedContainer *> seedContainers;
141 std::size_t total_seeds = 0;
145 std::vector< std::unique_ptr< std::vector<int> > > destinies {};
147 destinies.reserve( seedContainers.size() );
148 for (std::size_t i(0); i<seedContainers.size(); ++i) {
149 destinies.push_back( std::make_unique< std::vector<int> >( seedContainers.at(i)->size(),
DestinyType::UNKNOWN) );
154 std::vector<const xAOD::UncalibratedMeasurementContainer *> uncalibratedMeasurementContainers;
155 std::size_t total_measurements = 0;
162 std::vector< const InDet::SiDetectorElementStatus *> det_el_status_arr;
163 const std::vector<const InDetDD::SiDetectorElementCollection*> &det_el_collections =volumeIdToDetectorElementCollMap->collections();
164 det_el_status_arr.resize( det_el_collections.size(),
nullptr);
168 const std::vector<const InDetDD::SiDetectorElementCollection*>::const_iterator
169 det_el_col_iter = std::find(det_el_collections.begin(),
170 det_el_collections.end(),
171 &det_el_status->getDetectorElements());
172 det_el_status_arr.at(det_el_col_iter - det_el_collections.begin()) = det_el_status.
cptr();
176 for (std::size_t icontainer = 0; icontainer < uncalibratedMeasurementContainers.size(); ++icontainer) {
177 measurementIndex.
addMeasurements(*uncalibratedMeasurementContainers[icontainer]);
181 for (std::size_t icontainer = 0; icontainer < uncalibratedMeasurementContainers.size(); ++icontainer) {
184 *uncalibratedMeasurementContainers[icontainer],
200 for (std::size_t icontainer = 0; icontainer < seedContainers.size(); ++icontainer)
202 duplicateSeedDetector.
addSeeds(icontainer, *seedContainers[icontainer], measurementIndex,
212 Acts::Vector3 beamPos( beamSpotData->
beamPos().x() * Acts::UnitConstants::mm,
213 beamSpotData->
beamPos().y() * Acts::UnitConstants::mm,
217 std::shared_ptr<Acts::PerigeeSurface> pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(beamPos);
227 Acts::VectorTrackContainer actsTrackBackend;
228 Acts::VectorMultiTrajectory actsTrackStateBackend;
230 std::lock_guard<std::mutex>
lock( m_mutex );
231 actsTrackBackend.reserve(m_nTrackReserve);
232 actsTrackStateBackend.reserve(m_nTrackStateReserve);
235 actsTrackStateBackend);
242 event_stat.resize(m_stat.size());
252 std::optional<std::vector<unsigned int>> trackCategories;
253 if (
m_ambi) trackCategories.emplace();
256 for (std::size_t icontainer = 0; icontainer < seedContainers.size(); ++icontainer)
263 duplicateSeedDetector,
264 *seedContainers.at(icontainer),
274 ATH_MSG_DEBUG(
" \\__ Created " << actsTracksContainer.size() <<
" tracks");
276 mon_nTracks = actsTracksContainer.size();
285 for (std::size_t i(0); i<destinies.size(); ++i) {
294 std::lock_guard<std::mutex>
lock( m_mutex );
296 if (actsTrackBackend.size() > m_nTrackReserve) {
297 m_nTrackReserve =
static_cast<std::size_t
>( std::ceil(
m_memorySafetyMargin * actsTrackBackend.size()) );
299 if (actsTrackStateBackend.size() > m_nTrackStateReserve) {
300 m_nTrackStateReserve =
static_cast<std::size_t
>( std::ceil(
m_memorySafetyMargin * actsTrackStateBackend.size()) );
309 ATH_MSG_DEBUG(
" \\__ Created " << actsTracksContainer.size() <<
" resolved tracks");
311 std::move(actsTrackBackend),
312 std::move(actsTrackStateBackend) ) );
313 return StatusCode::SUCCESS;
318 Acts::VectorTrackContainer resolvedTrackBackend;
319 Acts::VectorMultiTrajectory resolvedTrackStateBackend;
320 resolvedTrackBackend.reserve( actsTrackBackend.size() );
321 resolvedTrackStateBackend.reserve( actsTrackStateBackend.size() );
328 Acts::GreedyAmbiguityResolution::State state;
339 for (
auto iTrack : state.selectedTracks) {
340 int actsTrackIndex = state.trackTips.at(iTrack);
341 auto destProxy = resolvedTracksContainer.makeTrack();
342 destProxy.copyFrom(actsTracksContainer.getTrack(actsTrackIndex));
344 unsigned int category_i = trackCategories->at(actsTrackIndex);
348 auto [nShared, nBadTrackMeasurements] = sharedHits_forFinalAmbi.
computeSharedHits(destProxy, resolvedTracksContainer, measurementIndex);
349 if (nBadTrackMeasurements > 0)
350 ATH_MSG_ERROR(
"computeSharedHits: " << nBadTrackMeasurements <<
" track measurements not found in input track");
354 ATH_MSG_DEBUG(
" \\__ Created " << resolvedTracksContainer.size() <<
" resolved tracks");
358 std::move(resolvedTrackBackend),
359 std::move(resolvedTrackStateBackend)) );
361 return StatusCode::SUCCESS;
365 Acts::VectorTrackContainer&& originalTrackBackend,
366 Acts::VectorMultiTrajectory&& originalTrackStateBackend)
const
369 Acts::ConstVectorTrackContainer constTrackBackend( std::move(originalTrackBackend) );
370 Acts::ConstVectorMultiTrajectory constTrackStateBackend( std::move(originalTrackStateBackend) );
371 std::unique_ptr< ActsTrk::TrackContainer> constTracksContainer = std::make_unique< ActsTrk::TrackContainer >( std::move(constTrackBackend),
372 std::move(constTrackStateBackend) );
376 ATH_CHECK(trackContainerHandle.
record(std::move(constTracksContainer)));
377 return StatusCode::SUCCESS;
391 std::size_t typeIndex,
392 const char *seedType,
394 std::vector<int>* destiny,
395 const Acts::PerigeeSurface& pSurface,
396 std::optional<std::vector<unsigned int>>& trackCategories)
const
400 auto [options, secondOptions, measurementSelector] =
getDefaultOptions(ctx, detContext, measurements, &pSurface);
403 Acts::VectorTrackContainer trackBackend;
404 Acts::VectorMultiTrajectory trackStateBackend;
411 std::size_t category_i = 0;
413 auto stopBranchProxy = [&](
const detail::RecoTrackContainer::TrackProxy &track,
415 return stopBranch(track, trackState, trackSelectorCfg, detContext.
geometry, measurementIndex, typeIndex, event_stat[category_i]);
417 options.extensions.branchStopper.connect(stopBranchProxy);
424 auto stopSecondBranchProxy = [&](
const detail::RecoTrackContainer::TrackProxy &track,
427 stopBranch(track, trackState, trackSelectorCfg, detContext.
geometry, measurementIndex, typeIndex, event_stat[category_i]);
428 return result == BranchStopperResult::StopAndDrop ? BranchStopperResult::StopAndKeep : result;
431 secondOptions.extensions.branchStopper.connect(stopSecondBranchProxy);
434 Acts::PropagatorOptions<detail::Stepper::Options, detail::Navigator::Options,
435 Acts::ActorList<Acts::MaterialInteractor>>
438 Acts::TrackExtrapolationStrategy extrapolationStrategy =
439 Acts::TrackExtrapolationStrategy::first;
442 ATH_MSG_DEBUG(
"Invoke track finding with " << seeds.
size() <<
' ' << seedType <<
" seeds.");
445 std::size_t nPrinted = 0;
448 auto retrieveSurfaceFunction =
454 if (geoid_iter == detectorElementToGeometryIdMapPtr->end()) {
455 throw std::runtime_error(
"measurement not linked to Acts surface.");
458 if (surface ==
nullptr) {
468 for (
unsigned int iseed = 0; iseed < seeds.
size(); ++iseed)
474 tracksContainerTemp.clear();
477 const bool isDupSeed = duplicateSeedDetector.
isDuplicate(typeIndex, iseed);
479 ATH_MSG_DEBUG(
"skip " << seedType <<
" seed " << iseed <<
" - already found");
488 const auto& [optTrackParams, estimationStatus] =
493 retrieveSurfaceFunction);
495 if (!optTrackParams) {
496 ATH_MSG_DEBUG(
"Failed to estimate track parameters for seed " << iseed);
506 printSeed(iseed, detContext, seeds, *optTrackParams, measurementIndex, nPrinted, seedType);
507 if (isDupSeed)
continue;
509 double etaInitial = -std::log(std::tan(0.5 * optTrackParams->theta()));
519 const auto &cutSet =
getCuts(etaInitial);
521 ATH_MSG_VERBOSE(
"min pt requirement not satisfied after param refinement: pt min is " << cutSet.ptMin <<
" but Refined params have pt of " << optTrackParams->transverseMomentum());
532 auto measurementRangesForced =
534 : std::unique_ptr<ActsTrk::detail::MeasurementRangeListFlat>();
535 measurementSelector->setMeasurementRangesForced(measurementRangesForced.get());
536 if (measurementRangesForced)
540 Acts::Result<std::vector<TrkProxy> > result =
541 trackFinder().
ckf.findTracks(*optTrackParams, options, tracksContainerTemp);
544 if (not result.ok()) {
545 ATH_MSG_WARNING(
"Track finding failed for " << seedType <<
" seed " << iseed <<
" with error" << result.error());
549 auto &tracksForSeed = result.value();
553 std::size_t ntracks = 0ul;
556 std::size_t nfirst = 0;
557 for (
TrkProxy &firstTrack : tracksForSeed) {
560 auto smoothingResult = Acts::smoothTrack(detContext.
geometry, firstTrack,
logger(), Acts::MbfSmoother());
561 if (!smoothingResult.ok()) {
563 << iseed <<
" and first track " << firstTrack.index()
564 <<
" failed with error " << smoothingResult.error());
574 extrapolationStrategy,
579 duplicateSeedDetector,
593 std::optional<detail::RecoTrackStateContainerProxy> firstMeas = getFirstMeasurementFromTrack(firstTrack);
595 if (not firstMeas.has_value()) {
596 ATH_MSG_ERROR(
"Could not retrieve first measurement from track proxy. Is it ill-formed?");
597 return StatusCode::FAILURE;
602 std::vector<typename detail::RecoTrackContainer::TrackProxy> secondTracksForSeed =
608 if ( secondTracksForSeed.empty() ) {
609 ATH_MSG_DEBUG(
"No viable result from second track finding for " << seedType <<
" seed " << iseed <<
" track " << nfirst);
614 extrapolationStrategy,
619 duplicateSeedDetector,
632 auto originalFirstMeasurementPrevious = firstMeasurement.previous();
633 for (
auto &secondTrack : secondTracksForSeed) {
634 secondTrack.reverseTrackStates(
true);
636 firstMeasurement.previous() = secondTrack.outermostTrackState().index();
637 secondTrack.tipIndex() = firstTrack.tipIndex();
648 extrapolationStrategy,
653 duplicateSeedDetector,
665 firstMeasurement.previous() = originalFirstMeasurementPrevious;
679 ATH_MSG_DEBUG(
"Track finding found no track candidates for " << seedType <<
" seed " << iseed);
681 }
else if (ntracks >= 2) {
686 std::cout << std::flush;
691 return StatusCode::SUCCESS;
700 const auto lastMeasurementIndex = track.tipIndex();
703 tracksContainer.trackStateContainer().visitBackwards(
704 lastMeasurementIndex,
705 [&duplicateSeedDetector,&measurementIndex](
const detail::RecoTrackStateContainer::ConstTrackStateProxy &state) ->
void
708 if (not state.hasUncalibratedSourceLink())
718 const std::vector< const InDet::SiDetectorElementStatus *> &det_el_status_arr,
720 const Acts::TrackingGeometry *
722 ATH_CHECK(acts_tracking_geometry !=
nullptr);
724 using Counter =
struct {
unsigned int n_volumes, n_volumes_with_status, n_missing_detector_elements, n_detector_elements, n_disabled_detector_elements;};
725 Counter counter {0u,0u,0u,0u,0u};
726 acts_tracking_geometry->visitVolumes([&counter,
727 &volume_id_to_det_el_coll,
730 this](
const Acts::TrackingVolume *volume_ptr) {
732 if (!volume_ptr)
return;
735 det_el_status = det_el_status_arr.at(volume_id_to_det_el_coll.
collecionMap().at(volume_ptr->geometryId().volume()));
737 ++counter.n_volumes_with_status;
738 volume_ptr->visitSurfaces([&counter, det_el_status, &measurements,
this](
const Acts::Surface *surface_ptr) {
741 if (!acts_detector_element) {
744 ++counter.n_detector_elements;
746 if (!det_el_status->
isGood( acts_detector_element->identifyHash() )) {
748 if (!old_range.
empty()) {
749 auto geoid_to_string = [](
const Acts::GeometryIdentifier &id) -> std::string {
750 std::stringstream amsg;
754 std::string a_msg ( geoid_to_string(surface_ptr->geometryId()));
756 <<
" measurements because surface " << a_msg);
758 ++counter.n_disabled_detector_elements;
764 ++counter.n_missing_detector_elements;
767 ATH_MSG_DEBUG(
"Volumes with detector element status " << counter.n_volumes_with_status <<
" / " << counter.n_volumes
768 <<
" disabled detector elements " << counter.n_disabled_detector_elements
769 <<
" / " << counter.n_detector_elements
770 <<
" missing detector elements "
771 << counter.n_missing_detector_elements);
772 return StatusCode::SUCCESS;
780 double etaSeed = std::atanh(pos[2] / pos.norm());
787 const Acts::BoundTrackParameters &seedParameters,
789 std::size_t& nPrinted,
790 const char *seedType,
796 ATH_MSG_INFO(
"CKF results for " << seeds.
size() <<
' ' << seedType <<
" seeds:");
806 template <
typename propagator_state_t,
typename stepper_t,
807 typename navigator_t>
808 Acts::Result<void> act(propagator_state_t& state,
const stepper_t& ,
809 const navigator_t& navigator, result_type& result,
810 const Acts::Logger& )
const {
811 const Acts::Surface* currentSurface = navigator.currentSurface(state.navigation);
812 if (currentSurface ==
nullptr) {
813 return Acts::Result<void>::success();
816 assert(result !=
nullptr &&
"Result type is nullptr");
818 if(detElem !=
nullptr) {
823 return Acts::Result<void>::success();
831 const Acts::Surface &referenceSurface,
833 Acts::TrackExtrapolationStrategy strategy,
836 Acts::PropagatorOptions<detail::Stepper::Options, detail::Navigator::Options,
837 Acts::ActorList<Acts::MaterialInteractor, Collector>>
840 auto findResult = findTrackStateForExtrapolation(
841 options.geoContext, track, referenceSurface, strategy,
logger());
843 if (!findResult.ok()) {
845 return findResult.error();
848 auto &[trackState, distance] = *findResult;
850 options.direction = Acts::Direction::fromScalarZeroAsPositive(distance);
852 Acts::BoundTrackParameters parameters = track.createParametersFromState(trackState);
853 ATH_MSG_VERBOSE(
"Extrapolating track to reference surface at distance "
854 << distance <<
" with direction " << options.direction
855 <<
" with starting parameters " << parameters);
857 auto state = propagator.makeState<
decltype(options), Acts::ForcedSurfaceReached>(options);
859 collectorResult = &expectedLayerPattern;
861 auto initRes = propagator.initialize<
decltype(state), Acts::ForcedSurfaceReached>(
862 state, parameters, &referenceSurface);
864 ATH_MSG_WARNING(
"Failed to initialize propagation state: " << initRes.error().message());
865 return initRes.error();
869 auto propagateOnlyResult =
870 propagator.propagate(state);
872 if (!propagateOnlyResult.ok()) {
873 ATH_MSG_WARNING(
"Failed to extrapolate track: " << propagateOnlyResult.error().message());
874 return propagateOnlyResult.error();
877 auto propagateResult = propagator.makeResult(
878 std::move(state), propagateOnlyResult, options,
true, &referenceSurface);
880 if (!propagateResult.ok()) {
881 ATH_MSG_WARNING(
"Failed to extrapolate track: " << propagateResult.error().message());
882 return propagateResult.error();
885 track.setReferenceSurface(referenceSurface.getSharedPtr());
886 track.parameters() = propagateResult->endParameters.value().parameters();
888 propagateResult->endParameters.value().covariance().value();
890 return Acts::Result<void>::success();
895 const Acts::Surface& pSurface,
896 const Acts::TrackExtrapolationStrategy& extrapolationStrategy,
902 std::vector<int>* destiny,
904 std::size_t& ntracks,
906 std::size_t category_i,
907 const char *seedType,
908 std::optional<std::vector<unsigned int>>& trackCategories)
const
911 std::array<unsigned int, 4> expectedLayerPattern{};
916 if (not track.hasReferenceSurface()) {
917 auto extrapolationResult =
921 extrapolationStrategy,
922 expectedLayerPattern);
924 if (not extrapolationResult.ok()) {
926 << iseed <<
" and " << track.index()
927 <<
" failed with error " << extrapolationResult.error()
928 <<
" dropping track candidate.");
930 return StatusCode::SUCCESS;
935 for(
const auto ts : track.trackStatesReversed()) {
937 if(detElem !=
nullptr) {
947 Acts::trimTrack(track,
true,
true,
true,
true);
948 Acts::calculateTrackQuantities(track);
951 for (
const auto trackState : track.trackStatesReversed()) {
962 if ( not
trackFinder().trackSelector.isValidTrack(track) or
964 ATH_MSG_DEBUG(
"Track " << ntracks <<
" from " << seedType <<
" seed " << iseed <<
" failed track selection");
968 return StatusCode::SUCCESS;
975 storeSeedInfo(tracksContainerTemp, track, duplicateSeedDetector, measurementIndex);
978 auto actsDestProxy = actsTracksContainer.makeTrack();
979 actsDestProxy.copyFrom(track);
983 auto setTrackCategory = [&]() {
984 if (!trackCategories)
return;
985 if (!(actsDestProxy.index() < trackCategories->size())) trackCategories->resize(actsDestProxy.index()+1);
986 trackCategories->at(actsDestProxy.index()) = category_i;
990 return StatusCode::SUCCESS;
993 auto [nShared, nBadTrackMeasurements] = sharedHits.
computeSharedHits(actsDestProxy, actsTracksContainer, measurementIndex);
995 if (nBadTrackMeasurements > 0) {
996 ATH_MSG_ERROR(
"computeSharedHits: " << nBadTrackMeasurements <<
" track measurements not found in input for " << seedType <<
" seed " << iseed <<
" track");
999 ATH_MSG_DEBUG(
"found " << actsDestProxy.nSharedHits() <<
" shared hits in " << seedType <<
" seed " << iseed <<
" track");
1011 ATH_MSG_DEBUG(
"found " << actsDestProxy.nSharedHits() <<
" shared hits in " << seedType <<
" seed " << iseed <<
" track");
1015 auto [nSharedRemoved, nRemoveBadTrackMeasurements] = sharedHits.
computeSharedHits(actsDestProxy, actsTracksContainer, measurementIndex,
true);
1017 ATH_MSG_DEBUG(
"Removed " << nSharedRemoved <<
" shared hits in " << seedType <<
" seed " << iseed <<
" track and the matching track");
1019 if (nRemoveBadTrackMeasurements > 0) {
1020 ATH_MSG_ERROR(
"computeSharedHits with remove flag ON: " << nRemoveBadTrackMeasurements <<
1021 " track measurements not found in input for " << seedType <<
" seed " << iseed <<
" track");
1024 if (actsDestProxy.nSharedHits() != 0) {
1025 ATH_MSG_ERROR(
"computeSharedHits with remove flag ON returned " <<
1026 actsDestProxy.nSharedHits()<<
" while expecting 0 for" <<
1027 seedType <<
" seed " << iseed <<
" track");
1031 actsTracksContainer.removeTrack(actsDestProxy.index());
1032 ATH_MSG_DEBUG(
"Track " << ntracks <<
" from " << seedType <<
" seed " << iseed <<
" failed shared hit selection");
1043 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_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(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
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
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
Gaudi::Property< unsigned int > m_seedMeasOffset
virtual StatusCode initialize() override
Acts::Result< void > extrapolateTrackToReferenceSurface(const DetectorContextHolder &detContext, detail::RecoTrackContainerProxy &track, const Acts::Surface &referenceSurface, const detail::Extrapolator &propagator, Acts::TrackExtrapolationStrategy strategy, ExpectedLayerPattern &expectedLayerPattern) const
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
ToolHandleArray< ActsTrk::ITrackParamsEstimationTool > m_paramEstimationTool
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
std::size_t getSeedCategory(std::size_t typeIndex, const ActsTrk::Seed &seed) const
Gaudi::Property< std::size_t > m_ambiStrategy
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
Gaudi::Property< double > m_seedRefitPtMinFactor
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)
@ kNForcedSeedMeasurements
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)
const Acts::TrackSelector::Config & getCuts(double eta) const
Retrieves track selector configuration for given eta value.
Gaudi::Property< bool > m_checkCounts
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
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.
virtual StatusCode finalize() override
ContextUtility m_ctxProvider
Utility to fetch the geometry, magnetic field and calibration context in the event.
Gaudi::Property< bool > m_doSecondPassBranchStopper
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...
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)
static const Acts::Surface * getSurface(const value_type &element)
Surface of the detector element, or nullptr if none was stored.
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::CalibrationContext calib
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