File indexing completed on 2026-04-10 07:49:40
0001 #pragma once
0002
0003 struct sevent ;
0004 struct quad4 ;
0005 struct sphoton ;
0006 struct salloc ;
0007 struct sslice ;
0008 struct qat4 ;
0009 struct quad6 ;
0010 struct NP ;
0011
0012 struct SEvt ;
0013
0014 struct sphoton_selector ;
0015 struct sphotonlite_selector ;
0016
0017
0018 #include <vector>
0019 #include <string>
0020 #include "plog/Severity.h"
0021 #include "SComp.h"
0022 #include "QUDARAP_API_EXPORT.hh"
0023 #include "NP_future.h"
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072 struct QUDARAP_API QEvt : public SCompProvider
0073 {
0074 friend struct QEvtTest ;
0075 friend struct QEvt_setInputPhoton_Test ;
0076
0077 static constexpr const char* QEvt__LIFECYCLE = "QEvt__LIFECYCLE" ;
0078 static bool LIFECYCLE ;
0079
0080 static const plog::Severity LEVEL ;
0081 static QEvt* INSTANCE ;
0082 static QEvt* Get();
0083 static const bool SEvt_NPFold_VERBOSE ;
0084 static std::string Desc();
0085
0086
0087 sevent* getDevicePtr() const ;
0088
0089 QEvt();
0090
0091 private:
0092 void init();
0093 void init_SEvt();
0094
0095
0096
0097
0098 public:
0099 SEvt* sev ;
0100 private:
0101 sphoton_selector* photon_selector ;
0102 sphotonlite_selector* photonlite_selector ;
0103
0104 sevent* evt ;
0105 sevent* d_evt ;
0106 const NP* gs ;
0107 sslice* gss ;
0108
0109 NP* input_photon ;
0110 public:
0111 int upload_count ;
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121 public:
0122
0123
0124 int setGenstepUpload_NP(const NP* gs);
0125 int setGenstepUpload_NP(const NP* gs, const sslice* sl );
0126 unsigned long long get_photon_slot_offset() const ;
0127 void clear();
0128 private:
0129
0130 int setGenstepUpload(const quad6* qq0, int num_gs );
0131 int setGenstepUpload(const quad6* qq0, int gs_start, int gs_stop );
0132 void device_alloc_genstep_and_seed();
0133 void setInputPhotonAndUpload();
0134 void setInputPhotonSimtraceAndUpload();
0135 void checkInputPhoton() const ;
0136
0137
0138 unsigned count_genstep_photons();
0139 void fill_seed_buffer();
0140 void count_genstep_photons_and_fill_seed_buffer();
0141
0142 public:
0143
0144 bool hasGenstep() const ;
0145 bool hasSeed() const ;
0146 bool hasPhoton() const ;
0147 bool hasPhotonLite() const ;
0148 bool hasRecord() const ;
0149 bool hasRec() const ;
0150 bool hasSeq() const ;
0151 bool hasPrd() const ;
0152 bool hasTag() const ;
0153 bool hasFlat() const ;
0154 bool hasHit() const ;
0155 bool hasHitLite() const ;
0156 bool hasSimtrace() const ;
0157 public:
0158 static constexpr const char* TYPENAME = "QEvt" ;
0159
0160 std::string getMeta() const ;
0161 const char* getTypeName() const ;
0162 NP* gatherComponent(unsigned comp) const ;
0163 public:
0164
0165 NP* getGenstep() const ;
0166 NP* getInputPhoton() const ;
0167
0168
0169 NP* gatherPhoton() const ;
0170 NP* gatherPhotonLite() const ;
0171
0172 NP* gatherHit() const ;
0173 NP* gatherHitLite() const ;
0174 NP* gatherHitLiteMerged() const ;
0175 NP* gatherHitMerged() const ;
0176
0177
0178 #ifndef PRODUCTION
0179 NP* gatherSeed() const ;
0180 NP* gatherDomain() const ;
0181 NP* gatherGenstepFromDevice() const ;
0182 void gatherSimtrace( NP* t ) const ;
0183 NP* gatherSimtrace() const ;
0184 void gatherSeq( NP* seq) const ;
0185 NP* gatherSeq() const ;
0186 NP* gatherPrd() const ;
0187 NP* gatherFlat() const ;
0188 NP* gatherRecord() const ;
0189 NP* gatherTag() const ;
0190 NP* gatherRec() const ;
0191 #endif
0192
0193 public:
0194 void gatherPhoton( NP* p ) const ;
0195 void gatherPhotonLite( NP* l ) const ;
0196
0197 private:
0198 NP* gatherComponent_(unsigned comp) const ;
0199 NP* gatherHit_() const ;
0200 NP* gatherHitLite_() const ;
0201 public:
0202
0203 template<typename T>
0204 static NP* PerLaunchMerge(sevent* evt, cudaStream_t stream );
0205
0206 template<typename T>
0207 static NP* FinalMerge( const NP* hitmerged_or_hitlitemerged, cudaStream_t stream);
0208
0209 template<typename T>
0210 static NP_future FinalMerge_async(const NP* hitmerged_or_hitlitemerged, cudaStream_t stream);
0211
0212 public:
0213 size_t getNumHit() const ;
0214 size_t getNumHitLite() const ;
0215 private:
0216 void setNumPhoton(size_t num_photon) ;
0217 void setNumSimtrace(size_t num_simtrace) ;
0218 void device_alloc_photon();
0219 void device_alloc_simtrace();
0220 static void SetAllocMeta(salloc* alloc, const sevent* evt);
0221 void uploadEvt();
0222 public:
0223 size_t getNumPhoton() const ;
0224 size_t getNumSimtrace() const ;
0225 public:
0226 std::string desc() const ;
0227 std::string desc_alloc() const ;
0228
0229 void checkEvt() ;
0230
0231 };
0232
0233