Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F19244279
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/Herwig++.cc b/src/Herwig++.cc
--- a/src/Herwig++.cc
+++ b/src/Herwig++.cc
@@ -1,217 +1,219 @@
// -*- C++ -*-
//
// Herwig++.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#include "herwigopts.h"
#include <ThePEG/Persistency/PersistentIStream.h>
#include <ThePEG/Repository/EventGenerator.h>
#include <ThePEG/Utilities/DynamicLoader.h>
#include <ThePEG/Repository/Repository.h>
#include <ThePEG/Utilities/Exception.h>
#include <ThePEG/Utilities/Debug.h>
#include <iostream>
using namespace ThePEG;
void printUsageAndExit();
void HerwigInit(string infile, string reponame);
void HerwigRead(string reponame, string runname);
void HerwigRun(string runname, int seed, long N,
bool tics, bool resume, bool keepid);
int main(int argc, char * argv[]) {
try {
// read command line options
gengetopt_args_info args_info;
if ( cmdline_parser( argc, argv, &args_info ) != 0 ) {
std::cerr << "Could not parse command line.\n";
return EXIT_FAILURE;
}
// require one command
if ( args_info.inputs_num < 1 )
printUsageAndExit();
// Interpret command status
enum { INIT, READ, RUN } status;
std::string runType = args_info.inputs[0];
if ( runType == "init" )
status = INIT;
else if ( runType == "read" )
status = READ;
else if ( runType == "run" )
status = RUN;
else
printUsageAndExit();
// Use second argument as input- or runfile name
string runname;
if ( args_info.inputs_num > 1 )
runname = args_info.inputs[1];
// If status is RUN, we need a runname
if ( status == RUN && runname.empty() ) {
cerr << "Error: You need to supply a runfile name.\n";
printUsageAndExit();
}
// Defaults for these filenames are set in the ggo file
std::string reponame = args_info.repo_arg;
std::string infile = args_info.init_arg;
// Number of events
long N = -1;
if ( args_info.numevents_given )
N = args_info.numevents_arg;
// RNG seed
int seed = 0;
if ( args_info.seed_given )
seed = args_info.seed_arg;
// Library search path for dlopen()
for ( size_t i = 0; i < args_info.append_given; ++i )
DynamicLoader::appendPath( args_info.append_arg[i] );
for ( size_t i = 0; i < args_info.prepend_given; ++i )
DynamicLoader::prependPath( args_info.prepend_arg[i] );
// Debugging level
if ( args_info.debug_given )
Debug::setDebug( args_info.debug_arg );
- if ( Debug::level )
+
+ // Floating point exceptions
+ if ( args_info.debug_fpe_flag )
Debug::unmaskFpuErrors();
// Exit-on-error flag
if ( args_info.exitonerror_flag )
Repository::exitOnError() = 1;
// Tics
bool tics = true;
if ( args_info.quiet_flag )
tics = false;
// Resume
bool resume = false;
if ( args_info.resume_flag )
resume = true;
// Keep id
bool keepid = false;
if ( args_info.keepid_flag )
keepid = true;
// *** End of command line parsing ***
// Call mode
switch ( status ) {
case INIT: HerwigInit( infile, reponame ); break;
case READ: HerwigRead( reponame, runname ); break;
case RUN: HerwigRun( runname, seed, N,
tics, resume, keepid ); break;
default: printUsageAndExit();
}
Repository::cleanup();
cmdline_parser_free( &args_info );
return EXIT_SUCCESS;
}
catch ( ThePEG::Exception & e ) {
std::cerr << argv[0] << ": ThePEG::Exception caught. "
<< "See logfile for details.\n";
Repository::cleanup();
return EXIT_FAILURE;
}
catch ( std::exception & e ) {
std::cerr << argv[0] << ": " << e.what() << '\n';
Repository::cleanup();
return EXIT_FAILURE;
}
catch (...) {
std::cerr << argv[0] << ": Unknown exception caught.\n";
Repository::cleanup();
return EXIT_FAILURE;
}
}
void printUsageAndExit() {
std::cerr << gengetopt_args_info_usage << '\n';
Repository::cleanup();
exit( EXIT_FAILURE );
}
void HerwigInit(string infile, string reponame) {
breakThePEG();
{
# ifdef HERWIG_PKGLIBDIR
DynamicLoader::appendPath(HERWIG_PKGLIBDIR);
# endif
# ifdef THEPEG_PKGLIBDIR
DynamicLoader::appendPath(THEPEG_PKGLIBDIR);
# endif
HoldFlag<> setup(InterfaceBase::NoReadOnly);
Repository::read(infile, cout);
Repository::update();
}
Repository::save(reponame);
}
void HerwigRead(string reponame, string runname) {
#ifdef HERWIG_PKGDATADIR
ifstream test(reponame.c_str());
if ( !test ) {
reponame = string(HERWIG_PKGDATADIR) + '/' + reponame;
}
test.close();
#endif
Repository::load(reponame);
breakThePEG();
if ( !runname.empty() && runname != "-" )
Repository::read(runname, std::cout);
else
Repository::read(std::cin, std::cout, "Herwig++> ");
}
void HerwigRun(string runname, int seed, long N,
bool tics, bool resume, bool keepid) {
PersistentIStream is(runname, keepid);
ThePEG::EGPtr eg;
is >> eg;
// debugging breakpoint
breakThePEG();
if ( !eg ) {
std::cerr << "Herwig++: EventGenerator not available.\n"
<< "Check if '" << runname << "' is a valid run file.\n";
Repository::cleanup();
exit( EXIT_FAILURE );
}
if ( seed > 0 ) eg->setSeed(seed);
eg->go( resume ? -1 : 1, N, tics );
if ( tics )
std::cout << '\n';
}
diff --git a/src/Makefile.am b/src/Makefile.am
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,132 +1,132 @@
SUBDIRS = defaults
AUTOMAKE_OPTIONS = -Wno-portability
defaultsdir = ${pkgdatadir}/defaults
bin_PROGRAMS = Herwig++
Herwig___SOURCES = Herwig++.cc herwigopts.c herwigopts.h
BUILT_SOURCES = herwigopts.c herwigopts.h
Herwig___LDFLAGS = $(AM_LDFLAGS) -export-dynamic $(THEPEGLDFLAGS)
Herwig___LDADD = $(THEPEGLIB) -ldl
Herwig___CPPFLAGS = $(AM_CPPFLAGS) \
-DHERWIG_PKGDATADIR="\"$(pkgdatadir)\"" \
-DHERWIG_PKGLIBDIR="\"$(pkglibdir)\"" \
-DTHEPEG_PKGLIBDIR="\"$(THEPEGPATH)/lib/ThePEG\""
bin_SCRIPTS = herwig-config
HELPERFILES = SPhenoSPS1a.spc NMSSM.spc MUED.model MSSM.model NMSSM.model\
RS.model ADD.model Leptoquark.model ColourRec.LEPtune
INPUTFILES = ILC.in LEP.in LHC.in TVT.in LHC-MSSM.in \
LHC-MUED.in LHC-NMSSM.in LHC-RS.in LHC-ADD.in\
ILC-MSSM.in ILC-MUED.in ILC-RS.in DIS.in LHC-Powheg.in \
TVT-Powheg.in GammaGamma.in LHC-TRP.in LHC-diffractive.in \
LHC-GammaGamma.in LHC-LQ.in LHC-UE7-1.in
## provide -no3body for faster 'make check'
dist_noinst_DATA = LHC-MUED-no3body.in
dist_pkgdata_DATA = $(INPUTFILES) $(HELPERFILES)
pkgdata_DATA = Makefile-UserModules
CLEANFILES = HerwigDefaults.rpo \
*.run *.log *.out *.tex \
multi.test *.output probs.test chisq.value \
LHC-RS-BR.spc LHC-MUED-no3body-BR.spc LHC-MSSM-BR.spc
## checking targets ##
HerwigDefaults.rpo: Herwig++ $(srcdir)/defaults/*.in defaults/PDF.in defaults/Analysis.in $(top_builddir)/lib/*.so
- ./Herwig++ init -L$(top_builddir)/lib -i defaults/HerwigDefaults.in --exitonerror
+ ./Herwig++ init -L$(top_builddir)/lib -i defaults/HerwigDefaults.in -D --exitonerror
check_BSM_Full=
check_BSM=
if WANT_MSSM
check_BSM += check-LHC-MSSM
check_BSM_Full += check-LHC-MSSM
endif
if WANT_NMSSM
check_BSM_Full += check-LHC-NMSSM
endif
if WANT_UED
check_BSM += check-LHC-MUED-no3body
check_BSM_Full += check-LHC-MUED
endif
if WANT_RS
check_BSM += check-LHC-RS
check_BSM_Full += check-LHC-RS
endif
if WANT_TRP
check_BSM_Full += check-LHC-TRP
endif
if WANT_ADD
check_BSM_Full += check-LHC-ADD
endif
check-local: check-LHC check-LEP check-DIS check-ILC check-GammaGamma $(check_BSM) check-LHC-Powheg
check-Powheg: check-LHC-Powheg check-TVT-Powheg
check-BSM: $(check_BSM_Full)
link-helper-files:
@for i in $(HELPERFILES); do \
if test -f $(srcdir)/$$i -a ! -e $$i; then \
$(LN_S) -f $(srcdir)/$$i; fi; done
check-%: $(srcdir)/%.in HerwigDefaults.rpo link-helper-files
- ./Herwig++ read $< --exitonerror
- ./Herwig++ run $(notdir $(subst .in,.run,$<)) -N500 -d1 --exitonerror
+ ./Herwig++ read -D $< --exitonerror
+ ./Herwig++ run $(notdir $(subst .in,.run,$<)) -N500 -d1 -D --exitonerror
## valgrind targets ##
VALGRIND=valgrind --leak-check=full --num-callers=25 --freelist-vol=100000000 --leak-resolution=med --trace-children=yes
valgrind: valgrind-init valgrind-read valgrind-run
valgrind-init:
- $(VALGRIND) ./Herwig++ init -d 1 -L$(top_builddir)/lib -i defaults/HerwigDefaults.in \
+ $(VALGRIND) ./Herwig++ init -d1 -D -L$(top_builddir)/lib -i defaults/HerwigDefaults.in \
&> /tmp/valgrind-init.log
valgrind-read:
- $(VALGRIND) ./Herwig++ read -d 1 LHC.in &> /tmp/valgrind-read.log
+ $(VALGRIND) ./Herwig++ read -d1 -D LHC.in &> /tmp/valgrind-read.log
valgrind-run:
- $(VALGRIND) ./Herwig++ run -d 1 -N5 LHC.run &> /tmp/valgrind-run.log
+ $(VALGRIND) ./Herwig++ run -d1 -D -N5 LHC.run &> /tmp/valgrind-run.log
SETUPTHEPEG=$(THEPEGPATH)/bin/setupThePEG
THEPEGREPO=$(THEPEGPATH)/lib/ThePEG/ThePEGDefaults.rpo
install-data-hook:
@echo Creating repository
@./Herwig++ init -L$(DESTDIR)$(pkglibdir) -i $(DESTDIR)$(defaultsdir)/HerwigDefaults.in -r $(DESTDIR)$(pkgdatadir)/HerwigDefaults.rpo --exitonerror
uninstall-hook:
rm -f $(DESTDIR)$(pkgdatadir)/HerwigDefaults.rpo
register: register-with-thepeg-repo
register-with-thepeg-repo:
@if test -x "$(SETUPTHEPEG)" -a -w "$(THEPEGREPO)"; \
then echo Registering with ThePEG; \
"$(SETUPTHEPEG)" --init \
$(DESTDIR)$(defaultsdir)/HerwigDefaults.in \
-r "$(THEPEGREPO)" -o "$(THEPEGREPO)" \
-l$(DESTDIR)$(pkglibdir) --exitonerror ; \
fi
unregister : unregister-from-thepeg-repo
unregister-from-thepeg-repo:
@if test -x "$(SETUPTHEPEG)" -a -w "$(THEPEGREPO)"; \
then echo Unregistering with ThePEG; \
"$(SETUPTHEPEG)" --init defaults/HerwigCleanup.in \
-r "$(THEPEGREPO)" -o "$(THEPEGREPO)" \
-l$(DESTDIR)$(pkglibdir) --exitonerror ; \
fi
EXTRA_DIST = herwigopts.ggo
GENGETOPT = gengetopt
%opts.h %opts.c : %opts.ggo
$(GENGETOPT) < $<
diff --git a/src/herwigopts.ggo b/src/herwigopts.ggo
--- a/src/herwigopts.ggo
+++ b/src/herwigopts.ggo
@@ -1,65 +1,68 @@
## args for the gengetopt call in Makefile.am
args "--file-name=herwigopts --unamed-opts --long-help"
##################################################
purpose "Herwig++ is a multi-purpose Monte-Carlo event generator \
for particle physics. See arXiv:0803.0883 for a detailed manual, \
or arXiv:1101.2599 for a more general description of the physics \
behind MC event generation."
usage " (read|run) [OPTIONS]... [FILE]"
description "One of the commands 'read' or 'run' is required:
read - reads an input file and creates a run file,
run - reads a run file and generates events."
section "Event generation options"
text ""
option "numevents" N "Number of events to generate."
long optional
option "seed" s "The random number generator seed."
int optional
option "debug" d "Set the ThePEG debug level."
int optional
+option "debug-fpe" D "Enable floating point exceptions."
+ flag off
+
option "quiet" q "Disable event counter."
flag off
section "Plugin library options"
text ""
option "append" l "Append a search path for dynamically loaded libraries."
typestr="PATH"
string optional multiple
option "prepend" L "Prepend a search path for dynamically loaded libraries."
typestr="PATH"
string optional multiple
text "\nUsage: Herwig++ init [OPTIONS]...\n"
text " creates a new default repository (not useful for end users).\n"
section "Advanced options"
option "init" i "Initialization file to read for 'init'."
typestr="FILE"
string optional default="HerwigDefaults.in" hidden
option "repo" r "Repository file to use."
typestr="FILE"
string optional default="HerwigDefaults.rpo" hidden
option "exitonerror" - "If set, ThePEG will not try to recover from \
failures, but will exit with a non-zero return code."
flag off hidden
option "resume" - "Try to resume execution from an earlier interrupted run."
flag off hidden
option "keepid" - "Peserve creation order of objects, \
to allow exactly reproducible runs."
flag off hidden
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Sep 30, 4:40 AM (22 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6564755
Default Alt Text
(12 KB)
Attached To
Mode
rHERWIGHG herwighg
Attached
Detach File
Event Timeline
Log In to Comment