![]() |
|
|||
File indexing completed on 2025-09-15 08:54:44
0001 //------------------------------- -*- C++ -*- -------------------------------// 0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details 0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0004 //---------------------------------------------------------------------------// 0005 //! \file celeritas/inp/Events.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <string> 0010 #include <variant> 0011 0012 #include "corecel/Types.hh" 0013 #include "geocel/Types.hh" 0014 #include "celeritas/Quantities.hh" 0015 #include "celeritas/phys/PDGNumber.hh" 0016 0017 namespace celeritas 0018 { 0019 namespace inp 0020 { 0021 //---------------------------------------------------------------------------// 0022 //! Generate at a single point 0023 struct PointShape 0024 { 0025 Real3 pos{0, 0, 0}; 0026 }; 0027 0028 //! Sample uniformly in a box 0029 struct UniformBoxShape 0030 { 0031 Real3 lower{0, 0, 0}; 0032 Real3 upper{0, 0, 0}; 0033 }; 0034 0035 //! Choose a spatial distribution for the primary generator 0036 using ShapeDistribution = std::variant<PointShape, UniformBoxShape>; 0037 0038 //---------------------------------------------------------------------------// 0039 //! Generate angles isotropically 0040 struct IsotropicAngle 0041 { 0042 }; 0043 0044 //! Generate angles in a single direction 0045 struct MonodirectionalAngle 0046 { 0047 Real3 dir{0, 0, 1}; 0048 }; 0049 0050 //! Choose an angular distribution for the primary generator 0051 using AngleDistribution = std::variant<IsotropicAngle, MonodirectionalAngle>; 0052 0053 //---------------------------------------------------------------------------// 0054 //! Generate primaries at a single energy value 0055 struct Monoenergetic 0056 { 0057 units::MevEnergy energy; 0058 }; 0059 0060 //! Choose an angular distribution for the primary generator 0061 using EnergyDistribution = Monoenergetic; 0062 0063 //---------------------------------------------------------------------------// 0064 /*! 0065 * Generate from a hardcoded distribution of primary particles. 0066 * 0067 * \todo Allow programmatic setting from particle ID as well 0068 * \todo Units? 0069 * \code using Particle = std::variant<PDGNumber, ParticleId>; \endcode 0070 */ 0071 struct PrimaryGenerator 0072 { 0073 //! Random number seed 0074 unsigned int seed{}; 0075 //! Sample evenly from this vector of particle types 0076 std::vector<PDGNumber> pdg; 0077 //! Number of events to generate 0078 size_type num_events{}; 0079 //! Number of primaries per event 0080 size_type primaries_per_event{}; 0081 0082 //! Distribution for sampling source position 0083 ShapeDistribution shape; 0084 //! Distribution for sampling source direction 0085 AngleDistribution angle; 0086 //! Distribution for sampling source energy 0087 EnergyDistribution energy; 0088 }; 0089 0090 //---------------------------------------------------------------------------// 0091 //! Sample random events from an input file 0092 struct SampleFileEvents 0093 { 0094 //! Total number of events to sample 0095 size_type num_events{}; 0096 //! File events per sampled event 0097 size_type num_merged{}; 0098 0099 //! ROOT file input 0100 std::string event_file; 0101 0102 //! Random number generator seed 0103 unsigned int seed{}; 0104 }; 0105 0106 //---------------------------------------------------------------------------// 0107 //! Read all events from the given file 0108 struct ReadFileEvents 0109 { 0110 std::string event_file; 0111 }; 0112 0113 //---------------------------------------------------------------------------// 0114 //! Mechanism for generating events for tracking 0115 using Events = std::variant<PrimaryGenerator, SampleFileEvents, ReadFileEvents>; 0116 0117 //---------------------------------------------------------------------------// 0118 } // namespace inp 0119 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |