![]() |
HepMC Reference DocumentationHepMC |
00001 //-------------------------------------------------------------------------- 00002 #ifdef _WIN32 // This version is for Windows MS Visual C++ only. 00003 #ifndef PYTHIA_WRAPPER_H 00004 #define PYTHIA_WRAPPER_H 00005 00007 // Matt.Dobbs@Cern.CH, November 2000 00008 // Wrapper for FORTRAN version 6.152 of Pythia 00009 // (which is the version in CERNlib 2001) 00010 // The _WIN32 version is provided by Witold Pokorski 00011 // <Witold.Pokorski@Cern.CH>, 2002-01-22, and is the version 00012 // which should be used when compiling on Windows MS Visual C++. 00013 // This wrapper is NOT intended as a part of HepMC - it is only supplied 00014 // for your convenience. 00016 // 00017 // A simple example of calling Pythia from C++ using this header file is 00018 // given in test/test_PythiaWrapper.cxx 00019 // 00020 // Note the pyhepc routine is used by Pythia to fill 00021 // the HEPEVT common block uses double precision and 4000 entries. 00022 // 00023 00024 #include <ctype.h> 00025 00026 //-------------------------------------------------------------------------- 00027 // Initialization routine 00028 00029 extern "C" { 00030 void INITPYDATA(void); 00031 } 00032 #define initpydata INITPYDATA 00033 00034 //-------------------------------------------------------------------------- 00035 // PYTHIA Common Block Declarations 00036 00037 const int pyjets_maxn =4000; 00038 00039 struct PYSUBS_DEF { 00040 int msel, mselpd, msub[500], kfin[81][2]; 00041 double ckin[200]; 00042 }; 00043 00044 struct PYJETS_DEF { 00045 int n, npad, k[5][pyjets_maxn]; 00046 double p[5][pyjets_maxn], v[5][pyjets_maxn]; 00047 }; 00048 00049 struct PYDAT1_DEF { 00050 int mstu[200]; 00051 double paru[200]; 00052 int mstj[200]; 00053 double parj[200]; 00054 }; 00055 00056 struct PYDAT2_DEF { 00057 int kchg[4][500]; 00058 double pmas[4][500], parf[2000], vckm[4][4]; 00059 }; 00060 00061 struct PYPARS_DEF{ 00062 int mstp[200]; 00063 double parp[200]; 00064 int msti[200]; 00065 double pari[200]; 00066 }; 00067 00068 struct PYDATR_DEF{ 00069 int mrpy[6]; 00070 double rrpy[100]; 00071 }; 00072 00073 struct PYDAT3_DEF{ 00074 int mdcy[3][500], mdme[2][4000]; 00075 double brat[4000]; 00076 int kfdp[5][4000]; 00077 }; 00078 00079 00080 struct PYINT1_DEF{ 00081 int mint[400]; 00082 double vint[400]; 00083 }; 00084 00085 struct PYINT2_DEF{ 00086 int iset[500], kfpr[2][500]; 00087 double coef[20][500]; 00088 int icol[2][4][40]; // was [320] was [40][4][2] 00089 }; 00090 00091 struct PYINT5_DEF{ 00092 int ngenpd, ngen[3][501]; 00093 double xsec[3][501]; 00094 }; 00095 00096 00097 extern "C" PYSUBS_DEF PYSUBS; 00098 extern "C" PYJETS_DEF PYJETS; 00099 extern "C" PYDAT1_DEF PYDAT1; 00100 extern "C" PYDAT2_DEF PYDAT2; 00101 extern "C" PYPARS_DEF PYPARS; 00102 extern "C" PYDATR_DEF PYDATR; 00103 extern "C" PYDAT3_DEF PYDAT3; 00104 extern "C" PYINT1_DEF PYINT1; 00105 extern "C" PYINT2_DEF PYINT2; 00106 extern "C" PYINT5_DEF PYINT5; 00107 00108 00109 #define pysubs PYSUBS 00110 #define pyjets PYJETS 00111 #define pydat1 PYDAT1 00112 #define pydat2 PYDAT2 00113 #define pypars PYPARS 00114 #define pydatr PYDATR 00115 #define pydat3 PYDAT3 00116 #define pyint1 PYINT1 00117 #define pyint2 PYINT2 00118 #define pyint5 PYINT5 00119 00120 00121 00122 //-------------------------------------------------------------------------- 00123 // PYTHIA routines declaration 00124 00125 00126 extern "C" { 00127 void __stdcall PYSTAT(int*); 00128 void __stdcall PYHEPC(int*); 00129 void __stdcall PYLIST(int*); 00130 void __stdcall PYEVNT(void); 00131 00132 //-------------------------------------------------------------------------- 00133 // PYTHIA block data 00134 // ( with gcc it works to initialize the block data by calling 00135 // "pydata();" at beginning, but this fails for f77, so the fortran routine 00136 // initpydata.f is supplied ... call it instead for platform independent 00137 // behaviour ) 00138 void __stdcall PYDATA(void); 00139 00140 void __stdcall PYINIT(const char*, int, const char*, int, const char*, int, double*); 00141 } 00142 00143 00144 00145 00146 // define methods to hide the subtle syntax necessary to call fortran from C++ 00147 00148 inline void call_pyhepc( int mode ){ PYHEPC( &mode ); } 00149 inline void call_pyinit( const char* frame, const char* beam, const char* target, 00150 double win ) 00151 { PYINIT( frame,strlen(frame),beam,strlen(beam),target,strlen(target),&win); } 00152 inline void call_pylist( int mode ){ PYLIST( &mode ); } 00153 inline void call_pystat( int mode ){ PYSTAT( &mode ); } 00154 inline void call_pyevnt(){ PYEVNT(); } 00155 00156 00157 #endif // PYTHIA_WRAPPER_H 00158 #endif // _WIN32 00159 //--------------------------------------------------------------------------