Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 #include "NPFold.h"
0003 #include "SBnd.h"
0004 #include "ssys.h"
0005 
0006 
0007 int main(int argc, char** argv)
0008 {
0009     const char* base = "$HOME/.opticks/GEOM/$GEOM/CSGFoundry/SSim" ;
0010 
0011     //const char* relp = "extra/GGeo" ;    
0012     const char* relp = "stree/standard" ; 
0013     const NP* bnd     = NP::Load(base, relp, "bnd.npy"); 
0014     const NP* optical = NP::Load(base, relp, "optical.npy"); 
0015 
0016     if( bnd == nullptr ) 
0017     { 
0018         std::cerr 
0019             << " FAILED to load bnd.npy" 
0020             << " base " << base 
0021             << " relp " << relp 
0022             << " : PROBABLY GEOM envvar is not defined " 
0023             << std::endl 
0024             ; 
0025         return 1 ; 
0026     }
0027 
0028     std::cout << " bnd " << ( bnd ? bnd->sstr() : "-" ) << std::endl ; 
0029     std::cout << " optical " << ( optical ? optical->sstr() : "-" ) << std::endl ; 
0030 
0031 
0032     SBnd sb(bnd) ; 
0033     std::cout << sb.desc() ;  
0034 
0035     NP* bd = sb.bd_from_optical(optical) ; 
0036     NP* mat = sb.mat_from_bd(bd) ; 
0037 
0038 
0039     NPFold* fold = new NPFold ; 
0040 
0041     fold->add("bnd", bnd ) ; 
0042     fold->add("optical", optical ) ; 
0043     fold->add("bd", bd ) ; 
0044     fold->add("mat", mat ) ; 
0045 
0046     fold->save("$FOLD") ; 
0047 
0048 
0049     const char* bnd_fallback = R"LITERAL(
0050     Acrylic///LS
0051     Water///Acrylic
0052     Water///Pyrex
0053     Pyrex/NNVTMCPPMT_PMT_20inch_photocathode_mirror_logsurf/NNVTMCPPMT_PMT_20inch_photocathode_mirror_logsurf/Vacuum
0054     )LITERAL" ; 
0055 
0056     // HMM: why did the bnd change ? Boundary to skin ?  
0057     // Pyrex/NNVTMCPPMT_PMT_20inch_photocathode_logsurf2/NNVTMCPPMT_PMT_20inch_photocathode_logsurf1/Vacuum
0058         
0059     const char* bnd_sequence = ssys::getenvvar("BND_SEQUENCE", bnd_fallback );
0060     std::cout << " bnd_sequence " << bnd_sequence << std::endl ;
0061 
0062     std::vector<unsigned> bnd_idx ;
0063     sb.getBoundaryIndices( bnd_idx, bnd_sequence, '\n' );
0064     std::cout << "sb.descBoundaryIndices" << std::endl << sb.descBoundaryIndices( bnd_idx ) << std::endl ;
0065 
0066 
0067     return 0 ; 
0068 }