 |
ATLAS Offline Software
|
Go to the documentation of this file.
16 #include "Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp"
17 #include "Acts/Definitions/Units.hpp"
18 #include "Acts/EventData/VectorMultiTrajectory.hpp"
19 #include "Acts/EventData/VectorTrackContainer.hpp"
20 #include "Acts/Plugins/Json/AmbiguityConfigJsonConverter.hpp"
21 #include "Acts/Utilities/Logger.hpp"
30 static std::size_t sourceLinkHash(
const Acts::SourceLink &slink) {
35 return uncalibMeas.identifier();
38 static bool sourceLinkEquality(
const Acts::SourceLink &
a,
const Acts::SourceLink &
b) {
54 const std::string &
name, ISvcLocator *pSvcLocator)
59 Acts::ScoreBasedAmbiguityResolution::Config
cfg;
60 Acts::ConfigPair configPair;
64 "ActsConfig/ActsAmbiguityConfig.json",
"DATAPATH");
67 if (!
file.is_open()) {
68 std::cerr <<
"Error opening file: " <<
fileName << std::endl;
76 cfg.volumeMap = configPair.first;
77 cfg.detectorConfigs = configPair.second;
85 m_ambi = std::make_unique<Acts::ScoreBasedAmbiguityResolution>(
94 return StatusCode::SUCCESS;
98 ATH_MSG_INFO(
"Score-based Ambiguity Resolution statistics" << std::endl
100 std::array<std::string, kNStat>{
103 "Total shared hits"}).columnWidth(10));
104 return StatusCode::SUCCESS;
108 const EventContext &ctx)
const {
124 Acts::ScoreBasedAmbiguityResolution::Optionals<
125 typename decltype(updatedTracks)::ConstTrackProxy>
134 Optionals.scores.push_back(
140 std::vector<int> goodTracks =
m_ambi->solveAmbiguity(
141 updatedTracks, &sourceLinkHash, &sourceLinkEquality, Optionals);
143 ATH_MSG_DEBUG(
"Resolved to " << goodTracks.size() <<
" tracks from "
144 << updatedTracks.size());
149 Acts::VectorTrackContainer resolvedTrackBackend;
150 Acts::VectorMultiTrajectory resolvedTrackStateBackend;
153 resolvedTracksContainer.ensureDynamicColumns(updatedTracks);
158 std::size_t totalShared = 0;
159 for (
auto iTrack : goodTracks) {
160 auto destProxy = resolvedTracksContainer.getTrack(resolvedTracksContainer.addTrack());
161 destProxy.copyFrom(updatedTracks.getTrack(iTrack));
164 auto [nShared, nBadTrackMeasurements] = sharedHits.
computeSharedHitsDynamic(destProxy, resolvedTracksContainer, measurementIndex);
165 if (nBadTrackMeasurements > 0) {
166 ATH_MSG_ERROR(
"computeSharedHits: " << nBadTrackMeasurements <<
" track measurements not found in input track");
168 totalShared += nShared;
173 ATH_MSG_DEBUG(
"total number of shared hits = " << totalShared);
178 Acts::ConstVectorTrackContainer storableTrackBackend( std::move(resolvedTrackBackend) );
179 Acts::ConstVectorMultiTrajectory storableTrackStateBackend( std::move(resolvedTrackStateBackend) );
180 std::unique_ptr< ActsTrk::TrackContainer > storableTracksContainer = std::make_unique< ActsTrk::TrackContainer >( std::move(storableTrackBackend),
181 std::move(storableTrackStateBackend) );
183 if (resolvedTrackHandle.
record( std::move(storableTracksContainer)).isFailure()) {
185 return StatusCode::FAILURE;
188 return StatusCode::SUCCESS;
DetectorIdentType identifier() const
Returns the full Identifier of the measurement.
ToolHandle< GenericMonitoringTool > m_monTool
Group
Properties of a chain group.
const_pointer_type cptr()
Dereference the pointer.
void innermostPixelLayerHitsScore(const trackProxy_t &track, double &score)
Score modifier for tracks based on innermost pixel layer hits.
virtual StatusCode finalize() override
ScoreBasedAmbiguityResolutionAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &ctx) const override
const std::string & key() const
Return the StoreGate ID for the referenced object.
Acts::TrackContainer< Acts::VectorTrackContainer, Acts::VectorMultiTrajectory > RecoTrackContainer
Gaudi::Property< bool > m_useAmbiguityScoring
SG::ReadHandleKey< ActsTrk::TrackContainer > m_tracksKey
def timer(name, disabled=False)
Gaudi::Property< std::size_t > m_minUnshared
An algorithm that can be simultaneously executed in multiple threads.
auto computeSharedHitsDynamic(typename track_container_t::TrackProxy &track, track_container_t &tracks, MeasurementIndex &measurementIndex, bool removeSharedHits=false) -> ReturnSharedAndBad
std::unique_ptr< Acts::ScoreBasedAmbiguityResolution > m_ambi
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
TableUtils::StatTable< T > makeTable(const std::array< T, N > &counter, const std::array< std::string, N > &label)
Gaudi::Property< double > m_minScore
::StatusCode StatusCode
StatusCode definition for legacy code.
trackContainer_t addSummaryInformation(const ActsTrk::TrackContainer &trackContainer)
Adds summary information to the track container.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Header file to be included by clients of the Monitored infrastructure.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
void nSCTPixelHitsScore(const trackProxy_t &track, double &score)
Score modifier for tracks based on number of SCT and pixel hits.
void doubleHolesScore(const trackProxy_t &track, double &score)
Filter for tracks based on double holes.
const xAOD::UncalibratedMeasurement & getUncalibratedMeasurement(const ATLASUncalibSourceLink &source_link)
Gaudi::Property< double > m_minScoreSharedTracks
Gaudi::Property< std::size_t > m_maxShared
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Gaudi::Property< std::size_t > m_maxSharedTracksPerMeasurement
Gaudi::Property< bool > m_countSharedHits
SG::WriteHandleKey< ActsTrk::TrackContainer > m_resolvedTracksKey
void from_json(const nlohmann::json &j, NNJvtBinning &binning)
bool etaDependentCuts(const trackProxy_t &track)
Filter for tracks based on eta dependent cuts.
void ContribPixelLayersScore(const trackProxy_t &track, double &score)
Score modifier for tracks based on number of contributing pixel layers.
virtual StatusCode initialize() override