HepPDT Reference Documentation

HepPDT

getIsajetID.cc

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------
00002 //
00003 // getIsajetID.cc
00004 // Author: Lynn Garren
00005 //
00006 // return Isajet particle ID from a line in the table
00007 //
00008 // ----------------------------------------------------------------------
00009 
00010 #include <iostream>
00011 #include <string>
00012 #include <sstream>
00013 
00014 namespace HepPDT {
00015 
00016 namespace detail {
00017 bool getIsajetID( int & id, const std::string & pdline )
00018 {
00019     int sl = pdline.length();
00020     id = 0;
00021     // line is too short
00022     if( sl < 30 ) return false;
00023     // now check for various comments to avoid problems with Solaris
00024     std::string header  = pdline.substr(17,8);
00025     std::string labels = pdline.substr(11,8);
00026     if( header == "PARTICLE" || labels == "PARTICLE" ) return false;
00027     // try to read the ID number
00028     std::string firstc = pdline.substr(0,1);
00029     if( firstc == " " ){
00030       std::istringstream var1( pdline.substr(0,10).c_str() );
00031       var1 >> id;               // if var1 is blank, id is not changed
00032       return true;
00033     } else {
00034         return false;
00035     }
00036 }
00037 }  // namespace detail
00038 
00039 }       // HepPDT

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