From ed7d485b58a5242416e863de7f08fdc978d15e23 Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 10 Jul 2020 15:25:21 +0200 Subject: [PATCH] New packages: thepeg, herwig++ (2.x) (#17443) * New packages: Rivet, Herwig++ 2 * Add patches for thepeg * Flake-8 * Update package.py * Delete thepeg-2.1.6.patch * Delete thepeg-2.1.5.patch * Delete thepeg-2.1.3.patch * Delete thepeg-2.2.0.patch --- .../packages/herwigpp/herwig++-2.7.1.patch | 66 +++++++++++ .../builtin/packages/herwigpp/package.py | 52 +++++++++ .../repos/builtin/packages/thepeg/package.py | 103 ++++++++++++++++++ .../packages/thepeg/thepeg-1.8.3.patch | 24 ++++ .../packages/thepeg/thepeg-1.9.0.patch | 34 ++++++ .../packages/thepeg/thepeg-1.9.2.patch | 83 ++++++++++++++ .../packages/thepeg/thepeg-2.1.1.patch | 14 +++ 7 files changed, 376 insertions(+) create mode 100644 var/spack/repos/builtin/packages/herwigpp/herwig++-2.7.1.patch create mode 100644 var/spack/repos/builtin/packages/herwigpp/package.py create mode 100644 var/spack/repos/builtin/packages/thepeg/package.py create mode 100644 var/spack/repos/builtin/packages/thepeg/thepeg-1.8.3.patch create mode 100644 var/spack/repos/builtin/packages/thepeg/thepeg-1.9.0.patch create mode 100644 var/spack/repos/builtin/packages/thepeg/thepeg-1.9.2.patch create mode 100644 var/spack/repos/builtin/packages/thepeg/thepeg-2.1.1.patch diff --git a/var/spack/repos/builtin/packages/herwigpp/herwig++-2.7.1.patch b/var/spack/repos/builtin/packages/herwigpp/herwig++-2.7.1.patch new file mode 100644 index 0000000000..1690f362ad --- /dev/null +++ b/var/spack/repos/builtin/packages/herwigpp/herwig++-2.7.1.patch @@ -0,0 +1,66 @@ +--- Utilities/Histogram.h.orig 2018-11-07 14:46:18.967689784 +0100 ++++ Utilities/Histogram.h 2018-11-07 14:46:32.755601195 +0100 +@@ -111,7 +111,7 @@ + * Function to add a weighted point to the histogram + */ + void addWeighted(double input, double weight) { +- if(isnan(input)) return; ++ if(std::isnan(input)) return; + unsigned int ibin; + for(ibin=1; ibin<_bins.size(); ++ibin) { + if(input<_bins[ibin].limit) +--- Contrib/AlpGen/BasicLesHouchesFileReader.cc.orig 2018-11-07 15:38:46.819306762 +0100 ++++ Contrib/AlpGen/BasicLesHouchesFileReader.cc 2018-11-07 15:39:04.927190111 +0100 +@@ -383,9 +383,9 @@ + >> hepeup.PUP[i][3] >> hepeup.PUP[i][4] + >> hepeup.VTIMUP[i] >> hepeup.SPINUP[i] ) ) + return false; +- if(isnan(hepeup.PUP[i][0])||isnan(hepeup.PUP[i][1])|| +- isnan(hepeup.PUP[i][2])||isnan(hepeup.PUP[i][3])|| +- isnan(hepeup.PUP[i][4])) ++ if(std::isnan(hepeup.PUP[i][0])||std::isnan(hepeup.PUP[i][1])|| ++ std::isnan(hepeup.PUP[i][2])||std::isnan(hepeup.PUP[i][3])|| ++ std::isnan(hepeup.PUP[i][4])) + throw Exception() + << "nan's as momenta in Les Houches file " + << Exception::eventerror; +--- DipoleShower/Base/DipoleChain.cc.orig 2018-12-14 16:51:47.597597788 +0100 ++++ DipoleShower/Base/DipoleChain.cc 2018-12-14 16:52:09.450796951 +0100 +@@ -15,6 +15,7 @@ + #include "Herwig++/DipoleShower/Utility/DipolePartonSplitter.h" + + #include ++#include + + using namespace Herwig; + +--- Exsample2/exsample/config.h.orig 2018-12-14 16:56:31.729186139 +0100 ++++ Exsample2/exsample/config.h 2018-12-14 16:56:55.969406851 +0100 +@@ -25,6 +25,7 @@ + #include + + #include ++#include + #include + #include + +--- DipoleShower/Base/DipoleEventRecord.cc.orig 2018-12-14 16:58:33.878298134 +0100 ++++ DipoleShower/Base/DipoleEventRecord.cc 2018-12-14 16:58:47.983426512 +0100 +@@ -19,6 +19,7 @@ + #include "ThePEG/PDF/PartonExtractor.h" + + #include ++#include + + #include + +--- ./Exsample2/BinnedStatistics.h.orig 2018-12-14 17:11:37.396421246 +0100 ++++ ./Exsample2/BinnedStatistics.h 2018-12-14 17:12:00.762633435 +0100 +@@ -16,6 +16,7 @@ + #include "ThePEG/Repository/UseRandom.h" + + #include ++#include + + namespace Herwig { + diff --git a/var/spack/repos/builtin/packages/herwigpp/package.py b/var/spack/repos/builtin/packages/herwigpp/package.py new file mode 100644 index 0000000000..c3cdf7791d --- /dev/null +++ b/var/spack/repos/builtin/packages/herwigpp/package.py @@ -0,0 +1,52 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Herwigpp(AutotoolsPackage): + """Herwig is a multi-purpose particle physics event generator. + This package provides old Herwig++ 2 generator""" + + homepage = "https://herwig.hepforge.org/" + url = "http://lcgpackages.web.cern.ch/lcgpackages/tarFiles/sources/MCGeneratorsTarFiles/Herwig++-2.7.1.tar.bz2" + + version('2.7.1', '80a189376bb65f5ec4e64f42e76c00ea9102d8224010563a424fc11e619a6ad6') + patch('herwig++-2.7.1.patch', when='@2.7.1', level=0) + + depends_on('gsl') + depends_on('boost') + depends_on('fastjet') + depends_on('thepeg@1.9.2', when='@2.7.1') + + def configure_args(self): + args = ['--with-gsl=' + self.spec['gsl'].prefix, + '--with-thepeg=' + self.spec['thepeg'].prefix, + '--with-fastjet=' + self.spec['fastjet'].prefix, + '--with-boost=' + self.spec['boost'].prefix] + return args + + def build(self, spec, prefix): + make() + with working_dir('Contrib'): + make() + + with working_dir('Contrib/AlpGen'): + make('BasicLesHouchesFileReader.so', + "HERWIGINCLUDE=-I{0}/include".format(self.stage.source_path)) + make('AlpGenHandler.so', + "HERWIGINCLUDE=-I{0}/include".format(self.stage.source_path)) + + def install(self, spec, prefix): + make('install') + install( + join_path(self.stage.source_path, + 'Contrib', 'AlpGen', 'AlpGenHandler.so'), + join_path(prefix.lib, 'Herwig++', 'AlpGenHandler.so')) + + install( + join_path(self.stage.source_path, + 'Contrib', 'AlpGen', 'BasicLesHouchesFileReader.so'), + join_path(prefix.lib, 'Herwig++', 'BasicLesHouchesFileReader.so')) diff --git a/var/spack/repos/builtin/packages/thepeg/package.py b/var/spack/repos/builtin/packages/thepeg/package.py new file mode 100644 index 0000000000..bc7580cf9a --- /dev/null +++ b/var/spack/repos/builtin/packages/thepeg/package.py @@ -0,0 +1,103 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Thepeg(AutotoolsPackage): + """Toolkit for High Energy Physics Event Generation""" + + homepage = "http://home.thep.lu.se/~leif/ThePEG/" + url = "https://thepeg.hepforge.org/downloads/?f=ThePEG-2.2.1.tar.bz2" + + # The commented out versions exist, but may need patches + # and/or recipe changes + version('2.2.1', sha256='63abc7215e6ad45c11cf9dac013738e194cc38556a8368b850b70ab1b57ea58f') + version('2.2.0', sha256='d3e1474811b7d9f61a4a98db1e9d60d8ef8f913a50de4cae4dc2cc4f98e6fbf8') + # version('2.1.7', sha256='2e15727afc1fbfb158fa42ded31c4b1e5b51c25ed6bb66a38233e1fc594329c8') + version('2.1.6', sha256='c1e51f83716bfca815b55100fbab3805ef5f9b9215e4373b22762693f5353f4f') + version('2.1.5', sha256='c61a00fb6cf406f0f98e8c934683d8d5efcb655747842113abc92e9526e4b5e6') + # version('2.1.4', sha256='400c37319aa967ed993fdbec84fc65b24f6cb3779fb1b173d7f5d7a56b772df5') + version('2.1.3', sha256='16e8f6507530c2b80ed873ad22946efefed7355d15c7026f3465f18acebc1c0c') + # version('2.1.2', sha256='6a0f675a27e10863d495de069f25b892e532beb32e9cbfe5a58317d015387f49') + version('2.1.1', sha256='e1b0bdc116fbc9a6e598b601f2aa670530cf2e1cd46b4572814a9b0130b10281') + # version('2.1.0', sha256='fe6e7740ce3cd4a3ce3d7a0079a16c9214ad18f432e29d034ae763bfc40f3d39') + # version('2.0.4', sha256='f3b625b411667e2708995f1d1379b5b8691406853c8c2cca2f4e4e6e062da0e4') + # version('2.0.3', sha256='c57ba68fbfda06a0ba256e06f276f91434bf2529a13f6287c051a4cd6da44634') + # version('2.0.2', sha256='d4249e019543d5c7520733292d2edfb0bdd9733177200a63837781ed6194789b') + # version('2.0.1', sha256='ec284abdc82ceaf10a8736f908e7955f49f872b79aaa62d22aa33bc5c7679bdb') + # version('2.0.0', sha256='571730cc956027dc82780dc04ef6e7382ab5ea853fcfebe259e488c6df302a04') + version('1.9.2', sha256='ff7bbb256866f994dae04ade1f57c92d2670edaac3df11c9a300419a5343faf4') + # version('1.9.1', sha256='8ec6d0669eba51e308be4e33aeb219999418170eae3aad93ec1491c942c2a4e9') + version('1.9.0', sha256='3ee58e5e3a26184567df1b9a10ca70df228e86f322e72f018dd7d8d5a4700a5d') + version('1.8.3', sha256='55ede3a3dd0bd07b90d0d49cf7ae28c18cd965780fdf53528508b97d57152fc7') + # version('1.8.2', sha256='44ccd0d70e42bb6ecd801a51bade6c25b3953c56f33017402d4f52ee6492dffa') + # version('1.8.1', sha256='84c2a212a681545cddd541dca191eb65d96f41df86c87480b6f4f7d4f9683562') + # version('1.8.0', sha256='4b22fda1078f410b999a23a17f611c9ae3a7f0f4cee4e83dc82c9336b7adf037') + # version('1.7.3', sha256='066d5df74118d6e984bb60e1c0bea08a8edcbcf917d83d8bc32ec6fea0726187') + # version('1.7.2', sha256='3b885c6c5a39b7399ccd45d1f5a866b7a65c96174a56a7ff4ae423347843d013') + # version('1.7.1', sha256='13434dc7a8623cacb94c0b5c8d7e15b4c5d5187fe9322d1afc1c91b2c940102e') + # version('1.7.0', sha256='40eb7196139a8bf4c35f5bb69818135943d534457df64aeb1cf60b6621435312') + # version('1.6.1', sha256='5bc074b78f8b663a6a33df9c94dcaa3100269f8da59f9553a565298e55af270f') + # version('1.6.0', sha256='c0ac06b70f3e8046fce4e49ba5916c9b49450f528d0e25f8f7f1427c62fec680') + # version('1.5.0', sha256='ccbf102cf1d350a21487518d12e7e03e6e50010e5604f0201f256fa46a7a50c2') + # version('1.4.2', sha256='40444304e40e07fd417a8ebf8e5c1cf07e895ceac52ef4f7c1eecc911f6f775c') + # version('1.4.1', sha256='156d06fd1ce68466d1f2adb9cc13f412b8b87073ec6a1d02102b173c34c29b8a') + # version('1.4.0', sha256='b1f55e9a3bec713e9abf2fe71c5bd8cf8df936ea00b09f96df9123d0d5ab233f') + # version('1.3.0', sha256='f731ebf3ce5a52b6d750d6e3c282fdc74d8ffd78bccb47b68f10a4daf44c7045') + + patch('thepeg-1.8.3.patch', when='@1.8.3', level=0) + patch('thepeg-1.9.0.patch', when='@1.9.0', level=0) + patch('thepeg-1.9.2.patch', when='@1.9.2', level=0) + patch('thepeg-2.1.1.patch', when='@2.1.1:2.2.1', level=0) + + depends_on('gsl') + depends_on('lhapdf') + depends_on('lhapdf@:6.2.999', when='@:1.9.999') + depends_on('hepmc', when='hepmc=2') + depends_on('hepmc3', when='hepmc=3') + conflicts('hepmc=3', when='@:2.1.999', msg='HepMC3 support was added in 2.2.0') + depends_on('fastjet', when='@2.0.0:') + depends_on('rivet', when='@2.0.3:') + depends_on('boost', when='@2.1.1:') + + depends_on('autoconf', type='build') + depends_on('automake', type='build') + depends_on('libtool', type='build') + depends_on('m4', type='build') + + variant('hepmc', default='2', values=('2', '3'), description='HepMC interface to build ') + + install_targets = ['install-strip'] + + def configure_args(self): + args = ['--with-gsl=' + self.spec['gsl'].prefix, '--without-javagui'] + + if self.spec.satisfies('@:1.8.999'): + args += ['--with-LHAPDF=' + self.spec['lhapdf'].prefix] + else: + args += ['--with-lhapdf=' + self.spec['lhapdf'].prefix] + + if self.spec.satisfies('hepmc=2'): + args += ['--with-hepmc=' + self.spec['hepmc'].prefix] + else: + args += ['--with-hepmc=' + self.spec['hepmc3'].prefix] + + if self.spec.satisfies('@2.2.0:'): + args += ['--with-hepmcversion=' + + self.spec.variants['hepmc'].value] + + if self.spec.satisfies('@2.0.0:'): + args += ['--with-fastjet=' + self.spec['fastjet'].prefix] + + if self.spec.satisfies('@2.0.3:'): + args += ['--with-rivet=' + self.spec['rivet'].prefix] + + if self.spec.satisfies('@:2.1.999'): + args += ['--with-boost=' + self.spec['boost'].prefix] + + args += ['CFLAGS=-O2', 'CXXFLAGS=-O2', 'FFLAGS=-O2'] + + return args diff --git a/var/spack/repos/builtin/packages/thepeg/thepeg-1.8.3.patch b/var/spack/repos/builtin/packages/thepeg/thepeg-1.8.3.patch new file mode 100644 index 0000000000..c396634779 --- /dev/null +++ b/var/spack/repos/builtin/packages/thepeg/thepeg-1.8.3.patch @@ -0,0 +1,24 @@ +--- PDF/LHAPDF.cc 2013-10-26 01:48:12.000000000 +0200 ++++ PDF/LHAPDF.cc 2013-12-05 17:23:13.000000000 +0100 +@@ -33,6 +33,7 @@ + #include "config.h" + #include "ThePEG/Persistency/PersistentOStream.h" + #include "ThePEG/Persistency/PersistentIStream.h" ++#include "stdlib.h" + + #ifdef ThePEG_HAS_FPU_CONTROL + #include +@@ -228,7 +229,12 @@ + + std::string LHAPDF::getIndexPath() { + // macro is passed in from -D compile flag +- return std::string(LHAPDF_PKGDATADIR) + "/PDFsets.index"; ++ char const* tmp = getenv( "LHAPATH" ); ++ if ( tmp != NULL ) { ++ return std::string(getenv("LHAPATH")) + "/../PDFsets.index"; ++ } else { ++ return std::string(LHAPDF_PKGDATADIR) + "/PDFsets.index"; ++ }; + } + + bool LHAPDF::openLHAIndex(ifstream & is) { diff --git a/var/spack/repos/builtin/packages/thepeg/thepeg-1.9.0.patch b/var/spack/repos/builtin/packages/thepeg/thepeg-1.9.0.patch new file mode 100644 index 0000000000..76bc91211b --- /dev/null +++ b/var/spack/repos/builtin/packages/thepeg/thepeg-1.9.0.patch @@ -0,0 +1,34 @@ +--- PDF/LHAPDF.cc 2013-10-26 01:48:12.000000000 +0200 ++++ PDF/LHAPDF.cc 2013-12-05 17:23:13.000000000 +0100 +@@ -33,6 +33,7 @@ + #include "config.h" + #include "ThePEG/Persistency/PersistentOStream.h" + #include "ThePEG/Persistency/PersistentIStream.h" ++#include "stdlib.h" + + #ifdef ThePEG_HAS_FPU_CONTROL + #include +@@ -228,7 +229,12 @@ + + std::string LHAPDF::getIndexPath() { + // macro is passed in from -D compile flag +- return std::string(LHAPDF_PKGDATADIR) + "/PDFsets.index"; ++ char const* tmp = getenv( "LHAPATH" ); ++ if ( tmp != NULL ) { ++ return std::string(getenv("LHAPATH")) + "/../PDFsets.index"; ++ } else { ++ return std::string(LHAPDF_PKGDATADIR) + "/PDFsets.index"; ++ }; + } + + bool LHAPDF::openLHAIndex(ifstream & is) { +--- ACDC/ACDCGen.h.orig 2014-04-02 16:20:59.000000000 +0200 ++++ ACDC/ACDCGen.h 2014-04-02 16:22:40.000000000 +0200 +@@ -13,6 +13,7 @@ + #include "ACDCTraits.h" + #include "ACDCGenCell.h" + #include "ThePEG/Utilities/Exception.h" ++#include + + namespace ACDCGenerator { + diff --git a/var/spack/repos/builtin/packages/thepeg/thepeg-1.9.2.patch b/var/spack/repos/builtin/packages/thepeg/thepeg-1.9.2.patch new file mode 100644 index 0000000000..556b683560 --- /dev/null +++ b/var/spack/repos/builtin/packages/thepeg/thepeg-1.9.2.patch @@ -0,0 +1,83 @@ +diff -r 2d8e0f74b65e PDF/LHAPDF6.cc +--- PDF/LHAPDF6.cc.orig Mon Jul 07 09:16:48 2014 +0100 ++++ PDF/LHAPDF6.cc Fri Sep 26 14:41:55 2014 +0100 +@@ -54,8 +54,8 @@ + return new_ptr(*this); + } + +-void ThePEG::LHAPDF::doinit() { +- PDFBase::doinit(); ++void ThePEG::LHAPDF::initPDFptr() { ++ if ( thePDF ) return; + thePDF = ::LHAPDF::mkPDF(thePDFName, theMember); + xMin = thePDF->xMin(); + xMax = thePDF->xMax(); +@@ -63,6 +63,11 @@ + Q2Max = thePDF->q2Max() * GeV2; + } + ++void ThePEG::LHAPDF::doinit() { ++ PDFBase::doinit(); ++ initPDFptr(); ++} ++ + void ThePEG::LHAPDF::dofinish() { + PDFBase::dofinish(); + delete thePDF; +@@ -71,11 +76,7 @@ + + void ThePEG::LHAPDF::doinitrun() { + PDFBase::doinitrun(); +- thePDF = ::LHAPDF::mkPDF(thePDFName, theMember); +- xMin = thePDF->xMin(); +- xMax = thePDF->xMax(); +- Q2Min = thePDF->q2Min() * GeV2; +- Q2Max = thePDF->q2Max() * GeV2; ++ initPDFptr(); + } + + void ThePEG::LHAPDF::setPDFName(string name) { +@@ -387,6 +388,7 @@ + lastQ2 = -1.0*GeV2; + lastX = -1.0; + lastP2 = -1.0*GeV2; ++ initPDFptr(); + } + + ThePEG::ClassDescription ThePEG::LHAPDF::initLHAPDF; +diff -r 2d8e0f74b65e PDF/LHAPDF6.h +--- PDF/LHAPDF6.h.orig Mon Jul 07 09:16:48 2014 +0100 ++++ PDF/LHAPDF6.h Fri Sep 26 14:41:55 2014 +0100 +@@ -147,6 +147,12 @@ + void checkUpdate(double x, Energy2 Q2, Energy2 P2) const; + + /** ++ * Initialize the LHAPDF library for the chosen PDF set if it has ++ * not been done before. ++ */ ++ void initPDFptr(); ++ ++ /** + * Used by the interface to select a set according to a file name. + */ + void setPDFName(string name); +--- Persistency/PersistentOStream.h.orig 2018-11-07 14:46:59.055432275 +0100 ++++ Persistency/PersistentOStream.h 2018-11-07 14:47:20.639293703 +0100 +@@ -219,7 +219,7 @@ + * Write a double. + */ + PersistentOStream & operator<<(double d) { +- if ( isnan(d) || isinf(d) ) ++ if ( std::isnan(d) || std::isinf(d) ) + throw WriteError() + << "Tried to write a NaN or Inf double to a persistent stream." + << Exception::runerror; +@@ -232,7 +232,7 @@ + * Write a float. + */ + PersistentOStream & operator<<(float f) { +- if ( isnan(f) || isinf(f) ) ++ if ( std::isnan(f) || std::isinf(f) ) + throw WriteError() + << "Tried to write a NaN or Inf float to a persistent stream." + << Exception::runerror; diff --git a/var/spack/repos/builtin/packages/thepeg/thepeg-2.1.1.patch b/var/spack/repos/builtin/packages/thepeg/thepeg-2.1.1.patch new file mode 100644 index 0000000000..90c61fc991 --- /dev/null +++ b/var/spack/repos/builtin/packages/thepeg/thepeg-2.1.1.patch @@ -0,0 +1,14 @@ +--- m4/rivet.m4.orig 2013-10-16 10:50:05.000000000 +0200 ++++ m4/rivet.m4 2017-08-02 12:26:22.897894696 +0200 +@@ -33,10 +33,7 @@ + else + AC_MSG_RESULT([$with_rivet]) + RIVETINCLUDE="$( $with_rivet/bin/rivet-config --cppflags )" +- RIVETLIBS="-L$with_rivet/lib -R$with_rivet/lib -lRivet" +- if test "${host_cpu}" == "x86_64" -a -e $with_rivet/lib64/libRivet.so ; then +- RIVETLIBS="-L$with_rivet/lib64 -R$with_rivet/lib64 -lRivet" +- fi ++ RIVETLIBS="$( $with_rivet/bin/rivet-config --libs ) -lYODA" + fi + + if test "x$with_rivet" != "xno"; then