cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Herwig6Interface.cpp
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2024 Laurent Forthomme
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <unistd.h>
20
21#include <cstdio>
22
24
25namespace {
26 extern "C" {
27 void hwigin_();
28 void hwsfun_(double&, double&, int&, int&, double dist[13], int&);
29 double hwuaem_(double&);
30 double hwualf_(int&, double&);
31 }
32} // namespace
33
34namespace cepgen {
35 namespace herwig6 {
36 void initialise() {
37 static bool kInitialised = false;
38 if (kInitialised)
39 return;
40 { // capture stdout to avoid "polluting" consumer code with unmanaged output
41 int out = dup(fileno(stdout));
42 freopen("/tmp/herwig.log", "w", stdout);
43 hwigin_();
44 dup2(out, fileno(stdout));
45 close(out);
46 }
47 kInitialised = true;
48 }
49 double hwuaem(double q2) { return hwuaem_(q2); }
50 double hwualf(int mode, double q2) { return hwualf_(mode, q2); }
51 double hwsfun(double xbj, double q2, int idhad, int nset, int ibeam) {
52 std::array<double, 13> dist;
53 hwsfun_(xbj, q2, idhad, nset, dist.data(), ibeam);
54 return dist[0];
55 }
56 } // namespace herwig6
57} // namespace cepgen
double hwsfun(double xbj, double q2, int idhad, int nset, int ibeam)
double hwualf(int mode, double q2)
double hwuaem(double q2)
Common namespace for this Monte Carlo generator.