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