00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TableBuilder_HH
00018 #define TableBuilder_HH
00019
00020
00021 #include <iostream>
00022 #include <string>
00023 #include <map>
00024
00025 #include "HepPDT/ParticleDataTable.hh"
00026 #include "HepPDT/TempParticleData.hh"
00027 #include "HepPDT/DefTable.hh"
00028 #include "HepPDT/stringtodouble.hh"
00029
00030 namespace HepPDT {
00031
00033
00042 class TableBuilder {
00043 typedef std::map<ParticleID,TempParticleData> TempMap;
00044 typedef std::map<std::string,ParticleID> TempIDMap;
00045 typedef std::map<std::string,TempAliasData> TempAliasMap;
00046
00047 public:
00049 explicit TableBuilder( ParticleDataTable & table,
00050 std::ostream & str = std::cerr )
00051 : pdt(table), os(str) { reverseEngineer(); }
00053 ~TableBuilder() { pdt.convertTemporaryMap( tempPDT, os ); }
00054
00056 inline TempParticleData & getParticleData( ParticleID pid );
00058 inline TempParticleData & getParticleData( std::string const & name );
00060 inline TempParticleData & getAntiParticle( ParticleID pid,
00061 const std::string & aname );
00062
00063
00064
00066 inline void addParticle( TempParticleData const & pd );
00068 void removeParticle(ParticleID pid ) { tempPDT.erase(pid); }
00069
00071 inline void addAlias( TempAliasData const & ad );
00072
00073
00074
00076 inline bool hasParticleData( std::string const & name );
00078 inline bool hasAlias( std::string const & alias );
00080 bool hasDefinition( std::string const & def ) { return tempDefMap.hasDefinition( def ); }
00081
00082
00083
00085 int size() const { return tempPDT.size(); }
00087 int aliasSize() const { return tempAliases.size(); }
00089 DefTable & definitions() { return tempDefMap; }
00091 double definition( std::string const & def ) { return tempDefMap.definition( def ); }
00093 inline TempAliasData & aliasData( std::string const & alias );
00094
00095 private:
00096 ParticleDataTable & pdt;
00097 TempMap tempPDT;
00098 TempIDMap tempIDT;
00099 TempAliasMap tempAliases;
00100 DefTable tempDefMap;
00101 std::ostream & os;
00102
00103 inline void fillPDT();
00104
00105
00106 inline void reverseEngineer();
00107
00108
00109 TableBuilder & operator = ( TableBuilder const & );
00110 TableBuilder( TableBuilder const & );
00111
00112 };
00113
00114
00115
00116
00117
00119 bool addPDGParticles( std::istream &, TableBuilder & );
00120
00122 bool addPythiaParticles( std::istream &, TableBuilder & );
00123
00124 bool addHerwigParticles( std::istream &, TableBuilder & );
00125
00127 bool addIsajetParticles( std::istream &, TableBuilder & );
00129 bool addIsajetDecay( std::istream &, TableBuilder & );
00130
00132 bool addQQParticles( std::istream &, TableBuilder & );
00133
00135 bool addEvtGenParticles( std::istream &, TableBuilder & );
00136
00140 bool addParticleTable( std::istream &, TableBuilder &,
00141 bool validate = false );
00142
00143
00145
00151 namespace detail {
00152
00153 void getPDGpid( std::vector<int> &, std::string & );
00154 void getPDGnames( std::vector<std::string> &, std::string & );
00155 void parsePDGline( TempParticleData &, std::string & );
00156 bool CheckPDGEntry( TempParticleData &, const std::string &, double, double );
00157
00158 bool getPythiaid( int &, const std::string & );
00159 void parsePythiaLine( TempParticleData &, int &, std::string &,
00160 const std::string & );
00161 void parsePythiaDecayLine( TempParticleData &, const std::string & );
00162 TempDecayData getPythiaDecay( const std::string & );
00163
00164 bool getIsajetID( int &, const std::string & );
00165 void parseIsajetLine( TempParticleData &, const std::string & );
00166 void parseIsajetDecayLine( TempParticleData &, const std::string &,
00167 TableBuilder & );
00168
00169 bool getParticleID( int & id, const std::string & );
00170 void parseParticleLine( TempParticleData &, const std::string & );
00171
00172 }
00173
00174
00175 }
00176
00177 #include "HepPDT/TableBuilder.icc"
00178
00179 #endif // TableBuilder_HH