File indexing completed on 2025-01-30 10:11:34
0001
0002
0003
0004
0005
0006
0007
0008 #include <algorithm> // swap()
0009
0010 namespace HepPDT {
0011
0012 inline CommonParticleData::CommonParticleData( const TempParticleData & tpd )
0013 : itsID ( tpd.tempID ),
0014 itsParticleName ( tpd.tempParticleName ),
0015 itsSource ( tpd.tempSource ),
0016 itsOriginalID ( tpd.tempOriginalID ),
0017 itsCharge ( tpd.tempCharge ),
0018 itsColorCharge ( tpd.tempColorCharge ),
0019 itsSpin ( tpd.tempSpin ),
0020 itsQuarks ( 0 ),
0021 itsResonance ( ResonanceStructure( tpd.tempMass, tpd.tempWidth, tpd.tempLowCutoff, tpd.tempHighCutoff ) )
0022 {
0023 getConstituentsFromPID();
0024 }
0025
0026 inline CommonParticleData::~CommonParticleData()
0027 { ; }
0028
0029 inline void CommonParticleData::swap( CommonParticleData & other )
0030 {
0031 std::swap(itsParticleName, other.itsParticleName);
0032 std::swap(itsSource , other.itsSource);
0033 std::swap(itsOriginalID , other.itsOriginalID);
0034 itsID.swap( other.itsID );
0035 std::swap(itsCharge , other.itsCharge);
0036 std::swap(itsColorCharge , other.itsColorCharge);
0037 itsSpin.swap( other.itsSpin );
0038 std::swap(itsQuarks , other.itsQuarks);
0039 std::swap(itsResonance , other.itsResonance);
0040 }
0041
0042 inline CommonParticleData::CommonParticleData( const CommonParticleData & orig )
0043 : itsID ( orig.itsID ),
0044 itsParticleName ( orig.itsParticleName ),
0045 itsSource ( orig.itsSource ),
0046 itsOriginalID ( orig.itsOriginalID ),
0047 itsCharge ( orig.itsCharge ),
0048 itsColorCharge ( orig.itsColorCharge ),
0049 itsSpin ( orig.itsSpin ),
0050 itsQuarks ( orig.itsQuarks ),
0051 itsResonance ( orig.itsResonance )
0052 { ; }
0053
0054 inline CommonParticleData & CommonParticleData::operator=( const CommonParticleData & rhs )
0055 {
0056 CommonParticleData temp( rhs );
0057 swap( temp );
0058 return *this;
0059 }
0060
0061 inline bool CommonParticleData::operator<( const CommonParticleData & other ) const
0062 {
0063 return ( mass() < other.mass() );
0064 }
0065
0066 inline bool CommonParticleData::operator==( const CommonParticleData & other ) const
0067 {
0068 return ( itsID == other.itsID );
0069 }
0070
0071 inline void CommonParticleData::getConstituentsFromPID()
0072 {
0073 Quarks qlist = itsID.quarks();
0074 if( qlist.nq1 != 0 ) {
0075 ParticleID pid(qlist.nq1);
0076 Constituent c( pid, 1 );
0077 addConstituent( c );
0078 }
0079 if( qlist.nq2 != 0 ) {
0080 ParticleID pid(qlist.nq2);
0081 Constituent c( pid, 1 );
0082 addConstituent( c );
0083 }
0084 if( qlist.nq3 != 0 ) {
0085 ParticleID pid(qlist.nq3);
0086 Constituent c( pid, 1 );
0087 addConstituent( c );
0088 }
0089 }
0090
0091 inline Constituent CommonParticleData::constituent( unsigned int i ) const
0092 {
0093
0094 if( i >= itsQuarks.size() ) {
0095
0096 return Constituent();
0097 } else {
0098 return itsQuarks[i];
0099 }
0100 }
0101
0102 inline ParticleID CommonParticleData::constituentParticle( unsigned int i ) const
0103 {
0104 if( i >= itsQuarks.size() ) {
0105
0106 return ParticleID(0);
0107 } else {
0108 return itsQuarks[i].pid();
0109 }
0110 }
0111
0112 }