File indexing completed on 2025-01-30 10:11:35
0001
0002
0003
0004
0005
0006
0007
0008 #include <sstream>
0009
0010 namespace HepPDT {
0011
0012
0013 void TableBuilder::fillPDT()
0014 { ; }
0015
0016
0017
0018 void TableBuilder::reverseEngineer()
0019 { ; }
0020
0021 TempParticleData & TableBuilder::getParticleData( ParticleID pid )
0022 {
0023 TempMap::iterator it = tempPDT.find( pid );
0024
0025 if ( it == tempPDT.end() ) {
0026 return tempPDT[pid] = TempParticleData(pid);
0027 } else {
0028 return it->second;
0029 }
0030
0031
0032
0033 }
0034
0035 TempParticleData & TableBuilder::getParticleData( std::string const & name )
0036 {
0037 TempIDMap::iterator it = tempIDT.find( name );
0038 if( it == tempIDT.end() ) {
0039
0040 os << "HepPDT::TableBuilder.getParticleData: There is no entry for " << name << std::endl;
0041 exit(-3);
0042 }
0043 ParticleID pid = it->second;
0044 return getParticleData( pid );
0045 }
0046
0047 TempParticleData & TableBuilder::getAntiParticle( ParticleID pid,
0048 const std::string & aname )
0049 {
0050
0051 ParticleID apid = ParticleID( -pid.pid() );
0052 TempMap::iterator it = tempPDT.find( apid );
0053 if( it != tempPDT.end() ) {
0054 return it->second;
0055 }
0056
0057 it = tempPDT.find( pid );
0058 if( it == tempPDT.end() ) {
0059
0060 TempParticleData atpd = getParticleData( apid );
0061 atpd.tempParticleName = aname;
0062 return tempPDT[apid] = atpd;
0063 } else {
0064
0065 TempParticleData tpd = it->second;
0066 TempParticleData atpd = tpd.antiparticle( aname );
0067 return tempPDT[apid] = atpd;
0068 }
0069 }
0070
0071 bool TableBuilder::hasParticleData( std::string const & name )
0072 {
0073 TempIDMap::iterator it = tempIDT.find( name );
0074 return ( it == tempIDT.end() ) ? false : true;
0075 }
0076
0077 bool TableBuilder::hasAlias( std::string const & alias )
0078 {
0079 TempAliasMap::iterator it = tempAliases.find( alias );
0080 return ( it == tempAliases.end() ) ? false : true;
0081 }
0082
0083 void TableBuilder::addParticle( TempParticleData const & pd ) {
0084 getParticleData( pd.tempID ) = pd;
0085 if( !hasParticleData( pd.tempParticleName ) ) {
0086 tempIDT[pd.tempParticleName] = pd.tempID;
0087 }
0088 }
0089
0090
0091 void TableBuilder::addAlias( TempAliasData const & ad )
0092 {
0093 std::string alias = ad.tempAlias;
0094 tempAliases[alias] = ad;
0095 }
0096
0097 TempAliasData& TableBuilder::aliasData( std::string const & alias )
0098 {
0099 TempAliasMap::iterator it = tempAliases.find( alias );
0100 if( it == tempAliases.end() ) {
0101
0102 os << "HepPDT::TableBuilder.aliasData: There is no entry for "
0103 << alias << std::endl;
0104 exit(-4);
0105 }
0106 return it->second;
0107 }
0108
0109 }