Anonymous avatar Anonymous committed 2d7c759

first import of (incomplete) C-bindings to HERWIG

Comments (0)

Files changed (3)

includes/c-herwig/herwig.h

+#ifndef CHERWIG_HERWIG_H
+#define CHERWIG_HERWIG_H 1
+
+#ifdef __cplusplus
+extern "C" { 
+#endif
+
+  //--------------------------------------------------------------------------
+  // HERWIG Common Block Declarations
+
+  //        COMMON/HWPROC/EBEAM1,EBEAM2,PBEAM1,PBEAM2,IPROC,MAXEV
+  extern struct {
+	double EBEAM1,EBEAM2,PBEAM1,PBEAM2;
+    int IPROC,MAXEV;
+  } hwproc_;
+#define hwproc hwproc_
+
+  //      COMMON/HWBEAM/IPART1,IPART2
+  extern struct {
+    int IPART1, IPART2;
+  } hwbeam_;
+#define hwbeam hwbeam_
+
+  //        CHARACTER*8 PART1,PART2
+  //        COMMON/HWBMCH/PART1,PART2
+  extern struct {
+	char PART1[8],PART2[8];
+  } hwbmch_;
+#define hwbmch hwbmch_
+
+  //  COMMON/HWEVNT/AVWGT,EVWGT,GAMWT,TLOUT,WBIGST,WGTMAX,WGTSUM,WSQSUM,
+  //       & IDHW(NMXHEP),IERROR,ISTAT,LWEVT,MAXER,MAXPR,NOWGT,NRN(2),NUMER,
+  //       & NUMERU,NWGTS,GENSOF
+#define herwig_hepevt_size 4000
+  extern struct hwgev {
+	double AVWGT,EVWGT,GAMWT,TLOUT,WBIGST,WGTMAX,WGTSUM,WSQSUM;
+	int IDHW[herwig_hepevt_size],IERROR,ISTAT,LWEVT,MAXER,MAXPR;
+	int NOWGT,NRN[2],NUMER,NUMERU,NWGTS;
+	int GENSOF; //Beware! in F77 this is logical
+  } hwevnt_;
+#define hwevnt hwevnt_
+
+  //  C Basic parameters (and quantities derived from them)
+  //        COMMON/HWPRAM/AFCH(16,2),ALPHEM,B1LIM,BETAF,BTCLM,CAFAC,CFFAC,
+  //       & CLMAX,CLPOW,CLSMR(2),CSPEED,ENSOF,ETAMIX,F0MIX,F1MIX,F2MIX,GAMH,
+  //       & GAMW,GAMZ,GAMZP,GEV2NB,H1MIX,PDIQK,PGSMX,PGSPL(4),PHIMIX,PIFAC,
+  //       & PRSOF,PSPLT(2),PTRMS,PXRMS,QCDL3,QCDL5,QCDLAM,QDIQK,QFCH(16),QG,
+  //       & QSPAC,QV,SCABI,SWEIN,TMTOP,VFCH(16,2),VCKM(3,3),VGCUT,VQCUT,
+  //       & VPCUT,ZBINM,EFFMIN,OMHMIX,ET2MIX,PH3MIX,GCUTME,
+  //       & IOPREM,IPRINT,ISPAC,LRSUD,LWSUD,MODPDF(2),NBTRY,NCOLO,NCTRY,
+  //       & NDTRY,NETRY,NFLAV,NGSPL,NSTRU,NSTRY,NZBIN,IOP4JT(2),NPRFMT,
+  //       & AZSOFT,AZSPIN,CLDIR(2),HARDME,NOSPAC,PRNDEC,PRVTX,SOFTME,ZPRIME,
+  //       & PRNDEF,PRNTEX,PRNWEB
+
+  extern struct {
+	double AFCH[2][16],ALPHEM,B1LIM,BETAF,BTCLM,CAFAC,CFFAC,
+      CLMAX,CLPOW,CLSMR[2],CSPEED,ENSOF,ETAMIX,F0MIX,F1MIX,F2MIX,GAMH,
+      GAMW,GAMZ,GAMZP,GEV2NB,H1MIX,PDIQK,PGSMX,PGSPL[4],PHIMIX,PIFAC,
+      PRSOF,PSPLT[2],PTRMS,PXRMS,QCDL3,QCDL5,QCDLAM,QDIQK,QFCH[16],QG,
+      QSPAC,QV,SCABI,SWEIN,TMTOP,VFCH[2][16],VCKM[3][3],VGCUT,VQCUT,
+      VPCUT,ZBINM,EFFMIN,OMHMIX,ET2MIX,PH3MIX,GCUTME;
+	int IOPREM,IPRINT,ISPAC,LRSUD,LWSUD,MODPDF[2],NBTRY,NCOLO,NCTRY,
+      NDTRY,NETRY,NFLAV,NGSPL,NSTRU,NSTRY,NZBIN,IOP4JT[2],NPRFMT;
+	int AZSOFT,AZSPIN,CLDIR[2],HARDME,NOSPAC,PRNDEC,PRVTX,SOFTME,
+      ZPRIME,PRNDEF,PRNTEX,PRNWEB; //Beware! in F77 these are logical
+  } hwpram_;
+
+#define hwpram hwpram_
+
+  //--------------------------------------------------------------------------
+  // HERWIG routines declaration
+
+#define hwigin hwigin_  // initialise other common blocks
+#define hwigup hwigup_  // initialise HepUP run common block
+#define hwuinc hwuinc_  // compute parameter-dependent constants
+#define hwusta hwusta_  // call hwusta to make any particle stable
+#define hweini hweini_  // initialise elementary process
+#define hwuine hwuine_  // initialise event
+#define hwepro hwepro_  // generate HERWIG hard subprocess
+#define hwupro hwupro_  // read USER hard subprocess from HepUP event common
+#define hwbgen hwbgen_  // generate parton cascades
+#define hwdhob hwdhob_  // do heavy object decays
+#define hwcfor hwcfor_  // do cluster hadronization
+#define hwcdec hwcdec_  // do cluster decay
+#define hwdhad hwdhad_  // do unstable particle decays
+#define hwdhvy hwdhvy_  // do heavy flavour decays
+#define hwmevt hwmevt_  // add soft underlying event if needed 
+#define hwufne hwufne_  // event generation completed, wrap up event .... 
+#define hwefin hwefin_  // terminate elementary process
+
+#define hwudpr hwudpr_  // prints out particle/decay properties
+#define hwuepr hwuepr_  // prints out event data
+#define hwupup hwupup_  // prints out HepEUP user common block event data
+#define hwegup hwegup_  // terminal calculations to replace HWEFIN for HepUP
+
+  void hwigin(void);
+  void hwigup(void);
+  void hwuinc(void);
+  void hwusta(const char*,int);
+  void hweini(void);
+  void hwuine(void);
+  void hwepro(void);
+  void hwupro(void);
+  void hwbgen(void);
+  void hwdhob(void);
+  void hwcfor(void);
+  void hwcdec(void);
+  void hwdhad(void);
+  void hwdhvy(void);
+  void hwmevt(void);
+  void hwufne(void);
+  void hwefin(void);
+  void hwudpr(void);
+  void hwuepr(void);
+  void hwupup(void);
+  void hwegup(void);
+
+  /* declare all of these symbols as weak ones to help lazy loading */
+#pragma weak hwigin
+#pragma weak hwigup
+#pragma weak hwuinc
+#pragma weak hwusta
+#pragma weak hweini
+#pragma weak hwuine
+#pragma weak hwepro
+#pragma weak hwupro
+#pragma weak hwbgen
+#pragma weak hwdhob
+#pragma weak hwcfor
+#pragma weak hwcdec
+#pragma weak hwdhad
+#pragma weak hwdhvy
+#pragma weak hwmevt
+#pragma weak hwufne
+#pragma weak hwefin
+
+#pragma weak hwudpr
+#pragma weak hwuepr
+#pragma weak hwupup
+#pragma weak hwegup
+
+  //--------------------------------------------------------------------------
+  // HERWIG block data
+  // ( with gcc it works to initialize the block data by calling 
+  //   "hwudat();" at beginning. )
+
+#define hwudat hwudat_
+  void hwudat(void);
+#pragma weak hwudat
+
+#ifdef __cplusplus  
+}
+#endif
+
+#endif /* !CHERWIG_HERWIG_H */
+
+#include "c-herwig/herwig.h"
+
+//#include "HepMC/HerwigWrapper.h"
+
+// declare the struct here to keep the shared library happy
+struct hwgev hwevnt_;
+
+#if 1
+void foo() {
+  hwigin();    // INITIALISE OTHER COMMON BLOCKS
+  hwevnt.MAXPR = 1; // number of events to print
+  hwuinc(); // compute parameter-dependent constants
+  hweini(); // initialise elementary process
+
+	// initialise event
+	hwuine();
+	// generate hard subprocess
+	hwepro();
+	// generate parton cascades
+	hwbgen();
+	// do heavy object decays
+	hwdhob();
+	// do cluster formation
+	hwcfor();
+	// do cluster decays
+	hwcdec();
+	// do unstable particle decays
+	hwdhad();
+	// do heavy flavour hadron decays
+	hwdhvy();
+	// add soft underlying event if needed
+	hwmevt();
+	// finish event
+	hwufne();
+}
+#endif
+
+// weak implementation
+void hwupro()
+{}
+
+// weak implementation
+void hwegup()
+{}
+#
+
+top = '.'
+out = '__build__'
+
+def options(ctx):
+    ctx.load('compiler_c')
+    ctx.load('compiler_cxx')
+    
+def configure(ctx):
+    ctx.load('compiler_c')
+    ctx.load('compiler_cxx')
+    
+def build(ctx):
+
+    ctx(features='cxx cxxshlib',
+        name    = 'c_herwig',
+        source  = 'src/herwig.cxx',
+        target  = 'c_herwig',
+        includes= ['includes'],
+        export_includes=['includes'],
+        use     = ['herwig65',],
+        lib     = ['gfortran',],
+        install_path='${LIBDIR}',
+        )
+
+    inc_dir = ctx.path.find_node('includes')
+    ctx.install_files('${PREFIX}/include/c-herwig',
+                      inc_dir.ant_glob('c-herwig/**.h'),
+                      relative_trick=False)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.