From be4d3955a4ad7e5bec10d7edd9f6378852639d2f Mon Sep 17 00:00:00 2001 From: Markus Fasel Date: Sun, 9 May 2021 13:27:32 -0400 Subject: [PATCH] Import ThePEG v2.2.2 From https://thepeg.hepforge.org/downloads/ThePEG-2.2.2.tar.bz2 --- Analysis/RivetAnalysis.cc | 54 +++++++++++++++++------------ Analysis/RivetAnalysis.h | 44 ++++------------------- EventRecord/Event.h | 38 ++++++++++++++++++++ Helicity/Vertex/Scalar/VSSVertex.cc | 2 +- NEWS | 14 ++++++++ PDF/LHAPDF6.cc | 42 +++++++++++++++++++--- configure | 20 +++++------ configure.ac | 2 +- 8 files changed, 141 insertions(+), 75 deletions(-) diff --git a/Analysis/RivetAnalysis.cc b/Analysis/RivetAnalysis.cc index a13bd72..b4cb8e0 100644 --- a/Analysis/RivetAnalysis.cc +++ b/Analysis/RivetAnalysis.cc @@ -19,10 +19,11 @@ #include "Rivet/AnalysisHandler.hh" #include "Rivet/Tools/RivetPaths.hh" #include "Rivet/Tools/Logging.hh" +#include "ThePEG/Utilities/DescribeClass.h" using namespace ThePEG; -RivetAnalysis::RivetAnalysis() : debug(false), _rivet(), _nevent(0) +RivetAnalysis::RivetAnalysis() : _debug(false), _rivet(), _nevent(0) {} void RivetAnalysis::analyze(ThePEG::tEventPtr event, long ieve, int loop, int state) { @@ -34,9 +35,7 @@ void RivetAnalysis::analyze(ThePEG::tEventPtr event, long ieve, int loop, int st // analyse the event if(_nevent>1) CurrentGenerator::Redirect stdout(cout); if ( _rivet ){ -#if ThePEG_RIVET_VERSION == 1 - _rivet->analyze(*hepmc); -#elif ThePEG_RIVET_VERSION > 1 +#if ThePEG_RIVET_VERSION > 1 try { _rivet->analyze(*hepmc); } catch (const YODA::Exception & e) { @@ -69,15 +68,17 @@ ThePEG::IBPtr RivetAnalysis::fullclone() const { } void RivetAnalysis::persistentOutput(ThePEG::PersistentOStream & os) const { - os << _analyses << _paths << filename << debug; + os << _analyses << _preload << _paths << _filename << _debug; } void RivetAnalysis::persistentInput(ThePEG::PersistentIStream & is, int) { - is >> _analyses >> _paths >> filename >> debug; + is >> _analyses >> _preload >> _paths >> _filename >> _debug; } -ThePEG::ClassDescription RivetAnalysis::initRivetAnalysis; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeClass +describeRivetAnalysis("ThePEG::RivetAnalysis", "RivetAnalysis.so"); void RivetAnalysis::Init() { @@ -91,6 +92,12 @@ void RivetAnalysis::Init() { &RivetAnalysis::_analyses, -1, "", "","" "", false, false, ThePEG::Interface::nolimits); + static ParVector interfacePreLoad + ("PreLoad", + "The yoda files to be preloaded", + &RivetAnalysis::_preload, -1, "", "", "", + false, false, Interface::nolimits); + static ThePEG::ParVector interfacePaths ("Paths", "The directory paths where Rivet should look for analyses.", @@ -99,24 +106,20 @@ void RivetAnalysis::Init() { static Parameter interfaceFilename ("Filename", -#if ThePEG_RIVET_VERSION == 1 - "The name of the file where the AIDA histograms are put. If empty, " - "the run name will be used instead. '.aida' will in any case be " - "appended to the file name.", -#elif ThePEG_RIVET_VERSION > 1 +#if ThePEG_RIVET_VERSION > 1 "The name of the file where the YODA histograms are put. If empty, " "the run name will be used instead. '.yoda' will in any case be " "appended to the file name.", #else #error "Unknown ThePEG_RIVET_VERSION" #endif - &RivetAnalysis::filename, "", true, false); + &RivetAnalysis::_filename, "", true, false); static Switch interfaceDebug ("Debug", "Enable debug information from Rivet", - &RivetAnalysis::debug, false, true, false); + &RivetAnalysis::_debug, false, true, false); static SwitchOption interfaceDebugNo (interfaceDebug, "No", @@ -145,11 +148,8 @@ void RivetAnalysis::dofinish() { #endif _rivet->finalize(); - string fname = filename; -#if ThePEG_RIVET_VERSION == 1 - if ( fname.empty() ) - fname = generator()->path() + "/" + generator()->runName() + ".aida"; -#elif ThePEG_RIVET_VERSION > 1 + string fname = _filename; +#if ThePEG_RIVET_VERSION > 1 if ( fname.empty() ) fname = generator()->path() + "/" + generator()->runName() + ".yoda"; #else @@ -186,7 +186,7 @@ void RivetAnalysis::doinitrun() { AnalysisHandler::doinitrun(); // create Rivet analysis handler CurrentGenerator::Redirect stdout(cout); - _rivet = new Rivet::AnalysisHandler; //(fname); + _rivet = new Rivet::AnalysisHandler; for ( int i = 0, N = _paths.size(); i < N; ++i ) Rivet::addAnalysisLibPath(_paths[i]); _rivet->addAnalyses(_analyses); // check that analysis list is still available @@ -196,6 +196,16 @@ void RivetAnalysis::doinitrun() { << "Use 'rivet --list-analyses' to check availability.\n" << ThePEG::Exception::runerror; } - if ( debug ) + // preload files +#if ThePEG_RIVET_VERSION > 2 + for(string fname : _preload) { + _rivet->readData(fname); + } +#else + if(!_preload.empty()) + throw Exception() << "You have requested yoda files are preloaded by Rivet but this only supported for Rivet 3 and above"; +#endif + // debugging + if ( _debug ) Rivet::Log::setLevel("Rivet",Rivet::Log::DEBUG); } diff --git a/Analysis/RivetAnalysis.h b/Analysis/RivetAnalysis.h index 5e59791..7ed2097 100644 --- a/Analysis/RivetAnalysis.h +++ b/Analysis/RivetAnalysis.h @@ -135,6 +135,11 @@ class RivetAnalysis: public ThePEG::AnalysisHandler { */ vector _analyses; + /** + * Yoda files to be preloaded + */ + vector _preload; + /** * Search paths for finding rivet analyses. */ @@ -143,12 +148,12 @@ class RivetAnalysis: public ThePEG::AnalysisHandler { /** * The base name of the output file. */ - string filename; + string _filename; /** * Enable debugging information from Rivet */ - bool debug; + bool _debug; /** * The RivetAnalysisHandler @@ -163,39 +168,4 @@ class RivetAnalysis: public ThePEG::AnalysisHandler { } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of RivetAnalysis. */ -template <> -struct BaseClassTrait { - /** Typedef of the first base class of RivetAnalysis. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the RivetAnalysis class and the shared object where it is defined. */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** Return a platform-independent class name */ - static string className() { return "ThePEG::RivetAnalysis"; } - /** - * The name of a file containing the dynamic library where the class - * RivetAnalysis is implemented. It may also include several, space-separated, - * libraries if the class RivetAnalysis depends on other classes (base classes - * excepted). In this case the listed libraries will be dynamically - * linked in the order they are specified. - */ - static string library() { return "RivetAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* THEPEG_RivetAnalysis_H */ diff --git a/EventRecord/Event.h b/EventRecord/Event.h index b51d8ad..d492567 100644 --- a/EventRecord/Event.h +++ b/EventRecord/Event.h @@ -14,6 +14,7 @@ #include "StandardSelectors.h" #include "SubProcess.h" #include "ThePEG/Utilities/Named.h" +#include "ThePEG/Utilities/AnyReference.h" namespace ThePEG { @@ -261,6 +262,38 @@ class Event : public EventRecordBase, public Named { */ void primaryCollision(tCollPtr c); +public: + + /** + * Check for meta information + */ + bool hasMeta(const string& id) const { + return theMeta.find(id) != theMeta.end(); + } + + /** + * Set meta information. + */ + template + void meta(const string& id, T& ref) { + theMeta[id] = AnyReference(ref); + } + + /** + * Erase meta information. + */ + void eraseMeta(const string& id) { + theMeta.erase(id); + } + + /** + * Retrieve meta information. + */ + template + T& meta(const string& id) const { + return theMeta.find(id)->second.cast(); + } + protected: /** @@ -388,6 +421,11 @@ class Event : public EventRecordBase, public Named { */ long theParticleNumber; + /** + * The meta information + */ + map theMeta; + public: /** diff --git a/Helicity/Vertex/Scalar/VSSVertex.cc b/Helicity/Vertex/Scalar/VSSVertex.cc index 7c43ac4..1b3c866 100644 --- a/Helicity/Vertex/Scalar/VSSVertex.cc +++ b/Helicity/Vertex/Scalar/VSSVertex.cc @@ -26,7 +26,7 @@ describeThePEGVSSVertex("ThePEG::VSSVertex", "libThePEG.so"); void VSSVertex::Init() { static ClassDocumentation documentation - ("The VSSVertex class is hte implementation of the" + ("The VSSVertex class is the implementation of the" "vector-scalar-scalar vertex for helicity amplitude calculations." " all such vertices should inherit from it"); } diff --git a/NEWS b/NEWS index 5f0cad1..a97c24e 100644 --- a/NEWS +++ b/NEWS @@ -8,12 +8,26 @@ where NN is the bug number. The latest version of ThePEG can be found at http://www.thep.lu.se/ThePEG or at https:///herwig.hepforge.org/ +* ThePEG-2.2.2 release: 2021-01-22 + +** add meta mechanism to event record + +** add option of preloading yoda files and remove support for rivet-1 and aida + +* ThePEG-2.2.1 release: 2019-04-10 + +** new release solely to keep Herwig and ThePEG version numbers in sync + * ThePEG-2.2.0 release: 2019-12-12 ** Improvements to the unit templates, building with gcc 4.8 is no longer possible ** Several smaller bug fixes and additions, to allow new features in Herwig 7.2 +* ThePEG-2.1.7 release: 2020-04-10 + +** new release solely to keep Herwig and ThePEG version numbers in sync + * ThePEG-2.1.6 release: 2019-12-11 ** update boost.m4 to allow compliation with new boost versions diff --git a/PDF/LHAPDF6.cc b/PDF/LHAPDF6.cc index e962731..4604936 100644 --- a/PDF/LHAPDF6.cc +++ b/PDF/LHAPDF6.cc @@ -143,14 +143,36 @@ cPDVector ThePEG::LHAPDF::partons(tcPDPtr particle) const { const vector & flavs = pdfset.get_entry_as< vector >("Flavors"); + // check for leptons and antileptons + bool hasLepton [3] = {false,false,false}; + bool hasAntiLepton[3] = {false,false,false}; + vector flav2; + flav2.reserve(flavs.size()+3); + for (int val : flavs) { + if(abs(val) == 11 || abs(val) ==13 || abs(val)==15) { + int ilep = (abs(val)-11)/2; + if(val>0) hasLepton[ilep]=true; + else hasAntiLepton[ilep]=true; + } + flav2.push_back(val); + } + for(unsigned int ix=0;ix<3;++ix) { + if(hasLepton[ix] && !hasAntiLepton[ix]) { + int pid = 11+2*ix; + cerr << "Charged lepton with pid=" << pid << " found in PDF but not the antilepton" + << " assumming antilepton PDF is equal to the lepton one\n"; + flav2.push_back(-pid); + } + } + cPDVector ret; - ret.reserve( flavs.size() ); + ret.reserve( flav2.size() ); if ( canHandleParticle(particle) ) { - for ( size_t i=0; i < flavs.size(); ++i ) { - ret.push_back(getParticleData(flavs[i])); + for ( size_t i=0; i < flav2.size(); ++i ) { + ret.push_back(getParticleData(flav2[i])); } } - assert( ret.size() == flavs.size() ); + assert( ret.size() == flav2.size() ); return ret; } @@ -227,6 +249,12 @@ double ThePEG::LHAPDF::xfx(tcPDPtr particle, tcPDPtr parton, return thePDF->xfxQ2(g,x,Q2); case ParticleID::gamma: return thePDF->xfxQ2(ParticleID::gamma,x,Q2); + case ParticleID::eminus: case ParticleID::muminus: case ParticleID::tauminus: + case ParticleID::eplus : case ParticleID::muplus : case ParticleID::tauplus : + if(pid>0 || thePDF->hasFlavor(pid)) + return thePDF->xfxQ2(pid,x,Q2); + else + return thePDF->xfxQ2(-pid,x,Q2); } return 0.0; } @@ -384,6 +412,12 @@ double ThePEG::LHAPDF::xfsx(tcPDPtr particle, tcPDPtr parton, return thePDF->xfxQ2(g,x,Q2); case ParticleID::gamma: return thePDF->xfxQ2(ParticleID::gamma,x,Q2); + case ParticleID::eminus: case ParticleID::muminus: case ParticleID::tauminus: + case ParticleID::eplus : case ParticleID::muplus : case ParticleID::tauplus : + if(pid>0 || thePDF->hasFlavor(pid)) + return thePDF->xfxQ2(pid,x,Q2); + else + return thePDF->xfxQ2(-pid,x,Q2); } return 0.0; } diff --git a/configure b/configure index cd09980..ba19b27 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for ThePEG 2.2.0. +# Generated by GNU Autoconf 2.69 for ThePEG 2.2.2. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='ThePEG' PACKAGE_TARNAME='ThePEG' -PACKAGE_VERSION='2.2.0' -PACKAGE_STRING='ThePEG 2.2.0' +PACKAGE_VERSION='2.2.2' +PACKAGE_STRING='ThePEG 2.2.2' PACKAGE_BUGREPORT='http://www.thep.lu.se/ThePEG/' PACKAGE_URL='' @@ -1409,7 +1409,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ThePEG 2.2.0 to adapt to many kinds of systems. +\`configure' configures ThePEG 2.2.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1480,7 +1480,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ThePEG 2.2.0:";; + short | recursive ) echo "Configuration of ThePEG 2.2.2:";; esac cat <<\_ACEOF @@ -1625,7 +1625,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ThePEG configure 2.2.0 +ThePEG configure 2.2.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2237,7 +2237,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ThePEG $as_me 2.2.0, which was +It was created by ThePEG $as_me 2.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3198,7 +3198,7 @@ fi # Define the identity of the package. PACKAGE='ThePEG' - VERSION='2.2.0' + VERSION='2.2.2' cat >>confdefs.h <<_ACEOF @@ -20356,7 +20356,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ThePEG $as_me 2.2.0, which was +This file was extended by ThePEG $as_me 2.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20422,7 +20422,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -ThePEG config.status 2.2.0 +ThePEG config.status 2.2.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index cf4f4f4..c547869 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([ThePEG],[2.2.0],[http://www.thep.lu.se/ThePEG/],[ThePEG]) +AC_INIT([ThePEG],[2.2.2],[http://www.thep.lu.se/ThePEG/],[ThePEG]) AC_CONFIG_AUX_DIR([Config]) AC_CONFIG_MACRO_DIR([m4])