diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -1,29 +1,30 @@
 0704eccbbae770dd2df2e8145a5dd46e4cb29b66 java-merge
 0704eccbbae770dd2df2e8145a5dd46e4cb29b66 pre-cuts-merge
 2763da36e168c75a5b48d63a5f44836eb521b343 herwig-2-0-alpha1
 337e051dcffc653cd0429988f12806758c183472 release-1-6-1
 3f01c180519e15200a4de8e0e9b7f298ab145d57 pre-java-merge
 432bd5d28ebdf0c95e737452ac068515c589872f pre-libtool-merge
 57f60f2e143afcc16543173ce59601fded4b8247 release-1-7-0
 5830e4eb9afe3ba3705341778a40d0fe2dc6567c release-1-8-0
 67c66b02adf69f650c77c50d89b698d8ed54c929 release-1-7-2
 7e8967c704d1f8a551637a300130587154e9028b LHA-merge
 825d126ced6f38223a9b378ba9b09dba4f48751e pre-LHA-merge
 8cab12da53be26a852e6a407f53db5e1997fd0b1 release-1-7-1
 8d298cf18309cdbded5344990a4955699afff04b cuts-merge
 b6a8110c61f6226e9a8e0c7f3fa73ec3638bc9c1 herwig-2-0-alpha3
 b6a8110c61f6226e9a8e0c7f3fa73ec3638bc9c1 herwig-2-0-beta
 d063c89add007af8bcff8d8b166576b6b1c091ba release-1-6-0
 f4f74476f4db925446c84b54e90c0ef27b82a3d6 libtool-merge
 d6ba7d425e3ae8b01157223638cbcf0dac939904 release-1-8-1
 813a7eb367a9a119998aaf74682a5543bf570da1 release-1-8-2
 52eeb52c35cf8b1ceed0e754ef47dd4af282cfa3 release-1-8-3
 9ac24d1eb03b6286038402b3420b2520846ce9f0 release-1-9-0
 f0ef8fb93d924e1c01a30eeaf172f9fd82d0b4d2 release-1-9-1
 2d8e0f74b65ef7f5acdf0128e7280fff535d1f82 release-1-9-2
 4cf20ed60ecd8c9016cdaf9e3f6cd0347cee8185 release-2-0-0
 7346f289aba9116f5b2327b98adb4b4e8b6a76dc release-2-0-1
 16491c05f54af0c4c02cbf40fc3e77120eba8374 release-2-0-2
 b08a997136055e39cac6187eeb3c3f84ddc148bc release-2-0-3
 9772c45ac9a165f4c30764e1ba1df43d778d6932 release-2-0-4
 46d46e5f0edf5bf67b778b86a5515685be648ae5 release-2-1-0
+f0a8c5985691243ee3c0b5f79be829a68601a527 release-2-1-1
diff --git a/LesHouches/Makefile.am b/LesHouches/Makefile.am
--- a/LesHouches/Makefile.am
+++ b/LesHouches/Makefile.am
@@ -1,27 +1,27 @@
 mySOURCES = LesHouchesReader.cc LesHouchesFileReader.cc  \
           LesHouchesEventHandler.cc
 
 DOCFILES = LesHouchesReader.h LesHouchesFileReader.h  \
            LesHouchesEventHandler.h LesHouches.h
 
 INCLUDEFILES = $(DOCFILES) LesHouchesReader.fh \
                LesHouchesFileReader.fh \
                 LesHouchesEventHandler.fh
 
 pkglib_LTLIBRARIES = LesHouches.la MadGraphReader.la
 
 # Version info should be updated if any interface or persistent I/O
 # function is changed
 MadGraphReader_la_LDFLAGS = $(AM_LDFLAGS) -module $(LIBTOOLVERSIONINFO)
 MadGraphReader_la_SOURCES = \
 MadGraphReader.cc MadGraphReader.h \
 MadGraphOneCut.cc MadGraphOneCut.h \
 MadGraphTwoCut.cc MadGraphTwoCut.h
 
 # Version info should be updated if any interface or persistent I/O
 # function is changed
-LesHouches_la_LDFLAGS = $(AM_LDFLAGS) -module $(LIBTOOLVERSIONINFO)
+LesHouches_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 25:1:0
 LesHouches_la_SOURCES = $(mySOURCES) $(INCLUDEFILES)
 
 include $(top_srcdir)/Config/Makefile.aminclude
 
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -1,943 +1,958 @@
 ThePEG News	-*- outline -*-
 ===============================
 
 Numbered bugs can be found at
  https://herwig.hepforge.org/trac/ticket/NN
 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.1.1 release: 2017-07-14
