Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
AmbiguityResolutionMLAlgorithm.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file AmbiguityResolutionMLAlgorithm.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2023 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#include "
ActsExamples/TrackFindingML/AmbiguityResolutionMLAlgorithm.hpp
"
10
11
#include "
ActsExamples/Framework/ProcessCode.hpp
"
12
13
#include <iterator>
14
#include <map>
15
16
ActsExamples::AmbiguityResolutionMLAlgorithm::AmbiguityResolutionMLAlgorithm
(
17
ActsExamples::AmbiguityResolutionMLAlgorithm::Config
cfg
,
18
Acts::Logging::Level
lvl)
19
: ActsExamples::
AmbiguityResolutionML
(
"AmbiguityResolutionMLAlgorithm"
,
20
lvl),
21
m_cfg
(std::
move
(cfg)),
22
m_duplicateClassifier(
m_cfg
.inputDuplicateNN.c_str()) {
23
if
(
m_cfg
.
inputTracks
.empty()) {
24
throw
std::invalid_argument(
"Missing trajectories input collection"
);
25
}
26
if
(
m_cfg
.
outputTracks
.empty()) {
27
throw
std::invalid_argument(
"Missing trajectories output collection"
);
28
}
29
m_inputTracks
.
initialize
(
m_cfg
.
inputTracks
);
30
m_outputTracks
.
initialize
(
m_cfg
.
outputTracks
);
31
}
32
33
ActsExamples::ProcessCode
ActsExamples::AmbiguityResolutionMLAlgorithm::execute
(
34
const
AlgorithmContext
& ctx)
const
{
35
// Read input data
36
const
auto
&
tracks
= m_inputTracks(ctx);
37
// Associate measurement to their respective tracks
38
std::multimap<int, std::pair<int, std::vector<int>>> trackMap =
39
mapTrackHits(
tracks
,
m_cfg
.nMeasurementsMin);
40
auto
cluster =
Acts::detail::clusterDuplicateTracks
(trackMap);
41
// Select the ID of the track we want to keep
42
std::vector<int> goodTracks =
43
m_duplicateClassifier.solveAmbuguity(cluster,
tracks
);
44
// Prepare the output track collection from the IDs
45
auto
outputTracks
= prepareOutputTrack(
tracks
, goodTracks);
46
m_outputTracks(ctx,
std::move
(
outputTracks
));
47
48
return
ActsExamples::ProcessCode::SUCCESS
;
49
}
acts
blob
sPHENIX
Examples
Algorithms
TrackFindingML
src
AmbiguityResolutionMLAlgorithm.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:37
using
1.8.2 with
sPHENIX GitHub integration