File indexing completed on 2024-04-06 12:29:42
0001 #ifndef SimDataFormats_GeneratorProducts_LHECommonBlocks_h
0002 #define SimDataFormats_GeneratorProducts_LHECommonBlocks_h
0003
0004 #include "SimDataFormats/GeneratorProducts/interface/LesHouches.h"
0005
0006 extern "C" {
0007 extern struct HEPRUP_ {
0008 int idbmup[2];
0009 double ebmup[2];
0010 int pdfgup[2];
0011 int pdfsup[2];
0012 int idwtup;
0013 int nprup;
0014 double xsecup[100];
0015 double xerrup[100];
0016 double xmaxup[100];
0017 int lprup[100];
0018 } heprup_;
0019
0020 extern struct HEPEUP_ {
0021 int nup;
0022 int idprup;
0023 double xwgtup;
0024 double scalup;
0025 double aqedup;
0026 double aqcdup;
0027 int idup[500];
0028 int istup[500];
0029 int mothup[500][2];
0030 int icolup[500][2];
0031 double pup[500][5];
0032 double vtimup[500];
0033 double spinup[500];
0034 } hepeup_;
0035 }
0036
0037 namespace lhef {
0038
0039 class CommonBlocks {
0040 public:
0041 static void fillHEPRUP(const HEPRUP *heprup) {
0042 heprup_.idbmup[0] = heprup->IDBMUP.first;
0043 heprup_.idbmup[1] = heprup->IDBMUP.second;
0044 heprup_.ebmup[0] = heprup->EBMUP.first;
0045 heprup_.ebmup[1] = heprup->EBMUP.second;
0046 heprup_.pdfgup[0] = heprup->PDFGUP.first;
0047 heprup_.pdfgup[1] = heprup->PDFGUP.second;
0048 heprup_.pdfsup[0] = heprup->PDFSUP.first;
0049 heprup_.pdfsup[1] = heprup->PDFSUP.second;
0050 heprup_.idwtup = heprup->IDWTUP;
0051 heprup_.nprup = heprup->NPRUP;
0052 for (int i = 0; i < heprup->NPRUP; i++) {
0053 heprup_.xsecup[i] = heprup->XSECUP[i];
0054 heprup_.xerrup[i] = heprup->XERRUP[i];
0055 heprup_.xmaxup[i] = heprup->XMAXUP[i];
0056 heprup_.lprup[i] = heprup->LPRUP[i];
0057 }
0058 }
0059
0060 static void fillHEPEUP(const HEPEUP *hepeup) {
0061 hepeup_.nup = hepeup->NUP;
0062 hepeup_.idprup = hepeup->IDPRUP;
0063 hepeup_.xwgtup = hepeup->XWGTUP;
0064 hepeup_.scalup = hepeup->SCALUP;
0065 hepeup_.aqedup = hepeup->AQEDUP;
0066 hepeup_.aqcdup = hepeup->AQCDUP;
0067 for (int i = 0; i < hepeup->NUP; i++) {
0068 hepeup_.idup[i] = hepeup->IDUP[i];
0069 hepeup_.istup[i] = hepeup->ISTUP[i];
0070 hepeup_.mothup[i][0] = hepeup->MOTHUP[i].first;
0071 hepeup_.mothup[i][1] = hepeup->MOTHUP[i].second;
0072 hepeup_.icolup[i][0] = hepeup->ICOLUP[i].first;
0073 hepeup_.icolup[i][1] = hepeup->ICOLUP[i].second;
0074 for (unsigned int j = 0; j < 5; j++)
0075 hepeup_.pup[i][j] = hepeup->PUP[i][j];
0076 hepeup_.vtimup[i] = hepeup->VTIMUP[i];
0077 hepeup_.spinup[i] = hepeup->SPINUP[i];
0078 }
0079 }
0080
0081 static void readHEPRUP(HEPRUP *heprup) {
0082 heprup->resize(heprup_.nprup);
0083 heprup->IDBMUP.first = heprup_.idbmup[0];
0084 heprup->IDBMUP.second = heprup_.idbmup[1];
0085 heprup->EBMUP.first = heprup_.ebmup[0];
0086 heprup->EBMUP.second = heprup_.ebmup[1];
0087 heprup->PDFGUP.first = heprup_.pdfgup[0];
0088 heprup->PDFGUP.second = heprup_.pdfgup[1];
0089 heprup->PDFSUP.first = heprup_.pdfsup[0];
0090 heprup->PDFSUP.second = heprup_.pdfsup[1];
0091 heprup->IDWTUP = heprup_.idwtup;
0092 for (int i = 0; i < heprup->NPRUP; i++) {
0093 heprup->XSECUP[i] = heprup_.xsecup[i];
0094 heprup->XERRUP[i] = heprup_.xerrup[i];
0095 heprup->XMAXUP[i] = heprup_.xmaxup[i];
0096 heprup->LPRUP[i] = heprup_.lprup[i];
0097 }
0098 }
0099
0100 static void readHEPEUP(HEPEUP *hepeup) {
0101 hepeup->resize(hepeup_.nup);
0102 hepeup->IDPRUP = hepeup_.idprup;
0103 hepeup->XWGTUP = hepeup_.xwgtup;
0104 hepeup->SCALUP = hepeup_.scalup;
0105 hepeup->AQEDUP = hepeup_.aqedup;
0106 hepeup->AQCDUP = hepeup_.aqcdup;
0107 for (int i = 0; i < hepeup->NUP; i++) {
0108 hepeup->IDUP[i] = hepeup_.idup[i];
0109 hepeup->ISTUP[i] = hepeup_.istup[i];
0110 hepeup->MOTHUP[i].first = hepeup_.mothup[i][0];
0111 hepeup->MOTHUP[i].second = hepeup_.mothup[i][1];
0112 hepeup->ICOLUP[i].first = hepeup_.icolup[i][0];
0113 hepeup->ICOLUP[i].second = hepeup_.icolup[i][1];
0114 for (unsigned int j = 0; j < 5; j++)
0115 hepeup->PUP[i][j] = hepeup_.pup[i][j];
0116 hepeup->VTIMUP[i] = hepeup_.vtimup[i];
0117 hepeup->SPINUP[i] = hepeup_.spinup[i];
0118 }
0119 }
0120
0121 CommonBlocks() = delete;
0122 ~CommonBlocks() = delete;
0123 };
0124
0125 }
0126
0127 #endif