![]() |
HepPDT Reference DocumentationHepPDT |
00001 // ---------------------------------------------------------------------- 00002 // 00003 // ParticleDataTable.hh 00004 // Author: Lynn Garren, Walter Brown 00005 // 00006 // ---------------------------------------------------------------------- 00007 #ifndef ParticleDataTable_HH 00008 #define ParticleDataTable_HH 00009 00010 #include <iostream> 00011 #include <string> 00012 #include <map> 00013 00014 #include "HepPDT/ParticleID.hh" 00015 #include "HepPDT/ParticleData.hh" 00016 #include "HepPDT/ParticleDataTableComparison.hh" 00017 #include "HepPDT/ProcessUnknownID.hh" 00018 #include "HepPDT/SimpleProcessUnknownID.hh" 00019 #include "HepPDT/Version.hh" 00020 00022 00027 namespace HepPDT { 00028 00030 00044 class ParticleDataTable { 00045 00046 public: 00047 typedef ParticleData CPD; 00048 00049 typedef std::map<ParticleID,TempParticleData> TempMap; 00050 typedef std::map<ParticleID,ParticleData,ParticleDataTableComparison> PDTMap; 00051 typedef std::map<std::string,ParticleID> PDTNameMap; 00052 00053 typedef PDTMap::const_iterator const_iterator; 00054 typedef PDTNameMap::const_iterator const_iteratorByName; 00055 00056 // --- birth/death: 00057 // 00060 ParticleDataTable( std::string name = " ", ProcessUnknownID* = new SimpleProcessUnknownID ); 00061 ~ParticleDataTable(); 00062 00063 // --- accessors: 00064 // 00066 int size() const { return itsMap.size(); } 00068 const_iterator begin() const { return itsMap.begin(); } 00070 const_iterator end() const { return itsMap.end(); } 00072 int sizeNameMap() const { return itsNameMap.size(); } 00074 const_iteratorByName beginNameMap() const { return itsNameMap.begin(); } 00076 const_iteratorByName endNameMap() const { return itsNameMap.end(); } 00078 std::string tableName() const { return itsTableName; } 00079 00081 ParticleData const * particle( ParticleID ) const; 00083 ParticleData * particle( ParticleID ); 00085 ParticleData const * particle( std::string ) const; 00087 ParticleData * particle( std::string ); 00088 00090 ParticleData * operator [] ( ParticleID ); 00092 ParticleData const * operator [] ( ParticleID ) const; 00094 ParticleData * operator [] ( std::string ); 00096 ParticleData const * operator [] ( std::string ) const; 00097 00099 void writeParticleData( std::ostream & outstr ); 00101 void writeParticleInfo( std::ostream & outstr ); 00103 void writeParticleTranslation( std::ostream & outstr ); 00105 void writeParticleStatus( std::ostream & ); 00106 00108 void convertTemporaryMap( TempMap & tempPDT, std::ostream & err ); 00109 00110 private: 00111 // --- local data: 00112 mutable PDTMap itsMap; 00113 mutable PDTNameMap itsNameMap; 00114 std::string itsTableName; 00115 ProcessUnknownID * itsProcessUnknownID; 00116 00117 // --- copying; forbidden: 00118 ParticleDataTable( const ParticleDataTable & orig ); 00119 ParticleDataTable& operator=( const ParticleDataTable & ); 00120 00121 // --- private methods 00122 void addParticle( ParticleData const & p ) const; 00123 // private interface to ProcessUnknownID 00124 ParticleData * DealWithUnknownID( ParticleID & ) const; 00125 // private non const iterators 00126 typedef PDTMap::iterator iterator; 00127 typedef PDTNameMap::iterator nameIterator; 00128 00129 }; // ParticleDataTable 00130 00131 // --- free functions 00132 // 00133 00134 bool writePDGStream (std::ostream & os, const ParticleDataTable & table); 00135 00136 bool writePythiaStream (std::ostream & os, const ParticleDataTable & table); 00137 00138 bool writeHerwigStream (std::ostream & os, const ParticleDataTable & table); 00139 00140 bool writeIsajetStream (std::ostream & os, const ParticleDataTable & table); 00141 00142 bool writeQQStream (std::ostream & os, const ParticleDataTable & table); 00143 00144 bool writeEvtGenStream (std::ostream & os, const ParticleDataTable & table); 00145 00146 00147 } // HepPDT 00148 00149 #include "HepPDT/ParticleDataTable.icc" 00150 00151 #endif // ParticleDataTable_HH