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
AmbiguityResolutionMLDBScanAlgorithm.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file AmbiguityResolutionMLDBScanAlgorithm.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/AmbiguityResolutionMLDBScanAlgorithm.hpp
"
10
11
#include "
Acts/Plugins/Mlpack/AmbiguityDBScanClustering.hpp
"
12
#include "
ActsExamples/Framework/ProcessCode.hpp
"
13
#include "
ActsExamples/Framework/WhiteBoard.hpp
"
14
15
#include <iterator>
16
#include <map>
17
18
ActsExamples::AmbiguityResolutionMLDBScanAlgorithm::
19
AmbiguityResolutionMLDBScanAlgorithm
(
20
ActsExamples::AmbiguityResolutionMLDBScanAlgorithm::Config
cfg
,
21
Acts::Logging::Level
lvl)
22
: ActsExamples::
AmbiguityResolutionML
(
23
"AmbiguityResolutionMLDBScanAlgorithm"
, lvl),
24
m_cfg
(std::
move
(cfg)),
25
m_duplicateClassifier(
m_cfg
.inputDuplicateNN.c_str()) {
26
if
(
m_cfg
.
inputTracks
.empty()) {
27
throw
std::invalid_argument(
"Missing trajectories input collection"
);
28
}
29
if
(
m_cfg
.
outputTracks
.empty()) {
30
throw
std::invalid_argument(
"Missing trajectories output collection"
);
31
}
32
m_inputTracks
.
initialize
(
m_cfg
.
inputTracks
);
33
m_outputTracks
.
initialize
(
m_cfg
.
outputTracks
);
34
}
35
36
ActsExamples::ProcessCode
37
ActsExamples::AmbiguityResolutionMLDBScanAlgorithm::execute
(
38
const
AlgorithmContext
& ctx)
const
{
39
// Read input data
40
const
auto
&
tracks
= m_inputTracks(ctx);
41
// Associate measurement to their respective tracks
42
std::multimap<int, std::pair<int, std::vector<int>>> trackMap =
43
mapTrackHits(
tracks
,
m_cfg
.nMeasurementsMin);
44
// Cluster the tracks using DBscan
45
auto
cluster =
Acts::dbscanTrackClustering
(
46
trackMap,
tracks
,
m_cfg
.epsilonDBScan,
m_cfg
.minPointsDBScan);
47
// Select the ID of the track we want to keep
48
std::vector<int> goodTracks =
49
m_duplicateClassifier.solveAmbuguity(cluster,
tracks
);
50
// Prepare the output track collection from the IDs
51
auto
outputTracks
= prepareOutputTrack(
tracks
, goodTracks);
52
m_outputTracks(ctx,
std::move
(
outputTracks
));
53
54
return
ActsExamples::ProcessCode::SUCCESS
;
55
}
acts
blob
sPHENIX
Examples
Algorithms
TrackFindingML
src
AmbiguityResolutionMLDBScanAlgorithm.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:37
using
1.8.2 with
sPHENIX GitHub integration