File indexing completed on 2026-04-09 07:49:17
0001
0002
0003 #include "OpticksGenstep.h"
0004 #include "ssys.h"
0005 #include "SEvt.hh"
0006
0007 struct SEvt_test
0008 {
0009 static const char* TEST ;
0010 static constexpr const int M = 1000000 ;
0011
0012
0013 static int AddGenstep();
0014 static int GetNumHit();
0015 static int RUN_META();
0016
0017 static int Main();
0018 };
0019
0020
0021 const char* SEvt_test::TEST = ssys::getenvvar("TEST", "ALL") ;
0022
0023 int SEvt_test::AddGenstep()
0024 {
0025 for(unsigned i=0 ; i < 10 ; i++)
0026 {
0027 quad6 q ;
0028 q.set_numphoton(1000) ;
0029 unsigned gentype = i % 2 == 0 ? OpticksGenstep_SCINTILLATION : OpticksGenstep_CERENKOV ;
0030 q.set_gentype(gentype);
0031
0032 SEvt::AddGenstep(q);
0033 }
0034 std::cout << SEvt::Get_EGPU()->desc() << std::endl ;
0035 return 0 ;
0036 }
0037
0038 int SEvt_test::GetNumHit()
0039 {
0040 unsigned num_hit = SEvt::GetNumHit(SEvt::EGPU);
0041 unsigned UNDEF = ~0u ;
0042
0043 std::cout
0044 << " num_hit " << num_hit
0045 << " num_hit " << std::hex << num_hit << std::dec
0046 << " is_undef " << ( num_hit == UNDEF ? "Y" : "N" )
0047 << " int(num_hit) " << int(num_hit)
0048 << " int(UNDEF) " << int(UNDEF)
0049 << std::endl
0050 ;
0051
0052 for(int idx=0 ; idx < int(num_hit) ; idx++) std::cout << idx << std::endl ;
0053
0054 return 0 ;
0055 }
0056
0057 int SEvt_test::RUN_META()
0058 {
0059 NP* m = SEvt::RUN_META ;
0060
0061 std::cout
0062 << ( m ? m->sstr() : "-" )
0063 << std::endl
0064 << ( m ? m->meta : "-" )
0065 << std::endl
0066 ;
0067 return 0 ;
0068 }
0069
0070 int SEvt_test::Main()
0071 {
0072 SEvt::Create_EGPU() ;
0073 bool ALL = strcmp(TEST, "ALL") == 0 ;
0074
0075 int rc = 0 ;
0076 if(ALL||0==strcmp(TEST,"AddGenstep")) rc+=AddGenstep();
0077 if(ALL||0==strcmp(TEST,"GetNumHit")) rc+=GetNumHit();
0078 if(ALL||0==strcmp(TEST,"RUN_META")) rc+=RUN_META();
0079 return rc ;
0080 }
0081
0082
0083 int main()
0084 {
0085 return SEvt_test::Main();
0086 }
0087
0088
0089