[1] | 1 | //-------------------------------------------------------------------------- |
---|
| 2 | #ifndef PYTHIA_WRAPPER_6_H |
---|
| 3 | #define PYTHIA_WRAPPER_6_H |
---|
| 4 | |
---|
| 5 | ////////////////////////////////////////////////////////////////////////// |
---|
| 6 | // Matt.Dobbs@Cern.CH, November 2000 |
---|
| 7 | // Version 6.200 update October 2001 |
---|
| 8 | // Wrapper for FORTRAN version of Pythia |
---|
| 9 | // This wrapper is NOT intended as a part of HepMC - it is only supplied |
---|
| 10 | // for your convenience. |
---|
| 11 | ////////////////////////////////////////////////////////////////////////// |
---|
| 12 | // |
---|
| 13 | // A simple example of calling Pythia from C++ using this header file is |
---|
| 14 | // given in test/test_PythiaWrapper.cxx |
---|
| 15 | // |
---|
| 16 | // Note the pyhepc routine is used by Pythia to fill |
---|
| 17 | // the HEPEVT common block uses double precision and 4000 entries. |
---|
| 18 | // |
---|
| 19 | |
---|
| 20 | #include <ctype.h> |
---|
| 21 | #include <cstring> |
---|
| 22 | |
---|
| 23 | //-------------------------------------------------------------------------- |
---|
| 24 | // Initialization routine |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | extern "C" { |
---|
| 28 | void initpydata(void); |
---|
| 29 | } |
---|
| 30 | #define initpydata initpydata_ |
---|
| 31 | |
---|
| 32 | //-------------------------------------------------------------------------- |
---|
| 33 | // PYTHIA Common Block Declarations |
---|
| 34 | |
---|
| 35 | const int pyjets_maxn =4000; |
---|
| 36 | extern "C" { |
---|
| 37 | extern struct { |
---|
| 38 | int n, npad, k[5][pyjets_maxn]; |
---|
| 39 | double p[5][pyjets_maxn], v[5][pyjets_maxn]; |
---|
| 40 | } pyjets_; |
---|
| 41 | } |
---|
| 42 | #define pyjets pyjets_ |
---|
| 43 | |
---|
| 44 | extern "C" { |
---|
| 45 | extern struct { |
---|
| 46 | int mstu[200]; |
---|
| 47 | double paru[200]; |
---|
| 48 | int mstj[200]; |
---|
| 49 | double parj[200]; |
---|
| 50 | } pydat1_; |
---|
| 51 | } |
---|
| 52 | #define pydat1 pydat1_ |
---|
| 53 | |
---|
| 54 | extern "C" { |
---|
| 55 | extern struct { |
---|
| 56 | int kchg[4][500]; |
---|
| 57 | double pmas[4][500], parf[2000], vckm[4][4]; |
---|
| 58 | } pydat2_; |
---|
| 59 | } |
---|
| 60 | #define pydat2 pydat2_ |
---|
| 61 | |
---|
| 62 | extern "C" { |
---|
| 63 | extern struct { |
---|
| 64 | int mdcy[3][500], mdme[2][8000]; |
---|
| 65 | double brat[8000]; |
---|
| 66 | int kfdp[5][8000]; |
---|
| 67 | } pydat3_; |
---|
| 68 | } |
---|
| 69 | #define pydat3 pydat3_ |
---|
| 70 | |
---|
| 71 | extern "C" { |
---|
| 72 | extern struct { |
---|
| 73 | int mrpy[6]; |
---|
| 74 | double rrpy[100]; |
---|
| 75 | } pydatr_; |
---|
| 76 | } |
---|
| 77 | #define pydatr pydatr_ |
---|
| 78 | |
---|
| 79 | extern "C" { |
---|
| 80 | extern struct { |
---|
| 81 | int msel, mselpd, msub[500], kfin[81][2]; |
---|
| 82 | double ckin[200]; |
---|
| 83 | } pysubs_; |
---|
| 84 | } |
---|
| 85 | #define pysubs pysubs_ |
---|
| 86 | |
---|
| 87 | extern "C" { |
---|
| 88 | extern struct { |
---|
| 89 | int mstp[200]; |
---|
| 90 | double parp[200]; |
---|
| 91 | int msti[200]; |
---|
| 92 | double pari[200]; |
---|
| 93 | } pypars_; |
---|
| 94 | } |
---|
| 95 | #define pypars pypars_ |
---|
| 96 | |
---|
| 97 | extern "C" { |
---|
| 98 | extern struct { |
---|
| 99 | int mint[400]; |
---|
| 100 | double vint[400]; |
---|
| 101 | } pyint1_; |
---|
| 102 | } |
---|
| 103 | #define pyint1 pyint1_ |
---|
| 104 | |
---|
| 105 | extern "C" { |
---|
| 106 | extern struct { |
---|
| 107 | int iset[500], kfpr[2][500]; |
---|
| 108 | double coef[20][500]; |
---|
| 109 | int icol[2][4][40]; |
---|
| 110 | } pyint2_; |
---|
| 111 | } |
---|
| 112 | #define pyint2 pyint2_ |
---|
| 113 | |
---|
| 114 | extern "C" { |
---|
| 115 | extern struct pin3 { |
---|
| 116 | double xsfx[81][2]; // Fortran is xsfx(2,-40:40) |
---|
| 117 | int isig[3][1000]; |
---|
| 118 | double sigh[1000]; |
---|
| 119 | } pyint3_; |
---|
| 120 | } |
---|
| 121 | #define pyint3 pyint3_ |
---|
| 122 | |
---|
| 123 | extern "C" { |
---|
| 124 | extern struct { |
---|
| 125 | int mwid[500]; |
---|
| 126 | double wids[5][500]; |
---|
| 127 | } pyint4_; |
---|
| 128 | } |
---|
| 129 | #define pyint4 pyint4_ |
---|
| 130 | |
---|
| 131 | extern "C" { |
---|
| 132 | extern struct pin5 { |
---|
| 133 | int ngenpd, ngen[3][501]; // Fortran is ngen(0:500,3) |
---|
| 134 | double xsec[3][501]; // Fortran is xsec(0:500,3) |
---|
| 135 | } pyint5_; |
---|
| 136 | } |
---|
| 137 | #define pyint5 pyint5_ |
---|
| 138 | |
---|
| 139 | extern "C" { |
---|
| 140 | extern struct pin7 { |
---|
| 141 | double sigt[6][7][7]; // Fortran is sigt(0:6,0:6,0:5) |
---|
| 142 | } pyint7_; |
---|
| 143 | } |
---|
| 144 | #define pyint7 pyint7_ |
---|
| 145 | |
---|
| 146 | extern "C" { |
---|
| 147 | extern struct pin8 { |
---|
| 148 | double xpvmd[13]; // Fortran is xpvmd(-6:6) |
---|
| 149 | double xpanl[13]; // Fortran is xpanl(-6:6) |
---|
| 150 | double xpanh[13]; // Fortran is xpanh(-6:6) |
---|
| 151 | double xpbeh[13]; // Fortran is xpbeh(-6:6) |
---|
| 152 | double xpdir[13]; // Fortran is xpdir(-6:6) |
---|
| 153 | } pyint8_; |
---|
| 154 | } |
---|
| 155 | #define pyint8 pyint8_ |
---|
| 156 | |
---|
| 157 | extern "C" { |
---|
| 158 | extern struct pin9 { |
---|
| 159 | double vxpvmd[13]; // Fortran is vxpvmd(-6:6) |
---|
| 160 | double vxpanl[13]; // Fortran is vxpanl(-6:6) |
---|
| 161 | double vxpanh[13]; // Fortran is vxpanh(-6:6) |
---|
| 162 | double vxpdgm[13]; // Fortran is vxpdgm(-6:6) |
---|
| 163 | } pyint9_; |
---|
| 164 | } |
---|
| 165 | #define pyint9 pyint9_ |
---|
| 166 | |
---|
| 167 | extern "C" { |
---|
| 168 | extern struct pssm { |
---|
| 169 | int imss[100]; // Fortran is imss(0:99) |
---|
| 170 | double rmss[100]; // Fortran is rmss(0:99) |
---|
| 171 | } pyssm_; |
---|
| 172 | } |
---|
| 173 | #define pyssm pyssm_ |
---|
| 174 | |
---|
| 175 | extern "C" { |
---|
| 176 | extern struct { |
---|
| 177 | double zmix[4][4]; |
---|
| 178 | double umix[2][2]; |
---|
| 179 | double vmix[2][2]; |
---|
| 180 | double smz[4]; |
---|
| 181 | double smw[2]; |
---|
| 182 | double sfmix[4][16]; |
---|
| 183 | double zmixi[4][4]; |
---|
| 184 | double umixi[2][2]; |
---|
| 185 | double vmixi[2][2]; |
---|
| 186 | } pyssmt_; |
---|
| 187 | } |
---|
| 188 | #define pyssmt pyssmt_ |
---|
| 189 | |
---|
| 190 | extern "C" { |
---|
| 191 | extern struct { |
---|
| 192 | double rvlam[3][3][3]; |
---|
| 193 | double rvlamp[3][3][3]; |
---|
| 194 | double rvlamb[3][3][3]; |
---|
| 195 | } pymsrv_; |
---|
| 196 | } |
---|
| 197 | #define pymsrv pymsrv_ |
---|
| 198 | |
---|
| 199 | extern "C" { |
---|
| 200 | extern struct prvnv { |
---|
| 201 | double ab[2][16][2]; |
---|
| 202 | double rms[4]; // Fortran is rms(0:3) |
---|
| 203 | double res[5][6]; |
---|
| 204 | int idr; |
---|
| 205 | int idr2; |
---|
| 206 | double dcmass; |
---|
| 207 | int kfr[3]; |
---|
| 208 | } pyrvnv_; |
---|
| 209 | } |
---|
| 210 | #define pyrvnv pyrvnv_ |
---|
| 211 | |
---|
| 212 | extern "C" { |
---|
| 213 | extern struct prvpm { |
---|
| 214 | double rm[4]; // Fortran is rm(0:3) |
---|
| 215 | double a[2]; |
---|
| 216 | double b[2]; |
---|
| 217 | double resm[2]; |
---|
| 218 | double resw[2]; |
---|
| 219 | bool mflag; |
---|
| 220 | } pyrvpm_; |
---|
| 221 | } |
---|
| 222 | #define pyrvpm pyrvpm_ |
---|
| 223 | |
---|
| 224 | extern "C" { |
---|
| 225 | extern struct { |
---|
| 226 | double xxm[20]; |
---|
| 227 | } pyints_; |
---|
| 228 | } |
---|
| 229 | #define pyints pyints_ |
---|
| 230 | |
---|
| 231 | extern "C" { |
---|
| 232 | extern struct { |
---|
| 233 | double x1; |
---|
| 234 | } pyg2dx_; |
---|
| 235 | } |
---|
| 236 | #define pyg2dx pyg2dx_ |
---|
| 237 | |
---|
| 238 | //-------------------------------------------------------------------------- |
---|
| 239 | // PYTHIA routines declaration |
---|
| 240 | |
---|
| 241 | #define pyhepc pyhepc_ |
---|
| 242 | #define pyinit pyinit_ |
---|
| 243 | #define pylist pylist_ |
---|
| 244 | #define pystat pystat_ |
---|
| 245 | #define pyevnt pyevnt_ |
---|
| 246 | #define upinit upinit_ |
---|
| 247 | #define upevnt upevnt_ |
---|
| 248 | extern "C" { |
---|
| 249 | void pyhepc(int*); |
---|
| 250 | void pyinit(const char*,const char*,const char*,double*,int,int,int); |
---|
| 251 | void pylist(int*); |
---|
| 252 | void pystat(int*); |
---|
| 253 | void pyevnt(); |
---|
| 254 | void upinit(); |
---|
| 255 | void upevnt(); |
---|
| 256 | } |
---|
| 257 | |
---|
| 258 | // define methods to hide the subtle syntax necessary to call fortran from C++ |
---|
| 259 | inline void call_pyhepc( int mode ){ pyhepc( &mode ); } |
---|
| 260 | inline void call_pyinit( const char* frame, const char* beam, const char* target, |
---|
| 261 | double win ) |
---|
| 262 | { pyinit( frame,beam,target,&win,strlen(frame),strlen(beam),strlen(target) ); } |
---|
| 263 | inline void call_pylist( int mode ){ pylist( &mode ); } |
---|
| 264 | inline void call_pystat( int mode ){ pystat( &mode ); } |
---|
| 265 | inline void call_pyevnt(){ pyevnt(); } |
---|
| 266 | |
---|
| 267 | |
---|
| 268 | //-------------------------------------------------------------------------- |
---|
| 269 | // PYTHIA block data |
---|
| 270 | // ( with gcc it works to initialize the block data by calling |
---|
| 271 | // "pydata();" at beginning, but this fails for f77, so the fortran routine |
---|
| 272 | // initpydata.f is supplied ... call it instead for platform independent |
---|
| 273 | // behaviour ) |
---|
| 274 | |
---|
| 275 | #define pydata pydata_ |
---|
| 276 | extern "C" { |
---|
| 277 | void pydata(void); |
---|
| 278 | } |
---|
| 279 | |
---|
| 280 | #endif // PYTHIA_WRAPPER_6_H |
---|
| 281 | //-------------------------------------------------------------------------- |
---|