File indexing completed on 2025-09-17 08:53:48
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <vector>
0010
0011 #include "corecel/Types.hh"
0012 #include "corecel/cont/Span.hh"
0013 #include "corecel/data/Collection.hh"
0014 #include "corecel/data/StreamStore.hh"
0015 #include "corecel/io/Label.hh"
0016 #include "corecel/io/OutputInterface.hh"
0017 #include "celeritas/Quantities.hh"
0018
0019 #include "SimpleCaloData.hh"
0020 #include "StepInterface.hh"
0021
0022 namespace celeritas
0023 {
0024
0025 class GeoParamsInterface;
0026
0027
0028
0029
0030
0031
0032
0033
0034 class SimpleCalo final : public StepInterface, public OutputInterface
0035 {
0036 public:
0037
0038
0039 using VecLabel = std::vector<Label>;
0040 using EnergyUnits = units::Mev;
0041 template<MemSpace M>
0042 using DetectorRef
0043 = celeritas::Collection<real_type, Ownership::reference, M, DetectorId>;
0044 using VecReal = std::vector<real_type>;
0045
0046
0047 public:
0048
0049 SimpleCalo(std::string output_label,
0050 VecLabel labels,
0051 GeoParamsInterface const& geo,
0052 size_type max_streams);
0053
0054
0055 SimpleCalo(VecLabel labels,
0056 GeoParamsInterface const& geo,
0057 size_type max_streams)
0058 : SimpleCalo{"simple_calo", std::move(labels), geo, max_streams}
0059 {
0060 }
0061
0062
0063
0064
0065
0066 Filters filters() const final;
0067
0068 StepSelection selection() const final;
0069
0070 void process_steps(HostStepState) final;
0071
0072 void process_steps(DeviceStepState) final;
0073
0074
0075
0076
0077
0078
0079 Category category() const final { return Category::result; }
0080
0081 std::string_view label() const final { return output_label_; }
0082
0083 void output(JsonPimpl*) const final;
0084
0085
0086
0087
0088
0089 DetectorId::size_type num_detectors() const { return volume_ids_.size(); }
0090
0091
0092 template<MemSpace M>
0093 DetectorRef<M> const& energy_deposition(StreamId) const;
0094
0095
0096 VecReal calc_total_energy_deposition() const;
0097
0098
0099
0100
0101 void clear();
0102
0103 private:
0104 using StoreT = StreamStore<SimpleCaloParamsData, SimpleCaloStateData>;
0105
0106 std::string output_label_;
0107 VecLabel volume_labels_;
0108 std::vector<VolumeId> volume_ids_;
0109 StoreT store_;
0110 };
0111
0112
0113 }