HepPDT Reference Documentation

HepPDT

TestNuclearFragment.hh

Go to the documentation of this file.
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     ParticleData * pd = 0;
00042     if( key.isNucleus() ) {
00043      
00044         // have to create a TempParticleData with all properties first
00045         TempParticleData tpd(key);
00046         // calculate approximate mass
00047         // WARNING: any calls to particle() from here MUST reference 
00048         //          a ParticleData which is already in the table
00049         // This convention is enforced.
00050         const ParticleData * proton = pdt.particle(2212);
00051         if( proton ) {
00052             double protonMass = proton->mass();
00053             tpd.tempMass = Measurement(key.A()*protonMass, 0.);
00054             std::ostringstream sname;
00055             sname << "fragment-" << key.pid();
00056             tpd.tempParticleName = sname.str();
00057             std::cout << "processUnknownID: creating ParticleData for " 
00058                       << key.pid() << std::endl;
00059             pd = new ParticleData(tpd);
00060         }
00061     }
00062     return pd;
00063 }
00064 
00065 }       // HepPDT
00066 
00067 #endif // TestNuclearFragment_HH

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