Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002 sysrap/tests/sseq_index_test.sh : C++ photon history comparison using seq.npy arrays
0003 =====================================================================================
0004 
0005 1. loads arrays a_seq and b_seq from $AFOLD/seq.npy and $BFOLD/seq.npy
0006 2. instanciate sseq_index a and b from the a_seq and b_seq arrays
0007 3. instanciate sseq_index_ab comparing a and b
0008 4. report on history differences between a and b using sseq_index_ab methods
0009 5. saves comparison metadata to $FOLD directory
0010 
0011 ::
0012 
0013     ~/opticks/sysrap/tests/sseq_index_test.sh
0014 
0015 
0016 Requirements
0017 -------------
0018 
0019 * AFOLD and BFOLD envvars pointing to SEvt folders
0020   containing seq.npy photon history files
0021 
0022 
0023 **/
0024 
0025 
0026 #include "NP.hh"
0027 #include "ssys.h"
0028 #include "sseq_index.h"
0029 #include "sstamp.h"
0030 
0031 int main()
0032 {
0033     std::cout << "[sseq_index_test.cc\n" ;
0034     const char* a_path = "$AFOLD/seq.npy" ;
0035     const char* b_path = "$BFOLD/seq.npy" ;
0036     NP* a_seq = NP::LoadIfExists(a_path);
0037     NP* b_seq = NP::LoadIfExists(b_path);
0038     std::cout << "a_path " << a_path << " " << ( a_seq ? a_seq->get_lpath() : "-" ) << " a_seq " << ( a_seq ? a_seq->sstr() : "-" ) << std::endl ;
0039     std::cout << "b_path " << b_path << " " << ( b_seq ? b_seq->get_lpath() : "-" ) << " b_seq " << ( b_seq ? b_seq->sstr() : "-" ) << std::endl ;
0040     if(!(a_seq && b_seq)) return 0 ;
0041 
0042     const char* _DEBUG = "sseq_index_test__DEBUG" ;
0043     int DEBUG = ssys::getenvint(_DEBUG, 0);
0044     std::cout << _DEBUG << ":" << DEBUG << "\n" ;
0045 
0046     int64_t t0 = sstamp::Now();
0047 
0048     sseq_index a(a_seq);
0049     int64_t t1 = sstamp::Now();
0050 
0051     sseq_index b(b_seq);
0052     int64_t t2 = sstamp::Now();
0053 
0054     sseq_index_ab ab(a, b);
0055     int64_t t3 = sstamp::Now();
0056 
0057 
0058     std::cout << " t0 " << t0 << "\n" ;
0059     std::cout << " t1 " << t1 << " (t1 - t0) " << std::setw(8) << ( t1 - t0 ) << " " << std::fixed << std::setprecision(6) << std::setw(8) << ( t1 - t0)/1e6 << "\n" ;
0060     std::cout << " t2 " << t2 << " (t2 - t1) " << std::setw(8) << ( t2 - t1 ) << " " << std::fixed << std::setprecision(6) << std::setw(8) << ( t2 - t1)/1e6 << "\n" ;
0061     std::cout << " t3 " << t3 << " (t3 - t2) " << std::setw(8) << ( t3 - t2 ) << " " << std::fixed << std::setprecision(6) << std::setw(8) << ( t3 - t2)/1e6 << "\n" ;
0062 
0063     if( DEBUG > 0 )
0064     {
0065         std::cout << "A" << std::endl << a.desc(1000) << std::endl ;
0066         std::cout << "B" << std::endl << b.desc(1000) << std::endl ;
0067     }
0068 
0069     std::cout << ab.desc() ;
0070 
0071 
0072     if(DEBUG > 0)
0073     {
0074         std::cout << "AB" << std::endl << ab.desc("ALL") << std::endl ;
0075         std::cout << "AB" << std::endl << ab.desc("C2INCL") << std::endl ;
0076     }
0077 
0078 
0079     ab.chi2.save("$FOLD");
0080     ab.save("$FOLD");
0081     std::cout << "]sseq_index_test.cc\n" ;
0082 
0083     return 0 ;
0084 }
0085 // ~/opticks/sysrap/tests/sseq_index_test.sh
0086 
0087 
0088