![]() |
|
|||
Warning, file /include/celeritas/phys/PrimaryGeneratorOptions.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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/phys/PrimaryGeneratorOptions.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <algorithm> 0010 0011 #include "corecel/io/StringEnumMapper.hh" 0012 #include "corecel/math/Algorithms.hh" 0013 #include "geocel/Types.hh" 0014 0015 #include "PDGNumber.hh" 0016 0017 namespace celeritas 0018 { 0019 namespace inp 0020 { 0021 struct PrimaryGenerator; 0022 } 0023 0024 //---------------------------------------------------------------------------// 0025 //! Distribution selection for sampling quantities in a \c PrimaryGenerator 0026 enum class DistributionSelection 0027 { 0028 delta, 0029 isotropic, 0030 box, 0031 size_ 0032 }; 0033 0034 //---------------------------------------------------------------------------// 0035 /*! 0036 * Distribution type and parameters. 0037 */ 0038 struct DistributionOptions 0039 { 0040 DistributionSelection distribution{DistributionSelection::size_}; 0041 std::vector<real_type> params; 0042 0043 //! Whether the options are valid 0044 explicit operator bool() const 0045 { 0046 return distribution != DistributionSelection::size_; 0047 } 0048 }; 0049 0050 //---------------------------------------------------------------------------// 0051 /*! 0052 * Primary generator options. 0053 * 0054 * - \c seed: RNG seed 0055 * - \c pdg: PDG numbers of the primaries. An equal number of primaries of each 0056 * type will be generated 0057 * - \c num_events: total number of events to generate 0058 * - \c primaries_per_event: number of primaries to generate in each event 0059 * - \c energy: energy distribution type and parameters 0060 * - \c position: spatial distribution type and parameters 0061 * - \c direction: angular distribution type and parameters 0062 * 0063 * \deprecated See inp::PrimaryGenerator 0064 */ 0065 struct PrimaryGeneratorOptions 0066 { 0067 unsigned int seed{}; 0068 std::vector<PDGNumber> pdg; 0069 size_type num_events{}; 0070 size_type primaries_per_event{}; 0071 DistributionOptions energy; 0072 DistributionOptions position; 0073 DistributionOptions direction; 0074 0075 //! Whether the options are valid 0076 explicit operator bool() const 0077 { 0078 return !pdg.empty() 0079 && std::all_of(pdg.begin(), pdg.end(), LogicalTrue{}) 0080 && num_events > 0 && primaries_per_event > 0 && energy 0081 && position && direction; 0082 } 0083 }; 0084 0085 //---------------------------------------------------------------------------// 0086 // Convert PrimaryGeneratorOptions to inp::PrimaryGenerator. 0087 inp::PrimaryGenerator to_input(PrimaryGeneratorOptions const&); 0088 0089 //---------------------------------------------------------------------------// 0090 // FREE FUNCTIONS 0091 //---------------------------------------------------------------------------// 0092 0093 // Get a distribution name 0094 char const* to_cstring(DistributionSelection value); 0095 0096 //---------------------------------------------------------------------------// 0097 } // 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 |
![]() ![]() |