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
MeasurementMapSelector.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file MeasurementMapSelector.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2022 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
#pragma once
10
11
#include "
Acts/Geometry/GeometryIdentifier.hpp
"
12
#include "
ActsExamples/EventData/IndexSourceLink.hpp
"
13
#include "
ActsExamples/EventData/Measurement.hpp
"
14
#include "
ActsExamples/Framework/DataHandle.hpp
"
15
#include "
ActsExamples/Framework/IAlgorithm.hpp
"
16
#include "
ActsExamples/Framework/WhiteBoard.hpp
"
17
#include "
ActsFatras/EventData/Barcode.hpp
"
18
19
#include <string>
20
#include <vector>
21
22
namespace
ActsExamples {
23
28
class
MeasurementMapSelector
final :
public
IAlgorithm
{
29
using
Map
=
IndexMultimap<ActsFatras::Barcode>
;
30
31
public
:
32
struct
Config
{
34
std::string
inputMeasurementParticleMap
;
35
37
std::string
inputSourceLinks
;
38
40
std::string
outputMeasurementParticleMap
;
41
43
std::vector<Acts::GeometryIdentifier>
geometrySelection
;
44
};
45
50
MeasurementMapSelector
(
Config
cfg
,
Acts::Logging::Level
lvl)
51
:
IAlgorithm
(
"MeasurementMapSelector"
, lvl),
m_cfg
(cfg) {
52
m_inputSourceLinks
.
initialize
(
m_cfg
.
inputSourceLinks
);
53
m_inputMap
.
initialize
(
m_cfg
.
inputMeasurementParticleMap
);
54
m_outputMap
.
initialize
(
m_cfg
.
outputMeasurementParticleMap
);
55
}
56
57
virtual
~MeasurementMapSelector
() =
default
;
58
63
ActsExamples::ProcessCode
execute
(
64
const
ActsExamples::AlgorithmContext
& ctx)
const
final
{
65
const
auto
& inputSourceLinks =
m_inputSourceLinks
(ctx);
66
const
auto
& inputMap =
m_inputMap
(ctx);
67
68
Map
outputMap;
69
70
for
(
const
auto
geoId :
m_cfg
.
geometrySelection
) {
71
auto
range =
selectLowestNonZeroGeometryObject
(inputSourceLinks, geoId);
72
for
(
const
auto
& sl : range) {
73
const
auto
[
begin
,
end
] = inputMap.equal_range(sl.index());
74
outputMap.insert(
begin
,
end
);
75
}
76
}
77
78
m_outputMap
(ctx,
std::move
(outputMap));
79
80
return
ProcessCode::SUCCESS
;
81
}
82
83
const
Config
&
config
()
const
{
return
m_cfg
; }
84
85
private
:
86
// configuration
87
Config
m_cfg
;
88
89
ReadDataHandle<IndexSourceLinkContainer>
m_inputSourceLinks
{
90
this
,
"InputSourceLinks"
};
91
ReadDataHandle<Map>
m_inputMap
{
this
,
"InputMeasurementParticleMap"
};
92
WriteDataHandle<Map>
m_outputMap
{
this
,
"OutputMeasurementParticleMap"
};
93
};
94
95
}
// namespace ActsExamples
acts
blob
sPHENIX
Examples
Algorithms
Utilities
include
ActsExamples
Utilities
MeasurementMapSelector.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:37
using
1.8.2 with
sPHENIX GitHub integration