00001
00002
00003
00004 #include "gismo/Medium.h"
00005 #include "gismo/Material.h"
00006 #include "gismo/MCParticle.h"
00007 #include "gismo/Interactor.h"
00008 #include "gismo/Units.h"
00009 #include "heavy/HeavyInteractor.h"
00010 #include "gismo/GheishaInteractor.h"
00011
00012
00013 const char* particleName="He";
00014 const char* materialName="Al";
00015 float pBeam =10.0;
00016 unsigned eventCount=1;
00017
00018 using namespace std;
00019
00020 Vector pinit(0,0,pBeam);
00021
00022 void WARNING(const char * text){cerr << "WARNING: " << text << '\n';}
00023 void FATAL(const char * text){
00024 cerr << "FATAL error: " <<text << '\n';
00025 cerr << "type help for instructions\n";
00026 exit(-1);}
00027
00028 const char* help=
00029 "Help for the heavy test program interact:\n\n"
00030 " heavy_test [[[[particleName] materialName] eventCount] pBeam]\n\n"
00031 "where:\n"
00032 " particleName [default He] is the name of a particle to interact:\n"
00033 " (\"decay list\" for a list)\n"
00034 " materialName [Al] the name of a PEGS4 material file, e.g. Al.mat\n"
00035 " eventCount [1] number of events to generate\n"
00036 " pBeam [.0 GeV] the beam momentum\n";
00037
00038
00039 int main(int argc, char* argv[])
00040 {
00041 int n=0;
00042 if( argc>++n ) particleName = argv[n];
00043 if( strcmp(particleName, "help")==0 ) {cout << help; return 0;}
00044 if( argc>++n ) materialName = argv[n];
00045 if( argc>++n ) eventCount = atoi(argv[n]);
00046 if( argc>++n ) pBeam = atof(argv[n]);
00047
00048
00049 MCParticle::addInteractor( new HeavyInteractor );
00050 MCParticle::addInteractor( new GheishaInteractor("hadronic") );
00051
00052
00053
00054 Medium* med = new Medium((Medium*)0,(Shape*)0,materialName);
00055 MCParticle p(particleName);
00056 p.setMomentum(Vector(0,0,pBeam));
00057
00058 cout << "\nInteraction test of "
00059 << pBeam << " GeV " << particleName
00060 << " in " << materialName << '\n';
00061 cout << "Interactions performed by: "<< p.interactor()->className()
00062 << ", Interaction length: "
00063 << p.interactionLength(med) << " cm\n";
00064
00065
00066
00067 for( unsigned i=0; i<eventCount; i++) {
00068 MCParticle q(p);
00069 if( q.interact(med))
00070 q.setStatus(MCParticle::INTERACTED);
00071 cout << q << '\n';
00072 }
00073 cout.flush();
00074 return 0;
00075 }
00076
00077