00001
00002
00003
00004
00005
00006 #include "facilities/error.h"
00007 #include "gismo/GParticle.h"
00008 #include "gismo/PDT.h"
00009 #include "gismo/Material.h"
00010 #include <iostream>
00011
00012 #if 0 //defined(_DEBUG) && defined (_WIN32)
00013 # include <CRTDBG.H>
00014 # pragma comment(lib, "msvcrtd.lib")
00015 #endif
00016
00017 using namespace std;
00018
00019 const char* particleName= "pi0";
00020 int number = 1;
00021
00022 void WARNING(const char * text){std::cerr << "WARNING: " << text << '\n';}
00023 void FATAL(const char * text){
00024 std::cerr << "FATAL error: " <<text << '\n';
00025 std::cerr << "type help for instructions\n";
00026 exit(-1);}
00027
00028 static const char* instructions =
00029 "Format for the gismo test program decay:\n"
00030 "\n"
00031 " decay [[particle-name ] count ]\n\n"
00032 "Where particle-name is the name of a particle in the Particle data table\n"
00033 " or 'list' to get a list of particles\n"
00034 " or 'help' for these instructions\n"
00035 " count is the number of particles to decay\n";
00036
00037 int main(int argc, char* argv[])
00038 {
00039 if( argc>1 ) particleName = argv[1];
00040 if( argc>2 ) number = atoi(argv[2]);
00041
00042 if( strcmp(particleName,"list")==0 )
00043 {
00044 GParticle::thePDT()->printOn(cout);
00045 return 0;
00046 }
00047
00048 if( strcmp(particleName, "help")==0) {
00049 cout << instructions;
00050 return 0;
00051 }
00052
00053 std::cout << " Decay test \n";
00054
00055 PData* pd = GParticle::thePDT()->lookUp(particleName);
00056 if( pd==0) {
00057 std::cout
00058 << "Particle "<<particleName
00059 << " not found in the PDT. Use the 'list' option for a list of particles"
00060 << std::endl;
00061 return -1;
00062 }
00063 std::cout << " -------- decays ---------\n";
00064 std::cout << " id name mass width fraction type products";
00065
00066 pd->printOn(cout);
00067
00068
00069 for(int n=0; n<number; n++)
00070 {
00071 GParticle p(pd);
00072 p.decayOnce();
00073 cout << p << '\n';
00074 cout.flush();
00075 }
00076 #if 0 //defined(_DEBUG) && defined (_WIN32)
00077
00078 _CrtSetDbgFlag( _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF);
00079
00080 delete GParticle::thePDT();
00081 Material::deleteAll();
00082
00083 #endif
00084 return 0;
00085 }
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096