File indexing completed on 2026-04-09 07:49:18
0001
0002
0003 #include "sgs.h"
0004 #include <iostream>
0005
0006
0007 void test_assign()
0008 {
0009 sgs gs ;
0010
0011 gs = {} ;
0012 std::cout << gs.desc() << std::endl ;
0013
0014 gs = { 101, 10000, 5000, OpticksGenstep_TORCH } ;
0015 std::cout << gs.desc() << std::endl ;
0016
0017 gs = { 202, 20000, 4000, OpticksGenstep_CERENKOV } ;
0018 std::cout << gs.desc() << std::endl ;
0019
0020 gs = { 303, 30000, 3000, OpticksGenstep_SCINTILLATION } ;
0021 std::cout << gs.desc() << std::endl ;
0022
0023 gs = { 303, 30000, 3000, OpticksGenstep_G4Cerenkov_1042 } ;
0024 std::cout << gs.desc() << std::endl ;
0025 }
0026
0027 void test_array()
0028 {
0029 sgs gs[] = {
0030 { 101, 10000, 5000, OpticksGenstep_TORCH },
0031 { 202, 20000, 4000, OpticksGenstep_CERENKOV },
0032 { 303, 30000, 3000, OpticksGenstep_SCINTILLATION },
0033 { 303, 30000, 3000, OpticksGenstep_G4Cerenkov_1042 }
0034 };
0035
0036 std::cout
0037 << " sizeof(sgs) " << sizeof(sgs)
0038 << " sizeof(gs) " << sizeof(gs)
0039 << std::endl
0040 ;
0041
0042 for(int i=0 ; i < sizeof(gs)/sizeof(sgs) ; i++) std::cout << gs[i].desc() << std::endl ;
0043 }
0044
0045 void test_MakePho_reemit()
0046 {
0047
0048 int index = 0 ;
0049 int photons = 10 ;
0050 int offset = 1000 ;
0051 int gentype = OpticksGenstep_SCINTILLATION ;
0052
0053 sgs gs = { index, photons, offset, gentype } ;
0054
0055 std::cout << " gs.desc " << gs.desc() << std::endl ;
0056
0057 spho non = spho::Placeholder();
0058
0059 spho p1[gs.photons] ;
0060 spho p2[gs.photons] ;
0061 spho p3[gs.photons] ;
0062
0063 std::cout << "first loop with ancestor placeholder " << std::endl ;
0064 for(int idx=0 ; idx < gs.photons ; idx++) p1[idx] = gs.MakePho(idx, non) ;
0065 for(int idx=0 ; idx < gs.photons ; idx++) std::cout << " p1.desc " << p1[idx].desc() << std::endl ;
0066
0067 std::cout << "second loop with ancestor to the preceeding generation " << std::endl ;
0068 for(int idx=0 ; idx < gs.photons ; idx++) p2[idx] = gs.MakePho(idx, p1[idx] ) ;
0069 for(int idx=0 ; idx < gs.photons ; idx++) std::cout << " p2.desc " << p2[idx].desc() << std::endl ;
0070
0071 std::cout << "third loop with ancestor to the preceeding generation " << std::endl ;
0072 for(int idx=0 ; idx < gs.photons ; idx++) p3[idx] = gs.MakePho(idx, p2[idx] ) ;
0073 for(int idx=0 ; idx < gs.photons ; idx++) std::cout << " p3.desc " << p3[idx].desc() << std::endl ;
0074
0075 }
0076
0077
0078 int main()
0079 {
0080
0081
0082
0083
0084
0085 test_MakePho_reemit();
0086
0087
0088 return 0 ;
0089 }