![]() |
HepPDT Reference DocumentationHepPDT |
00001 // ---------------------------------------------------------------------- 00002 // readIsajet.cc 00003 // Author: Lynn Garren 00004 // 00005 // read the isajet particle table for testing purposes 00006 // note that isaparticles.dat was created with PRTLST(...) 00007 // 00008 // Usage: readIsajet 00009 // 00010 // ---------------------------------------------------------------------- 00011 00012 #include <fstream> 00013 00014 #include "HepPDT/defs.h" 00015 #include "HepPDT/TableBuilder.hh" 00016 #include "HepPDT/ParticleDataTable.hh" 00017 00018 int main() 00019 { 00020 char pdgfile[300] = "@top_srcdir@/examples/data/isaparticles.dat"; 00021 const char outfile[] = "testReadIsajet.out"; 00022 // construct empty PDT 00023 HepPDT::ParticleDataTable datacol( "Isajet Table" ); 00024 { 00025 // open input files 00026 std::ifstream pdfile( pdgfile ); 00027 if( !pdfile ) { 00028 std::cerr << "cannot open " << pdgfile << std::endl; 00029 exit(-1); 00030 } 00031 // Construct table builder 00032 HepPDT::TableBuilder tb(datacol); 00033 // read the input - put as many here as you want 00034 if( !HepPDT::addIsajetParticles( pdfile, tb ) ) { 00035 std::cout << "error reading " << pdgfile << std::endl; 00036 } 00037 } // the tb destructor fills datacol 00038 std::ofstream wpdfile( outfile ); 00039 if( !wpdfile ) { 00040 std::cerr << "cannot open " << outfile << std::endl; 00041 exit(-1); 00042 } 00043 datacol.writeParticleData(wpdfile); 00044 wpdfile << std::endl; 00045 00046 // particle info 00047 datacol.writeParticleInfo(wpdfile); 00048 00049 return 0; 00050 }