![]() |
HepPDT Reference DocumentationHepPDT |
00001 // ---------------------------------------------------------------------- 00002 // listEvtGenNames.cc 00003 // Author: Lynn Garren 00004 // 00005 // read EvtGen table and write out translation from EvtGen to HepPDT 00006 // 00007 // ---------------------------------------------------------------------- 00008 00009 #include <fstream> 00010 #include <iostream> 00011 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[] = "listEvtGenNames.out"; 00020 // open input files 00021 std::ifstream pdfile1( infile1 ); 00022 if( !pdfile1 ) { 00023 std::cerr << "cannot open " << infile1 << std::endl; 00024 exit(-1); 00025 } 00026 std::ifstream pdfile2( infile2 ); 00027 if( !pdfile2 ) { 00028 std::cerr << "cannot open " << infile2 << std::endl; 00029 exit(-1); 00030 } 00031 // construct PDT 00032 HepPDT::ParticleDataTable datacol( "EvtGen Table" ); 00033 { 00034 // Construct table builder 00035 HepPDT::TableBuilder tb(datacol); 00036 // read the input - put as many here as you want 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 } // the tb destructor fills datacol 00040 // open output file 00041 std::ofstream wpdfile( outfile ); 00042 if( !wpdfile ) { 00043 std::cerr << "cannot open " << outfile << std::endl; 00044 exit(-1); 00045 } 00046 // write a translation list 00047 datacol.writeParticleTranslation( wpdfile ); 00048 00049 return 0; 00050 }