+
+** Added missing evaluate() option to GeneralVVSVertex
+
+** More robust reading of LHE files
+
+** Warn about duplicate PDG names in user input
+
+** Write current timestamp into log files
+
+** Calling 'read' in an input file will no longer change the 
+   repository directory you're in
+
+
+
 * ThePEG-2.1.0 release: 2017-05-19
 
 ** Transition to C++-11 code, building with C++-98 is no longer possible
 
 ** Interfaces with two choices now consistently accept Yes/No as answer
 
 ** Several smaller bug fixes and additions, to allow new features in Herwig 7.1
 
 
 
 * ThePEG-2.0.4 release: 2016-10-25
 
 ** Default weight explicitly labelled    
    The nominal event weight is now labelled "Default" and is always the
    first weight to be inserted into HepMC.
    (Note that HepMC 2.06.09 may not preserve this ordering.)
 
 ** LesHouches event weights handling    
    There are now two options for the treatment of optional weights 
    coming in from a Les Houches file, available through 
    "LesHouchesEventHandler:WeightNormalization". Either they are
    normalized to the "Default" weight ("Normalized"), or they are given
    as cross-sections in pb ("CrossSection"). The default behaviour
    is "Normalized".
 
 ** JetFinder in Cuts objects writes information
    The selected JetFinder is explicitly listed in the debug output
    
 
 
 * ThePEG-2.0.3 release: 2016-07-21
 
 ** LesHouches reader
    Removed FxFx-specific weights from default output
 
 ** FuzzyTheta cut
    Fixed missing division by width 
 
 ** NaN check for incoming momenta from ME providers
 
 ** Build system
    Compatibility with gcc-6, improved configure macros. 
 
 
 
 * ThePEG-2.0.2 release: 2016-04-27
 
 ** LesHouches reader
    Fixed cross-section issue for LH event files using weight scheme 3
 
 
 
 * ThePEG-2.0.1 release: 2016-02-17
 
 ** Electroweak scheme fixes
    Schemes 2 and 5 now set GF, scheme 7 calculates mw correctly.
 
 ** New ParVector 'clear' command
 
 ** More visible version information
    The version number of ThePEG is written into the log file.
 
 ** Rivet exception handling
    Any exceptions from Rivet/YODA are converted into warning exceptions. 
    This can invalidate plots, please check the logfile.
 
 ** Rapidity limits fixed in FuzzyTheta cuts
 
 ** Doxygen updated to version 1.8
 
 ** Java interface fixed
 
 
 
 * ThePEG-2.0.0 release: 2015-12-04
 
 ** Improvements for NLO
    A number of improvements and bug fixes have been made in the course of
    (Herwig 7) NLO development.
 
 ** Improvements for spin correlations
    A number of improvements have been made to handle spin correlations in the
    parton shower.
 
 ** Setup file mechanism
    An isolated event generator can now be modified prior to generating events
    by providing an additional input file; also support for re-initalizing
    isolated event generators has been added in this course to support Herwig
    7's parallel integration modes.
 
 ** Handling of weighted LHE events
    The handling of LHE events with variable weight (codes 3 and 4) has now
    been enabled, along with the full handling of multiple event weights down
    to the HepMC output.
 
 ** LHAPDF6 handling
    A problem in initializing LHAPDF6 has been fixed.
 
 ** Heavy ion collisions
    A dedicated HepMC interface for heavy ion collisions has been introduced.
 
 ** First steps for unit testing
    Unit testing has been introduced for a number of components based on
    boost's unittesting framework. They are only enabled, when configured
    --with-boost .
 
 * ThePEG-1.9.2 release: 2014-07-07
 
 ** Better support for LHAPDF 6
    The LHAPDF interface now determines if version 6 is available and
    makes use of new LHAPDFv6 features.
 
 
 
 * ThePEG-1.9.1 release: 2014-04-30
 
 ** Build fix for SLC6
    Fixed problems with a missing <algorithm> header in ACDCGen.h that affected 
    some builds on SLC6 
 
 ** Build fix for Rivet 2.1.1
    Adapted to Rivet 2.1.1 changed header file layout
 
 ** OS X Mavericks build fix for readline
    The problem of infinite hangs when linking against libreadline 
    in Mavericks has been resolved.
 
 
 
 * ThePEG-1.9.0 release: 2013-10-28
 
 ** Rapidity edge cases
    Changed behavior for vanishing pt in eta() and vanishing mt in
    rapidity(): no error is thrown, but a ridculously large rapidity is
    returned instead.
 
 ** Command line interface
    Adding a tag of the form "#first-last" when running a
    MultiEventGenerator now allows to run a subset of the runs
 
 ** Pre- and Posthandlers
    A warning is now issued if the same handler is inserted twice into
    a pre- or posthandler list.
 
 ** Statistics fixes
    Various issues for the handling of statistics in the presence of
    negative weights have been fixed.
 
 ** Rivet search paths
    A new interface RivetAnalysis:Paths allows more search paths to be
    added to the analysis finding routine. This supplements the
    RIVET_ANALYSIS_PATH environment variable.
 
 ** Vertex classes
    A chain of sign and prefactor fixes has been implemented in the
    Vertex classes to correct various vertex structures in Herwig++
    conversions of Feynrules models.
 
 ** Custom XComb objects
    Matrix element classes can built with customized XComb objects.
 
 ** Reweighting of SubProcessGroups and projections
    Matrix element groups can reweight contributions in a
    SubProcessGroup and select one of the dependent subprocesses to be
    used as the hard one instead of the group in total.
 
 ** Fuzzy cuts
    Jet cuts in the jet cut framework can be assigned a fuzzy shape to
    improve the stability of NLO calculations.
 
 ** NLORivetAnalysis, NLOHepMCFile
    The NLOHepMCFile and NLORivetAnalysis classes have been added to
    allow Rivet to analyse NLO calculations which perform output for the
    subtracted real emission matrix elements as ThePEG::SubProcessGroups; 
    individual subprocesses in these groups are flagged as correlated
    by being assigned the same event number.
 
 ** C++-11 testing
    To help with the coming transition to C++-11, we provide the new
    --enable-stdcxx11 configure flag. Please try to test builds with
    this flag enabled and let us know any problems, but do not use this
    in production code yet. In future releases, this flag will be on by
    default.
 
 
 
 
 * ThePEG-1.8.3 release: 2013-02-22
 
 ** Fixed HepMC status code assignment
    The incoming line to a technical vertex that only changes a particle's
    momentum is now labelled 11 (MC-internal) instead of 2 (unstable).
 
 
 
 * ThePEG-1.8.2 release: 2013-01-30
 
 ** Changes to scheduled event dumps
    Set the EventGenerator option "KeepAllDumps" to keep all dump files
    of a run, labelled by event number. These scheduled dumps now produce
    a cleaned generator state between events.
    
 ** SLHA block bug fix
    In some circumstances, the end of an SLHA block was not parsed
    correctly.
 
 
 
 * ThePEG-1.8.1 release: 2012-10-15
 
 ** Repository changes
 
 *** Stable flag
     The behaviour of the 'Particle:Stable' flag has changed slightly. When
     all decaymodes are removed from a particle, the flag will be
     automatically set to stable. However, it still needs to be set unstable
     by hand when new decaymodes are added to a formerly stable particle.
 
 *** Search paths
     The search paths for reading input files are now saved in the
     repository.
 
 ** Rivet analysis YODA capable
    The configure time check for Rivet will now detect the version to
    check if it is YODA capable.
 
 ** NLOHepMCFile
    An AnalysisHandler, similar to the standard HepMCFile has been
    added to allow analysing plain NLO calculations by communicating
    each member of a subprocess group (typically real emission and
    subtraction contributions) to a HepMC file; until Rivet supports
    the correct treatment of errors in this case, the subprocess group
    members are written out as events independent of each other.
 
 ** Jet cuts
    A more flexible framework for cuts on jets has been added,
    including jet finders (either builtin or via an optional link to
    fastjet). All kinds of exclusive and inclusive jet cuts, as well as
    jet vetoes on the level of the hard process are now supported.
 
 ** Tree2toNDiagram
    A bug has been fixed in Tree2toNDiagram::isSame(tcDiagPtr,
    map<int,int>&) method to take into account symmetries when swapping
    two external legs attached to the same vertex
 
 ** Quark thresholds in alphaS
    Support for setting quark masses for threshold matching in
    couplings deriving from AlphaSBase independently of masses used in
    ParticleData objects has been added. The O1AlphaS implementation is
    fully aware of this enhancement.
 
 ** LesHouches reader fixes
    The LesHouches readers have been improved, and will spot many more
    consistency errors, such as coloured Standard Model leptons, or helicity
    values outside of [-1,1] and 9.
 
 ** Spinor enhancements
    The LorentzSpinor class has gained member functions for projection operations
    and the contraction with the sigma-mu-nu commutator.
 
 
 
 * ThePEG-1.8.0 release: 2012-05-21
 
 ** NLO support
 
 ***    ThePEG now includes structures to ease implementing next-to-leading
        order (NLO) calculations as well as for interfacing external
        matrix element codes through runtime interfaces. Particularly,
        the newly introduced MEGroup and accompanying StdXCombGroup,
        StdDependentXComb and SubProcessGroup classes provide the
        functionality required by subtraction approaches to higher
        orders. A general interface for cutting on reconstructed jets
        as required by higher-order calculations is included, along
        with an implementation of kt, Cambridge-Aachen and anti-kt jet
        finding as relevant for NLO calculations. Hard process
        implementations deriving from MEBase are no longer limited to
        the evaluation of PDFs by PartonExtractor objects, thus
        allowing for a more flexible and more stable implementation of
        finite collinear contributioins appearing in the context of
        higher order corrections.
 
 ***    The generation of phasespace points
        for the hard subprocess has been made more flexible,
        particularly to allow generation of incoming parton momenta by
        the hard matrix element as is typically done by phasespace
        generators provided with fixed-order codes. Along with this
        change, generation of the phasespace point does not need to
        take place in the centre-of-mass system of the incoming
        partons.
 
 ***    Various helpers have been added to MEBase and dependent 
        code along with the improvements described above, including
        simple functionality required for caching intermediate results.
 
 ***    Tree2toNDiagram supports merging of two external legs, 
        yielding another Tree2toNDiagram object to assist in
        determining subtraction terms required for a particular process
 
 ** Support for SU(3)-sextet colour lines
 
 ** Named weights support, also in HepMC
    Named, optional weights on top of the usual event weight are now
    fully supported; this includes their communication to HepMC events
    as well as their parsing from the extented Les Houches file format
    drafted at the Les Houches workshop 2009.
 
 ** Complex masses supported in Helicity code
 
 ** Several minor fixes and enhancements
  
 
 
 
 
 * ThePEG-1.7.3 release: 2012-03-05
 
   The only changes are in LesHouches.so, now at version 14.
 
 ** Spin information
    Spin correlation information will now be set up correctly for tau
    leptons. To go back to the old behaviour, set
    LesHouchesReader:IncludeSpin No
 
 ** Consistency checks
    Catch broken input where mother-daughter relations are circular.
 
 * ThePEG-1.7.2 release: 2011-11-01
 
 ** HepMC configuration
    Clarified at configure time that HepMC versions before 2.05 are not
    officially supported.
 
 ** Rivet configuration
    Rivet builds with external header dependencies are now correctly
    recognized.
 
 ** Helicity vertex consistency
    To help debugging, the addToList() function for registering
    particle lines connected to a vertex now checks for electric charge
    conservation at the vertex. Additionally, the specified QED/QCD
    order of the interaction is checked.
 
 ** Ticket #355: Global library list for resume functionality
    The list of global libraries is now correctly included in the dump
    file, to fix the functionality of resuming a run from regular
    checkpoints.
 
 
 
 * ThePEG-1.7.1 release: 2011-06-20
 
 ** Ticket #238: Self-consistent electroweak schemes
    The default behaviour of Herwig++ is to use the best values for all
    the electroweak parameters, which can be inconsistent. Optionally
    now, a self-consistent electroweak scheme can be chosen in the
    parameter Model:EW/Scheme. Note that values of 'EW/Scheme' away
    from the default have not received the same amount of testing.
 
 ** Ticket #338: Fixed reporting of floating point exceptions
    This was an issue whenever LHAPDF libraries were linked in.
 
 ** Fixed cTau() behaviour
    The new behavior is that if both width and lifetime are zero,
    cTau() returns zero for unstable particles and MaxLength for
    stable ones.
 
 ** MaxErrors
    The cutoff can be disabled by setting MaxErrors to -1.
 
 ** StdOut redirect
    CurrentGenerator::Redirect now does not redirect to to the internal
    stream in EventGenerator if the useStdout flag has been set.
 
 ** Run name tags
    Aded possibility to add a tag to the run name when running with the
    '-t' option. One run file can thus be run with different seeds and
    result in different output files.
 
 ** Exception names
    EventGenerator tries to convert exception type names into
    human-readable form. Currently this only works for gcc-compatible
    compilers.
 
 ** Repository API changes
    Instead of printing an error message to cerr, the
    Repository::load() and Repository::read(filename,os) commands now
    behave like the other repo commands and return an error string.
    This allows --exitonerror to work correctly for load() and read().
    Users of these functions need to send the string to cerr themselves
    if the old output behaviour is required. 
    Repository::read(is, os, prompt) is unchanged.
 
 ** HepMC precision
    The precision() option for HepMC GenEvent is now available as an
    interface in the HepMCFile analysis handler.
 
 ** gcc-4.6
    The build has now also been tested with gcc 4.6.0.
 
 
 
 * ThePEG-1.7.0 release: 2011-02-08
 
 ** Behaviour
 *** Cross-section information
     The .out file contains a better estimate of the cross-section
     directly from the phase space sampler. It should be reliable if
     not too many events were vetoed during the later phases of the
     production.
 *** Simpler decay mode selection
     Instead of having to turn off every mode individually, the new
     'SelectDecayModes' interface allows commands such as
       tbar:SelectDecayModes none 
       tbar:SelectDecayModes tbar->nu_ebar,e-,bbar; tbar->nu_mubar,mu-,bbar;
     Use 'PrintDecayModes' to list the available choices.
 *** Rivet interface
     The interface will check before the run if all chosen analyses are
     actually available in Rivet, and will only call finalize() if any
     events have been generated. Event weights are now passed correctly
     into Rivet.
 *** Les Houches QNUMBER support
     QNUMBER particle creation support has been added to the Les
     Houches reader.
 *** Debug level
     If a debug level is set on the command line, it will always be used.
 *** Abort preserves events
     A hard abort exception during event generation will try to finalize as
     best as it can, thus preserving information about the run until this
     point.
 *** Progress log
     There is a new ThePEG::ProgressLog analysis handler, which prints
     timing information about the run to screen. 
 *** Graphviz
     The event graph can show missing momentum information.
 *** CRLF line endings (Windows-style)
     File readers can now cope with files that have CRLF (Windows) and CR
     (Mac) line endings.
 
 
 ** Structure
 *** Diffraction support
     To provide support for the simulation of diffractive events, the
     LeptonLeptonRemnant class was renamed to UnresolvedRemnant, the
     WeizsackerWilliams PDF extended, BudnevPDF added, and PartonExtractor
     modified to allow separate override PDFs for each beam.
 *** Polarized beams
     The PolarizedBeamParticleData class permits a spin polarization choice
     on the incoming particles.
 *** Mixing particles
     The MixedParticleData class supports mixed particle states.
 *** SpinBase
     The SpinBase class has been removed, SpinInfo is now the base class. 
 *** Vertex classes
     Several new vertices were added for BSM physics, and some minor bugs
     fixed with existing classes.
 *** PID type
     Particle IDs now have their own type, 'PID'. It can only be converted
     to 'long' to avoid unsigned int overflow errors on 64bit machines.
 *** ClassDescription
     There is a simpler way to register ClassDescription information with
     the Repository: the DescribeClass<> template. No information is needed
     in the class headers anymore, reducing build dependencies. New code
     will use this method now, older classes will be migrated in future.
 *** LWH histogramming
     The built-in implementation of AIDA histogramming has been
     restructured slightly to decouple the implementation from the
     interface.
 
 ** Build system
 *** Silent build rules
     'make' now builds silently, to improve readability. To get the old
     behaviour, run 'make V=1'
 *** zlib
     Integrated zlib to read compressed files, such as Les Houches events.
 *** Libtool 2.4
     Will fix some issues on OS X. 
 *** gsl check
     This check now also works with Rivet
 
 
 ** Bug fixes
 *** Ticket #286: Implementation of Cuts in LesHouchesReader
     Les Houches events are given in the lab frame, but QCDCuts expects to
     be given momenta in the parton-parton cmf.  Boost added.
 *** Ticket #303: AlphaS thresholds
     AlphaS thresholds were fixed for exactly massless quarks. 
 *** Ticket #304: Length units in HepMC
 *** Ticket #309: Particle initialization order
 *** Ticket #310: LeptonLeptonPDF fix
 
    
 
 * ThePEG-1.6.1 release: 2009-12-11
 
 ** Ticket #292: Spin correlation fix to stabilize tau decay numerics
    We have restructured the spin correlation code to stabilize the
    numerical problems seen in tau decays. 
 
 ** Speed increase
    Improved decay chain handling speeds up a typical run by a few percent.
 
 ** Exception logging
    The log file lists different exception types individually again
    instead of grouping them all by severity only. This was broken in
    the last few releases.
 
 
 
 * ThePEG-1.6.0 release: 2009-11-19
  
 ** Helicity amplitudes
    The main change in this release is a streamlining of the helicity
    amplitude code. If you have self-written vertex classes, you will
    need to adapt them slightly:
 *** Spinor representation
     All spinors are now in HELAS representation, the optional
     representation switching has been removed.
 *** Adding particles to the vertex
     Instead of calling setList(v1, v2, v3) with three vectors of
     particles that need to be filled in sync, call 
     addToList(p1, p2, p3) repeatedly.
 *** Name changes
     To make them consistent with the rest of ThePEG, the names of
     functions starting with get...() have changed:
     getFoo() becomes foo(); setFoo(...) becomes foo(...).
 
 ** Vector code changes
 *** Vector3 has been renamed ThreeVector
     This makes it consistent with the other vector classes.
 *** LorentzVector::mag()/mag2() removed, to reduce confusion
     Use the equivalent ::m()/m2() instead to get E^2-p^2. 
     LorentzVector::rho2() == ThreeVector::mag2() == p^2
 *** Calculating with a zero-length vector 
     Previously, mathematically undefined values were arbitrarily set
     to 0 in this situation.  Now an assertion failure is triggered in
     debug mode. Only the azimuthal angle phi() still returns 0.
 
 ** Environment variable interpretation removed
    The programs setupThePEG and runThePEG are not wrapped in shell
    scripts anymore. All usage of environment variables at runtime has
    been removed. To influence the behaviour of ThePEG, you will need
    to use explicit command line flags, or calls to Repository::
    functions.
 
 ** StandardModelBase now provides G_Fermi
    InvEnergy2 StandardModelBase::fermiConstant() const;
    provides the PDG 2006 value of G_Fermi.
 
 ** Allow particle width cuts to be unset
    Setting a negative value for the lower or upper width cut removes
    that bound on the width.
 
 ** Ticket #271: Decay mode names are normalized
    Previously, the ordering of decay products in a decay mode
    specifier needed to match ThePEG's internal ordering exactly. This
    is now done automatically.
 
 ** Ticket #273: NoPDF and LesHouches reader
    The LesHouches reader has been fixed for the case where no PDFs are
    used in the LHE file.
 
 ** Ticket #275: doinitrun() ordering
    The ACDC sampler now ensures that initrun() of all ME objects is
    run first.
 
 ** Ticket #277: Repository command help texts
    ThePEG's repository command language now includes a 'help'
    functionality.
 
 ** Redirection of various files
    The log file stream now goes to stdout instead of stderr when
    EventGenerator:UseStdout is set.
 
 ** Readline support can be disabled
    Using the configure switch '--disable-readline', the linking of
    libreadline can be suppressed. This can be useful for batch code that
    will never be used interactively, if the number of linked-in
    libraries is a problem.
 
 ** --with-LHAPDF configure flag
    Previously, the full LHAPDF path including lib/ needed to be
    specified. This now also works with the more common usage of just
    LHAPDF's prefix path.
 
 ** Rivet analysis plugin
    The Rivet analysis output files are now named consistently like the
    other output from a run, with the run name as prefix. 
 
 ** Graphviz event visualization
    This is now independent of HepMC. The call to
    void ThePEG::printGraphviz(ostream & os, tcEventPtr event);
    on any event will output a Graphviz file to the stream,
    suitable for interpretation with the 'dot' tool. It shows a
    visualization of the generator's internal event structure, useful
    for debugging. This is an initial version, feedback is welcome!
 
 ** Fixed compatibility with older HepMC versions
    A problem with rejecting a missing HepMC unit implementation was fixed.
 
 
 
 
 * ThePEG-1.5.0 release: 2009-09-01
 ** New ZERO object
    The ZERO object can be used to set any dimensionful quantity to
    zero. This avoids explicit constructs like 0.0*GeV.
 
 ** Readline interface
    The interactive repository access now uses the readline library,
    providing a command history and easier command line editing.
 
 ** Syntax highlighting
    We now have a syntax highlighting mode for emacs. To enable it, use
    'M-x ThePEG-repository-mode' on any .in file.
 
 ** Configure information
    Important configuration information is listed at the end of the
    'configure' run and in the file 'config.thepeg'. Please provide
    this file in any bug reports.
 
 ** Rivet interface
    ThePEG now supports Rivet internally as an AnalysisHandler if it's
    available.
 
 ** HepMC tools; CLHEP support removed
    The HepMC file output and graphviz event view have migrated from
    Herwig++ to ThePEG. The deprecated CLHEP support has been removed.
 
 ** Exception specifiers removed
    Client code changes are needed in doinit() etc. Simply remove the
    exception specifier after the function name.
 
 ** Support for HepMC 2.05
 *** New features
     ThePEG now supports cross-section output, PDF information and unit
     specifications if they are available in HepMC.
 *** IO_ASCII
     Support for the deprecated IO_ASCII format has been removed.
 *** Status codes
     ThePEG uses codes 1, 2 and 11 according to the HepMC agreement.
 
 ** Redirection of .out, .log and .tex to stdout
    Set 'EventGenerator:UseStdout' to 'Yes' and (almost) all output
    will be streamed to stdout instead of files.
 
 ** Ticket #248: Les Houches reader
    The cross-section information is now reported correctly when
    reading several files.
 
 ** Cuts output
    If the debug level is set > 0, the current set of cuts is prepended
    to the logfile.
 
 ** Preweighting of matrix elements
    A segfault when using preweights was fixed. Preweights are now
    correctly included in handler statistics.
 
 ** Other technical changes
 *** Colour line improvements
 *** PDFsets.index search improved
 *** Ticket #232: Java check on OS X now works headless
 *** Running couplings restructured
 *** LeptonLeptonRemnant iprovements to support GammaGamma
 *** WaveFunction constructors streamlined
 *** VertexBase now provides sin2ThetaW etc.
 
 
 
 
 * ThePEG-1.4.2 release: 2009-05-08
 ** Ticket #242
    Fixed a compiler problem that showed up on openSUSE 10.2, g++
    4.1.2.  A source line was omitted if the optimization level was
    higher than -O1.
 
 ** User interaction
    Dump file generation can now be disabled completely by setting
    EventGenerator:DumpPeriod to -1.
 
 
 
 * ThePEG-1.4.1 release: 2009-03-31
 ** User interaction
    Error messages have been clarified in BaseRepository and
    StandardEventHandler
 
 ** Les Houches files
    File readers are more robust, with clearer messages when things go
    wrong.
 
 ** Floating point issues
    fixed in ThreeVector and VertexBase.
 
 ** HepMC converter
    Fixed PDF choice for asymmetric beams.
 
 ** Libtool
    Updated to version 2.2.6
 
 
 
 * ThePEG-1.4.0 release: 2008-12-02
 ** Efficiency improvements
    The LorentzVector class, the helicity amplitude code and PDF
    lookups have been profiled and restructured to eliminate speed
    bottlenecks. 
 
 ** Deep inelastic scattering
    Support for DIS is now implemented in ThePEG.
 
 ** New rapidity cut
    Added alternative pT cut that cuts on rapidity rather than
    pseudorapidty as the existing one fails for zero-pt massive
    particles.
 
 ** HepMC units support
    Users of HepMC versions > 2.04 get full units support. The HepMC
    GenEvent object has the correct units set.
 
 ** Support for HepMC PdfInfo data
    Users of the HepMC converter can now fill the PdfInfo data, which
    has been available since HepMC 1.28.00. Older versions are no
    longer supported.
 
 ** Ticket #199: Particle lifetime cutoff
    Users can set a maximum lifetime. Particles that live longer than
    this are not decayed.
 
 ** Ticket #215: Madgraph
    Fixed a problem in reading certain Madgraph event files.
 
 ** Les Houches files
    Optional rescaling of energy or mass of particles which were read
    in. Check the file to trap 'nan' and 'inf' values early during the read-in.
 
 ** File cleanup
    Most inline functions are now defined in the headers rather than a
    separate .icc file.
 
 
 
 * ThePEG-1.3.0 release: 2008-06-20
 ** Statistical errors
    Error estimates on the cross-sections are now reported in the .out files.
 
 ** Decaymode setup
    The decaymode setup has been reworked, keeping backwards
    compatibility. The 'defaultparticle' command has been removed.
 
 ** Madgraph reader
    Updated to latest Madevent version. 
 
 ** LHAPDF improvements
    lhapdf-config is not used anymore to determine the location of the
    PDF sets. Instead, they are fixed at configure-time.
 
 ** HepMC 
    The beam particles are now set correctly.
 
 ** Arbitrary search paths for .in files
    Input files don't have to be in '.', use '-I' to specify additional
    directories.
 
 ** Ticket #172
    Fix for cuts in mirrored processes.
 
 ** Simpler emacs macros
    The emacs macros have been significantly cleaned up.
 
 ** Helicity vertex classes
    Potential prolems with uninitialized variables were fixed. No
    actual bugs had occurred from here.
 
 ** Memory leak fixes and performance
    Several loops of shared pointers were fixed involving DecayModes
    and ParticleData. FixedSizeAllocator was removed, the regular 'new'
    and 'delete' is now used for all allocations, giving a 5% speedup.  
 
 
 
 * ThePEG-1.2.0 release: 2008-04-18
 ** ThePEG uses GSL 
    The GNU Scientific Library and its headers are now required for
    building ThePEG. RandomGenerator partially uses GSL now.
 
 ** Ticket #160: HepMC converter 
    Optionally, the HepMC converter can fill an external GenEvent object,
    instead of newing one internally.
 
 ** 'globallibrary' command
    The 'globallibrary' command can be used to register libraries which
    are useful for the whole run. They do not need to be listed in each
    class's library() function.
 
 ** Resume from dump files (also solves #149)
    The --resume command line flag instructs runThePEG to resume the
    run from a previous dump file. 'set Generator:DumpPeriod 1000'
    writes such a checkpoint every 1000 events.
 
 ** New Repository interface (also solves #141)
    The repository now provides a Repository::cleanup() method, to be
    called at the end of a run. Alternatively, a Repository object can
    be created and its member functions called. 
 
 ** Les Houches interface improvements.
    LesHouchesReader had had a major overhaul.
 
 ** XSecCheck analysis
    Issues a warning if a target cross section is not met in the run.
 
 ** Weighted events
    Handling of weighted events was improved.
 
 ** Ticket #124: 'Deleted' interface option 
    Interfaces can be declared obsolete, a warning will be issued when
    they're used. 
 
 ** LHAPDF interface 
    The interface now allows photons as partons inside a hadron.
 
 ** gcc 4.3.0
    ThePEG compiles cleanly with the new gcc 4.3 series.
 
 ** Bug #138
    Lepton NoPDF now works.
 
 
 
 
 * ThePEG-1.1.2 release: 2008-02-25
 ** Bug #136: dSigHatDR
    Efficiency improvement for zero PDF.
 
 ** Bug #137: HepMC conversion
    The HepMC converter now takes a unit argument to specify which
    energy and length units should be used in the HepMC event.
 
 ** Bug #140 / #141: Crash on shutdown
    This fixes a bug introduced in 1.1.1. External code interfaces
    should now work again. 
 
 ** Bug #151: Loop in Remnant record
    The loop between remnants in the event record has been removed.
 
 ** PDF improvements
    Fix to handling of maximum flavour from LHAPDF. Fix for xmin
    calculation. 
 
 
 
 
 * ThePEG-1.1.1 release: 2007-12-07
 ** Bug #46: Reproducibility
    Fixed a problem where runs were not identical for a given random
    number seed. You now _must_ reset the seed if you need independent
    event generator runs.  
 
 ** Detection of gcc abs bug
    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34130
    configure now checks for and works around the gcc abs() bug.
 
 ** Separate LWHFactory library
    Fixed problem in Rivet interaction by factoring out LWHFactory into
    its own dynamic library.
 
 
 
 
 * ThePEG-1.1.0 release: 2007-11-20
 ** New vector classes
    ThePEG now uses its own internal Vector classes, making it
    independent of CLHEP.
 
 ** New dimension checking mechanism
    Optionally, any physical expression is checked for dimensional
    correctness at compile time.
 
 ** Extended Helicity classes
    A full set of helicity amplitude classes has been transferred from
    Herwig++. 
 
 ** unlisted
   Many other improvements and small bug fixes, see ChangeLog.
 
 
 
 
 * ThePEG-1.0.1 release: 2006-11-22
 
 ** unlisted:
    Fixed memory leak in LesHouchesReader.
 
 ** Bug #58
    maximumCMEnergy() member of the EventGenerator returns zero. See
    ChangeLog entry 2006-10-06
 
 ** Bug #62
    fixed 'const' behaviour in Lorentz spinor classes
 
 ** Bug #68
    Improved error message for switch options
 
 ** unlisted
    Improved compile-time LHAPDF library and include file handling.
 
 ** unlisted
    Bug in IteratorRange::rrange(const Container &).
 
 ** unlisted
    fixed Selector::swap()
 
 ** unlisted
    Bug in ClusterCollapser where no colour-singlet particles were
    considered for momentum compensation if no coloured particles were
    present. 
 
 ** unlisted
    Bug in LeptonLeptonRemnant: minX variable not persistent
 
 ** unlisted
    scale of the produced coloured particles was not set in
    Onium3GDecayer and ColourPairDecayer
 
 ** unlisted
    unused default path removed from DynamicLoader
 
 
 
 
 * ThePEG-1.0 release: 2006-09-27
diff --git a/Repository/Repository.cc b/Repository/Repository.cc
--- a/Repository/Repository.cc
+++ b/Repository/Repository.cc
@@ -1,1143 +1,1150 @@
 // -*- C++ -*-
 //
 // Repository.cc is a part of ThePEG - Toolkit for HEP Event Generation
 // Copyright (C) 1999-2017 Leif Lonnblad
 //
 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
 //
 //
 // This is the implementation of the non-inlined, non-templated member
 // functions of the Repository class.
 //
 
 // macro is passed in from -D compile flag
 #ifndef THEPEG_PKGLIBDIR
 #error Makefile.am needs to define THEPEG_PKGLIBDIR
 #endif
 
 #include "Repository.h"
 #include "ThePEG/Utilities/Rebinder.h"
 #include "ThePEG/Handlers/EventHandler.h"
 #include "ThePEG/PDT/DecayMode.h"
 #include "ThePEG/Repository/Strategy.h"
 #include "ThePEG/Persistency/PersistentOStream.h"
 #include "ThePEG/Persistency/PersistentIStream.h"
 #include "ThePEG/Utilities/Debug.h"
 #include "ThePEG/Config/algorithm.h"
 #include "ThePEG/Utilities/DynamicLoader.h"
 #include "ThePEG/Utilities/StringUtils.h"
 
 #include <iterator>
 #include <chrono>
 
 #include <config.h>
 
 // readline options taken from
 // http://autoconf-archive.cryp.to/vl_lib_readline.html 
 // Copyright © 2008 Ville Laurikari <vl@iki.fi> 
 // Copying and distribution of this file, with or without
 // modification, are permitted in any medium without royalty provided
 // the copyright notice and this notice are preserved.
 
 #ifdef HAVE_LIBREADLINE
 #  if defined(HAVE_READLINE_READLINE_H)
 #    include <readline/readline.h>
 #  elif defined(HAVE_READLINE_H)
 #    include <readline.h>
 #  else
 extern "C" char *readline (const char *);
 #  endif
 #endif
 
 #ifdef HAVE_READLINE_HISTORY
 #  if defined(HAVE_READLINE_HISTORY_H)
 #    include <readline/history.h>
 #  elif defined(HAVE_HISTORY_H)
 #    include <history.h>
 #  else
 extern "C" void add_history (const char *);
 #  endif
 #endif
 
 using namespace ThePEG;
 
 ParticleMap & Repository::defaultParticles() {
   static ParticleMap theMap;
   return theMap;
 }
 
 
 ParticleDataSet & Repository::particles() {
   static ParticleDataSet theSet;
   return theSet;
 }
 
 MatcherSet & Repository::matchers() {
   static MatcherSet theSet;
   return theSet;
 }
 
 Repository::GeneratorMap & Repository::generators() {
   static GeneratorMap theMap;;
   return theMap;
 }
 
 string & Repository::currentFileName() {
   static string theCurrentFileName;
   return theCurrentFileName;
 }
 
 int & Repository::exitOnError() {
   static int exitonerror = 0;
   return exitonerror;
 }
 
 void Repository::cleanup() {
   generators().clear();
 }
 
 void Repository::Register(IBPtr ip) {
   BaseRepository::Register(ip);
   registerParticle(dynamic_ptr_cast<PDPtr>(ip));
   registerMatcher(dynamic_ptr_cast<PMPtr>(ip));
 }
 
 void Repository::Register(IBPtr ip, string newName) {
   DirectoryAppend(newName);
   BaseRepository::Register(ip, newName);
   registerParticle(dynamic_ptr_cast<PDPtr>(ip));
   registerMatcher(dynamic_ptr_cast<PMPtr>(ip));
 }
 
 void Repository::registerParticle(tPDPtr pd) {
   if ( !pd ) return;
   if ( !member(particles(), pd) ) {
     particles().insert(pd);
     CreateDirectory(pd->fullName());
   }
   if ( pd->id() == 0 ) return;
   if ( !member(defaultParticles(), pd->id()) )
     defaultParticles()[pd->id()] = pd;
   for ( MatcherSet::iterator it = matchers().begin();
 	it != matchers().end(); ++it) (*it)->addPIfMatch(pd);
 }
 
 void Repository::registerMatcher(tPMPtr pm) {
   if ( !pm || member(matchers(), pm) ) return;
   pm->addPIfMatchFrom(particles());
   for ( MatcherSet::iterator it = matchers().begin();
 	it != matchers().end(); ++it) {
     (*it)->addMIfMatch(pm);
     pm->addMIfMatch(*it);
   }
   matchers().insert(pm);
 }
 
 tPDPtr Repository::findParticle(string name) {
   tPDPtr pd;
   string path = name;
   DirectoryAppend(path);
   pd = dynamic_ptr_cast<tPDPtr>(GetPointer(path));
   if ( pd ) return pd;
   for ( ParticleMap::iterator pit = defaultParticles().begin();
 	pit != defaultParticles().end(); ++pit )
     if ( pit->second->PDGName() == name ) return pit->second;
   for ( ParticleDataSet::iterator pit = particles().begin();
 	pit != particles().end(); ++pit )
     if ( (**pit).PDGName() == name ) return *pit;
   return pd;
 }
 
 tPMPtr Repository::findMatcher(string name) {
   for ( MatcherSet::iterator mit = matchers().begin();
 	mit != matchers().end(); ++mit )
     if ( name == (**mit).name() ) return *mit;
   return tPMPtr();
 }
 
 void Repository::saveRun(string EGname, string name, string filename) {
   EGPtr eg = BaseRepository::GetObject<EGPtr>(EGname);
   EGPtr run = makeRun(eg, name);
   PersistentOStream os(filename, globalLibraries());
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "Saving event generator '" << name << "'... " << flush;
   os << run;
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "done" << endl;
 }
 
 EGPtr Repository::makeRun(tEGPtr eg, string name) {
 
   // Clone all objects relevant for the EventGenerator. This is
   // the EventGenerator itself, all particles and all particle
   // matchers. 'localObject' is the set of all object refered to by
   // the generator particles and matcher and in the end these are
   // cloned as well.
 
   // Clone all Particle matchers
 
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "Making event generator '" << name << "':" << endl
 	   << "Updating all objects... " << flush;
 
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "done\nCloning matchers and particles... " << flush;
 
   MatcherSet localMatchers;
   ObjectSet localObjects;
   ObjectSet clonedObjects;
   TranslationMap trans;
 
   for ( MatcherSet::iterator mit = matchers().begin();
 	mit != matchers().end(); ++mit ) {
     PMPtr pm = clone(**mit);
     pm->clear();
     trans[*mit] = pm;
     localMatchers.insert(pm);
     clonedObjects.insert(pm);
     localObjects.insert(*mit);
     addReferences(*mit, localObjects);
   }
 
 
   // Clone the particles. But only the ones which should be
   // used. First select the localParticles of the EventGenerator, then
   // add particles from the strategy of the EventGenerator which have
   // not already been selected. Finally add particles from the global
   // default if no default directories has been specified in the
   // strategy which have not already been selected.
   PDVector allParticles;
 
   for ( ParticleMap::const_iterator pit = eg->localParticles().begin();
  	pit != eg->localParticles().end(); ++pit )
     allParticles.push_back(pit->second);
   if ( eg->strategy() ) {
     tcStrategyPtr strat = eg->strategy();
     for ( ParticleMap::const_iterator pit = strat->particles().begin();
  	  pit != strat->particles().end(); ++pit )
       allParticles.push_back(pit->second);
 
     vector<string> pdirs;
     if ( eg->strategy()->localParticlesDir().length() )
       pdirs.push_back(eg->strategy()->localParticlesDir());
     pdirs.insert(pdirs.end(), eg->strategy()->defaultParticlesDirs().begin(),
 		 eg->strategy()->defaultParticlesDirs().end());
 
     for ( int i = 0, N = pdirs.size(); i < N; ++i ) {
       string dir = pdirs[i];
       for ( ParticleDataSet::iterator pit = particles().begin();
 	    pit != particles().end(); ++pit )
 	if ( (**pit).fullName().substr(0, dir.length()) == dir )
 	  allParticles.push_back(*pit);
     }
   }
 
   if ( !eg->strategy() || eg->strategy()->defaultParticlesDirs().empty() )
     for ( ParticleMap::iterator pit = defaultParticles().begin();
 	  pit != defaultParticles().end(); ++pit )
       allParticles.push_back(pit->second);
 
   for ( ParticleDataSet::iterator pit = particles().begin();
 	pit != particles().end(); ++pit )
     allParticles.push_back(*pit);
 
   ParticleMap localParticles;
 
   for ( PDVector::iterator pit = allParticles.begin();
 	pit != allParticles.end(); ++pit ) {
     ParticleMap::iterator it = localParticles.find((**pit).id());
     if ( it == localParticles.end() ) {
       PDPtr pd = clone(**pit);
       trans[*pit] = pd;
       localParticles[pd->id()] = pd;
       clonedObjects.insert(pd);
       localObjects.insert(*pit);
       addReferences(*pit, localObjects);
     } else {
       trans[*pit] = it->second;
     }
   }
 
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "done\nCloning other objects... " << flush;
 
   // Clone the OldEventGenerator object to be used:
   localObjects.insert(eg);
   addReferences(eg, localObjects);
   EGPtr egrun = clone(*eg);
   clonedObjects.insert(egrun);
   trans[eg] = egrun;
 
   for ( ObjectSet::iterator it = localObjects.begin();
 	it != localObjects.end(); ++it ) {
     if ( member(trans.map(), *it) ) continue;
     IBPtr ip = clone(**it);
     trans[*it] = ip;
     clonedObjects.insert(ip);
   }
 
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "done\nRebind references... " << flush;
 
   IVector defaults;
 
   trans.translate(inserter(defaults), eg->defaultObjects().begin(),
 		  eg->defaultObjects().end());
   if ( eg->strategy() )
     trans.translate(inserter(defaults),
 		    eg->strategy()->defaultObjects().begin(),
 		    eg->strategy()->defaultObjects().end());
 
   for ( ObjectSet::iterator it = clonedObjects.begin();
 	it != clonedObjects.end(); ++it ) {
     dynamic_cast<Interfaced &>(**it).theGenerator = egrun;
     rebind(**it, trans, defaults);
   }
 
   // Now, dependencies may have changed, so we do a final round of
   // updates.
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "done\nUpdating cloned objects... " << flush;
 
 
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "done\nInitializing... " << flush;
 
   clonedObjects.erase(egrun);
   egrun->setup(name, clonedObjects, localParticles, localMatchers);
 
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "done" << endl;
 
   generators()[name] = egrun;
 
   return egrun;
 
 }
 
 PDPtr Repository::defaultParticle(PID id) {
   ParticleMap::iterator pit = defaultParticles().find(id);
   return pit == defaultParticles().end()? PDPtr(): pit->second;
 }
 
 void Repository::defaultParticle(tPDPtr pdp) {
   if ( pdp ) defaultParticles()[pdp->id()] = pdp;
 }
 
 struct ParticleOrdering {
   bool operator()(tcPDPtr p1, tcPDPtr p2) {
     return abs(p1->id()) > abs(p2->id()) ||
       ( abs(p1->id()) == abs(p2->id()) && p1->id() > p2->id() ) ||
       ( p1->id() == p2->id() && p1->fullName() > p2->fullName() );
   }
 };
 
 struct MatcherOrdering {
   bool operator()(tcPMPtr m1, tcPMPtr m2) {
     return m1->name() < m2->name() ||
       ( m1->name() == m2->name() && m1->fullName() < m2->fullName() );
   }
 };
 
 struct InterfaceOrdering {
   bool operator()(tcIBPtr i1, tcIBPtr i2) {
     return i1->fullName() < i2->fullName();
   }
 };
 
 void Repository::save(string filename) {
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "saving '" << filename << "'... " << flush;
   PersistentOStream os(filename, globalLibraries());
   set<tcPDPtr,ParticleOrdering>
     part(particles().begin(), particles().end());
   set<tcPMPtr,MatcherOrdering>  match(matchers().begin(), matchers().end());
 
   os << objects().size();
   for ( ObjectMap::iterator it = objects().begin();
 	it != objects().end(); ++it ) os << it->second;
   os << defaultParticles() << part << match << generators()
      << directories() << directoryStack() << globalLibraries() << readDirs();
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "(" << objects().size() << " objects in " << directories().size()
 	   << " directories) done" << endl;
 }
 
 string Repository::load(string filename) {
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "loading '" << filename << "'... " << flush;
   currentFileName() = filename;
   PersistentIStream * is = new PersistentIStream(filename);
   if ( !*is ) {
     delete is;
     // macro is passed in from -D compile flag
     string fullpath = string(THEPEG_PKGLIBDIR) + '/' + filename;
     is = new PersistentIStream(fullpath);
     if ( !*is ) {
       delete is;
       return "Error: Could not find repository '" + filename + "'.";
     }
   }
   *is >> allObjects() >> defaultParticles()
       >> particles() >> matchers() >> generators()
       >> directories() >> directoryStack() >> globalLibraries() >> readDirs();
   delete is;
   objects().clear();
   for ( ObjectSet::iterator it = allObjects().begin();
 	it != allObjects().end(); ++it )
     objects()[(**it).fullName()] = *it;
 
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "(" << objects().size() << " objects in " << directories().size()
 	   << " directories) done\nUpdating... " << flush;
   BaseRepository::resetAll(allObjects());
   BaseRepository::update();
 
   if ( ThePEG_DEBUG_ITEM(3) )
     clog() << "done" << endl;
   return "";
 }
 
 void Repository::stats(ostream & os) {
   os << "number of objects:        " << setw(6) << objects().size() << endl;
   os << "number of objects (all):  " << setw(6) << allObjects().size() << endl;
   os << "number of particles:        " << setw(6) << particles().size() << endl;
   os << "number of matchers:         " << setw(6) << matchers().size() << endl;
 }
 
 string Repository::read(string filename, ostream & os) {
   ifstream is;
   string file = filename;
   if ( file[0] == '/' ) {
     if ( ThePEG_DEBUG_LEVEL > 1 ) os << "(= trying to open " << file << " =)" << endl;
     is.open(file.c_str());
   }
   else {
     vector<string> dirs(readDirs().rbegin(), readDirs().rend());
     dirs.push_back(currentReadDirStack().top()); 
     if ( ThePEG_DEBUG_LEVEL > 1 ) {
       os << "(= search path order =)\n(== ";
       std::copy(dirs.rbegin(), dirs.rend(), std::ostream_iterator<string>(os, " ==)\n(== "));
       os << ")" << endl;
     }
     while ( dirs.size() ) {
       string dir = dirs.back();
       if ( dir != "" && dir[dir.length() -1] != '/' ) dir += '/';
       file = dir + filename;
       is.clear();
       if ( ThePEG_DEBUG_LEVEL > 1 ) os << "(= trying to open " << file << " =)" << endl;
       is.open(file.c_str());
       if ( is ) break;
       if ( ThePEG_DEBUG_LEVEL > 1 ) os << "(= no, try next search path =)" << endl;
       dirs.pop_back();
     }
   }
   if ( !is ) {
     return "Error: Could not find input file '" + filename + "'";
   }
   if ( ThePEG_DEBUG_LEVEL > 1 ) os << "(= yes =)" << endl;
   const string dir = StringUtils::dirname(file);
   if ( ThePEG_DEBUG_LEVEL > 1 ) os << "(= pushing <" << dir << "> to stack =)" << endl;
   currentReadDirStack().push(dir);
   try {
     Repository::read(is, os);
     if ( ThePEG_DEBUG_LEVEL > 1 ) os << "(= popping <" << currentReadDirStack().top() << "> from stack =)" << endl;
     currentReadDirStack().pop();
   }
   catch ( ... ) {
     if ( ThePEG_DEBUG_LEVEL > 1 ) os << "(= popping <" << currentReadDirStack().top() << "> from stack =)" << endl;
     currentReadDirStack().pop();
     throw;
   }
   return "";
 }
 
 string Repository::
 modifyEventGenerator(EventGenerator & eg, string filename, 
 		     ostream & os, bool initOnly) {
   ObjectSet objs = eg.objects();
   objs.insert(&eg);
   for ( ObjectSet::iterator it = objs.begin(); it != objs.end(); ++it ) {
     string name = (**it).fullName();
     if ( name.rfind('/') != string::npos )
       CreateDirectory(name.substr(0, name.rfind('/') + 1));
     objects()[name] = *it;
     allObjects().insert(*it);
   }
   
   string msg = read(filename, os);
 
   if ( !msg.empty() )
     return msg;
  
   for_each(objs, mem_fun(&InterfacedBase::reset)); 
   eg.initialize(initOnly);
 
   if ( !generators().empty() )
     msg += "Warning: new generators were initialized while modifying "
       + eg.fullName() + ".\n";
 
   return msg;
 }
 
 void Repository::resetEventGenerator(EventGenerator & eg) {
 
   ObjectSet objs = eg.objects();
   objs.insert(&eg);
   for ( ObjectSet::iterator it = objs.begin(); it != objs.end(); ++it ) {
     string name = (**it).fullName();
     if ( name.rfind('/') != string::npos )
       CreateDirectory(name.substr(0, name.rfind('/') + 1));
     objects()[name] = *it;
     allObjects().insert(*it);
   }
   
   for_each(objs, mem_fun(&InterfacedBase::reset)); 
   eg.initialize(true);
 
 }
 
 void Repository::execAndCheckReply(string line, ostream & os) {
   string reply = exec(line, os);
   if ( reply.size() ) 
     os << reply;
   if ( reply.size() && reply[reply.size()-1] != '\n' ) 
     os << endl;
   if ( exitOnError() && reply.size() >= 7 
        && reply.substr(0, 7) == "Error: " )
     exit(exitOnError());
 }
 
 void Repository::read(istream & is, ostream & os, string prompt) {
 #ifdef HAVE_LIBREADLINE
   if ( &is == &std::cin ) {
     char * line_read = 0;
     do {
       if ( line_read ) {
 	free(line_read);
 	line_read = 0;
       }
       
       line_read = readline(prompt.c_str());
       
       if ( line_read && *line_read ) {
 	string line = line_read;
 	while ( !line.empty() && line[line.size() - 1] == '\\' ) {
 	  line[line.size() - 1] = ' ';
 	  char * cont_read = readline("... ");
 	  if ( cont_read ) {
 	    line += cont_read;
 	    free(cont_read);
 	  }
 	}
 	if ( prompt.empty() && ThePEG_DEBUG_LEVEL > 0 )
 	  os << "(" << line << ")" << endl;
 #ifdef HAVE_READLINE_HISTORY
 	add_history(line.c_str());
 #endif // HAVE_READLINE_HISTORY
 	execAndCheckReply(line, os);
       }
     }
     while ( line_read );
   }
   else {
 #endif // HAVE_LIBREADLINE
     string line;
     if ( prompt.size() ) os << prompt;
     while ( getline(is, line) ) {
       while ( !line.empty() && line[line.size() - 1] == '\\' ) {
 	line[line.size() - 1] = ' ';
 	string cont;
 	if ( prompt.size() ) os << "... ";
 	getline(is, cont);
 	line += cont;
       }
       if ( prompt.empty() && ThePEG_DEBUG_LEVEL > 0 )
 	os << "(" << line << ")" << endl;
       execAndCheckReply(line, os);
       if ( prompt.size() ) os << prompt;
     }
 #ifdef HAVE_LIBREADLINE
   }
 #endif
   if ( prompt.size() ) os << endl;
 }
 
 
 string Repository::copyParticle(tPDPtr p, string newname) {
   DirectoryAppend(newname);
   
   string newdir = newname.substr(0, newname.rfind('/')+1);
   newname =newname.substr(newname.rfind('/')+1);
   if ( newname.empty() ) newname = p->name();
   if ( GetPointer(newdir + newname) )
     return "Error: Cannot create particle " + newdir + newname +
       ". Object already exists.";
   if ( p->CC() && GetPointer(newdir + p->CC()->name()) )
     return "Error: Cannot create anti-particle " + newdir + newname +
       ". Object already exists.";
   PDPtr pd = p->pdclone();
   Register(pd, newdir + newname);
   pd->theDecaySelector.clear();
   pd->theDecayModes.clear();
   pd->isStable = true;
   if ( p->CC() ) {
     PDPtr apd = p->CC()->pdclone();
     Register(apd, newdir + apd->name());
     apd->theDecaySelector.clear();
     apd->theDecayModes.clear();
     apd->isStable = true;
     pd->theAntiPartner = apd;
     apd->theAntiPartner = pd;
     pd->syncAnti = p->syncAnti;
     apd->syncAnti = p->CC()->syncAnti;
   }
   HoldFlag<> dosync(pd->syncAnti, true);
   for ( DecaySet::const_iterator it = p->theDecayModes.begin();
 	it != p->theDecayModes.end(); ++it )
     pd->addDecayMode(*it);
   return "";
 }
 
 void Repository::remove(tIBPtr ip) {
   ObjectMap::iterator it = objects().find(ip->fullName());
   if ( it == objects().end() || ip != it->second ) return;
   objects().erase(it);
   allObjects().erase(ip);
   if ( dynamic_ptr_cast<tPDPtr>(ip) ) {
     particles().erase(dynamic_ptr_cast<tPDPtr>(ip));
     defaultParticles().erase(dynamic_ptr_cast<tPDPtr>(ip)->id());
   }
   if ( dynamic_ptr_cast<tPMPtr>(ip) )
     matchers().erase(dynamic_ptr_cast<tPMPtr>(ip));
 }
 
 string Repository::remove(const ObjectSet & rmset) {
   ObjectSet refset;
   for ( ObjectMap::const_iterator i = objects().begin();
 	i != objects().end(); ++i ) {
     if ( member(rmset, i->second) ) continue;
     IVector ov = DirectReferences(i->second);
     for ( int j = 0, M = ov.size(); j < M; ++j )
       if ( member(rmset, ov[j]) ) {
 	refset.insert(i->second);
 	break;
       }
   }
   if ( refset.empty() ) {
     for ( ObjectSet::iterator oi = rmset.begin(); oi != rmset.end(); ++oi )
       remove(*oi);
     return "";
   }
   string ret = "Error: cannot remove the objects because the following "
     "objects refers to some of them:\n";
   for ( ObjectSet::iterator oi = refset.begin(); oi != refset.end(); ++oi )
     ret += (**oi).fullName() + "\n";
   return ret;
 }
    
 string Repository::exec(string command, ostream & os) {
   string cpcmd = command;
   try {
     string verb = StringUtils::car(command);
     command = StringUtils::cdr(command);
     if ( verb == "help" ) {
       help(command, os);
       return "";
     }
     if ( verb == "rm" ) {
       ObjectSet rmset;
       while ( !command.empty() ) {
 	string name = StringUtils::car(command);
 	DirectoryAppend(name);
 	IBPtr obj = GetPointer(name);
 	if ( !obj ) return "Error: Could not find object named " + name;
 	rmset.insert(obj);
 	command = StringUtils::cdr(command);
       }
       return remove(rmset);
     }
     if ( verb == "rmdir" || verb == "rrmdir" ) {
       string dir = StringUtils::car(command);
       DirectoryAppend(dir);
       if ( dir[dir.size() - 1] != '/' ) dir += '/';
       if ( !member(directories(), dir) )
 	return verb == "rmdir"? "Error: No such directory.": "";
       IVector ov = SearchDirectory(dir);
       if ( ov.size() && verb == "rmdir" )
 	return "Error: Cannot remove a non-empty directory. "
 	  "(Use rrmdir do remove all object and subdirectories.)";
       ObjectSet rmset(ov.begin(), ov.end());
       string ret = remove(rmset);
       if ( !ret.empty() ) return ret;
       StringVector dirs(directories().begin(), directories().end());
       for ( int i = 0, N = dirs.size(); i < N; ++ i )
 	if ( dirs[i].substr(0, dir.size()) == dir )
 	  directories().erase(dirs[i]);
       for ( int i = 0, N = directoryStack().size(); i < N; ++i )
 	if ( directoryStack()[i].substr(0, dir.size()) == dir )
 	  directoryStack()[i] = '/';
       return "";
     }
     if ( verb == "cp" ) {
       string name = StringUtils::car(command);
       DirectoryAppend(name);
       tPDPtr p = dynamic_ptr_cast<tPDPtr>(GetPointer(name));
       if ( p ) return copyParticle(p, StringUtils::cdr(command));
       return BaseRepository::exec(cpcmd, os);
     }
     if ( verb == "setup" ) {
       string name = StringUtils::car(command);
       DirectoryAppend(name);
       IBPtr obj = GetPointer(name);
       if ( !obj ) return "Error: Could not find object named " + name;
       istringstream is(StringUtils::cdr(command));
       readSetup(obj, is);
       // A particle may have been registered before but under the wrong id().
       PDPtr pd = dynamic_ptr_cast<PDPtr>(obj);
       if(pd) {
 	registerParticle(pd);
 	checkDuplicatePDGName(pd);
       }
       return "";
     }
     if ( verb == "decaymode" ) {
       string tag = StringUtils::car(command);
       DMPtr dm = DecayMode::constructDecayMode(tag);
       if ( !dm ) return "Error: Could not create decay mode from the tag " +
 		   StringUtils::car(command);
       istringstream is(StringUtils::cdr(command));
       readSetup(dm, is);
       if ( !dm->CC() ) return "";
 
       if ( dm->CC()->parent()->synchronized() ) {
 	dm->CC()->synchronize();
 	return "";
       }
 
       if ( !dm->CC()->decayer() )
 	return FindInterface(dm, "Decayer")->
 	  exec(*dm->CC(), "set", dm->decayer()->fullName());
       return "";
     }
     if ( verb == "makeanti" ) {
       string name = StringUtils::car(command);
       DirectoryAppend(name);
       tPDPtr p = dynamic_ptr_cast<tPDPtr>(GetPointer(name));
       if ( !p ) return "Error: No particle named " + name;
       name = StringUtils::car(StringUtils::cdr(command));
       DirectoryAppend(name);
       tPDPtr ap = dynamic_ptr_cast<tPDPtr>(GetPointer(name));
       if ( !ap ) return "Error: No particle named " + name;
       ParticleData::antiSetup(PDPair(p, ap));
       return "";
     }
     if ( verb == "read" ) {
+      // remember directory we're in
+      string cwd = directoryStack().back();
       string filename = StringUtils::car(command);
-      return read(filename, os);
+      string msg = read(filename, os);
+      // Return to the original directory, so that
+      // calling 'read' in an input file will not change the 
+      // repository directory you're in
+      ChangeDirectory(cwd);
+      return msg;
     }
     if ( verb == "load" ) {
       return load(StringUtils::car(command));
     }      
     if ( verb == "save" ) {
       save(StringUtils::car(command));
       return "";
     }
     if ( verb == "lsruns" ) {
       string ret;
       for ( GeneratorMap::iterator ieg = generators().begin();
 	    ieg != generators().end(); ++ieg ) ret += ieg->first + "\n";
       return ret;
     }
     if ( verb == "makerun" ) {
       string runname = StringUtils::car(command);
       string generator = StringUtils::car(StringUtils::cdr(command));
       DirectoryAppend(generator);
       EGPtr eg = BaseRepository::GetObject<EGPtr>(generator);
       makeRun(eg, runname);
       return "";
     }
     if ( verb == "rmrun" ) {
       string runname = StringUtils::car(command);
       generators().erase(runname);
       return "";
     }
     if ( verb == "saverun" || verb == "saverunfile" || verb == "run" ) {
       string runname = StringUtils::car(command);
       string generator = StringUtils::car(StringUtils::cdr(command));
       DirectoryAppend(generator);
       GeneratorMap::iterator ieg = generators().find(runname);
       EGPtr eg;
       if ( ieg == generators().end() ) {
 	eg = BaseRepository::GetObject<EGPtr>(generator);
 	eg = makeRun(eg, runname);
       } else
 	eg = ieg->second;
       if ( !eg )
 	return "Error: Could not create/find run named'" + runname + "'.";
       if ( verb == "run" ) 
 	eg->go();
       else if ( verb == "saverunfile" ) {
 	string file = generator;
 	PersistentOStream os(file, globalLibraries());
 	os << eg;
 	if ( !os ) return "Save failed! (I/O error)";
       } else {
 	string file = eg->filename() + ".run";
 	PersistentOStream os(file, globalLibraries());
 	os << eg;
 	if ( !os ) return "Save failed! (I/O error)";
       }
       return "";
     }
     if ( verb == "removerun" ) {
       string runname = StringUtils::car(command);
       GeneratorMap::iterator ieg = generators().find(runname);
       if ( ieg != generators().end() ) {
 	generators().erase(ieg);
 	return "";
       } else
 	return "Error: No run named '" + runname + "' available.";
     }
     if ( verb == "create" ) {
       string className = StringUtils::car(command);
       command = StringUtils::cdr(command);
       string name = StringUtils::car(command);
       const ClassDescriptionBase * db = DescriptionList::find(className);
       command = StringUtils::cdr(command);
       while ( !db && command.length() ) {
 	string library = StringUtils::car(command);
 	command = StringUtils::cdr(command);
 	DynamicLoader::load(library);
 	db = DescriptionList::find(className);
       }
       if ( !db ) {
 	string msg = "Error: " + className + ": No such class found.";
 	if ( !DynamicLoader::lastErrorMessage.empty() )
 	  msg += "\nerror message from dynamic loader:\n" +
 	    DynamicLoader::lastErrorMessage;
 	return msg;
       }
       IBPtr obj = dynamic_ptr_cast<IBPtr>(db->create());
       if ( !obj ) return "Error: Could not create object of this class class.";
       if ( name.empty() ) return "Error: No name specified.";
       Register(obj, name);
       return "";
     }
     if ( verb == "defaultparticle" ) {
       while ( !command.empty() ) {
 	string name = StringUtils::car(command);
 	DirectoryAppend(name);
 	tPDPtr p = dynamic_ptr_cast<tPDPtr>(GetPointer(name));
 	if ( !p ) return "Error: No particle named " + name;
 	defaultParticle(p);
 	command = StringUtils::cdr(command);
       }
       return "";
     }
     if ( verb == "EXITONERROR" ) {
       exitOnError() = 1;
       return "";
     }
   }
   catch (const Exception & e) {
     e.handle();
     return "Error: " + e.message();
   }
 
   return BaseRepository::exec(cpcmd, os);
 }
 
 void Repository::help(string cmd, ostream & os) {
  
   cmd = StringUtils::car(cmd);
 
   if ( cmd == "cd" )
     os << "Usage: cd <directory>" << endl
        << "Set the current directory to <directory>." << endl;
   else if ( cmd == "mkdir" )
     os << "Usage: mkdir <path-name>" << endl
        << "Create a new directory called with the given path name." << endl;
   else if ( cmd == "rmdir" )
     os << "Usage: rmdir <directory>" << endl
        << "Remove an empty directory." << endl;
   else if ( cmd == "rrmdir" )
     os << "Usage: rrmdir <directory>" << endl
        << "Remove a directory and everything that is in it recursively." << endl
        << "Will only succeed if no other objects refers to the ones to "
        << "be deleted." << endl;
   else if ( cmd == "cp" )
     os << "Usage: cp <object> <path-name>" << endl
        << "Copy the given object to a new object with the given name." << endl;
   else if ( cmd == "setup" )
     os << "Usage: setup <object> <arguments> ..." << endl
        << "Tell a given object to read information given by the arguments."
        << endl;
   else if ( cmd == "decaymode" )
     os << "Usage: decaymode <tag> <branching fraction> <on|off> <decayer-object>"
        << endl
        << "Construct a decay mode from the given decay tag. The resulting "
        << "object will be inserted in the directory with the same path as "
        << "the decaying particle object. The given brancing fraction will "
        << "be set as well as the given decayer object. If the mode should "
        << "be switched on by default 1(on) should be specified (otherwise "
        << "0(off))." << endl;
   else if ( cmd == "makeanti" )
     os << "Usage: makeanti <particle-object> <particle-object>" << endl
        << "Indicate that the two given particle objects are eachothers "
        << "anti-partnets." << endl;
   else if ( cmd == "read" )
     os << "Usage: read <file-name>" << endl
        << "Read more commands from the given file. The file name can be "
        << "given relative to the current directory in the shell, or "
        << "relative to standard directories, or as an absolute path." << endl;
   else if ( cmd == "load" )
     os << "Usage: load <repository-file-name>" << endl
        << "Discard everything in the reopsitory and read in a completely "
        << "new repository from the given file." << endl;
   else if ( cmd == "save" )
     os << "Usage: save <file-name>" << endl
        << "Save the complete repository to the given file." << endl;
   else if ( cmd == "lsruns" )
     os << "Usage: lsruns" << endl
        << "List the run names of all initialized event generators." << endl;
   else if ( cmd == "makerun" )
     os << "Usage: makerun <run-name> <event-generator-object>" << endl
        << "Initialize the given event generator and assign a run name." << endl;
   else if ( cmd == "rmrun" )
     os << "Usage: rmrun <run-name>" << endl
        << "Remove the initialized event generator given by the run name."
        << endl;
   else if ( cmd == "saverun" )
     os << "Usage: saverun <run-name> <event-generator-object>" << endl
        << "Initialize the given event generator and assign a run name "
        << "and save it to a file named <run-name>.run" << endl;
   else if ( cmd == "run" )
     os << "Usage: run <run-name>" << endl
        << "Run the initialized event generator given b the run name." << endl;
   else if ( cmd == "create" )
     os << "Usage: create <class-name> <name> {<dynamic-library>}" << endl
        << "Create an object of the given class and assign the given name. "
        << "Optionally supply a dynamically loaded library where the class "
        << "is included." << endl;
   else if ( cmd == "pushd" )
     os << "Usage: pushd <directory>" << endl
        << "Set the current directory to <directory>, but keep the previous "
        << "working directory on the directory stack." << endl;
   else if ( cmd == "popd" )
     os << "Usage: popd" << endl
        << "Leave the current working directory and set the current "
        << "directory to the previous one on the directory stack." << endl;
   else if ( cmd == "pwd" )
     os << "Usage: pwd" << endl
        << "Print the current working directory." << endl;
   else if ( cmd == "dirs" )
     os << "Usage: dirs" << endl
        << " Print the contents of the directory stack." << endl;
   else if ( cmd == "mv" )
     os << "Usage: mv  <object> <path-name>" << endl
        << "Rename the given object to a new path name." << endl;
   else if ( cmd == "ls" )
     os << "Usage: ls {<directory>}" << endl
        << "List the objects and subdirectories in the current or given "
        << "directory." << endl;
   else if ( cmd == "library" )
     os << "Usage: library <dynamic-library>" << endl
        << "Make new classes available to the repository by dynamically "
        << "linking the given library." << endl;
   else if ( cmd == "globallibrary" )
     os << "Usage: globallibrary <dynamic-library>" << endl
        << "Make new classes available to the repository by dynamically "
        << "linking the given library. If this repository is saved and read "
        << "in again, this library will be linked in from the beginning." << endl;
   else if ( cmd == "rmgloballibrary" )
     os << "Usage: rmgloballibrary <dynamic-library>" << endl
        << "Remove a dynamic library previously added with globallibrary."
        << endl;
   else if ( cmd == "appendpath" )
     os << "Usage: appendpath <unix-directory>" << endl
        << "Add a search path for dynamic libraries to the end of the "
        << "search list." << endl;
   else if ( cmd == "lspaths" )
     os << "Usage: lspaths" << endl
        << "List search paths for dynamic libraries." << endl;
   else if ( cmd == "prependpath" )
     os << "Usage: prependpath <unix-directory>" << endl
        << "Add a search path for dynamic libraries to the beginning of the "
        << "search list." << endl;
   else if ( cmd == "doxygendump" )
     os << "Usage: doxygendump <namespace> <filename>" << endl
        << "Extract doxygen documentation of all loaded classes in the "
        << "given name space and weite it to a file.." << endl;
   else if ( cmd == "mset" || cmd == "minsert" || cmd == "mdo" )
     os << "Usage: " << cmd << " <directory> <class> <interface> <value>" << endl
        << "Recursively find in the given directory all objects of the "
        << "given class and call '" << cmd.substr(1)
        << "' with the given value for the given interface." << endl;
   else if ( cmd == "msetdef" || cmd == "mget" || cmd == "mdef" ||
 	    cmd == "mmin" || cmd == "mmax" || cmd == "merase" )
     os << "Usage: " << cmd << " <directory> <class> <interface>" << endl
        << "Recursively find in the given directory all objects of the given "
        << "class and call '" << cmd.substr(1)
        << "' for the given interface." << endl;
   else if ( cmd == "set" )
     os << "Usage: set <object>:<interface> <value>" << endl
        << "Set the interface for the given object to the given value." << endl;
   else if ( cmd == "setdef" )
     os << "Usage: setdef <object>:<interface>" << endl
        << "Set the interface for the given object to its default value." << endl;
   else if ( cmd == "insert" )
     os << "Usage: insert <object>:<interface> <value>" << endl
        << "Insert a value in the vector interface of the given object." << endl;
   else if ( cmd == "erase" )
     os << "Usage: erase <object>:<interface>" << endl
        << "Erase a value from the vector interface of the given object." << endl;
   else if ( cmd == "do" )
     os << "Usage: do <object>:<command-interface> <arguments>" << endl
        << "Call the command interface of the given object with the "
        << "given arguments." << endl;
   else if ( cmd == "get" )
     os << "Usage: get <object>:<interface>" << endl
        << "Print the value of the interface of the given object." << endl;
   else if ( cmd == "def" )
     os << "Usage: def <object>:<interface>" << endl
        << "Print the default value of the interface of the given object."
        << endl;
   else if ( cmd == "min" )
     os << "Usage: min <object>:<interface>" << endl
        << "Print the minimum value of the interface of the given object."
        << endl;
   else if ( cmd == "max" )
     os << "Usage: max <object>:<interface>" << endl
        << "Print the maximum value of the interface of the given object."
        << endl;
   else if ( cmd == "describe" )
     os << "Usage: describe <object>{:<interface>}" << endl
        << "Describe the given object or an interface of the object." << endl;
   else if ( cmd == "lsclass" )
     os << "Usage: lsclass" << endl
        << "List all classes available in the repository." << endl;
   else if ( cmd == "all" ) {
     os << "Available commands:"
        << endl
        << "* cd, mkdir, rmdir, rrmdir, pwd, cp, mv, rm, pushd, popd, dirs, ls:\n"
        << "  Manipulate the repository structure. Analogous to unix "
        << "shell commands."
        << endl
        << "* create, setup, decaymode makeanti:\n"
        << "  Create or setup an object."
        << endl
        << "* set, get, insert, erase, do, detdef, def, min, max, describe\n"
        << "  mset, minsert, mdo, msetdef, mdef, mmin, mmax, merase:\n"
        << "  Manipulate interfaces to objects."
        << endl
        << "* makerun, saverun, run, lsruns, rmrun:\n"
        << "  Create and handle initialized event genrators which can be run."
        << endl
        << "* read, load, library globallibrary, rmgloballibrary,\n"
        << "  appendpath, prependpath, lspaths, doxygendump:\n"
        << "  Handle files external files and libraries."
        << endl;
     os << "Do 'help syntax' for help on syntax." << endl
        << "Do 'help <command>' for help on a particular command." << endl;
   }
   else if ( cmd == "syntax" )
     os << "* <directory> = '/' | <name> | <directory>/<name>" << endl
        << "  <object> = <name> | <directory>/<name> | <object>:<ref-interface>\n"
        << "  Analogous to a unix file structure, an object can be "
        << "specified with an\n  absolute path or a path relative to "
        << "the current directory." << endl
        << "* <interface> = <interface-name>|<interface-name>[<index>]" << endl
        << "  An interface can be a parameter (floating point, integer or "
        << "string),\n  a switch (integer, possibly named), a reference to "
        << "another object in the\n  repository or a command which takes "
        << "an arbitrary string as argument.\n  There are also vector interfaces "
        << "of parameters and references for which\n  an index must be supplied."
        << endl;
   else {
     if ( !cmd.empty() ) os << "No command '" << cmd << "' found." << endl;
     os << "Common commands:" << endl
        << "* cd, mkdir, rmdir, pwd, cp, mv, rm:\n"
        << "  Manipulate the repository structure. Analogous to unix "
        << "shell commands." << endl
        << "* create, setup:\n"
        << " Create an object." << endl
        << "set, get, insert, erase, do:\n"
        << " Manipulate interfaces to objects." << endl
        << "* makerun, saverun, run, lsruns:\n"
        << " Create and handle initialized event genrators which can be run."
        << endl;
     os << "Do 'help all' for a complete list of commands." << endl
        << "Do 'help syntax' for help on syntax." << endl
        << "Do 'help <command>' for help on a particular command." << endl;
   }
 
 }
 
 Repository::Repository() {
   ++ninstances;
 }
 
 Repository::~Repository() {
   --ninstances;
   if ( ninstances <= 0 ) {
     generators().clear();
   }
 }
 
 void Repository::checkDuplicatePDGName(PDPtr pd) {
   string name = pd->PDGName();
   for ( ParticleMap::iterator pit = defaultParticles().begin();
 	pit != defaultParticles().end(); ++pit ) {
     if( pit->second == pd) continue;
     if ( pit->second->PDGName() == name ) {
       std::cerr << "Using duplicate PDGName " << pd->PDGName()
 		<< " for a new particle.\n This can cause problems and is not "
 		<< "recommended.\n If this second particle is a new particle "
 		<< "in a BSM Model we recommend you change the name of the particle.\n";
     }
   }
   for ( ParticleDataSet::iterator pit = particles().begin();
 	pit != particles().end(); ++pit ) {
     if( *pit == pd) continue;
     if ( (**pit).PDGName() == name ) {
       std::cerr << "Using duplicate PDGName " << pd->PDGName()
 		<< " for a new particle.\n This can cause problems and is not "
 		<< "recommended.\n If this second particle is a new particle "
 		<< "in a BSM Model we recommend you change the name of the particle.\n";
     }
   }
 }
 
 int Repository::ninstances = 0;
 
 namespace {
 static string version_ =
 #include "versionstamp.inc"
 "";
 }
 
 string Repository::version() {
   return ::version_;
 }
 
 string Repository::banner() {
   const auto now    = std::chrono::system_clock::now();
   const auto now_c  = std::chrono::system_clock::to_time_t(now);
   string time = ">>>> " ;
   time += StringUtils::stripws(string(std::ctime(&now_c))) + ' ';
   time += string(max(0,74 - int(time.size())), ' ');
   time += "<<<<";
 
   string line = ">>>> Toolkit for HEP Event Generation - "
     + Repository::version() + ' ';
   line += string(max(0,78 - int(line.size())), '<');
 
   string block = string(78, '>') + '\n' 
                  + line + '\n' 
                  + time + '\n'
                  + string(78, '<') + '\n';
   return block;
 }
 
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1,174 +1,174 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.59])
-AC_INIT([ThePEG],[2.1.0],[http://www.thep.lu.se/ThePEG/],[ThePEG])
+AC_INIT([ThePEG],[devel],[http://www.thep.lu.se/ThePEG/],[ThePEG])
 AC_CONFIG_AUX_DIR([Config])
 AC_CONFIG_MACRO_DIR([m4])
 
 THEPEG_LIBTOOL_VERSION_INFO(25,0,0)
 
 AC_CONFIG_SRCDIR([EventRecord/SubProcess.h])
 AC_CONFIG_HEADERS([Config/config.h])
 
 AC_CANONICAL_HOST
 
 case "${host}" in
   *-darwin[[0156]].*)
     AC_MSG_ERROR([ThePEG requires OS X 10.3 or later])
     ;;
   *-darwin7.*)
     if test "x$MACOSX_DEPLOYMENT_TARGET" != "x10.3"; then
        AC_MSG_ERROR(
        [Please export the MACOSX_DEPLOYMENT_TARGET variable, set to 10.3])
     fi
     ;;
 esac
 
 AC_LANG(C++)
 AM_INIT_AUTOMAKE([1.9 gnu dist-bzip2 subdir-objects -Wall])
 dnl also include std-options once --version and --help exist
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 
 dnl Checks for C++ compiler. Handle C++11 flags.
 AC_PROG_CXX
 AX_CXX_COMPILE_STDCXX([11],[noext],[mandatory])
 
 dnl check for unistd
 AC_CHECK_HEADER([unistd.h],[],
       [AC_MSG_ERROR([ThePEG needs "unistd.h". Check your system is POSIX-compliant.])])
 
 dnl Checks for programs.
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 AC_PROG_LN_S
 
 LT_PREREQ([2.2])
 LT_INIT([disable-static dlopen pic-only])
 
 VL_LIB_READLINE
 
 THEPEG_CHECK_GSL
 THEPEG_SEARCH_LHAPDF
 THEPEG_CHECK_HEPMC
 THEPEG_CHECK_RIVET
 FASTJET_CHECK_FASTJET
 
 AX_CHECK_ZLIB
 
 dnl AX_CHECK_BZ2LIB
 
 THEPEG_DEFINE_ENVDEFAULT(ThePEG_GZREAD_FILE,GZREAD_FILE,gunzip -c,[The command which, taking the name of a gzipped file as argument, unzips it and prints it to stdout. Default is "gunzip -c"])
 
 THEPEG_DEFINE_ENVDEFAULT(ThePEG_GZWRITE_FILE,GZWRITE_FILE,[gzip -c > ],[The command which, taking the name of a gzipped file as argument, reads stdin, zips it and writes it to the file. Default is "gzip -c > ".])
 
 THEPEG_DEFINE_ENVDEFAULT(ThePEG_BZ2READ_FILE,BZ2READ_FILE,bunzip2 -c,[The command which, taking the name of a bzipped file as argument, unzips it and prints it to stdout. Default is "bunzip2 -c".])
 
 THEPEG_DEFINE_ENVDEFAULT(ThePEG_BZ2WRITE_FILE,BZ2WRITE_FILE,[bzip2 -c > ],[The command which, taking the name of a bzipped file as argument, reads stdin, zips it and writes it to the file. Default is "bzip2 -c > ".])
 
 THEPEG_CHECK_EXPM1
 THEPEG_CHECK_LOG1P
 THEPEG_CHECK_DLOPEN
 
 AX_COMPILER_VENDOR
 case "${ax_cv_cxx_compiler_vendor}" in
     clang)
         case "${host}" in
             *linux*)
                 AC_MSG_WARN([
 *****************************************************************************
  clang/LLVM ignores the CPU floating-point environment.
  All floating point exception trapping will be disabled.
 *****************************************************************************])
                 ;;
         esac
 esac
 THEPEG_CHECK_FPUCONTROL
 THEPEG_CHECK_FENV
 
 AM_CPPFLAGS="-I\$(top_builddir)/include \$(GSLINCLUDE)"
 
 case "${ax_cv_cxx_compiler_vendor}" in
      gnu)
     AM_CXXFLAGS="-pedantic -Wall -W"
     ;;
      clang)
     AM_CXXFLAGS="-pedantic -Wall -Wno-overloaded-virtual -Wno-unused-function"
 dnl  -Wno-unneeded-internal-declaration
     ;;
      intel)
     AM_CXXFLAGS="-strict-ansi -Wall -wd13000,1418,981,444,383,1599,1572,2259,980"
     ;;
 esac
 
 AC_SUBST(AM_CPPFLAGS)
 AC_SUBST(AM_CXXFLAGS)
 
 dnl do an actual capability check on ld instead of this workaround
 case "${host}" in
   *-darwin*)
      ;;
   *)
      AM_LDFLAGS="-Wl,--enable-new-dtags"
      ;;
 esac
 
 AC_SUBST(AM_LDFLAGS)
 
 THEPEG_EMPTY_SUBST
 
 AC_PATH_PROG(PERL, perl)
 
 AC_ARG_WITH(javagui,
             [  --with-javagui          Compile and install the java-based GUI.])
 
 if test "x$with_javagui" != "xno"; then
   THEPEG_HAS_JAVA([1.4], [], [with_javagui=no; AC_MSG_NOTICE([Java GUI disabled])])
 fi
 
 AM_CONDITIONAL([JAVAGUI], [test "x$with_javagui" != "xno"])
 
 AC_CONFIG_FILES([Helicity/Makefile
 Helicity/WaveFunction/Makefile
 Helicity/Vertex/Makefile
 Helicity/Vertex/Scalar/Makefile
 Helicity/Vertex/Vector/Makefile
 Helicity/Vertex/Tensor/Makefile
 Utilities/Makefile
 include/Makefile
 Interface/Makefile
 LesHouches/Makefile
 Vectors/Makefile
 PDT/Makefile
 PDF/Makefile
 Persistency/Makefile
 Config/Makefile
 Handlers/Makefile
 MatrixElement/Makefile
 Pointer/Makefile
 lib/Makefile
 lib/Makefile.common.install
 src/Makefile
 ACDC/Makefile
 Repository/Makefile
 EventRecord/Makefile
 StandardModel/Makefile
 Cuts/Makefile
 Analysis/Makefile
 Doc/Makefile
 Doc/MakeDocs.in
 Doc/refman.h
 Doc/refman.conf
 java/Makefile
 Makefile])
 AC_CONFIG_FILES([Doc/fixinterfaces.pl],[chmod +x Doc/fixinterfaces.pl])
 
 BOOST_REQUIRE([1.41],[AC_SUBST([BOOST_NOT_FOUND],[true])])
 BOOST_TEST()
 THEPEG_BOOST_UNIT_TEST
 
 THEPEG_OVERVIEW
 
 AC_CONFIG_COMMANDS([summary],[cat config.thepeg])
 
 AC_OUTPUT
