File indexing completed on 2025-01-30 10:11:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef TableBuilder_HH
0018 #define TableBuilder_HH
0019
0020
0021 #include <iostream>
0022 #include <string>
0023 #include <map>
0024
0025 #include "HepPDT/ParticleDataTable.hh"
0026 #include "HepPDT/TempParticleData.hh"
0027 #include "HepPDT/DefTable.hh"
0028 #include "HepPDT/stringtodouble.hh"
0029
0030 namespace HepPDT {
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 class TableBuilder {
0043 typedef std::map<ParticleID,TempParticleData> TempMap;
0044 typedef std::map<std::string,ParticleID> TempIDMap;
0045 typedef std::map<std::string,TempAliasData> TempAliasMap;
0046
0047 public:
0048
0049 explicit TableBuilder( ParticleDataTable & table,
0050 std::ostream & str = std::cerr )
0051 : pdt(table), os(str) { reverseEngineer(); }
0052
0053 ~TableBuilder() { pdt.convertTemporaryMap( tempPDT, os ); }
0054
0055
0056 inline TempParticleData & getParticleData( ParticleID pid );
0057
0058 inline TempParticleData & getParticleData( std::string const & name );
0059
0060 inline TempParticleData & getAntiParticle( ParticleID pid,
0061 const std::string & aname );
0062
0063
0064
0065
0066 inline void addParticle( TempParticleData const & pd );
0067
0068 void removeParticle(ParticleID pid ) { tempPDT.erase(pid); }
0069
0070
0071 inline void addAlias( TempAliasData const & ad );
0072
0073
0074
0075
0076 inline bool hasParticleData( std::string const & name );
0077
0078 inline bool hasAlias( std::string const & alias );
0079
0080 bool hasDefinition( std::string const & def ) { return tempDefMap.hasDefinition( def ); }
0081
0082
0083
0084
0085 int size() const { return tempPDT.size(); }
0086
0087 int aliasSize() const { return tempAliases.size(); }
0088
0089 DefTable & definitions() { return tempDefMap; }
0090
0091 double definition( std::string const & def ) { return tempDefMap.definition( def ); }
0092
0093 inline TempAliasData & aliasData( std::string const & alias );
0094
0095 private:
0096 ParticleDataTable & pdt;
0097 TempMap tempPDT;
0098 TempIDMap tempIDT;
0099 TempAliasMap tempAliases;
0100 DefTable tempDefMap;
0101 std::ostream & os;
0102
0103 inline void fillPDT();
0104
0105
0106 inline void reverseEngineer();
0107
0108
0109 TableBuilder & operator = ( TableBuilder const & );
0110 TableBuilder( TableBuilder const & );
0111
0112 };
0113
0114
0115
0116
0117
0118
0119 bool addPDGParticles( std::istream &, TableBuilder & );
0120
0121
0122 bool addPythiaParticles( std::istream &, TableBuilder & );
0123
0124 bool addHerwigParticles( std::istream &, TableBuilder & );
0125
0126
0127 bool addIsajetParticles( std::istream &, TableBuilder & );
0128
0129 bool addIsajetDecay( std::istream &, TableBuilder & );
0130
0131
0132 bool addQQParticles( std::istream &, TableBuilder & );
0133
0134
0135 bool addEvtGenParticles( std::istream &, TableBuilder & );
0136
0137
0138 bool addParticleTable( std::istream &, TableBuilder & );
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148 namespace detail {
0149
0150 void getPDGpid( std::vector<int> &, std::string & );
0151 void getPDGnames( std::vector<std::string> &, std::string & );
0152 void parsePDGline( TempParticleData &, std::string & );
0153 bool CheckPDGEntry( TempParticleData &, const std::string &, double, double );
0154
0155 bool getPythiaid( int &, const std::string & );
0156 void parsePythiaLine( TempParticleData &, int &, std::string &,
0157 const std::string & );
0158 void parsePythiaDecayLine( TempParticleData &, const std::string & );
0159 TempDecayData getPythiaDecay( const std::string & );
0160
0161 bool getIsajetID( int &, const std::string & );
0162 void parseIsajetLine( TempParticleData &, const std::string & );
0163 void parseIsajetDecayLine( TempParticleData &, const std::string &,
0164 TableBuilder & );
0165
0166 bool getParticleID( int & id, const std::string & );
0167 void parseParticleLine( TempParticleData &, const std::string & );
0168
0169 }
0170
0171
0172 }
0173
0174 #include "HepPDT/TableBuilder.icc"
0175
0176 #endif