Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-12 07:52:21

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 "ActsExamples/Framework/RandomNumbers.hpp"
0012 
0013 #include <random>
0014 
0015 namespace ActsExamples {
0016 
0017 /// @brief Generator interface for event multiplicity of vertices
0018 struct MultiplicityGenerator {
0019   /// @brief Virtual destructor required
0020   virtual ~MultiplicityGenerator() = default;
0021   /// @brief Generate the multiplicity of vertices
0022   ///
0023   /// @param rng Shared random number generator instance
0024   /// @return std::size_t The multiplicity for the event
0025   virtual std::size_t operator()(RandomEngine& rng) const = 0;
0026 };
0027 
0028 struct FixedMultiplicityGenerator : public MultiplicityGenerator {
0029   std::size_t n = 1;
0030 
0031   explicit FixedMultiplicityGenerator(std::size_t _n) : n{_n} {}
0032   FixedMultiplicityGenerator() = default;
0033 
0034   std::size_t operator()(RandomEngine& /*rng*/) const override { return n; }
0035 };
0036 
0037 struct PoissonMultiplicityGenerator : public MultiplicityGenerator {
0038   double mean = 1;
0039   explicit PoissonMultiplicityGenerator(double _mean) : mean{_mean} {}
0040   PoissonMultiplicityGenerator() = default;
0041 
0042   std::size_t operator()(RandomEngine& rng) const override {
0043     return (0 < mean) ? std::poisson_distribution<std::size_t>(mean)(rng) : 0;
0044   }
0045 };
0046 
0047 }  // namespace ActsExamples