![]() |
|
|||
File indexing completed on 2025-09-17 08:53:48
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/user/StepInterface.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <map> 0010 0011 #include "corecel/Types.hh" 0012 0013 #include "StepData.hh" // IWYU pragma: export 0014 0015 namespace celeritas 0016 { 0017 //---------------------------------------------------------------------------// 0018 // FIXME: rename this to something less confusing 0019 template<MemSpace M> 0020 struct StepState 0021 { 0022 // TODO: step state params 0023 //! Host pointer to externally owned step state data reference 0024 StepStateData<Ownership::reference, M> const& steps; 0025 // TODO: aux state vec 0026 //! Stream ID (local to each core state) 0027 StreamId stream_id; 0028 }; 0029 0030 //---------------------------------------------------------------------------// 0031 /*! 0032 * Callback class to gather and process data from many tracks at a single step. 0033 * 0034 * The filtering mechanism allows different step interfaces to gather data from 0035 * different detector volumes. Filtered step interfaces cannot be combined with 0036 * unfiltered in a single hit collector. (FIXME: maybe we need a slightly 0037 * different class hierarchy for the two cases?) If detectors are in use, and 0038 * all \c StepInterface instances in use by a \c StepCollector select the 0039 * "nonzero_energy_deposition" flag, then the \c StepStateData::detector entry 0040 * for a thread with no energy deposition will be cleared even if it is in a 0041 * sensitive detector. Otherwise entries with zero energy deposition will 0042 * remain. 0043 */ 0044 class StepInterface 0045 { 0046 public: 0047 //@{ 0048 //! \name Type aliases 0049 using HostStepState = StepState<MemSpace::host>; 0050 using DeviceStepState = StepState<MemSpace::device>; 0051 using MapVolumeDetector = std::map<VolumeId, DetectorId>; 0052 //@} 0053 0054 //! Filtering to apply to the gathered data for this step. 0055 struct Filters 0056 { 0057 //! Only select data from these volume IDs and map to detectors 0058 MapVolumeDetector detectors; 0059 //! Only select data with nonzero energy deposition (if detectors) 0060 bool nonzero_energy_deposition{false}; 0061 }; 0062 0063 public: 0064 //! Detector filtering required for this interface 0065 virtual Filters filters() const = 0; 0066 0067 //! Selection of data required for this interface 0068 virtual StepSelection selection() const = 0; 0069 0070 //! Process CPU-generated hit data 0071 virtual void process_steps(HostStepState) = 0; 0072 0073 //! Process device-generated hit data 0074 virtual void process_steps(DeviceStepState) = 0; 0075 0076 // TODO: hook for end-of-event and/or end-of-run 0077 0078 protected: 0079 // Protected destructor prevents deletion of pointer-to-interface 0080 ~StepInterface() = default; 0081 }; 0082 0083 //---------------------------------------------------------------------------// 0084 } // 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 |
![]() ![]() |