File indexing completed on 2026-01-09 09:26:47
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/Io/Root/RootAthenaDumpReader.hpp"
0010 #include "ActsExamples/Io/Root/RootAthenaNTupleReader.hpp"
0011 #include "ActsExamples/Io/Root/RootBFieldWriter.hpp"
0012 #include "ActsExamples/Io/Root/RootMaterialTrackReader.hpp"
0013 #include "ActsExamples/Io/Root/RootMaterialTrackWriter.hpp"
0014 #include "ActsExamples/Io/Root/RootMaterialWriter.hpp"
0015 #include "ActsExamples/Io/Root/RootMeasurementWriter.hpp"
0016 #include "ActsExamples/Io/Root/RootMuonSpacePointReader.hpp"
0017 #include "ActsExamples/Io/Root/RootMuonSpacePointWriter.hpp"
0018 #include "ActsExamples/Io/Root/RootNuclearInteractionParametersWriter.hpp"
0019 #include "ActsExamples/Io/Root/RootParticleReader.hpp"
0020 #include "ActsExamples/Io/Root/RootParticleWriter.hpp"
0021 #include "ActsExamples/Io/Root/RootPropagationStepsWriter.hpp"
0022 #include "ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp"
0023 #include "ActsExamples/Io/Root/RootSeedWriter.hpp"
0024 #include "ActsExamples/Io/Root/RootSimHitReader.hpp"
0025 #include "ActsExamples/Io/Root/RootSimHitWriter.hpp"
0026 #include "ActsExamples/Io/Root/RootSpacepointWriter.hpp"
0027 #include "ActsExamples/Io/Root/RootTrackFinderNTupleWriter.hpp"
0028 #include "ActsExamples/Io/Root/RootTrackFinderPerformanceWriter.hpp"
0029 #include "ActsExamples/Io/Root/RootTrackFitterPerformanceWriter.hpp"
0030 #include "ActsExamples/Io/Root/RootTrackParameterWriter.hpp"
0031 #include "ActsExamples/Io/Root/RootTrackStatesWriter.hpp"
0032 #include "ActsExamples/Io/Root/RootTrackSummaryReader.hpp"
0033 #include "ActsExamples/Io/Root/RootTrackSummaryWriter.hpp"
0034 #include "ActsExamples/Io/Root/RootVertexNTupleWriter.hpp"
0035 #include "ActsExamples/Io/Root/RootVertexReader.hpp"
0036 #include "ActsExamples/Io/Root/RootVertexWriter.hpp"
0037 #include "ActsPython/Utilities/Macros.hpp"
0038
0039 #include <pybind11/pybind11.h>
0040 #include <pybind11/stl.h>
0041 #include <pybind11/stl/filesystem.h>
0042
0043 namespace py = pybind11;
0044 using namespace pybind11::literals;
0045
0046 using namespace Acts;
0047 using namespace ActsExamples;
0048 using namespace ActsPython;
0049
0050 PYBIND11_MODULE(ActsExamplesPythonBindingsRoot, root) {
0051
0052 {
0053 ACTS_PYTHON_DECLARE_READER(RootParticleReader, root, "RootParticleReader",
0054 outputParticles, treeName, filePath);
0055
0056 ACTS_PYTHON_DECLARE_READER(RootVertexReader, root, "RootVertexReader",
0057 outputVertices, treeName, filePath);
0058
0059 ACTS_PYTHON_DECLARE_READER(
0060 RootMaterialTrackReader, root, "RootMaterialTrackReader",
0061 outputMaterialTracks, treeName, fileList, readCachedSurfaceInformation);
0062
0063 ACTS_PYTHON_DECLARE_READER(RootTrackSummaryReader, root,
0064 "RootTrackSummaryReader", outputTracks,
0065 outputParticles, treeName, filePath);
0066 ACTS_PYTHON_DECLARE_READER(RootMuonSpacePointReader, root,
0067 "RootMuonSpacePointReader", outputSpacePoints,
0068 filePath, treeName);
0069
0070 ACTS_PYTHON_DECLARE_READER(
0071 RootAthenaNTupleReader, root, "RootAthenaNTupleReader", inputTreeName,
0072 inputFilePath, outputTrackParameters, outputTruthVtxParameters,
0073 outputRecoVtxParameters, outputBeamspotConstraint);
0074
0075 ACTS_PYTHON_DECLARE_READER(
0076 RootAthenaDumpReader, root, "RootAthenaDumpReader", treename,
0077 inputfiles, outputMeasurements, outputPixelSpacePoints,
0078 outputStripSpacePoints, outputSpacePoints, outputClusters,
0079 outputMeasurementParticlesMap, outputParticleMeasurementsMap,
0080 outputParticles, onlySpacepoints, onlyPassedParticles,
0081 skipOverlapSPsPhi, skipOverlapSPsEta, geometryIdMap, trackingGeometry,
0082 absBoundaryTolerance, onlySpacepoints, noTruth, readCellData);
0083
0084 #ifdef WITH_GEOMODEL_PLUGIN
0085 ACTS_PYTHON_DECLARE_READER(RootAthenaDumpGeoIdCollector, root,
0086 "RootAthenaDumpGeoIdCollector", treename,
0087 inputfile, trackingGeometry, geometryIdMap);
0088 #endif
0089
0090 ACTS_PYTHON_DECLARE_READER(RootSimHitReader, root, "RootSimHitReader",
0091 treeName, filePath, outputSimHits);
0092 }
0093
0094
0095 {
0096
0097 {
0098 py::class_<PlotHelpers::Binning>(root, "Binning")
0099 .def_static(
0100 "uniform",
0101 [](std::string title, int bins, double bMin, double bMax) {
0102 return PlotHelpers::Binning::Uniform(std::move(title), bins,
0103 bMin, bMax);
0104 },
0105 "title"_a, "bins"_a, "bMin"_a, "bMax"_a)
0106 .def_static(
0107 "variable",
0108 [](std::string title, std::vector<double> bins) {
0109 return PlotHelpers::Binning::Variable(std::move(title),
0110 std::move(bins));
0111 },
0112 "title"_a, "bins"_a)
0113 .def_static(
0114 "logarithmic",
0115 [](std::string title, int bins, double bMin, double bMax) {
0116 return PlotHelpers::Binning::Logarithmic(std::move(title), bins,
0117 bMin, bMax);
0118 },
0119 "title"_a, "bins"_a, "bMin"_a, "bMax"_a);
0120
0121 py::class_<EffPlotTool::Config>(root, "EffPlotToolConfig")
0122 .def(py::init<std::map<std::string, PlotHelpers::Binning>>(),
0123 "varBinning"_a);
0124
0125 py::class_<FakePlotTool::Config>(root, "FakePlotToolConfig")
0126 .def(py::init<std::map<std::string, PlotHelpers::Binning>>(),
0127 "varBinning"_a);
0128
0129 py::class_<DuplicationPlotTool::Config>(root, "DuplicationPlotToolConfig")
0130 .def(py::init<std::map<std::string, PlotHelpers::Binning>>(),
0131 "varBinning"_a);
0132 }
0133
0134
0135 ACTS_PYTHON_DECLARE_WRITER(RootPropagationStepsWriter, root,
0136 "RootPropagationStepsWriter", collection,
0137 filePath, fileMode);
0138
0139 ACTS_PYTHON_DECLARE_WRITER(RootPropagationSummaryWriter, root,
0140 "RootPropagationSummaryWriter",
0141 inputSummaryCollection, filePath, fileMode);
0142
0143 ACTS_PYTHON_DECLARE_WRITER(RootParticleWriter, root, "RootParticleWriter",
0144 inputParticles, filePath, fileMode, treeName,
0145 referencePoint, bField, writeHelixParameters);
0146
0147 ACTS_PYTHON_DECLARE_WRITER(RootVertexWriter, root, "RootVertexWriter",
0148 inputVertices, filePath, fileMode, treeName);
0149
0150 ACTS_PYTHON_DECLARE_WRITER(RootMuonSpacePointWriter, root,
0151 "RootMuonSpacePointWriter", inputSpacePoints,
0152 filePath, fileMode, treeName, trackingGeometry,
0153 writeGlobal);
0154
0155 ACTS_PYTHON_DECLARE_WRITER(RootTrackFinderNTupleWriter, root,
0156 "RootTrackFinderNTupleWriter", inputTracks,
0157 inputParticles, inputParticleMeasurementsMap,
0158 inputTrackParticleMatching, filePath, fileMode,
0159 treeNameTracks, treeNameParticles);
0160
0161 ACTS_PYTHON_DECLARE_WRITER(RootTrackFitterPerformanceWriter, root,
0162 "RootTrackFitterPerformanceWriter", inputTracks,
0163 inputParticles, inputTrackParticleMatching,
0164 filePath, resPlotToolConfig, effPlotToolConfig,
0165 trackSummaryPlotToolConfig);
0166
0167 ACTS_PYTHON_DECLARE_WRITER(
0168 RootTrackParameterWriter, root, "RootTrackParameterWriter",
0169 inputTrackParameters, inputProtoTracks, inputParticles, inputSimHits,
0170 inputMeasurementParticlesMap, inputMeasurementSimHitsMap, filePath,
0171 treeName, fileMode);
0172
0173 ACTS_PYTHON_DECLARE_WRITER(
0174 RootMaterialTrackWriter, root, "RootMaterialTrackWriter",
0175 inputMaterialTracks, filePath, fileMode, treeName, recalculateTotals,
0176 prePostStep, storeSurface, storeVolume, collapseInteractions);
0177
0178 {
0179 using Writer = RootBFieldWriter;
0180 auto w = py::class_<Writer>(root, "RootBFieldWriter")
0181 .def_static(
0182 "run",
0183 [](const Writer::Config& config, Logging::Level level) {
0184 Writer::run(config, getDefaultLogger(
0185 "RootBFieldWriter", level));
0186 },
0187 py::arg("config"), py::arg("level"));
0188
0189 py::enum_<Writer::GridType>(w, "GridType")
0190 .value("rz", Writer::GridType::rz)
0191 .value("xyz", Writer::GridType::xyz);
0192
0193 auto c = py::class_<Writer::Config>(w, "Config").def(py::init<>());
0194 ACTS_PYTHON_STRUCT(c, treeName, fileName, fileMode, bField, gridType,
0195 rBounds, zBounds, rBins, zBins, phiBins);
0196 }
0197
0198 {
0199 using Writer = RootMeasurementWriter;
0200 auto w = py::class_<Writer, IWriter, std::shared_ptr<Writer>>(
0201 root, "RootMeasurementWriter")
0202 .def(py::init<const Writer::Config&, Logging::Level>(),
0203 py::arg("config"), py::arg("level"));
0204
0205 auto c = py::class_<Writer::Config>(w, "Config").def(py::init<>());
0206
0207 ACTS_PYTHON_STRUCT(c, inputMeasurements, inputClusters, inputSimHits,
0208 inputMeasurementSimHitsMap, filePath, fileMode,
0209 surfaceByIdentifier);
0210 }
0211
0212 {
0213 using Writer = RootMaterialWriter;
0214 auto w =
0215 py::class_<Writer, IMaterialWriter, std::shared_ptr<Writer>>(
0216 root, "RootMaterialWriter")
0217 .def(py::init<const Writer::Config&, Logging::Level>(),
0218 py::arg("config"), py::arg("level"))
0219 .def("write",
0220 py::overload_cast<const TrackingGeometry&>(&Writer::write));
0221
0222 auto c = py::class_<Writer::Config>(w, "Config").def(py::init<>());
0223
0224 ACTS_PYTHON_STRUCT(c, processSensitives, processApproaches,
0225 processRepresenting, processBoundaries, accessorConfig,
0226 accessorOptions, filePath, fileMode);
0227 }
0228
0229 ACTS_PYTHON_DECLARE_WRITER(RootSeedWriter, root, "RootSeedWriter",
0230 inputSeeds, writingMode, filePath, fileMode,
0231 treeName);
0232
0233 ACTS_PYTHON_DECLARE_WRITER(RootSimHitWriter, root, "RootSimHitWriter",
0234 inputSimHits, filePath, fileMode, treeName);
0235
0236 ACTS_PYTHON_DECLARE_WRITER(
0237 RootSpacepointWriter, root, "RootSpacepointWriter", inputSpacepoints,
0238 inputMeasurementParticlesMap, filePath, fileMode, treeName);
0239
0240 ACTS_PYTHON_DECLARE_WRITER(
0241 RootTrackStatesWriter, root, "RootTrackStatesWriter", inputTracks,
0242 inputParticles, inputTrackParticleMatching, inputSimHits,
0243 inputMeasurementSimHitsMap, filePath, treeName, fileMode);
0244
0245 ACTS_PYTHON_DECLARE_WRITER(
0246 RootTrackSummaryWriter, root, "RootTrackSummaryWriter", inputTracks,
0247 inputParticles, inputTrackParticleMatching, filePath, treeName,
0248 fileMode, writeCovMat, writeGsfSpecific, writeGx2fSpecific);
0249
0250 ACTS_PYTHON_DECLARE_WRITER(
0251 RootVertexNTupleWriter, root, "RootVertexNTupleWriter", inputVertices,
0252 inputTracks, inputTruthVertices, inputParticles, inputSelectedParticles,
0253 inputTrackParticleMatching, bField, filePath, treeName, fileMode,
0254 vertexMatchThreshold, trackMatchThreshold, writeTrackInfo);
0255
0256 ACTS_PYTHON_DECLARE_WRITER(
0257 RootTrackFinderPerformanceWriter, root,
0258 "RootTrackFinderPerformanceWriter", inputTracks, inputParticles,
0259 inputTrackParticleMatching, inputParticleTrackMatching,
0260 inputParticleMeasurementsMap, filePath, fileMode, effPlotToolConfig,
0261 fakePlotToolConfig, duplicationPlotToolConfig,
0262 trackSummaryPlotToolConfig, subDetectorTrackSummaryVolumes,
0263 writeMatchingDetails);
0264
0265 ACTS_PYTHON_DECLARE_WRITER(RootNuclearInteractionParametersWriter, root,
0266 "RootNuclearInteractionParametersWriter",
0267 inputSimulationProcesses, filePath, fileMode,
0268 interactionProbabilityBins, momentumBins,
0269 invariantMassBins, multiplicityMax,
0270 writeOptionalHistograms, nSimulatedEvents);
0271 }
0272 }