00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <unistd.h>
00026 #include <Stiostream.h>
00027 #include "Stiostream.h"
00028 #include <string>
00029
00030
00031 #include "SystemOfUnits.h"
00032 #ifndef ST_NO_NAMESPACES
00033 using namespace units;
00034 #endif
00035
00036 #define HBOOK
00037 #ifdef HBOOK
00038 #include "StHbook.hh"
00039 #endif
00040 #include "Randomize.h"
00041
00042
00043 #include "StTrsDeDx.hh"
00044
00045
00046
00047 int main()
00048 {
00049 #ifdef HBOOK
00050 const int tupleSize = 3;
00051 StHbookFile hbookFile("hbook");
00052 StHbookTuple theTuple("dedx", tupleSize);
00053 float tuple[tupleSize];
00054 theTuple << "pri" << "tot" << "pnt" << book;
00055
00056 const int tupleSize2 = 2;
00057 StHbookTuple secTuple("distribution", tupleSize2);
00058 float tuple2[tupleSize2];
00059
00060 secTuple << "energy" << "sec" << book;
00061 #endif
00062
00063 string gas("Ar");
00064 StTrsDeDx myEloss(gas);
00065
00066 int primary, secondary;
00067 int totalSecondary;
00068 int total;
00069 double xysec;
00070
00071 myEloss.print();
00072 for(int pnt=0; pnt<10000; pnt++) {
00073
00074
00075 primary = myEloss.primary();
00076
00077
00078 totalSecondary = 0;
00079 for(int ii=0; ii<primary; ii++) {
00080
00081 secondary = myEloss.secondary(&xysec);
00082 totalSecondary += secondary;
00083 #ifdef HBOOK
00084 tuple2[0] = static_cast<float>(xysec/eV);
00085 tuple2[1] = static_cast<float>(secondary);
00086 secTuple.fill(tuple2);
00087 #endif
00088 totalSecondary +=secondary;
00089 }
00090
00091
00092 total = primary+totalSecondary;
00093
00094 #ifdef HBOOK
00095 tuple[0] = static_cast<float>(primary);
00096 tuple[1] = static_cast<float>(total);
00097 tuple[2] = static_cast<float>(pnt);
00098
00099 theTuple.fill(tuple);
00100 #endif
00101 }
00102
00103 cout <<"Done: " << endl;
00104
00105 #ifdef HBOOK
00106 hbookFile.saveAndClose();
00107 #endif
00108 return 0;
00109 }