00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <string>
00011 #include <vector>
00012 #include <sstream>
00013
00014 #include "HepPDT/defs.h"
00015 #include "HepPDT/TableBuilder.hh"
00016
00017 namespace HepPDT {
00018
00019 namespace detail {
00020 void getPDGpid( std::vector<int> & idlist, std::string & pdline )
00021 {
00022 int sl, cl, id1, id2, id3, id4;
00023 sl = pdline.length();
00024 cl = pdline.find('*');
00025
00026 idlist.clear();
00027 if( cl != 0 && sl > 80 ){
00028
00029
00030 id1 = id2 = id3 = id4 = 0;
00031 std::istringstream idnet( pdline.substr(1,32).c_str() );
00032 idnet >> id1 >> id2 >> id3 >> id4;
00033 if( id1 > 0 ) { idlist.push_back( id1 ); }
00034 if( id2 > 0 ) { idlist.push_back( id2 ); }
00035 if( id3 > 0 ) { idlist.push_back( id3 ); }
00036 if( id4 > 0 ) { idlist.push_back( id4 ); }
00037 }
00038 }
00039
00040 void getPDGnames( std::vector<std::string> & namelst, std::string & pdline )
00041 {
00042 int sl, cl;
00043 std::string name, charges, fullname;
00044 sl = pdline.length();
00045 cl = pdline.find('*');
00046
00047 namelst.clear();
00048 if( cl != 0 && sl > 80 ){
00049
00050 std::istringstream namelist( pdline.substr(68,21).c_str() );
00051 namelist >> name >> charges;
00052
00053 char buf[20];
00054 std::istringstream chglst(charges);
00055 while( chglst ) {
00056 chglst.getline(buf,20,',');
00057 if( chglst.gcount() > 0 ) {
00058 fullname = name + buf;
00059 namelst.push_back( fullname );
00060 }
00061 }
00062 }
00063 }
00064
00065
00066 }
00067
00068 }
00069