File indexing completed on 2026-11-07 10:11:40
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Types.hh"
0010 #include "corecel/data/Collection.hh"
0011 #include "geocel/Types.hh"
0012 #include "celeritas/Quantities.hh"
0013
0014 namespace celeritas
0015 {
0016 namespace optical
0017 {
0018
0019
0020
0021
0022 struct DetectorHit
0023 {
0024 using Energy = units::MevEnergy;
0025
0026 DetectorId detector{};
0027 PrimaryId primary{};
0028 Energy energy;
0029 real_type time{};
0030 Real3 position{};
0031 VolumeInstanceId volume_instance;
0032 VolumeUniqueInstanceId unique_instance;
0033 size_type num_steps{};
0034 real_type path_length{};
0035
0036
0037 explicit CELER_CONSTEXPR_FUNCTION operator bool() const
0038 {
0039 return static_cast<bool>(detector);
0040 }
0041 };
0042
0043
0044
0045
0046
0047
0048
0049
0050 template<Ownership W, MemSpace M>
0051 struct DetectorStateData
0052 {
0053
0054
0055 template<class T>
0056 using StateItems = StateCollection<T, W, M>;
0057
0058
0059 StateItems<DetectorHit> detector_hits;
0060
0061
0062 explicit CELER_FUNCTION operator bool() const
0063 {
0064 return !detector_hits.empty();
0065 }
0066
0067
0068 CELER_FUNCTION size_type size() const { return detector_hits.size(); }
0069
0070
0071 template<Ownership W2, MemSpace M2>
0072 DetectorStateData<W, M>& operator=(DetectorStateData<W2, M2>& other)
0073 {
0074 CELER_EXPECT(other);
0075 detector_hits = other.detector_hits;
0076 return *this;
0077 }
0078 };
0079
0080
0081
0082
0083
0084
0085
0086 template<MemSpace M>
0087 inline void resize(DetectorStateData<Ownership::value, M>* state,
0088 size_type size)
0089 {
0090 CELER_EXPECT(state);
0091 CELER_EXPECT(size > 0);
0092
0093 resize(&state->detector_hits, size);
0094
0095 CELER_ENSURE(*state);
0096 }
0097
0098
0099 }
0100 }