File indexing completed on 2025-02-22 09:54:43
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <memory>
0011 #include <vector>
0012
0013 #include "geocel/Types.hh"
0014 #include "celeritas/geo/GeoFwd.hh"
0015 #include "celeritas/user/StepInterface.hh"
0016
0017 class G4LogicalVolume;
0018 class G4ParticleDefinition;
0019
0020 namespace celeritas
0021 {
0022 struct SDSetupOptions;
0023 class ParticleParams;
0024
0025 namespace detail
0026 {
0027
0028
0029 class HitProcessor;
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 class HitManager final : public StepInterface
0047 {
0048 public:
0049
0050
0051 using StepStateHostRef = HostRef<StepStateData>;
0052 using StepStateDeviceRef = DeviceRef<StepStateData>;
0053 using SPConstVecLV
0054 = std::shared_ptr<std::vector<G4LogicalVolume const*> const>;
0055 using SPProcessor = std::shared_ptr<HitProcessor>;
0056 using VecVolId = std::vector<VolumeId>;
0057 using VecParticle = std::vector<G4ParticleDefinition const*>;
0058
0059
0060 public:
0061
0062 HitManager(GeoParams const& geo,
0063 ParticleParams const& par,
0064 SDSetupOptions const& setup,
0065 StreamId::size_type num_streams);
0066
0067
0068 SPProcessor make_local_processor(StreamId sid);
0069
0070
0071 ~HitManager();
0072
0073
0074 Filters filters() const final;
0075
0076
0077 StepSelection selection() const final { return selection_; }
0078
0079
0080 void process_steps(HostStepState) final;
0081
0082
0083 void process_steps(DeviceStepState) final;
0084
0085
0086
0087
0088 SPConstVecLV const& geant_vols() const { return geant_vols_; }
0089
0090
0091 VecVolId const& celer_vols() const { return vecgeom_vols_; }
0092
0093
0094 VecParticle const& geant_particles() const { return particles_; }
0095
0096 private:
0097 using VecLV = std::vector<G4LogicalVolume const*>;
0098
0099 bool nonzero_energy_deposition_{};
0100 VecVolId vecgeom_vols_;
0101
0102
0103 SPConstVecLV geant_vols_;
0104 VecParticle particles_;
0105 StepSelection selection_;
0106 bool locate_touchable_{};
0107
0108 std::vector<std::weak_ptr<HitProcessor>> processor_weakptrs_;
0109 std::vector<HitProcessor*> processors_;
0110
0111
0112 void setup_volumes(GeoParams const& geo, SDSetupOptions const& setup);
0113
0114 void setup_particles(ParticleParams const& par);
0115
0116
0117 HitProcessor& get_local_hit_processor(StreamId);
0118 };
0119
0120
0121 }
0122 }