diff --git a/lib/Makefile.am b/lib/Makefile.am
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,72 +1,72 @@
 ## workaround for OS X, automake doesn't realize it's meant to use c++
 LINK = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(AM_CXXFLAGS) \
 	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
 
 LINKDIRS = Config Utilities Helicity Interface LesHouches Vectors \
            PDT PDF Persistency Handlers MatrixElement Pointer ACDC \
            StandardModel Repository EventRecord Cuts Analysis
 
 EXTRA_DIST = Makefile.dist.install
 
 dist_pkgdata_DATA = ThePEG.el
 
 pkglib_LTLIBRARIES = libThePEG.la
 
 CLEANFILES = Makefile.dist Makefile.common
 
 # Version info should be updated if any interface or persistent I/O
 # function is changed
-libThePEG_la_LDFLAGS = $(AM_LDFLAGS) $(LIBTOOLVERSIONINFO) -export-dynamic
+libThePEG_la_LDFLAGS = $(AM_LDFLAGS) -version-info 26:0:1 -export-dynamic
 libThePEG_la_SOURCES =
 libThePEG_la_LIBADD = \
 	$(top_builddir)/Utilities/libThePEGUtilities.la \
 	$(top_builddir)/Vectors/libThePEGVectors.la \
 	$(top_builddir)/Persistency/libThePEGPersistency.la \
 	$(top_builddir)/Pointer/libThePEGReferenceCounted.la \
 	$(top_builddir)/Config/libThePEGConfig.la \
 	$(top_builddir)/PDF/libThePEGPDF.la \
 	$(top_builddir)/MatrixElement/libThePEGME.la \
 	$(top_builddir)/Repository/libThePEGRepo.la \
 	$(top_builddir)/Handlers/libThePEGHandlers.la \
 	$(top_builddir)/EventRecord/libThePEGEvent.la \
 	$(top_builddir)/PDT/libThePEGPDT.la \
 	$(top_builddir)/StandardModel/libThePEGSM.la \
 	$(top_builddir)/Interface/libThePEGInter.la \
 	$(top_builddir)/Helicity/libThePEGHelicity.la \
 	$(top_builddir)/Cuts/libThePEGCuts.la \
 	$(top_builddir)/Analysis/libThePEGHist.la \
 	-ldl $(LIBS) \
 	$(GSLLIBS)
 
 all-local: .done-all-links
 
 .done-all-links: libThePEG.la
 @EMPTY@ifdef SHOWCOMMAND
 	for dir in $(LINKDIRS); do \
 	  for sofile in ../$$dir/.libs/*.so* ../$$dir/.libs/*.la; \
             do if test -f $$sofile; then $(LN_S) -f $$sofile .; fi; done; done
 	for sofile in .libs/*.so*; \
             do if test -f $$sofile; then $(LN_S) -f $$sofile .; fi; done
 	echo "stamp" > .done-all-links
 @EMPTY@else
 	@echo "Sym-linking all shared libraries ..."
 	@for dir in $(LINKDIRS); do \
 	  for sofile in ../$$dir/.libs/*.so* ../$$dir/.libs/*.la; \
             do if test -f $$sofile; then $(LN_S) -f $$sofile .; fi; done; done
 	@for sofile in .libs/*.so*; \
             do if test -f $$sofile; then $(LN_S) -f $$sofile .; fi; done
 	@echo "stamp" > .done-all-links
 @EMPTY@endif
 
 install-data-local: Makefile.common.install
 	sed -e s:@THEPEGLIB@:$(pkglibdir):g -e s:@THEPEGINCLUDE@:-I$(includedir):g Makefile.common.install > Makefile.common
 	sed -e s:@THEPEGLIB@:$(pkglibdir):g $(srcdir)/Makefile.dist.install > Makefile.dist
 	test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
 	$(INSTALL_DATA) Makefile.common $(DESTDIR)$(pkglibdir)/Makefile.common
 	$(INSTALL_DATA) Makefile.dist $(DESTDIR)$(pkglibdir)/Makefile
 
 uninstall-local:
 	rm -f $(DESTDIR)$(pkglibdir)/Makefile.common $(DESTDIR)$(pkglibdir)/Makefile
 
 clean-local:
 	rm -f *.so* *.la *.rpo .done-all-links
diff --git a/src/Makefile.am b/src/Makefile.am
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,143 +1,143 @@
 AUTOMAKE_OPTIONS = -Wno-portability
 
 bin_PROGRAMS = setupThePEG runThePEG
 EXTRA_PROGRAMS = runEventLoop
 
 EXTRA_DIST = testpdfs .check-local.sh
 
 myLDADD = $(top_builddir)/lib/libThePEG.la 
 myLDFLAGS = -export-dynamic
 
 runThePEG_SOURCES = runThePEG.cc
 runThePEG_LDADD = $(myLDADD) $(GSLLIBS)
 runThePEG_LDFLAGS = $(AM_LDFLAGS) $(myLDFLAGS)
 
 runEventLoop_SOURCES = runEventLoop.cc
 runEventLoop_LDADD = -lHepMC $(myLDADD) $(GSLLIBS)
 runEventLoop_LDFLAGS = $(AM_LDFLAGS) $(myLDFLAGS)
 
 setupThePEG_SOURCES = setupThePEG.cc
 setupThePEG_LDADD = $(myLDADD) $(GSLLIBS)
 setupThePEG_LDFLAGS = $(AM_LDFLAGS) $(myLDFLAGS)
 setupThePEG_CPPFLAGS = $(AM_CPPFLAGS) \
 -DTHEPEG_PKGLIBDIR="\"$(pkglibdir)\""
 
 if USELHAPDF
 pkglib_LTLIBRARIES = TestLHAPDF.la
 TestLHAPDF_la_SOURCES = TestLHAPDF.cc TestLHAPDF.h
 TestLHAPDF_la_LDFLAGS = $(AM_LDFLAGS) -module $(LIBTOOLVERSIONINFO)
 endif
 
 dist_pkgdata_DATA = SimpleLEP.in ThePEGDefaults.in ThePEGParticles.in debugItems.txt TestLHAPDF.in MultiLEP.in
 
 rpodir = $(pkglibdir)
 nodist_rpo_DATA = ThePEGDefaults.rpo
 
 CLEANFILES = SimpleLEP.log SimpleLEP.out SimpleLEP.run SimpleLEP.tex \
              MultiLEP.log MultiLEP.out MultiLEP.run MultiLEP.tex \
              ThePEGDefaults.rpo .done-all-links \
              TestLHAPDF.log TestLHAPDF.out TestLHAPDF.run TestLHAPDF.tex \
              .runThePEG.timer.TestLHAPDF.run SimpleLEP.dump MultiLEP.dump 
 
 save:
 	mkdir -p save
 	cp *.log *.out *.run *.tex *.rpo save
 
 valgrind:
 	valgrind --leak-check=full --num-callers=25 --track-fds=yes --freelist-vol=100000000 --leak-resolution=med --trace-children=yes ./setupThePEG -r ThePEGDefaults.rpo SimpleLEP.in &> /tmp/valgrind.out
 	valgrind --leak-check=full --num-callers=25 --track-fds=yes --freelist-vol=100000000 --leak-resolution=med --trace-children=yes ./runThePEG SimpleLEP.run >> /tmp/valgrind.out 2>&1
 
 INPUTFILES = ThePEGDefaults.in ThePEGParticles.in \
              SimpleLEP.in SimpleLEP.mod MultiLEP.in TestLHAPDF.in
 
 .done-all-links:
 @EMPTY@ifdef SHOWCOMMAND
 	for file in $(INPUTFILES); do \
 	  if test ! -f $$file; then $(LN_S) $(srcdir)/$$file $$file; fi; done
 	echo "stamp" > .done-all-links
 @EMPTY@else
 	@echo "sym-linking input files files..."
 	@for file in $(INPUTFILES); do \
 	  if test ! -f $$file; then $(LN_S) $(srcdir)/$$file $$file; fi; done
 	@echo "stamp" > .done-all-links
 @EMPTY@endif
 
 ThePEGDefaults.rpo: .done-all-links setupThePEG ThePEGDefaults.in ThePEGParticles.in
 	./setupThePEG --init --exitonerror -L../lib -r ThePEGDefaults.rpo ThePEGDefaults.in
 	cd ../lib; rm -f ThePEGDefaults.rpo; $(LN_S) -f ../src/ThePEGDefaults.rpo .
 
 check-local: ThePEGDefaults.rpo
-	@./.check-local.sh
+	@$(srcdir)/.check-local.sh
 if USELHAPDF
 	LHAPATH=$(srcdir)/testpdfs ./setupThePEG --exitonerror -r ThePEGDefaults.rpo TestLHAPDF.in
 	LHAPATH=$(srcdir)/testpdfs time ./runThePEG -d 1 -x .libs/TestLHAPDF.so TestLHAPDF.run
 endif
 
 SimpleLEP.run: .done-all-links setupThePEG ThePEGDefaults.rpo SimpleLEP.in
 	./setupThePEG --exitonerror -r ThePEGDefaults.rpo SimpleLEP.in
 
 SimpleLEP.out: runThePEG SimpleLEP.run
 	time ./runThePEG -d 0 SimpleLEP.run
 
 MultiLEP.run: .done-all-links setupThePEG ThePEGDefaults.rpo MultiLEP.in
 	./setupThePEG --exitonerror -r ThePEGDefaults.rpo MultiLEP.in
 
 MultiLEP.out: runThePEG MultiLEP.run
 	time ./runThePEG -d 0 MultiLEP.run
 
 if USELHAPDF
 TestLHAPDF.run: .done-all-links setupThePEG ThePEGDefaults.rpo TestLHAPDF.in TestLHAPDF.la
 	LHAPATH=$(srcdir)/testpdfs ./setupThePEG --exitonerror -r ThePEGDefaults.rpo TestLHAPDF.in
 
 TestLHAPDF.out: runThePEG TestLHAPDF.run
 	LHAPATH=$(srcdir)/testpdfs time ./runThePEG -d 1 -x .libs/TestLHAPDF.so TestLHAPDF.run
 endif
 
 install-exec-hook:
 	cd $(DESTDIR)$(pkglibdir); \
 	rm -f setupThePEG-$(VERSION) runThePEG-$(VERSION); \
 	cp $(DESTDIR)$(bindir)/setupThePEG setupThePEG-$(VERSION); \
 	cp $(DESTDIR)$(bindir)/runThePEG runThePEG-$(VERSION)
 
 install-data-hook:
 	rm -f $(DESTDIR)$(pkglibdir)/ThePEGDefaults.rpo
 	./setupThePEG --init --exitonerror -L$(DESTDIR)$(pkglibdir) -r $(DESTDIR)$(pkglibdir)/ThePEGDefaults.rpo $(DESTDIR)$(pkgdatadir)/ThePEGDefaults.in
 if USELHAPDF
 #	LHAPATH=$(srcdir)/testpdfs ./setupThePEG --init --exitonerror -r $(DESTDIR)$(pkglibdir)/ThePEGDefaults.rpo -o $(DESTDIR)$(pkglibdir)/ThePEGDefaults.rpo
 endif
 	cd $(DESTDIR)$(pkglibdir); \
 	if test -n "$(DESTDIR)"; \
 	then sed -i.bak -e "s@$(DESTDIR)@@g" ThePEGDefaults.rpo; \
 	rm -f ThePEGDefaults.rpo.bak; \
 	fi ; \
 	cp ThePEGDefaults.rpo ThePEGDefaults-$(VERSION).rpo
 
 uninstall-local:
 	cd $(DESTDIR)$(pkglibdir); \
 	rm -f setupThePEG-$(VERSION) runThePEG-$(VERSION) ThePEGDefaults-$(VERSION).rpo 
 
 installcheck-local:
 	$(mkdir_p) _test_thepeg_installation_
 	cd _test_thepeg_installation_; \
 $(DESTDIR)$(bindir)/setupThePEG --exitonerror $(DESTDIR)$(pkgdatadir)/SimpleLEP.in; \
 mv SimpleLEP.out SimpleLEP.cmp; \
 $(DESTDIR)$(bindir)/runThePEG SimpleLEP.run; \
 diff SimpleLEP.out SimpleLEP.cmp; \
 mv SimpleLEP.out SimpleLEP.cmp; \
 $(DESTDIR)$(bindir)/runThePEG --resume SimpleLEP.dump; \
 diff SimpleLEP.out SimpleLEP.cmp; \
 $(DESTDIR)$(bindir)/setupThePEG --exitonerror $(DESTDIR)$(pkgdatadir)/MultiLEP.in; \
 $(DESTDIR)$(bindir)/runThePEG MultiLEP.run;
 if USELHAPDF
 	export LHAPATH=$$(pwd)/$(srcdir)/testpdfs; cd _test_thepeg_installation_; \
 $(DESTDIR)$(bindir)/setupThePEG --exitonerror $(DESTDIR)$(pkgdatadir)/TestLHAPDF.in; \
 $(DESTDIR)$(bindir)/runThePEG -x $(DESTDIR)$(pkglibdir)/TestLHAPDF.so TestLHAPDF.run
 endif
 	rm -rf _test_thepeg_installation_
 
 %.run: %.in .done-all-links ThePEGDefaults.rpo
 	./setupThePEG --exitonerror -L .libs -r ../lib/ThePEGDefaults.rpo $<
 
 %.out: %.run
 	time ./runThePEG -d 0 $<