Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:50:29

0001 /**
0002 U4TreeCreateTest.cc
0003 ===================
0004 
0005 ::
0006 
0007     ~/o/u4/tests/U4TreeCreateTest.sh
0008 
0009 **/
0010 
0011 #include <csignal>
0012 #include "OPTICKS_LOG.hh"
0013 #include "spath.h"
0014 #include "stree.h"
0015 
0016 #include "U4VolumeMaker.hh"
0017 #include "U4Tree.h"
0018 
0019 const char* FOLD = spath::Resolve("$TMP/U4TreeCreateTest"); 
0020 
0021 int main(int argc, char** argv)
0022 {
0023     OPTICKS_LOG(argc, argv); 
0024 
0025     stree* st = new stree ; 
0026     st->level = 1 ;  
0027 
0028     if( argc > 1 )
0029     {
0030         LOG(info) << " load stree from FOLD " << FOLD ; 
0031         int rc = st->load(FOLD); 
0032         if(rc != 0) return rc ; 
0033     }
0034     else
0035     {
0036         const G4VPhysicalVolume* world = U4VolumeMaker::PV() ; 
0037         LOG_IF(error, world == nullptr) << " FAILED TO CREATE world with U4VolumeMaker::PV " ;   
0038         if(world == nullptr) return 0 ; 
0039 
0040         U4Tree* tr = U4Tree::Create(st, world) ; 
0041         assert( tr ); 
0042         if(!tr) std::raise(SIGINT); 
0043         //LOG(info) << tr->desc() ; 
0044 
0045         LOG(info) << " save stree to FOLD " << FOLD ; 
0046         st->save(FOLD); 
0047     }
0048 
0049     std::cout << st->desc() ; 
0050     return 0 ;  
0051 }