Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:04

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Definitions/PdgParticle.hpp"
0010 #include "Acts/Plugins/Python/Utilities.hpp"
0011 #include "Acts/Utilities/Logger.hpp"
0012 #include "ActsExamples/Generators/EventGenerator.hpp"
0013 #include "ActsExamples/Generators/Pythia8ProcessGenerator.hpp"
0014 #include "ActsExamples/Utilities/Range.hpp"
0015 
0016 #include <memory>
0017 #include <string>
0018 #include <unordered_map>
0019 #include <vector>
0020 
0021 #include <pybind11/pybind11.h>
0022 #include <pybind11/stl.h>
0023 
0024 namespace py = pybind11;
0025 using namespace ActsExamples;
0026 
0027 namespace Acts::Python {
0028 void addPythia8(Context& ctx) {
0029   auto mex = ctx.get("examples");
0030 
0031   auto p8 = mex.def_submodule("pythia8");
0032   ctx.modules["pythia8"] = p8;
0033 
0034   using Gen = ActsExamples::Pythia8Generator;
0035   auto gen = py::class_<Gen, ActsExamples::EventGenerator::ParticlesGenerator,
0036                         std::shared_ptr<Gen>>(p8, "Pythia8Generator")
0037                  .def(py::init<const Gen::Config&, Acts::Logging::Level>(),
0038                       py::arg("config"), py::arg("level"));
0039 
0040   py::class_<Gen::Config>(gen, "Config")
0041       .def(py::init<>())
0042       .def_readwrite("pdgBeam0", &Gen::Config::pdgBeam0)
0043       .def_readwrite("pdgBeam1", &Gen::Config::pdgBeam1)
0044       .def_readwrite("cmsEnergy", &Gen::Config::cmsEnergy)
0045       .def_readwrite("settings", &Gen::Config::settings)
0046       .def_readwrite("printShortEventListing",
0047                      &Gen::Config::printShortEventListing)
0048       .def_readwrite("printLongEventListing",
0049                      &Gen::Config::printLongEventListing)
0050       .def_readwrite("labelSecondaries", &Gen::Config::labelSecondaries)
0051       .def_readwrite("spatialVertexThreshold",
0052                      &Gen::Config::spatialVertexThreshold)
0053       .def_readwrite("initializationSeed", &Gen::Config::initializationSeed);
0054 
0055   patchClassesWithConfig(p8);
0056 }
0057 }  // namespace Acts::Python