File indexing completed on 2026-09-27 09:14:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef LAGER_GEN_BEAM_VERTEX_GEN_LOADED
0021 #define LAGER_GEN_BEAM_VERTEX_GEN_LOADED
0022
0023 #include <lager/core/generator.hh>
0024 #include <lager/core/interval.hh>
0025 #include <lager/core/particle.hh>
0026 #include <lager/gen/initial/data.hh>
0027 #include <lager/gen/initial/generator.hh>
0028
0029 namespace lager {
0030 namespace initial {
0031
0032
0033
0034
0035 class origin_vertex : public vertex_generator {
0036 public:
0037 origin_vertex(const configuration& cf, const string_path& path,
0038 std::shared_ptr<TRandom> r)
0039 : vertex_generator{std::move(r)}
0040 , vertex_{0, 0, cf.get<double>(path / "vz", 0), 0} {
0041 LOG_INFO("initial::origin_vertex", "Vertex generator initialized");
0042 }
0043
0044 virtual particle::XYZTVector generate() { return vertex_; }
0045 virtual double max_cross_section() const { return 1.; }
0046 virtual double phase_space() const { return 1.; }
0047
0048 protected:
0049 const particle::XYZTVector vertex_;
0050 };
0051
0052 class linear_vertex : public vertex_generator {
0053 public:
0054 linear_vertex(const configuration& cf, const string_path& path,
0055 std::shared_ptr<TRandom> r)
0056 : vertex_generator{std::move(r)}
0057 , range_{cf.get_range<double>(path / "range")} {
0058 LOG_INFO("initial::linear_vertex", "Vertex generator initialized");
0059 LOG_INFO("initial::linear_vertex",
0060 "Vertex range [cm]: [" + std::to_string(range_.min) + ", " +
0061 std::to_string(range_.max) + "]");
0062 }
0063
0064 virtual particle::XYZTVector generate() {
0065 const double vz = rng()->Uniform(range_.min, range_.max);
0066 LOG_JUNK2("linear_vertex", "Vertex position [cm]: " + std::to_string(vz));
0067 return {0., 0., vz, 0};
0068 }
0069 virtual double max_cross_section() const { return 1.; }
0070 virtual double phase_space() const { return 1.; }
0071
0072 protected:
0073 const interval<double> range_;
0074 };
0075
0076 }
0077 }
0078
0079 #endif