HepPDT Reference Documentation

HepPDT

listPDGNames.cc.in

00001 // ----------------------------------------------------------------------
00002 // listPDGNames.cc
00003 // Author: Lynn Garren
00004 //
00005 // read PDG table and write out translation 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 infile[] = "@top_srcdir@/data/mass_width_2006.mc";
00018     const char outfile[] = "listPDGNames.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( "PDG Table" );
00027     {
00028         // Construct table builder
00029         HepPDT::TableBuilder  tb(datacol);
00030         // read the input - put as many here as you want
00031         if( !addPDGParticles( pdfile, tb ) ) 
00032           { std::cout << "error reading PDG file " << std::endl; }
00033     }   // the tb destructor fills datacol
00034     // open output file
00035     std::ofstream wpdfile( outfile );
00036     if( !wpdfile ) { 
00037       std::cerr << "cannot open " << outfile << std::endl;
00038       exit(-1);
00039     }
00040     // write a translation list
00041     datacol.writeParticleTranslation( wpdfile );
00042 
00043     return 0;
00044 }

Generated on Fri Dec 4 14:05:23 2009 for HepPDT by  doxygen 1.4.7