Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Examples/Algorithms/GeneratorsPythia8/ActsExamples/Generators/Pythia8ProcessGenerator.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 #pragma once
0010 
0011 #include "Acts/Definitions/PdgParticle.hpp"
0012 #include "Acts/Definitions/Units.hpp"
0013 #include "Acts/Utilities/Logger.hpp"
0014 #include "ActsExamples/EventData/SimParticle.hpp"
0015 #include "ActsExamples/EventData/SimVertex.hpp"
0016 #include "ActsExamples/Framework/RandomNumbers.hpp"
0017 #include "ActsExamples/Utilities/ParametricParticleGenerator.hpp"
0018 
0019 #include <memory>
0020 #include <mutex>
0021 #include <string>
0022 #include <vector>
0023 
0024 namespace Pythia8 {
0025 class Pythia;
0026 }
0027 
0028 namespace ActsExamples {
0029 
0030 struct Pythia8GeneratorImpl;
0031 
0032 class Pythia8Generator : public ParticlesGenerator {
0033  public:
0034   struct Config {
0035     /// PDG particle number of the first incoming beam.
0036     Acts::PdgParticle pdgBeam0 = Acts::PdgParticle::eProton;
0037     /// PDG particle number of the second incoming beam.
0038     Acts::PdgParticle pdgBeam1 = Acts::PdgParticle::eProton;
0039     /// Center-of-mass energy.
0040     double cmsEnergy = 14 * Acts::UnitConstants::TeV;
0041     /// Additional Pythia8 settings.
0042     std::vector<std::string> settings = {{"HardQCD:all = on"}};
0043     /// Let pythia print summarized event info
0044     bool printShortEventListing = false;
0045     /// Let pythia print detailed event info
0046     bool printLongEventListing = false;
0047     /// Turn on/off the labeling of secondary vertices
0048     /// TODO this is essentially broken as the current code will label any kind
0049     /// of decay as secondary
0050     bool labelSecondaries = true;
0051     /// The spatial threshold to consider a particle originating from a vertex
0052     double spatialVertexThreshold = 1.0 * Acts::UnitConstants::um;
0053     /// Random seed for the initialization stage of Pythia8
0054     unsigned int initializationSeed = 42;
0055 
0056     /// Direct HepMC3 output (for debugging)
0057     std::optional<std::filesystem::path> writeHepMC3 = std::nullopt;
0058   };
0059 
0060   Pythia8Generator(const Config& cfg, Acts::Logging::Level lvl);
0061   ~Pythia8Generator() override;
0062   // try to prevent pythia breakage by forbidding copying
0063   Pythia8Generator() = delete;
0064   Pythia8Generator(const Pythia8Generator&) = delete;
0065   Pythia8Generator(Pythia8Generator&&) = delete;
0066   Pythia8Generator& operator=(const Pythia8Generator&) = delete;
0067   Pythia8Generator& operator=(Pythia8Generator&& other) = delete;
0068 
0069   std::shared_ptr<HepMC3::GenEvent> operator()(RandomEngine& rng) override;
0070 
0071  private:
0072   /// Private access to the logging instance
0073   const Acts::Logger& logger() const { return (*m_logger); }
0074 
0075   Config m_cfg;
0076   std::unique_ptr<const Acts::Logger> m_logger;
0077   std::unique_ptr<::Pythia8::Pythia> m_pythia8;
0078   std::mutex m_pythia8Mutex;
0079 
0080   std::unique_ptr<Pythia8GeneratorImpl> m_impl;
0081 };
0082 
0083 }  // namespace ActsExamples