![]() |
HepPDT Reference DocumentationHepPDT |
00001 // ---------------------------------------------------------------------- 00002 // 00003 // write.cc 00004 // Author: Lynn Garren 00005 // 00006 // ---------------------------------------------------------------------- 00007 00008 #include <iomanip> 00009 #include <sstream> 00010 00011 #include "HepPDT/defs.h" 00012 #include "HepPDT/ParticleData.hh" 00013 00014 using namespace std; 00015 00016 namespace HepPDT { 00017 00018 void ParticleData::write( std::ostream & ostr ) const 00019 { 00020 if( !itsID.isValid() ) { 00021 std::cout << " WARNING: invalid particle " << itsID.pid() << std::endl; 00022 return; 00023 } 00024 Measurement mass = itsResonance.mass(); 00025 Measurement width = itsResonance.totalWidth(); 00026 Measurement ctau = lifetime(); 00027 int il = itsParticleName.length(); 00028 ostr << itsParticleName ; 00029 // pad the name 00030 int pad; 00031 for( pad = 0; pad < 20 - il; ++pad ) { 00032 ostr << " " ; 00033 } 00034 ostr.width(12); 00035 ostr << itsID.pid(); 00036 ostr.width(8); 00037 ostr.precision(4); 00038 ostr << itsCharge; 00039 ostr.width(5); 00040 ostr.precision(2); 00041 ostr << " " << itsColorCharge; 00042 ostr.width(5); 00043 ostr << itsSpin.totalSpin() ; 00044 ostr.width(5); 00045 ostr << itsSpin.spin() ; 00046 ostr.width(5); 00047 ostr << itsSpin.orbAngMom() ; 00048 ostr.width(14); 00049 ostr.precision(5); 00050 ostr.setf(std::ios::scientific, std::ios::floatfield); 00051 ostr << mass.value() << "+/-" << mass.sigma() ; 00052 ostr.width(13); 00053 ostr.precision(4); 00054 ostr << width.value() << "+/-" << width.sigma() ; 00055 ostr.width(13); 00056 ostr.precision(4); 00057 ostr << lowerCutoff() << " " << upperCutoff(); 00058 ostr.width(15); 00059 ostr.precision(4); 00060 ostr << ctau.value() << "+/-" << ctau.sigma(); 00061 // return to default settings 00062 ostr.precision(6); 00063 ostr.setf(std::ios::fmtflags(0), std::ios::floatfield); 00064 // end the line 00065 ostr << std::endl; 00066 } 00067 00068 void ParticleData::writeParticleInfo( std::ostream & os ) const 00069 { 00070 write(os); 00071 } 00072 00073 void ParticleData::writeParticleTranslation( std::ostream & os ) const 00074 { 00075 os << " " << itsSource << ": "; 00076 os.width(20); 00077 os << itsParticleName; 00078 os.width(12); 00079 os << itsOriginalID; 00080 os << " HepPDT: "; 00081 os.width(20); 00082 os << PDTname(); 00083 os.width(12); 00084 os << pid() << std::endl; 00085 00086 return; 00087 } 00088 00089 } // HepPDT