Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002 CSGOptiXSimulateTest
0003 ======================
0004 
0005 Canonically used by cxsimulate.sh combining CFBASE_LOCAL simple test geometry (eg GeoChain) 
0006 with standard CFBASE basis CSGFoundry/SSim input arrays. 
0007 
0008 Notice that the standard SSim input arrays are loaded without the corresponding standard geometry
0009 using the intentional arms length (SSim subdirectory/NPFold) relationship between CSGFoundry and SSim. 
0010 
0011 **/
0012 
0013 #include <cuda_runtime.h>
0014 
0015 #include "SSim.hh"
0016 #include "OPTICKS_LOG.hh"
0017 #include "SEvt.hh"
0018 #include "CSGFoundry.h"
0019 #include "CSGOptiX.h"
0020 #include "QSim.hh"
0021 
0022 int main(int argc, char** argv)
0023 {
0024     OPTICKS_LOG(argc, argv); 
0025 
0026     SEvt* evt = SEvt::Create(SEvt::EGPU) ;
0027     assert(evt);  
0028 
0029     const SSim* ssim = SSim::Load() ;  // standard $CFBase/CSGFoundry/SSim
0030 
0031     CSGFoundry* fdl = CSGFoundry::Load("$CFBASE_LOCAL", "CSGFoundry") ;  // local geometry 
0032 
0033     fdl->setOverrideSim(ssim);    // local geometry with standard SSim inputs 
0034 
0035     CSGOptiX* cx = CSGOptiX::Create(fdl);  // uploads geometry, instanciates QSim 
0036 
0037     QSim* qs = cx->sim ; 
0038 
0039     SEvt::AddCarrierGenstep(); 
0040 
0041     int eventID = 0 ; 
0042     bool end = true ; 
0043 
0044     qs->simulate(eventID, end); 
0045 
0046     cudaDeviceSynchronize(); 
0047 
0048     evt->save();
0049  
0050     return 0 ; 
0051 }