00001
00002
00003
00004
00005
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 infile1[] = "@top_srcdir@/data/pdt.table";
00018 const char infile2[] = "@top_srcdir@/data/DECAY.DEC";
00019 const char outfile[] = "testReadEvtGen.out";
00020
00021 std::ifstream pdfile1( infile1 );
00022 if( !pdfile1 ) {
00023 std::cerr << "cannot open " << infile1 << std::endl;
00024 exit(-1);
00025 }
00026
00027 std::ifstream pdfile2( infile2 );
00028 if( !pdfile2 ) {
00029 std::cerr << "cannot open " << infile2 << std::endl;
00030 exit(-1);
00031 }
00032 HepPDT::ParticleDataTable datacol( "EvtGen Table" );
00033 {
00034
00035 HepPDT::TableBuilder tb(datacol);
00036
00037 if( !addEvtGenParticles( pdfile1, tb ) ) { std::cout << "error reading EvtGen pdt file " << std::endl; }
00038 if( !addEvtGenParticles( pdfile2, tb ) ) { std::cout << "error reading EvtGen decay file " << std::endl; }
00039 }
00040 std::ofstream wfile( outfile );
00041 if( !wfile ) {
00042 std::cerr << "cannot open " << outfile << std::endl;
00043 exit(-1);
00044 }
00045 datacol.writeParticleData(wfile);
00046
00047 return 0;
00048 }