HepPDT Reference Documentation

HepPDT

ParticleData.icc

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------
00002 //
00003 // ParticleData.icc
00004 // Author: Lynn Garren
00005 //
00006 // ----------------------------------------------------------------------
00007 
00008 #include <algorithm>    // swap()
00009 
00010 namespace HepPDT {
00011 
00012 inline ParticleData::ParticleData( const TempParticleData & tpd )
00013 : itsID            ( tpd.tempID ), 
00014   itsParticleName  ( tpd.tempParticleName ), 
00015   itsSource        ( tpd.tempSource ), 
00016   itsOriginalID    ( tpd.tempOriginalID ), 
00017   itsCharge        ( tpd.tempCharge ),
00018   itsColorCharge   ( tpd.tempColorCharge ),
00019   itsSpin          ( tpd.tempSpin ),
00020   itsQuarks        ( 0 ),
00021   itsResonance     ( ResonanceStructure( tpd.tempMass, tpd.tempWidth, tpd.tempLowCutoff, tpd.tempHighCutoff ) )
00022 {
00023     getConstituentsFromPID();
00024 }
00025 
00026 inline ParticleData::~ParticleData()
00027 { ; }
00028 
00029 inline void  ParticleData::swap( ParticleData & other )
00030 {
00031     std::swap(itsParticleName, other.itsParticleName); 
00032     std::swap(itsSource      , other.itsSource); 
00033     std::swap(itsOriginalID  , other.itsOriginalID); 
00034     itsID.swap( other.itsID ); 
00035     std::swap(itsCharge      , other.itsCharge);
00036     std::swap(itsColorCharge , other.itsColorCharge);
00037     itsSpin.swap( other.itsSpin );
00038     std::swap(itsQuarks      , other.itsQuarks);
00039     std::swap(itsResonance   , other.itsResonance);
00040 }
00041 
00042 inline ParticleData::ParticleData( const ParticleData & orig )
00043 : itsID            ( orig.itsID ), 
00044   itsParticleName  ( orig.itsParticleName ), 
00045   itsSource        ( orig.itsSource ), 
00046   itsOriginalID    ( orig.itsOriginalID ), 
00047   itsCharge        ( orig.itsCharge ),
00048   itsColorCharge   ( orig.itsColorCharge ),
00049   itsSpin          ( orig.itsSpin ),
00050   itsQuarks        ( orig.itsQuarks ),
00051   itsResonance     ( orig.itsResonance )
00052 { ; }
00053 
00054 inline ParticleData & ParticleData::operator=( const ParticleData & rhs )
00055 { 
00056   ParticleData temp( rhs );
00057   swap( temp );
00058   return *this;
00059 }
00060 
00061 inline bool ParticleData::isStable() const
00062 {
00063     if( totalWidth().value() == -1. ) return false;
00064     if( totalWidth().value() > 0 || lifetime().value() > 0 ) return false;
00065     return true;
00066 }
00067 
00068 inline bool ParticleData::operator<( const ParticleData & other ) const
00069 { 
00070   return ( mass() < other.mass() );
00071 }
00072 
00073 inline bool ParticleData::operator==( const ParticleData & other ) const
00074 { 
00075   return ( itsID == other.itsID );
00076 }
00077 
00078 inline void ParticleData::getConstituentsFromPID()
00079 {
00080     Quarks qlist = itsID.quarks();
00081     if( qlist.nq1 != 0 ) {
00082          ParticleID pid(qlist.nq1);
00083          Constituent c( pid, 1 );
00084          addConstituent( c );
00085     }
00086     if( qlist.nq2 != 0 ) {
00087          ParticleID pid(qlist.nq2);
00088          Constituent c( pid, 1 );
00089          addConstituent( c );
00090     }
00091     if( qlist.nq3 != 0 ) {
00092          ParticleID pid(qlist.nq3);
00093          Constituent c( pid, 1 );
00094          addConstituent( c );
00095     }
00096 }
00097 
00098 inline Constituent ParticleData::constituent( unsigned int i ) const
00099 {
00101     if( i >= itsQuarks.size() ) {
00102          // attempting invalid operation
00103          return Constituent();
00104     } else {
00105         return itsQuarks[i];
00106     }
00107 }
00108 
00109 inline ParticleID ParticleData::constituentParticle( unsigned int i ) const
00110 {
00111     if( i >= itsQuarks.size() ) {
00112          // attempting invalid operation
00113          return ParticleID(0);
00114     } else {
00115         return itsQuarks[i].pid();
00116     }
00117 }
00118 
00119 }       // HepPDT

Generated on Fri Oct 24 13:41:36 2008 for HepPDT by  doxygen 1.5.1-3