00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef TABLEBUILDERT_HH
00019 #define TABLEBUILDERT_HH
00020
00021
00022 #include "CLHEP/config/CLHEP.h"
00023 #include "CLHEP/config/iostream.h"
00024 #include <string>
00025 #include <map>
00026
00027 #include "CLHEP/HepPDT/ParticleDataTableT.hh"
00028 #include "CLHEP/HepPDT/TempParticleData.hh"
00029 #include "CLHEP/HepPDT/DefTable.hh"
00030 #include "CLHEP/HepPDT/QQDecayTable.hh"
00031 #include "CLHEP/HepPDT/stringtodouble.hh"
00032
00033 namespace HepPDT {
00034
00035
00040 template< class Config >
00041 class TableBuilderT {
00042 typedef std::map<ParticleID,TempParticleData> TempMap;
00043 typedef std::map<std::string,ParticleID> TempIDMap;
00044 typedef std::map<std::string,TempAliasData> TempAliasMap;
00045
00046 public:
00047 explicit TableBuilderT( ParticleDataTableT<Config> & table,
00048 std::ostream & str = std::cerr )
00049 : pdt(table), os(str) { reverseEngineer(); }
00050 ~TableBuilderT() { pdt.convertTemporaryMap( tempPDT, os ); }
00051
00052 inline TempParticleData & getParticleData( ParticleID pid );
00053 inline TempParticleData & getParticleData( std::string const & name );
00054 inline TempParticleData & getAntiParticle( ParticleID pid,
00055 const std::string & aname );
00056
00057
00058
00059 inline void addParticle( TempParticleData const & pd );
00060 void removeParticle(ParticleID pid ) { tempPDT.remove(pid); }
00061
00062 inline void addAlias( TempAliasData const & ad );
00063
00064
00065
00066 inline bool hasParticleData( std::string const & name );
00067 inline bool hasAlias( std::string const & alias );
00068 bool hasDefinition( std::string const & def ) { return tempDefMap.hasDefinition( def ); }
00069
00070
00071
00072 int size() const { return tempPDT.size(); }
00073 int aliasSize() const { return tempAliases.size(); }
00074 DefTable & definitions() { return tempDefMap; }
00075 double definition( std::string const & def ) { return tempDefMap.definition( def ); }
00076 inline TempAliasData & aliasData( std::string const & alias );
00077
00078 private:
00079 ParticleDataTableT<Config> & pdt;
00080 TempMap tempPDT;
00081 TempIDMap tempIDT;
00082 TempAliasMap tempAliases;
00083 DefTable tempDefMap;
00084 std::ostream & os;
00085
00086 inline void fillPDT();
00087
00088 inline void reverseEngineer();
00089
00090
00091 TableBuilderT & operator = ( TableBuilderT const & );
00092 TableBuilderT( TableBuilderT const & );
00093
00094 };
00095
00096
00097
00098
00099
00100 template< class Config >
00101 inline
00102 bool addPDGParticles( std::istream & pdfile, TableBuilderT<Config> & tb );
00103
00104 template< class Config >
00105 inline
00106 bool addPythiaParticles( std::istream & pdfile, TableBuilderT<Config> & tb );
00107
00108 template< class Config >
00109 inline
00110 bool addHerwigParticles( std::istream & pdfile, TableBuilderT<Config> & tb );
00111
00112 template< class Config >
00113 inline
00114 bool addIsajetParticles( std::istream & pdfile, TableBuilderT<Config> & tb );
00115
00116 template< class Config >
00117 inline
00118 bool addQQParticles( QQDecayTable & qd, TableBuilderT<Config> & tb );
00119
00120 template< class Config >
00121 inline
00122 bool addEvtGenParticles( std::istream & pdfile, TableBuilderT<Config> & tb );
00123
00124 }
00125
00126 #include "CLHEP/HepPDT/TableBuilderT.icc"
00127 #include "CLHEP/HepPDT/TableBuilderPythiaT.icc"
00128 #include "CLHEP/HepPDT/TableBuilderHerwigT.icc"
00129 #include "CLHEP/HepPDT/TableBuilderIsajetT.icc"
00130 #include "CLHEP/HepPDT/TableBuilderTEvtGen.icc"
00131 #include "CLHEP/HepPDT/TableBuilderTQQ.icc"
00132
00133 #endif // TABLEBUILDERT_HH