Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TruthTracking.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TruthTracking.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2021 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 
21 
22 #include <array>
23 #include <cstddef>
24 #include <memory>
25 
26 #include <pybind11/pybind11.h>
27 #include <pybind11/stl.h>
28 
29 namespace ActsExamples {
30 class IAlgorithm;
31 } // namespace ActsExamples
32 
33 namespace py = pybind11;
34 
35 using namespace ActsExamples;
36 using namespace Acts;
37 
38 namespace Acts::Python {
39 
41  auto mex = ctx.get("examples");
42 
44  ActsExamples::TruthTrackFinder, mex, "TruthTrackFinder", inputParticles,
45  inputMeasurementParticlesMap, outputProtoTracks);
46 
47  {
49  using Config = Alg::Config;
50 
51  auto alg = py::class_<Alg, IAlgorithm, std::shared_ptr<Alg>>(
52  mex, "TruthSeedSelector")
53  .def(py::init<const Alg::Config&, Acts::Logging::Level>(),
54  py::arg("config"), py::arg("level"))
55  .def_property_readonly("config", &Alg::config);
56 
57  auto c = py::class_<Config>(alg, "Config").def(py::init<>());
58 
63  ACTS_PYTHON_MEMBER(rhoMin);
64  ACTS_PYTHON_MEMBER(rhoMax);
65  ACTS_PYTHON_MEMBER(zMin);
66  ACTS_PYTHON_MEMBER(zMax);
68  ACTS_PYTHON_MEMBER(phiMax);
69  ACTS_PYTHON_MEMBER(etaMin);
70  ACTS_PYTHON_MEMBER(etaMax);
71  ACTS_PYTHON_MEMBER(absEtaMin);
72  ACTS_PYTHON_MEMBER(absEtaMax);
73  ACTS_PYTHON_MEMBER(ptMin);
74  ACTS_PYTHON_MEMBER(ptMax);
75  ACTS_PYTHON_MEMBER(keepNeutral);
76  ACTS_PYTHON_MEMBER(nHitsMin);
77  ACTS_PYTHON_MEMBER(nHitsMax);
79 
80  pythonRangeProperty(c, "rho", &Config::rhoMin, &Config::rhoMax);
81  pythonRangeProperty(c, "z", &Config::zMin, &Config::zMax);
82  pythonRangeProperty(c, "phi", &Config::phiMin, &Config::phiMax);
83  pythonRangeProperty(c, "eta", &Config::etaMin, &Config::etaMax);
84  pythonRangeProperty(c, "absEta", &Config::absEtaMin, &Config::absEtaMax);
85  pythonRangeProperty(c, "pt", &Config::ptMin, &Config::ptMax);
86  pythonRangeProperty(c, "nHits", &Config::nHitsMin, &Config::nHitsMax);
87  }
88 
90  ActsExamples::ParticleSmearing, mex, "ParticleSmearing", inputParticles,
91  outputTrackParameters, sigmaD0, sigmaD0PtA, sigmaD0PtB, sigmaZ0,
92  sigmaZ0PtA, sigmaZ0PtB, sigmaT0, sigmaPhi, sigmaTheta, sigmaPRel,
93  initialSigmas, initialVarInflation, particleHypothesis, randomNumbers);
94 
95  {
97  using Config = Alg::Config;
98 
99  auto alg = py::class_<Alg, IAlgorithm, std::shared_ptr<Alg>>(
100  mex, "ParticleSelector")
101  .def(py::init<const Alg::Config&, Acts::Logging::Level>(),
102  py::arg("config"), py::arg("level"))
103  .def_property_readonly("config", &Alg::config);
104 
105  auto c = py::class_<Config>(alg, "Config").def(py::init<>());
106 
111  ACTS_PYTHON_MEMBER(rhoMin);
112  ACTS_PYTHON_MEMBER(rhoMax);
113  ACTS_PYTHON_MEMBER(absZMin);
114  ACTS_PYTHON_MEMBER(absZMax);
115  ACTS_PYTHON_MEMBER(timeMin);
116  ACTS_PYTHON_MEMBER(timeMax);
118  ACTS_PYTHON_MEMBER(phiMax);
119  ACTS_PYTHON_MEMBER(etaMin);
120  ACTS_PYTHON_MEMBER(etaMax);
121  ACTS_PYTHON_MEMBER(absEtaMin);
122  ACTS_PYTHON_MEMBER(absEtaMax);
123  ACTS_PYTHON_MEMBER(mMin);
124  ACTS_PYTHON_MEMBER(mMax);
125  ACTS_PYTHON_MEMBER(ptMin);
126  ACTS_PYTHON_MEMBER(ptMax);
127  ACTS_PYTHON_MEMBER(measurementsMin);
128  ACTS_PYTHON_MEMBER(measurementsMax);
129  ACTS_PYTHON_MEMBER(removeCharged);
130  ACTS_PYTHON_MEMBER(removeNeutral);
131  ACTS_PYTHON_MEMBER(removeSecondaries);
133 
134  pythonRangeProperty(c, "rho", &Config::rhoMin, &Config::rhoMax);
135  pythonRangeProperty(c, "absZ", &Config::absZMin, &Config::absZMax);
136  pythonRangeProperty(c, "time", &Config::timeMin, &Config::timeMax);
137  pythonRangeProperty(c, "phi", &Config::phiMin, &Config::phiMax);
138  pythonRangeProperty(c, "eta", &Config::etaMin, &Config::etaMax);
139  pythonRangeProperty(c, "absEta", &Config::absEtaMin, &Config::absEtaMax);
140  pythonRangeProperty(c, "m", &Config::mMin, &Config::mMax);
141  pythonRangeProperty(c, "pt", &Config::ptMin, &Config::ptMax);
142  pythonRangeProperty(c, "measurements", &Config::measurementsMin,
143  &Config::measurementsMax);
144  }
145 
146  {
148  using Config = Alg::Config;
149 
150  auto alg = py::class_<Alg, IAlgorithm, std::shared_ptr<Alg>>(
151  mex, "TrackParameterSelector")
152  .def(py::init<const Alg::Config&, Acts::Logging::Level>(),
153  py::arg("config"), py::arg("level"))
154  .def_property_readonly("config", &Alg::config);
155 
156  auto c = py::class_<Config>(alg, "Config").def(py::init<>());
157 
159  ACTS_PYTHON_MEMBER(inputTrackParameters);
160  ACTS_PYTHON_MEMBER(outputTrackParameters);
161  ACTS_PYTHON_MEMBER(loc0Min);
162  ACTS_PYTHON_MEMBER(loc0Max);
163  ACTS_PYTHON_MEMBER(loc1Min);
164  ACTS_PYTHON_MEMBER(loc1Max);
165  ACTS_PYTHON_MEMBER(timeMin);
166  ACTS_PYTHON_MEMBER(timeMax);
168  ACTS_PYTHON_MEMBER(phiMax);
169  ACTS_PYTHON_MEMBER(etaMin);
170  ACTS_PYTHON_MEMBER(etaMax);
171  ACTS_PYTHON_MEMBER(absEtaMin);
172  ACTS_PYTHON_MEMBER(absEtaMax);
173  ACTS_PYTHON_MEMBER(ptMin);
174  ACTS_PYTHON_MEMBER(ptMax);
176 
177  pythonRangeProperty(c, "loc0", &Config::loc0Min, &Config::loc0Max);
178  pythonRangeProperty(c, "loc1", &Config::loc1Min, &Config::loc1Max);
179  pythonRangeProperty(c, "time", &Config::timeMin, &Config::timeMax);
180  pythonRangeProperty(c, "phi", &Config::phiMin, &Config::phiMax);
181  pythonRangeProperty(c, "eta", &Config::etaMin, &Config::etaMax);
182  pythonRangeProperty(c, "absEta", &Config::absEtaMin, &Config::absEtaMax);
183  pythonRangeProperty(c, "pt", &Config::ptMin, &Config::ptMax);
184  }
185 
187  ActsExamples::TruthVertexFinder, mex, "TruthVertexFinder", inputParticles,
188  outputProtoVertices, excludeSecondaries, separateSecondaries);
189 
191  ActsExamples::TrackModifier, mex, "TrackModifier", inputTrajectories,
192  inputTrackParameters, outputTrajectories, outputTrackParameters,
193  dropCovariance, covScale, killTime);
194 
196  ActsExamples::TruthSeedingAlgorithm, mex, "TruthSeedingAlgorithm",
197  inputParticles, inputMeasurementParticlesMap, inputSpacePoints,
198  outputParticles, outputSeeds, outputProtoTracks, deltaRMin, deltaRMax);
199 }
200 
201 } // namespace Acts::Python