![]() |
|
|||
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/Scoring.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <optional> 0010 #include <unordered_set> 0011 #include <variant> 0012 #include <vector> 0013 0014 #include "corecel/cont/EnumArray.hh" 0015 #include "corecel/io/Label.hh" 0016 0017 class G4LogicalVolume; 0018 0019 namespace celeritas 0020 { 0021 namespace inp 0022 { 0023 //---------------------------------------------------------------------------// 0024 //! Options for saving attributes at each step point 0025 struct GeantSdStepPointAttributes 0026 { 0027 //! Store the time since the start of the event 0028 bool global_time{true}; 0029 //! Store the step point position 0030 bool position{true}; 0031 //! Store the step point direction (AKA momentum direction) 0032 bool direction{true}; 0033 //! Store the step point energy 0034 bool kinetic_energy{true}; 0035 //! Reconstruct the complete volume hierarchy 0036 bool touchable{true}; 0037 }; 0038 0039 //---------------------------------------------------------------------------// 0040 /*! 0041 * Control options for Geant4 sensitive detector integration. 0042 * 0043 * By default, Celeritas connects to Geant4 sensitive detectors so that it 0044 * reconstructs full-fidelity hits with all available step information. 0045 * 0046 * - By default, steps that do not deposit energy do not generate any hits. 0047 * - To improve performance and memory usage, determine what quantities (time, 0048 * position, direction, touchable, ...) are required by your setup's 0049 * sensitive detectors and set all other attributes to \c false. 0050 * - Reconstructing the full geometry status using \c touchable step option is 0051 * the most expensive detector option. Disable it unless your SDs require 0052 * (e.g.) the volume's copy number to locate a detector submodule. 0053 * - Some reconstructed track attributes (such as post-step material) are 0054 * currently never set because they are rarely used in practice. Contact the 0055 * Celeritas team or submit a pull request to add this functionality. 0056 * 0057 * Various attributes on the step, track, and pre/post step points may be 0058 * available depending on the selected options. 0059 * 0060 * - Disabling \c track will leave \c G4Step::GetTrack as \c nullptr . 0061 * - Enabling \c track will set the \c Charge attribute on the 0062 * pre-step. 0063 * - Requested post-step data including \c GlobalTime, \c Position, \c 0064 * KineticEnergy, and \c MomentumDirection will be copied to the \c Track 0065 * when the combination of options is enabled. 0066 * - Some pre-step properties (\c Material and \c MaterialCutsCouple, and 0067 * sensitive detector) are always updated. Post-step values for those are not 0068 * set. 0069 * - Track and Parent IDs will \em never be a valid value since Celeritas track 0070 * counters are independent from Geant4 track counters. Similarly, special 0071 * Geant4 user-defined \c UserInformation and \c AuxiliaryTrackInformation 0072 * are never set. 0073 * 0074 * The \c force_volumes option can be used for unusual cases (i.e., when using 0075 * a custom run manager) that do not define SDs on the "master" thread. 0076 * Similarly, the \c skip_volumes option allows optimized GPU-defined SDs to be 0077 * used in place of a Geant4 callback. For both options, the \c 0078 * FindVolumes helper function can be used to determine LV pointers from 0079 * the volume names. 0080 * 0081 * \todo For improved granularity in models with duplicate names, we could add 0082 * a vector of \c Label to \c VariantSetVolume . 0083 * \todo change from \c unordered_set to \c set for better reproducibility in 0084 * serialized output 0085 * 0086 * The pre- and post-step attributes can be set with: \code 0087 sd.points[StepPoint::pre].global_time = true; 0088 sd.points[StepPoint::post].touchable = false; 0089 \endcode 0090 * 0091 * \sa celeritas::GeantSd 0092 */ 0093 struct GeantSd 0094 { 0095 //! Provide either a set of labels or a set of pointers to Geant4 objects 0096 using SetVolume = std::unordered_set<G4LogicalVolume const*>; 0097 using SetString = std::unordered_set<std::string>; 0098 using VariantSetVolume = std::variant<SetVolume, SetString>; 0099 using PointAttrs = EnumArray<StepPoint, GeantSdStepPointAttributes>; 0100 0101 //! Skip steps that do not deposit energy locally 0102 bool ignore_zero_deposition{true}; 0103 //! Save energy deposition 0104 bool energy_deposition{true}; 0105 //! Save physical step length 0106 bool step_length{true}; 0107 //! Create a track with the dynamic particle type and post-step data 0108 bool track{true}; 0109 0110 //! Options for saving and converting beginning- and end-of-step data 0111 PointAttrs points; 0112 0113 //! Manually list LVs that don't have an SD on the master thread 0114 VariantSetVolume force_volumes; 0115 //! List LVs that should *not* have automatic hit mapping 0116 VariantSetVolume skip_volumes; 0117 }; 0118 0119 //---------------------------------------------------------------------------// 0120 /*! 0121 * Integrate energy deposition in each volume over all events. 0122 * 0123 * \sa celeritas::SimpleCalo. 0124 */ 0125 struct SimpleCalo 0126 { 0127 //! List of geometry volumes to score 0128 std::vector<Label> volumes; 0129 }; 0130 0131 //---------------------------------------------------------------------------// 0132 /*! 0133 * Enable scoring of hits or other quantities. 0134 * 0135 * If the problem to be executed has no sensitive detectors, \c sd must be 0136 * \c std::nullopt (unset). 0137 */ 0138 struct Scoring 0139 { 0140 //! Enable Geant4 sensitive detector integration 0141 std::optional<GeantSd> sd; 0142 0143 //! Add simple on-device calorimeters integrated over events 0144 std::optional<SimpleCalo> simple_calo; 0145 }; 0146 0147 //---------------------------------------------------------------------------// 0148 } // namespace inp 0149 } // 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 |
![]() ![]() |