![]() |
HepPDT Reference DocumentationHepPDT |
00001 // ---------------------------------------------------------------------- 00002 // 00003 // TempParticleData.cc 00004 // Author: Lynn Garren 00005 // 00006 // ---------------------------------------------------------------------- 00007 00008 #include <algorithm> // swap() 00009 00010 #include "HepPDT/defs.h" 00011 #include "HepPDT/TempParticleData.hh" 00012 00013 namespace HepPDT { 00014 00015 TempParticleData::TempParticleData( ) 00016 : tempID ( ParticleID(0) ), 00017 tempParticleName ( "" ), 00018 tempSource ( "" ), 00019 tempOriginalID ( 0 ), 00020 tempCharge ( 0. ), 00021 tempColorCharge ( 0. ), 00022 tempSpin ( SpinState() ), 00023 tempMass ( Measurement(0.,0.) ), 00024 tempWidth ( Measurement(0.,0.) ), 00025 tempLowCutoff ( 0. ), 00026 tempHighCutoff ( 0. ), 00027 tempQuarks ( 0 ), 00028 tempDecayList ( 0 ) 00029 { ; } 00030 00031 00032 TempParticleData::TempParticleData( int id ) 00033 : tempID ( ParticleID(id) ), 00034 tempParticleName ( "" ), 00035 tempSource ( "" ), 00036 tempOriginalID ( 0 ), 00037 tempCharge ( 0. ), 00038 tempColorCharge ( 0. ), 00039 tempSpin ( SpinState() ), 00040 tempMass ( Measurement(0.,0.) ), 00041 tempWidth ( Measurement(0.,0.) ), 00042 tempLowCutoff ( 0. ), 00043 tempHighCutoff ( 0. ), 00044 tempQuarks ( 0 ), 00045 tempDecayList ( 0 ) 00046 { 00047 processPID(); 00048 } 00049 00050 TempParticleData::TempParticleData( ParticleID pid ) 00051 : tempID ( pid ), 00052 tempParticleName ( "" ), 00053 tempSource ( "" ), 00054 tempOriginalID ( 0 ), 00055 tempCharge ( 0. ), 00056 tempColorCharge ( 0. ), 00057 tempSpin ( SpinState() ), 00058 tempMass ( Measurement(0.,0.) ), 00059 tempWidth ( Measurement(0.,0.) ), 00060 tempLowCutoff ( 0. ), 00061 tempHighCutoff ( 0. ), 00062 tempQuarks ( 0 ), 00063 tempDecayList ( 0 ) 00064 { 00065 processPID(); 00066 } 00067 00068 TempParticleData::TempParticleData( int id, const std::string & name, 00069 const std::string & source, 00070 int oid, double charge, SpinState const & spin, 00071 Measurement const & mass, Measurement const & wid ) 00072 : tempID ( ParticleID(id) ), 00073 tempParticleName ( name ), 00074 tempSource ( source ), 00075 tempOriginalID ( oid ), 00076 tempCharge ( charge ), 00077 tempColorCharge ( 0. ), 00078 tempSpin ( spin ), 00079 tempMass ( mass ), 00080 tempWidth ( wid ), 00081 tempLowCutoff ( 0. ), 00082 tempHighCutoff ( 0. ), 00083 tempQuarks ( 0 ), 00084 tempDecayList ( 0 ) 00085 { ; } 00086 00087 TempParticleData TempParticleData::antiparticle( std::string const & name ) 00088 { 00089 double tchg = tempCharge; 00090 tempID = ParticleID( -tempID.pid() ); 00091 tempParticleName = name; 00092 tempOriginalID = 0; 00093 processPID(); 00094 tempSource = tempSource; 00095 tempColorCharge = tempColorCharge; 00096 tempMass = tempMass; 00097 tempWidth = tempWidth; 00098 tempLowCutoff = tempLowCutoff; 00099 tempHighCutoff = tempHighCutoff; 00100 tempDecayList = tempDecayList; 00101 // for PID's 81-100, charge may be known but cannot be inferred from the PID 00102 if( tchg != 0. ) { tempCharge = -tchg; } 00103 return *this; 00104 } 00105 00106 TempParticleData::TempParticleData( TempParticleData const & orig ) 00107 : tempID ( orig.tempID ), 00108 tempParticleName ( orig.tempParticleName ), 00109 tempSource ( orig.tempSource ), 00110 tempOriginalID ( orig.tempOriginalID ), 00111 tempCharge ( orig.tempCharge ), 00112 tempColorCharge ( orig.tempColorCharge ), 00113 tempSpin ( orig.tempSpin ), 00114 tempMass ( orig.tempMass ), 00115 tempWidth ( orig.tempWidth ), 00116 tempLowCutoff ( orig.tempLowCutoff ), 00117 tempHighCutoff ( orig.tempHighCutoff ), 00118 tempQuarks ( orig.tempQuarks ), 00119 tempDecayList ( orig.tempDecayList ) 00120 { ; } 00121 00122 TempParticleData & TempParticleData::operator = ( TempParticleData const & rhs ) 00123 { 00124 TempParticleData temp( rhs ); 00125 swap( temp ); 00126 return *this; 00127 } 00128 00129 void TempParticleData::swap( TempParticleData & other ) 00130 { 00131 std::swap( tempID, other.tempID ); 00132 std::swap( tempParticleName, other.tempParticleName ); 00133 std::swap( tempSource, other.tempSource ); 00134 std::swap( tempOriginalID, other.tempOriginalID ); 00135 std::swap( tempCharge, other.tempCharge ); 00136 std::swap( tempColorCharge, other.tempColorCharge ); 00137 std::swap( tempSpin, other.tempSpin ); 00138 std::swap( tempMass, other.tempMass ); 00139 std::swap( tempWidth, other.tempWidth ); 00140 std::swap( tempLowCutoff, other.tempLowCutoff ); 00141 std::swap( tempHighCutoff, other.tempHighCutoff ); 00142 std::swap( tempQuarks, other.tempQuarks ); 00143 std::swap( tempDecayList, other.tempDecayList ); 00144 } 00145 00146 bool TempParticleData::processPID() 00147 { 00148 // extract charge, spin, and quark content from PID 00149 if( tempID.pid() == 0 ) { return false; } 00150 tempCharge = double( tempID.threeCharge() )/3.0; 00151 tempSpin.setTotalSpin( spinitod( tempID.jSpin() ) ); 00152 tempSpin.setSpin( tempID.sSpin() ); 00153 tempSpin.setOrbAngMom( tempID.lSpin() ); 00154 Quarks ql = tempID.quarks(); 00155 if( ql.nq1 != 0 ) { 00156 TempConstituent tc; 00157 tc.tempConstituentPID = ParticleID( ql.nq1 ); 00158 tc.tempMultiplicity = 1; 00159 tempQuarks.push_back( tc ); 00160 } 00161 if( ql.nq2 != 0 ) { 00162 TempConstituent tc; 00163 tc.tempConstituentPID = ParticleID( ql.nq2 ); 00164 tc.tempMultiplicity = 1; 00165 tempQuarks.push_back( tc ); 00166 } 00167 if( ql.nq3 != 0 ) { 00168 TempConstituent tc; 00169 tc.tempConstituentPID = ParticleID( ql.nq3 ); 00170 tc.tempMultiplicity = 1; 00171 tempQuarks.push_back( tc ); 00172 } 00173 return true; 00174 } 00175 00176 TempAliasData::TempAliasData( ) 00177 : tempAlias ( "" ), 00178 tempAliasedParticle ( "" ), 00179 tempChargeConj ( "" ), 00180 tempAliasDecayList ( 0 ) 00181 { ; } 00182 00183 00184 } // HepPDT