File indexing completed on 2025-07-12 07:52:21
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "ActsExamples/Framework/RandomNumbers.hpp"
0013
0014 #include <numbers>
0015 #include <random>
0016
0017 namespace ActsExamples {
0018
0019
0020 struct PrimaryVertexPositionGenerator {
0021
0022 virtual ~PrimaryVertexPositionGenerator() = default;
0023
0024
0025
0026
0027 virtual Acts::Vector4 operator()(RandomEngine& rng) const = 0;
0028 };
0029
0030 struct FixedPrimaryVertexPositionGenerator
0031 : public PrimaryVertexPositionGenerator {
0032
0033 Acts::Vector4 fixed = Acts::Vector4::Zero();
0034
0035 Acts::Vector4 operator()(RandomEngine& ) const override {
0036 return fixed;
0037 }
0038 };
0039
0040 struct GaussianPrimaryVertexPositionGenerator
0041 : public PrimaryVertexPositionGenerator {
0042
0043
0044 Acts::Vector4 stddev = {0.0, 0.0, 0.0, 0.0};
0045
0046 Acts::Vector4 mean = {0.0, 0.0, 0.0, 0.0};
0047
0048 Acts::Vector4 operator()(RandomEngine& rng) const override {
0049 auto normal = std::normal_distribution<double>(0.0, 1.0);
0050 Acts::Vector4 rndNormal = {
0051 normal(rng),
0052 normal(rng),
0053 normal(rng),
0054 normal(rng),
0055 };
0056 return mean + rndNormal.cwiseProduct(stddev);
0057 }
0058 };
0059
0060
0061 struct GaussianDisplacedVertexPositionGenerator
0062 : public PrimaryVertexPositionGenerator {
0063 double rMean = 0;
0064 double rStdDev = 1;
0065 double zMean = 0;
0066 double zStdDev = 1;
0067 double tMean = 0;
0068 double tStdDev = 1;
0069
0070 Acts::Vector4 operator()(RandomEngine& rng) const override {
0071 double min_value = -std::numbers::pi;
0072 double max_value = std::numbers::pi;
0073
0074 std::uniform_real_distribution uniform(min_value, max_value);
0075
0076 std::normal_distribution rDist(rMean, rStdDev);
0077 std::normal_distribution zDist(zMean, zStdDev);
0078 std::normal_distribution tDist(tMean, tStdDev);
0079
0080
0081 double r = rDist(rng);
0082 double phi = uniform(rng);
0083 double z = zDist(rng);
0084 double t = tDist(rng);
0085
0086
0087 double x = r * std::cos(phi);
0088 double y = r * std::sin(phi);
0089
0090 return Acts::Vector4(x, y, z, t);
0091 }
0092 };
0093 }