![]() |
HepPDT Reference DocumentationHepPDT |
00001 #ifndef TestNuclearFragment_HH 00002 #define TestNuclearFragment_HH 00003 // ---------------------------------------------------------------------- 00004 // 00005 // TestNuclearFragment.hh 00006 // Author: Lynn Garren 00007 // 00008 // ---------------------------------------------------------------------- 00009 00010 #include <sstream> 00011 00012 #include "HepPDT/ProcessUnknownID.hh" 00013 #include "HepPDT/ParticleData.hh" 00014 00015 namespace HepPDT { 00016 00018 00029 class TestNuclearFragment : public ProcessUnknownID { 00030 public: 00031 TestNuclearFragment() {} 00032 00033 virtual ParticleData * processUnknownID( ParticleID, const ParticleDataTable & pdt ); 00034 00035 }; 00036 00037 00038 inline ParticleData * TestNuclearFragment::processUnknownID 00039 ( ParticleID key, const ParticleDataTable & pdt ) 00040 { 00041 if( ! key.isNucleus() ) return 0; 00042 // have to create a TempParticleData with all properties first 00043 TempParticleData tpd(key); 00044 // calculate approximate mass 00045 // WARNING: any calls to particle() from here MUST reference 00046 // a ParticleData which is already in the table 00047 // This convention is enforced. 00048 const ParticleData * proton = pdt.particle(2212); 00049 if( ! proton ) return 0; 00050 double protonMass = proton->mass(); 00051 tpd.tempMass = Measurement(key.A()*protonMass, 0.); 00052 std::ostringstream sname; 00053 sname << "fragment-" << key.pid(); 00054 tpd.tempParticleName = sname.str(); 00055 std::cout << "TestNuclearFragment::processUnknownID: creating ParticleData for " 00056 << key.pid() << std::endl; 00057 return new ParticleData(tpd); 00058 } 00059 00060 } // HepPDT 00061 00062 #endif // TestNuclearFragment_HH