]>
Commit | Line | Data |
---|---|---|
5ad4eb21 | 1 | // LHAFortran.h is a part of the PYTHIA event generator. |
2 | // Copyright (C) 2008 Torbjorn Sjostrand. | |
3 | // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details. | |
4 | // Please respect the MCnet Guidelines, see GUIDELINES for details. | |
5 | ||
6 | // Header file for Fortran Les Houches Accord user process information. | |
7 | // LHAupFortran: derived class with the HEPRUP and HEPEUP Fortran info. | |
8 | // You are expected to supply the fillHepRup and fillHepEup methods. | |
9 | ||
10 | #ifndef Pythia8_LHAFortran_H | |
11 | #define Pythia8_LHAFortran_H | |
12 | ||
13 | #include "PythiaStdlib.h" | |
14 | ||
15 | namespace Pythia8 { | |
16 | ||
17 | //************************************************************************** | |
18 | ||
19 | // Give access to the HEPRUP and HEPEUP Fortran commonblocks. | |
20 | ||
21 | extern "C" { | |
22 | ||
23 | extern struct { | |
24 | int idbmup[2]; | |
25 | double ebmup[2]; | |
26 | int pdfgup[2], pdfsup[2], idwtup, nprup; | |
27 | double xsecup[100], xerrup[100], xmaxup[100]; | |
28 | int lprup[100]; | |
29 | } heprup_; | |
30 | ||
31 | extern struct { | |
32 | int nup, idprup; | |
33 | double xwgtup, scalup, aqedup, aqcdup; | |
34 | int idup[500], istup[500], mothup[500][2], icolup[500][2]; | |
35 | double pup[500][5], vtimup[500],spinup[500]; | |
36 | } hepeup_; | |
37 | ||
38 | } | |
39 | ||
40 | //********* | |
41 | ||
42 | // A derived class with initialization information from the HEPRUP | |
43 | // Fortran commonblock and event information from the HEPEUP one. | |
44 | ||
45 | class LHAupFortran : public LHAup { | |
46 | ||
47 | public: | |
48 | ||
49 | // Constructor. | |
50 | LHAupFortran() {} | |
51 | ||
52 | // Routine for doing the job of setting initialization info. | |
53 | bool setInit() { | |
54 | // Call the routine that does the job. | |
55 | if (!fillHepRup()) return false; | |
56 | // Store beam and strategy info. | |
57 | setBeamA(heprup_.idbmup[0], heprup_.ebmup[0], heprup_.pdfgup[0], | |
58 | heprup_.pdfsup[0]); | |
59 | setBeamB(heprup_.idbmup[1], heprup_.ebmup[1], heprup_.pdfgup[1], | |
60 | heprup_.pdfsup[1]); | |
61 | setStrategy(heprup_.idwtup); | |
62 | // Store process info. Protect against vanishing cross section. | |
63 | for (int ip = 0; ip < heprup_.nprup; ++ip) { | |
64 | double xsec = max( 1e-10, heprup_.xsecup[ip]); | |
65 | addProcess( heprup_.lprup[ip], xsec, heprup_.xerrup[ip], | |
66 | heprup_.xmaxup[ip] ); | |
67 | } | |
68 | // Done. | |
69 | return true; | |
70 | } | |
71 | ||
72 | // Routine for doing the job of setting info on next event. | |
73 | bool setEvent(int idProcIn = 0) { | |
74 | // In some strategies the type of the next event has been set. | |
75 | hepeup_.idprup = idProcIn; | |
76 | // Call the routine that does the job. | |
77 | if (!fillHepEup()) return false; | |
78 | // Store process info. | |
79 | setProcess(hepeup_.idprup, hepeup_.xwgtup, hepeup_.scalup, | |
80 | hepeup_.aqedup, hepeup_.aqcdup); | |
81 | // Store particle info. | |
82 | for (int ip = 0; ip < hepeup_.nup; ++ip) addParticle(hepeup_.idup[ip], | |
83 | hepeup_.istup[ip], hepeup_.mothup[ip][0], hepeup_.mothup[ip][1], | |
84 | hepeup_.icolup[ip][0], hepeup_.icolup[ip][1], hepeup_.pup[ip][0], | |
85 | hepeup_.pup[ip][1], hepeup_.pup[ip][2], hepeup_.pup[ip][3], | |
86 | hepeup_.pup[ip][4], hepeup_.vtimup[ip], hepeup_.spinup[ip]) ; | |
87 | // Done. | |
88 | return true; | |
89 | } | |
90 | ||
91 | private: | |
92 | ||
93 | // User-written routine that does the intialization and fills heprup. | |
94 | bool fillHepRup(); | |
95 | ||
96 | // User-written routine that does the event generation and fills hepeup. | |
97 | bool fillHepEup(); | |
98 | ||
99 | }; | |
100 | ||
101 | //************************************************************************** | |
102 | ||
103 | } // end namespace Pythia8 | |
104 | ||
105 | #endif // Pythia8_LHAFortran_H |