![]() |
HepPDT Reference DocumentationHepPDT |
00001 // $Id: testReadQQ.cc.in,v 1.1 2007/05/22 22:12:23 garren Exp $ 00002 // ---------------------------------------------------------------------- 00003 // testReadQQ.cc 00004 // 00005 // read QQ table and write it out 00006 // 00007 // ---------------------------------------------------------------------- 00008 00009 #include <fstream> 00010 00011 #include "HepPDT/defs.h" 00012 #include "HepPDT/TableBuilder.hh" 00013 #include "HepPDT/ParticleDataTable.hh" 00014 00015 int main() 00016 { 00017 const char infile[] = "@srcdir@/listQQ.dec"; 00018 const char outfile[] = "testReadQQ.out"; 00019 // open input file 00020 std::ifstream pdfile( infile ); 00021 if( !pdfile ) { 00022 std::cerr << "cannot open " << infile << std::endl; 00023 exit(-1); 00024 } 00025 // construct empty PDT 00026 HepPDT::ParticleDataTable datacol( "QQ Table" ); 00027 { 00028 // Construct table builder 00029 HepPDT::TableBuilder tb(datacol); 00030 // read the input - put as many here as you want 00031 if( !addQQParticles( pdfile, tb ) ) 00032 { std::cout << "error reading QQ table file " << std::endl; } 00033 } // the tb destructor fills the PDT 00034 std::ofstream wpdfile( outfile ); 00035 if( !wpdfile ) { 00036 std::cerr << "cannot open " << outfile << std::endl; 00037 exit(-1); 00038 } 00039 // write a translation list 00040 datacol.writeParticleTranslation( wpdfile ); 00041 // write the particle and decay info 00042 datacol.writeParticleData( wpdfile ); 00043 00044 return 0; 00045 }