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 infile[] = "@top_srcdir@/data/particle.tbl";
00018 const char outfile[] = "testReadParticleTable.out";
00019
00020 std::ifstream pdfile( infile );
00021 if( !pdfile ) {
00022 std::cerr << "cannot open " << infile << std::endl;
00023 exit(-1);
00024 }
00025
00026 HepPDT::ParticleDataTable datacol( "Generic Particle Table" );
00027 {
00028
00029 HepPDT::TableBuilder tb(datacol);
00030
00031
00032
00033
00034 if( !addParticleTable( pdfile, tb, true ) ) {
00035 std::cout << "error reading EvtGen pdt file " << std::endl;
00036 }
00037 }
00038
00039 std::ofstream wfile( outfile );
00040 if( !wfile ) {
00041 std::cerr << "cannot open " << outfile << std::endl;
00042 exit(-1);
00043 }
00044
00045 datacol.writeParticleData(wfile);
00046
00047 wfile << std::endl;
00048 wfile << std::endl;
00049 HepPDT::ParticleData * pd;
00050 pd=datacol.particle(HepPDT::ParticleID(1000020040));
00051 if(pd) pd->write(wfile);
00052 pd=datacol.particle(HepPDT::ParticleID(1000050110));
00053 if(pd) pd->write(wfile);
00054
00055
00056 const char outfile3[] = "testReadParticleTableStatus.out";
00057 std::ofstream wpdt3( outfile3 );
00058 if( !wpdt3 ) {
00059 std::cerr << "cannot open " << outfile3 << std::endl;
00060 exit(-1);
00061 }
00062 datacol.writeParticleStatus(wpdt3);
00063
00064 return 0;
00065 }