00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <stdlib.h>
00018 #include <time.h>
00019
00020 #include <stdio.h>
00021 #include <iostream>
00022 #include <fstream>
00023 #include <sstream>
00024 #include "HepMC/PythiaWrapper.h"
00025 #include "HepMC/IO_HEPEVT.h"
00026
00027 #include "HepMC/IO_BaseClass.h"
00028 #include "HepMC/GenEvent.h"
00029 #include "HepMC/SimpleVector.h"
00030 #include "MyPythia6Wrapper.h"
00031
00032 #include "HepMC/IO_GenEvent.h"
00033
00034
00035 #include "Configuration.h"
00036 #include "readpythiaConfigFile.h"
00037
00038 using namespace std;
00039
00040
00041 int main(int argc, const char* argv[])
00042 {
00043 if(argc <= 2 ) {
00044 std::cout << "Usage: " << argv[0] << " <Configuration File>" << " <name of file to generate to>"<< std::endl;
00045 return 0;
00046 }
00047
00048
00049 Configuration* currentconfig = new Configuration();
00050 if(currentconfig->read(argv[1]))
00051 {
00052 cout << " ... skip !" << endl;
00053 return 0;
00054 }
00055
00056
00057
00058
00059
00060
00061
00062 pyjets.n=0;
00063 call_pyhepc(1);
00064
00065 HepMC::HEPEVT_Wrapper::set_max_number_entries(10000);
00066 HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 pydatr.mrpy[1-1] = currentconfig->rseed ;
00078
00079
00080
00081
00082 cout << "Configuration Parameter List:" << endl;
00083
00084 for (unsigned int files=0; files<(currentconfig->ConfigFileNames).size(); files++)
00085 readConfigFile((currentconfig->ConfigFileNames)[files]);
00086
00087
00088
00089
00090
00091
00092
00093
00094 call_pyinit("CMS", "p", "p", 14000.);
00095
00096
00097
00098
00099 HepMC::IO_HEPEVT hepevtio;
00100
00101
00102
00103
00104
00105
00106
00107 int nShow = 50;
00108 int nShowPace = max(1,int(currentconfig->nevents)/nShow);
00109
00110 HepMC::IO_GenEvent ascii_out(argv[2],std::ios::out);
00111
00112 for (unsigned int iEvent = 1 ; iEvent <= currentconfig->nevents; iEvent++) {
00113
00114
00115 if (iEvent%nShowPace == 0) cout << "pythia6: Now begin event "
00116 << iEvent << endl;
00117
00118 call_pyevnt();
00119
00120 call_pyhepc(1);
00121 HepMC::GenEvent* evt = hepevtio.read_next_event();
00122
00123 evt->set_event_number(iEvent);
00124 evt->set_signal_process_id(20);
00125
00126
00127
00128
00129
00130 ascii_out << evt;
00131
00132
00133 delete evt;
00134 }
00135
00136
00137
00138 call_pystat(1);
00139
00140
00141 delete currentconfig;
00142
00143 cout<<"pythia6: program ends"<<endl;
00144
00145 cout<<"Run successfully!"<<endl;
00146 return 0;
00147 }
00148