Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:49:32

0001 /**
0002 CSGOptiXSimTest
0003 ======================
0004 
0005 Canonically used by cxsim.sh 
0006 
0007 **/
0008 
0009 #include <cuda_runtime.h>
0010 
0011 #include "OPTICKS_LOG.hh"
0012 #include "SEventConfig.hh"
0013 #include "SEvt.hh"
0014 #include "CSGFoundry.h"
0015 #include "CSGOptiX.h"
0016 #include "QSim.hh"
0017 
0018 int main(int argc, char** argv)
0019 {
0020     OPTICKS_LOG(argc, argv); 
0021 
0022     const char* comp = "genstep,photon,hit,domain,record,rec,seq" ;  // NB no "simtrace" here
0023     SEventConfig::SetGatherComp(comp); 
0024     SEventConfig::SetSaveComp(comp); 
0025     // TODO: this now automated ? check that 
0026 
0027 
0028     SEvt* evt = SEvt::Create(SEvt::EGPU)  ;  // holds gensteps and output NPFold of component arrays
0029     SEvt::AddCarrierGenstep();   // normally gensteps added after geometry setup, but can be before in this simple test 
0030 
0031     // TODO: this is missing setFrame
0032 
0033     CSGFoundry* fd = CSGFoundry::Load() ;  // standard OPTICKS_KEY CFBase/CSGFoundry geometry and SSim
0034 
0035     CSGOptiX* cx = CSGOptiX::Create(fd);   // uploads geometry, instanciates QSim 
0036 
0037     QSim* qs = cx->sim ; 
0038 
0039     int eventID = 0 ; 
0040     bool end = true ; 
0041 
0042     qs->simulate(eventID, end);  // internally calls CSGOptiX::simulate_launch following genstep uploading by QSim
0043 
0044     cudaDeviceSynchronize(); 
0045 
0046     evt->save();  // uses SGeo::LastUploadCFBase_OutDir to place outputs into CFBase/ExecutableName folder sibling to CSGFoundry  
0047  
0048     return 0 ; 
0049 }