File indexing completed on 2026-04-09 07:49:07
0001 #include "OPTICKS_LOG.hh"
0002
0003 #include "SEvt.hh"
0004 #include "SSim.hh"
0005 #include "NP.hh"
0006
0007 #include <cuda_runtime.h>
0008 #include "scuda.h"
0009 #include "squad.h"
0010 #include "sphoton.h"
0011
0012 #include "QSim.hh"
0013 #include "SEvent.hh"
0014 #include "QEvt.hh"
0015
0016 int main(int argc, char** argv)
0017 {
0018 OPTICKS_LOG(argc, argv);
0019
0020 SEvt* sev = SEvt::Create_EGPU() ;
0021
0022 LOG(info) << "[ SSim::Load " ;
0023 const SSim* sim = SSim::Load();
0024 LOG(info) << "] SSim::Load : sim " << sim ;
0025
0026 LOG_IF(info, getenv("VERBOSE")!=nullptr )
0027 << "[sim.desc "
0028 << std::endl
0029 << sim->desc()
0030 << std::endl
0031 << "]sim.desc "
0032 ;
0033
0034 QSim::UploadComponents(sim);
0035
0036 QSim* qs = QSim::Create();
0037 QEvt* qev = qs->qev ;
0038
0039
0040 std::vector<int> photon_counts_per_genstep = { 3, 5, 2, 0, 1, 3, 4, 2, 4 };
0041 int x_total = 0 ;
0042 const NP* gs = SEvent::MakeCountGenstep(photon_counts_per_genstep, &x_total ) ;
0043
0044 std::cout << " main [ SEvt::AddGenstep(gs ) " << std::endl ;
0045 SEvt::AddGenstep(gs);
0046 std::cout << " main ] SEvt::AddGenstep(gs ) " << std::endl ;
0047
0048 std::cout << " main [ qev->setGenstep " << std::endl ;
0049
0050
0051
0052 const NP* igs = sev->makeGenstepArrayFromVector();
0053 qev->setGenstepUpload_NP(igs);
0054 std::cout << " main ] qev->setGenstep " << std::endl ;
0055
0056 assert( int(qev->getNumPhoton()) == x_total );
0057
0058
0059
0060 std::cout << " main [ qev->checkEvt " << std::endl ;
0061 qev->checkEvt();
0062 std::cout << " main ] qev->checkEvt " << std::endl ;
0063
0064
0065 std::cout << " main [ qs->generate_photon " << std::endl ;
0066 qs->generate_photon();
0067 std::cout << " main ] qs->generate_photon " << std::endl ;
0068
0069
0070 std::cout << " main [ qev->gather_photon " << std::endl ;
0071 NP* photon = qev->gatherPhoton();
0072 std::cout << " main ] qev->gather_photon " << std::endl ;
0073 photon->dump();
0074
0075 cudaDeviceSynchronize();
0076
0077 return 0 ;
0078 }