Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:01

0001 
0002 
0003 void CSGOptiX::setComposition()   // TODO: replace with setFrame 
0004 {
0005     setComposition(SSys::getenvvar("MOI", "-1")); 
0006 }
0007 void CSGOptiX::setComposition(const char* moi) // TODO: replace this with setFrame
0008 {
0009     moi = moi_ ? strdup(moi_) : "-1" ;  
0010 
0011     int midx, mord, iidx ;  // mesh-index, mesh-ordinal, instance-index
0012     foundry->parseMOI(midx, mord, iidx,  moi );  
0013 
0014     float4 ce = make_float4(0.f, 0.f, 0.f, 1000.f ); 
0015 
0016     // m2w and w2m are initialized to identity, the below call may populate them 
0017     qat4* m2w = qat4::identity() ; 
0018     qat4* w2m = qat4::identity() ; 
0019     int rc = foundry->getCenterExtent(ce, midx, mord, iidx, m2w, w2m ) ;
0020 
0021     LOG(info) 
0022         << " moi " << moi 
0023         << " midx " << midx << " mord " << mord << " iidx " << iidx 
0024         << " rc [" << rc << "]" 
0025         << " ce (" << ce.x << " " << ce.y << " " << ce.z << " " << ce.w << ") " 
0026         << " m2w (" << *m2w << ")"    
0027         << " w2m (" << *w2m << ")"    
0028         ; 
0029 
0030     assert(rc==0); 
0031     setComposition(ce, m2w, w2m );   // establish the coordinate system 
0032 }
0033 
0034 void CSGOptiX::setComposition(const float4& v, const qat4* m2w, const qat4* w2m )
0035 {
0036     glm::vec4 ce(v.x, v.y, v.z, v.w); 
0037     setComposition(ce, m2w, w2m ); 
0038 }
0039 
0040 
0041 /**
0042 
0043 CSGOptiX::snapSimtraceTest
0044 ---------------------------
0045 
0046 TODO: eliminate this, instead just use normal QEvent::save  
0047 
0048 Saving data for 2D cross sections, used by tests/CSGOptiXSimtraceTest.cc 
0049 
0050 The writing of pixels and frame photon "fphoton.npy" are commented 
0051 here as they are currently not being filled by OptiX7Test.cu:simtrace
0052 Although they could be reinstated the photons.npy array is more useful 
0053 for debugging as that can be copied from remote to laptop enabling local analysis 
0054 that gives flexible python "rendering" with tests/CSGOptiXSimtraceTest.py 
0055 
0056 **/
0057 
0058 
0059 void CSGOptiX::snapSimtraceTest() const    // only from CSGOptiXSimtraceTest.cc
0060 {
0061     const char* outdir = SEventConfig::OutFold();
0062 
0063     event->setMeta( foundry->meta.c_str() ); 
0064 
0065     // HMM: QEvent rather than here ?  
0066     event->savePhoton( outdir, "photons.npy");   // this one can get very big 
0067     event->saveGenstep(outdir, "genstep.npy");  
0068     event->saveMeta(   outdir, "fdmeta.txt" ); 
0069 
0070     savePeta(          outdir, "peta.npy");   
0071 
0072     if(metatran) metatran->save(outdir, "metatran.npy");
0073 
0074 }
0075 
0076 
0077 void CSGOptiX::savePeta(const char* fold, const char* name) const  // TODO: ELIMINATE USING sframe TO HOLD THE INFO
0078 {
0079     const char* path = SPath::Resolve(fold, name, FILEPATH) ; 
0080     LOG(info) << path ; 
0081     NP::Write(path, (float*)(&peta->q0.f.x), 1, 4, 4 );
0082 }
0083 
0084 void CSGOptiX::setMetaTran(const Tran<double>* metatran_ ) // only from CSGOptiXSimtraceTest.cc TODO: ELIMINATE USING sframe 
0085 {
0086     metatran = metatran_ ; 
0087 }
0088 
0089 
0090 /**
0091 CSGOptiX::setCEGS Center-Extent gensteps  TODO: ELIMINATE
0092 -------------------------------------------------------------
0093 
0094 From cegs vector into peta quad4 
0095 
0096 HMM: seems peta is not uploaded ?  Just for python consumption, eg tests/CSGOptiXSimtraceTest.py 
0097 
0098 **/
0099 
0100 
0101 
0102     /*
0103     peta->q2.f.x = ce.x ;   // moved from q1   
0104     peta->q2.f.y = ce.y ; 
0105     peta->q2.f.z = ce.z ; 
0106     peta->q2.f.w = ce.w ; 
0107     */
0108 
0109 
0110 
0111 void CSGOptiX::setCEGS(const std::vector<int>& cegs)
0112 {
0113     assert( cegs.size() == 7 );   // use QEvent::StandardizeCEGS to convert 4 to 7  
0114 
0115     peta->q0.i.x = cegs[0] ;  // ix0   these are after standardization
0116     peta->q0.i.y = cegs[1] ;  // ix1
0117     peta->q0.i.z = cegs[2] ;  // iy0 
0118     peta->q0.i.w = cegs[3] ;  // iy1
0119 
0120     peta->q1.i.x = cegs[4] ;  // iz0
0121     peta->q1.i.y = cegs[5] ;  // iz1 
0122     peta->q1.i.z = cegs[6] ;  // num_photons
0123     peta->q1.i.w = 0 ;     // TODO: gridscale according to ana/gridspec.py 
0124 }
0125 
0126