New package: hepmcanalysis (#17296)

* [WIP] Add hepmcanalysis package

* Implement install() for hepmcanalysis

* Flake-8

Co-authored-by: iarspider <iarpsider@gmail.com>
This commit is contained in:
iarspider 2020-06-30 04:35:25 +02:00 committed by GitHub
parent 17985959a4
commit 2de0053c08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 105 additions and 0 deletions

View file

@ -0,0 +1,58 @@
--- spack-src/examples/hepmcreader/reader.cc.orig 2013-10-31 11:11:16.000000000 +0100
+++ spack-src/examples/hepmcreader/reader.cc 2013-10-31 11:11:59.000000000 +0100
@@ -172,7 +172,7 @@
for (vector<baseAnalysis*>::const_iterator i(analysis.begin()); i != analysis.end(); ++i) {
(*i)->Finalize(f);
}
-
+f->Close();
// clean up analysis modules and configuration
for (vector<baseAnalysis*>::const_iterator i(analysis.begin()); i != analysis.end(); ++i) {
delete (*i);
--- spack-src/Makefile.orig 2013-09-03 16:52:14.000000000 +0200
+++ spack-src/Makefile 2013-09-03 16:54:04.000000000 +0200
@@ -28,7 +28,7 @@
@mkdir -p $(LIBDIR)
$(CXX) $(CXXFLAGS) $(INCLUDES) \
-shared -o $(LIBDIR)/libHepMCAnalysis.so $(OBJECTS) \
- $(HepMClib) $(HepPDTlib) $(FastJetlib) \
+ $(HepMClib) $(HepPDTlib) $(FastJetlib) $(CLHEPlib) \
$(ROOTGLIBS) $(LINK_LIBS)
--- spack-src/src/baseAnalysis.cc 2013-03-04 19:19:55.000000000 +0100
+++ spack-src/src/baseAnalysis.cc 2014-10-03 07:36:47.000000000 +0200
@@ -281,8 +281,8 @@
double pe = (*p)->momentum().e();
// remove garbage
- if ( isnan( px ) || isnan( py ) || isnan( pz ) || isnan( pe ) ||
- isinf( px ) || isinf( py ) || isinf( pz ) || isinf( pe ) ) {
+ if ( std::isnan( px ) || std::isnan( py ) || std::isnan( pz ) || std::isnan( pe ) ||
+ std::isinf( px ) || std::isinf( py ) || std::isinf( pz ) || std::isinf( pe ) ) {
cout << "baseAnalysis: NaN (Not A Number) found in the event record! Particle will be skipped." << endl;
++m_NanNum;
continue;
--- spack-src/config.mk.orig 2020-06-25 17:05:30.142357100 +0200
+++ spack-src/config.mk 2020-06-25 17:06:24.219319861 +0200
@@ -10,16 +10,16 @@
# -I$(HepPDTdir)/include -I$(ROOTSYS)/include
INCLUDES = $(INCLUDEH) $(INCLUDEF)
-ROOTGLIBS = `root-config --glibs`
-ROOTCFLAGS = `root-config --cflags` -Wno-long-long
+ROOTGLIBS = `$(ROOTSYS)/bin/root-config --glibs`
+ROOTCFLAGS = `$(ROOTSYS)/bin/root-config --cflags` -Wno-long-long
#CLHEP = -L$(CLHEPdir)/lib -lCLHEP # causes problems in HepMCAnalysis_i interface!
-CLHEPlib =
+CLHEPlib = -L$(CLHEPdir)/lib -lCLHEP
# common libraries
HepPDTlib =
#HepPDTlib = -L$(HepPDTdir)/lib -lHepPDT -lHepPID
-HepMClib = $(HepMCdir)/lib/libHepMC.so $(HepMCdir)/lib/libHepMCfio.a
+HepMClib = -L$(HepMCdir)/lib -lHepMC
#FastJetlib = -L$(FastJetdir)/lib -lfastjet -lSISConePlugin -lCDFConesPlugin -lsiscone -lsiscone_spherical
FastJetlib = -L$(FastJetdir)/lib -lfastjet -lfastjetplugins -lsiscone -lsiscone_spherical

View file

@ -0,0 +1,47 @@
# 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 Hepmcanalysis(MakefilePackage):
"""The HepMCAnalysis Tool is a tool for generator
validation and comparisons."""
homepage = "https://hepmcanalysistool.desy.de/"
url = "https://hepmcanalysistool.desy.de/releases/HepMCAnalysis-00-03-04-13.tar.gz"
version('3.4.13', sha256='be9937c6de493a5671258919493b0caa0cecca77853a2075f5cecce1071e0029')
depends_on('hepmc')
depends_on('fastjet')
depends_on('root')
depends_on('clhep')
variant('cxxstd',
default='11',
values=('11', '14', '17'),
multi=False,
description='Use the specified C++ standard when building.')
patch('lcg.patch')
def edit(self, spec, prefix):
filter_file(r"CXXFLAGS(.*)", r"CXXFLAGS\1 -std=c++" +
self.spec.variants['cxxstd'].value, "config.mk")
def setup_build_environment(self, env):
env.set("HepMCdir", self.spec['hepmc'].prefix)
env.set("FastJetdir", self.spec['fastjet'].prefix)
env.set("CLHEPdir", self.spec['clhep'].prefix)
def url_for_version(self, version):
parts = [int(x) for x in str(version).split('.')]
root = "https://hepmcanalysistool.desy.de/releases/HepMCAnalysis-00-"
return root + "{0:02d}-{1:02d}-{2:02d}.tar.gz".format(*parts)
def install(self, spec, prefix):
install_tree('lib', prefix.lib)
install_tree('include', prefix.include)