summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authoriarspider <iarspider@gmail.com>2021-02-01 19:21:02 +0100
committerGitHub <noreply@github.com>2021-02-01 10:21:02 -0800
commit5add6c4e03afa2c6244ac7341c16cf86536cbd83 (patch)
tree96aa0a1c9b0716f69948cc66d1b87780e17ea39d /var
parent5cb8d1894bce18e81b2a785a7827b3e9e6dbfeb5 (diff)
downloadspack-5add6c4e03afa2c6244ac7341c16cf86536cbd83.tar.gz
spack-5add6c4e03afa2c6244ac7341c16cf86536cbd83.tar.bz2
spack-5add6c4e03afa2c6244ac7341c16cf86536cbd83.tar.xz
spack-5add6c4e03afa2c6244ac7341c16cf86536cbd83.zip
New package: unigen (#21338)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/unigen/package.py31
-rw-r--r--var/spack/repos/builtin/packages/unigen/unigen-2.3.patch127
2 files changed, 158 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/unigen/package.py b/var/spack/repos/builtin/packages/unigen/package.py
new file mode 100644
index 0000000000..1dfac876be
--- /dev/null
+++ b/var/spack/repos/builtin/packages/unigen/package.py
@@ -0,0 +1,31 @@
+# Copyright 2013-2021 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 Unigen(MakefilePackage):
+ """The United Generators project was launched by the Virtual Institute 146
+ VI-SIM in September 2005 following a proposal of Herbert Strobele.
+ The goal was to facilitate comparison between various models (see below)
+ and/or various experiments (HADES, FOPI, CERES, NA49, CBM). The package
+ at present allows to convert output of various event generators to a
+ generic root format."""
+
+ homepage = "https://www.gsi.de/work/wissenschaftliche_netzwerke/helmholtz_virtuelle_institute/unigen.htm"
+ url = "https://github.com/FairRootGroup/UniGen/archive/v2.3.tar.gz"
+
+ version('2.3', sha256='8783bcabbdf8c50dab6e93153cff9cfb267a9a9e61aef51bf1e17679ba42a717')
+ patch('unigen-2.3.patch', level=0)
+
+ depends_on('root', type=('build', 'link'))
+
+ def build(self, spec, prefix):
+ mkdirp(join_path(self.build_directory, 'lib'))
+ make('TOPDIR=' + self.build_directory, 'all')
+
+ def install(self, spec, prefix):
+ make('DESTDIR=' + prefix, 'TOPDIR=' + self.build_directory, 'install')
diff --git a/var/spack/repos/builtin/packages/unigen/unigen-2.3.patch b/var/spack/repos/builtin/packages/unigen/unigen-2.3.patch
new file mode 100644
index 0000000000..2cb58628df
--- /dev/null
+++ b/var/spack/repos/builtin/packages/unigen/unigen-2.3.patch
@@ -0,0 +1,127 @@
+--- config/Makelib.orig 2019-10-29 01:07:48.000000000 +0100
++++ config/Makelib 2021-01-27 15:09:05.473365100 +0100
+@@ -3,7 +3,7 @@
+
+
+ # Default target
+-all : obj dict lib
++all : lib
+
+
+ # ----- Rules for source compilation ----------
+@@ -20,7 +20,14 @@
+
+ $(TARGET)Dict.cxx : $(incl) include/$(TARGET)LinkDef.h
+ @echo 'Generating dictionary' $@ '...'
++ifneq ($(strip $(RLIBMAP)),)
++# ROOTv5
+ @rootcint -f $@ -c $(INCDIR) $^
++else
++#ROOT v6
++ @rootcling -f $@ -rmf $(TOPDIR)/lib/lib$(TARGET).rootmap -rml lib$(TARGET) -s lib$(TARGET) $(INCDIR) $^
++ @mv lib$(TARGET)_rdict.pcm $(TOPDIR)/lib/lib$(TARGET)_rdict.pcm
++endif
+ # -----------------------------------------------
+
+
+@@ -96,6 +103,7 @@
+ @rm -f $(TOPDIR)/lib/lib$(TARGET).so
+ @rm -f $(TOPDIR)/lib/lib$(TARGET).a
+ @rm -f $(TOPDIR)/lib/lib$(TARGET).rootmap
++ @rm -f $(TOPDIR)/lib/lib$(TARGET)_rdict.pcm
+
+ htmldoc :
+ @echo 'Building class documentation...'
+@@ -106,8 +114,10 @@
+ install_lib : lib
+ @echo 'Installing library ...'
+ mkdir -p -m 0755 $(DESTDIR)/lib
++ mkdir -p -m 0755 $(DESTDIR)/include/unigen
+ install -m 0755 $(TOPDIR)/lib/lib$(TARGET).so $(DESTDIR)/lib
+-ifneq ($(strip $(RLIBMAP)),)
+ install -m 0644 $(TOPDIR)/lib/lib$(TARGET).rootmap $(DESTDIR)/lib
++ifeq ($(strip $(RLIBMAP)),)
++ install -m 0644 $(TOPDIR)/lib/lib$(TARGET)_rdict.pcm $(DESTDIR)/lib
+ endif
+-
++ install -m 0644 include/*.h $(DESTDIR)/include/unigen
+--- converters/urqmd2u.cpp.orig 2019-10-29 01:07:48.000000000 +0100
++++ converters/urqmd2u.cpp 2021-01-27 15:04:37.547010300 +0100
+@@ -93,7 +93,6 @@
+ char *inpfile;
+ char *outfile;
+ char c;
+- int nevents;
+ string dust;
+
+ URun *ru = 0;
+@@ -101,7 +100,7 @@
+ int filetype, eos, aproj, zproj, atarg, ztarg, nr;
+ double beta, b, bmin, bmax, sigma, elab, plab, sqrts, time, dtime;
+
+- if (argc != 4) {
++ if (argc < 3 || argc > 4) {
+ cout << "usage: " << argv[0] << " inpfile outfile nevents\n";
+ cout << "example: " << argv[0] << " ftn14 ftn14.root 10\n";
+ exit(0);
+@@ -109,7 +108,7 @@
+
+ inpfile = argv[1];
+ outfile = argv[2];
+- nevents = atoi(argv[3]);
++ const int nevents = (argc == 4) ? atoi(argv[3]) : 1e8;
+
+ int nout=0;
+ in.open(inpfile);
+@@ -141,15 +140,14 @@
+ in.ignore(777,'\n'); // ignore the rest of the line
+
+ comment.clear();
+- // read 3 lines of options and 4 lines of params
+- for (int i=0; i<100; i++) {
+- getline(in,line);
+- if(0 == line.substr(0, 4).compare("pvec"))
+- {
+- break;
+- }
+- comment.append(line);
+- comment.append("\n");
++ // read options and parameters
++ while (true) {
++ getline(in, line);
++ if (TString(line).BeginsWith("op") || TString(line).BeginsWith("pa")) {
++ comment.append(line);
++ comment.append("\n");
++ } else
++ break;
+ }
+ //in.ignore(777,'\n');
+
+@@ -207,9 +205,15 @@
+ double m = 0.938271998;
+ double ecm = sqrts/2; // energy per nucleon in cm
+ double pcm = sqrt(ecm*ecm-m*m); // momentum per nucleon in cm
+- double gamma = 1.0/sqrt(1-beta*beta);
+- double pproj = gamma*(+pcm-beta*ecm);
+- double ptarg = gamma*(-pcm-beta*ecm);
++ double pproj = 0.0;
++ double ptarg = 0.0;
++ if (fabs(beta) < 1e-8) { // we are in CM
++ pproj = pcm;
++ ptarg = -pcm;
++ } else {
++ pproj = plab;
++ ptarg = 0.0;
++ }
+ ru = new URun(generator.data(), comment.data(),
+ aproj, zproj, pproj,
+ atarg, ztarg, ptarg,
+@@ -217,7 +221,7 @@
+ ru->Write();
+ fi->Write();
+ fi->Close();
+- return nout;
++
+ return 0;
+ }
+ /*****************************************************************************/