Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002 U4PMTAccessorTest.cc
0003 =====================
0004 
0005 See also j/PMTFastSim/tests/PMTAccessorTest.cc that is 
0006 similar to this and has faster dev cycle 
0007 
0008 
0009 **/
0010 
0011 #include "OPTICKS_LOG.hh"
0012 #include "sdirect.h"
0013 
0014 #ifdef WITH_PMTFASTSIM
0015 #include "DetectorConstruction.hh"
0016 #include "JPMT.h"
0017 #include "PMTAccessor.h"
0018 
0019 #include <CLHEP/Units/SystemOfUnits.h>
0020 
0021 #endif
0022 
0023 int main(int argc, char** argv)
0024 {
0025     OPTICKS_LOG(argc, argv); 
0026 
0027 #ifdef WITH_PMTFASTSIM
0028 
0029     DetectorConstruction* dc = nullptr ; 
0030 
0031     std::stringstream coutbuf;
0032     std::stringstream cerrbuf;
0033     {   
0034         sdirect::cout_ out_(coutbuf.rdbuf());
0035         sdirect::cerr_ err_(cerrbuf.rdbuf());
0036     
0037         dc = new DetectorConstruction ; 
0038         // boot G4Material from files read under $JUNOTOP  with verbosity silenced
0039     }    
0040     std::string out = coutbuf.str(); 
0041     std::string err = cerrbuf.str(); 
0042     bool VERBOSE = getenv("VERBOSE") != nullptr ;  
0043     std::cout << sdirect::OutputMessage("DetectorConstruction" , out, err, VERBOSE );  
0044 
0045 
0046     const PMTSimParamData* data = PMTAccessor::LoadPMTSimParamData() ; 
0047     LOG(info) << " data " << *data ; 
0048 
0049     int pmtcat = kPMT_Hamamatsu ; 
0050     double energy = 5.*CLHEP::eV ; 
0051     double v = data->get_pmtcat_prop( pmtcat, "ARC_RINDEX" , energy ); 
0052 
0053     LOG(info) << " energy " << energy << " ARC_RINDEX " << v ;  
0054 
0055 
0056     const PMTAccessor* acc = PMTAccessor::Create(data) ; 
0057     LOG(info) << " acc " << acc->desc() ; 
0058 
0059 
0060 #else
0061     LOG(fatal) << "not WITH_PMTFASTSIM : nothing to do " ;     
0062 #endif
0063     return 0 ; 
0064 }
0065