Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
Analysis Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
blob
sPHENIX
Alignment
CI
cmake
Core
docs
Examples
Algorithms
Alignment
AmbiguityResolution
Digitization
Fatras
Geant4
Geant4HepMC
Generators
GeneratorsPythia8
Geometry
HepMC
MaterialMapping
Printers
Propagation
TrackFinding
TrackFindingExaTrkX
TrackFindingML
TrackFitting
TruthTracking
ActsExamples
TruthTracking
ParticleSelector.cpp
ParticleSelector.hpp
ParticleSmearing.cpp
ParticleSmearing.hpp
TrackModifier.cpp
TrackModifier.hpp
TrackParameterSelector.cpp
TrackParameterSelector.hpp
TruthSeedingAlgorithm.cpp
TruthSeedingAlgorithm.hpp
TruthSeedSelector.cpp
TruthSeedSelector.hpp
TruthTrackFinder.cpp
TruthTrackFinder.hpp
TruthVertexFinder.cpp
TruthVertexFinder.hpp
Utilities
Vertexing
Detectors
Framework
Io
Python
Run
Scripts
Fatras
Plugins
Tests
acts-fatras
analysis
analysis_tpc_prototype
coresoftware
Doxygen_Assist
g4exampledetector
GenFit
JETSCAPE
KFParticle
macros
online_distribution
OnlMon
prototype
pythia6
rcdaq
RDBC
tutorials
doxygen_mainpage.h
File Members
Examples
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
TruthTrackFinder.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TruthTrackFinder.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2019 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/TruthTracking/TruthTrackFinder.hpp
"
10
11
#include "
Acts/Utilities/MultiIndex.hpp
"
12
#include "
ActsExamples/EventData/Index.hpp
"
13
#include "
ActsExamples/EventData/ProtoTrack.hpp
"
14
#include "
ActsExamples/EventData/SimParticle.hpp
"
15
#include "
ActsExamples/Utilities/Range.hpp
"
16
#include "
ActsFatras/EventData/Particle.hpp
"
17
18
#include <algorithm>
19
#include <ostream>
20
#include <stdexcept>
21
#include <utility>
22
23
namespace
ActsExamples {
24
struct
AlgorithmContext
;
25
}
// namespace ActsExamples
26
27
using namespace
ActsExamples;
28
29
TruthTrackFinder::TruthTrackFinder
(
const
Config
&
config
,
30
Acts::Logging::Level
level
)
31
:
IAlgorithm
(
"TruthTrackFinder"
, level),
m_cfg
(config) {
32
if
(
m_cfg
.
inputParticles
.empty()) {
33
throw
std::invalid_argument(
"Missing input truth particles collection"
);
34
}
35
if
(
m_cfg
.
inputMeasurementParticlesMap
.empty()) {
36
throw
std::invalid_argument(
"Missing input hit-particles map collection"
);
37
}
38
if
(
m_cfg
.
outputProtoTracks
.empty()) {
39
throw
std::invalid_argument(
"Missing output proto tracks collection"
);
40
}
41
42
m_inputParticles
.
initialize
(
m_cfg
.
inputParticles
);
43
m_inputMeasurementParticlesMap
.
initialize
(
m_cfg
.
inputMeasurementParticlesMap
);
44
m_outputProtoTracks
.
initialize
(
m_cfg
.
outputProtoTracks
);
45
}
46
47
ProcessCode
TruthTrackFinder::execute
(
const
AlgorithmContext
& ctx)
const
{
48
// prepare input collections
49
const
auto
&
particles
=
m_inputParticles
(ctx);
50
const
auto
& hitParticlesMap =
m_inputMeasurementParticlesMap
(ctx);
51
// compute particle_id -> {hit_id...} map from the
52
// hit_id -> {particle_id...} map on the fly.
53
const
auto
& particleHitsMap =
invertIndexMultimap
(hitParticlesMap);
54
55
// prepare output collection
56
ProtoTrackContainer
tracks
;
57
tracks.reserve(
particles
.size());
58
59
ACTS_VERBOSE
(
"Create prototracks for "
<<
particles
.size() <<
" particles"
);
60
for
(
const
auto
&
particle
:
particles
) {
61
// find the corresponding hits for this particle
62
const
auto
& hits =
63
makeRange
(particleHitsMap.equal_range(
particle
.particleId()));
64
ACTS_VERBOSE
(
" - Prototrack from "
<< hits.size() <<
" hits"
);
65
// fill hit indices to create the proto track
66
ProtoTrack
track;
67
track.reserve(hits.size());
68
for
(
const
auto
& hit : hits) {
69
track.emplace_back(hit.second);
70
}
71
// add proto track to the output collection
72
tracks.emplace_back(
std::move
(track));
73
}
74
75
m_outputProtoTracks
(ctx,
std::move
(tracks));
76
return
ProcessCode::SUCCESS
;
77
}
acts
blob
sPHENIX
Examples
Algorithms
TruthTracking
ActsExamples
TruthTracking
TruthTrackFinder.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:37
using
1.8.2 with
sPHENIX GitHub integration