Page MenuHomeHEPForge

No OneTemporary

Index: contrib/Sacrifice/m4/pythia.m4
===================================================================
--- contrib/Sacrifice/m4/pythia.m4 (revision 896)
+++ contrib/Sacrifice/m4/pythia.m4 (revision 897)
@@ -1,149 +1,149 @@
#AC_SEARCH_PYTHIA(actionIfFound, actionIfNotFound)
AC_DEFUN([AC_SEARCH_PYTHIA],[
if test x$with_pythia != x && test x$with_pythia != xyes ; then
AC_MSG_NOTICE([Adding $with_pythia to search path for Pythia])
if test -d $with_pythia/include/ && test -d $with_pythia/lib ; then
found_pythia=yes
pythia_base=$with_pythia
pythia_include=$with_pythia/include/
pythia_lib=$with_pythia/lib
pythia_data=$with_pythia/xmldoc
else
found_pythia=no
fi
fi
# If we failed to find it in the specified path then check some ~standard locations
# Add some default afs search paths here if LCG_TAG is defined
# If no PYTHIA_VERSION is defined then try to use the most recent
if test x$found_pythia != xyes ; then
searchPaths="/usr /usr/local /opt /opt/local"
if test "x$HAVE_LCG" == "xyes" ; then
afs_base_path="/afs/cern.ch/sw/lcg/external/MCGenerators_lcgcmt64/pythia8/"
if test "x$PYTHIA_VERSION" == "xno" ; then
afs_subdirs=`ls $afs_base_path`
PYTHIA_VERSION=`for dir in $afs_subdirs; do echo $dir; done | sort -r | head -n 1`
fi
AC_MSG_NOTICE([Testing for Pythia version $PYTHIA_VERSION in LCG AFS area])
searchPaths="$searchPaths $afs_base_path/$PYTHIA_VERSION/${LCG_TAG}"
fi
for ac_pythia_path_tmp in $searchPaths ; do
AC_MSG_NOTICE([Testing $ac_pythia_path_tmp for Pythia 8...])
if test -d $ac_pythia_path_tmp/include && test -d $ac_pythia_path_tmp/lib && test -d $ac_pythia_path_tmp/xmldoc && test x$found_pythia != xyes; then
AC_MSG_NOTICE([...found])
found_pythia=yes
pythia_base=$ac_pythia_path_tmp
pythia_include=$ac_pythia_path_tmp/include/
pythia_lib=$ac_pythia_path_tmp/lib
pythia_data=$ac_pythia_path_tmp/xmldoc
fi
done
fi
if test x$found_pythia = xno ; then
AC_MSG_ERROR([Could not find Pythia 8 libraries])
fi
# check for Pythia version > 8.180
if test -d $pythia_include/Pythia8Plugins ; then
pythiaversion="8200"
test_include="$pythia_include/Pythia8"
hepmclib="no"
pythia_data=$pythia_base/share/Pythia8/xmldoc
elif test -d $pythia_include/Pythia8 ; then
pythiaversion="8180"
test_include="$pythia_include/Pythia8"
hepmclib="pythia8tohepmc"
else
pythiaversion="8170"
test_include="$pythia_include"
hepmclib="hepmcinterface"
fi
# final check that the headers and libraries are actually there
if test x$found_pythia = xyes ; then
if test -f $test_include/Pythia.h && test -f $pythia_lib/libpythia8.$LIB_SUFFIX && test -f $pythia_data/ParticleData.xml; then
PYTHIA_LIBDIR="$pythia_lib"
PYTHIA_LDFLAGS="-L$pythia_lib -lpythia8"
PYTHIA_CPPFLAGS="-I$pythia_include"
if test "x$pythiaversion" == "x8170" ; then
PYTHIA_CPPFLAGS="$PYTHIA_CPPFLAGS -DPYTHIA8176"
elif test "x$pythiaversion" == "x8180" ; then
PYTHIA_CPPFLAGS="$PYTHIA_CPPFLAGS -DPYTHIA8180"
else
PYTHIA_CPPFLAGS="$PYTHIA_CPPFLAGS -DPYTHIA8200"
fi
PYTHIA_DATA="$pythia_data"
# test for z lib dependency
have_zlib=no
zlib=`nm -P $pythia_lib/libpythia8.$LIB_SUFFIX | grep -i zlib | head -n 1`
if test "x$zlib" != "x" ; then
have_zlib=yes
PYTHIA_LDFLAGS="$PYTHIA_LDFLAGS $BOOST_LDFLAGS -lboost_iostreams"
fi
if test x$enable_HepMC = xyes && test x$hepmclib != xno ; then
if test -f $pythia_lib/lib$hepmclib.$LIB_SUFFIX ; then
PYTHIA_LDFLAGS="$PYTHIA_LDFLAGS -l$hepmclib"
else
AC_MSG_NOTICE([HepMC requested, but Pythia 8 interface library libhepmcinterface not found!])
found_pythia=no
fi
fi
- if test x$enable_LHAPDF != xyes ; then
+ if test x$enable_LHAPDF != xyes && test x$pythiaversion != x8200 ; then
if test -f $pythia_lib/liblhapdfdummy.$LIB_SUFFIX ; then
PYTHIA_LDFLAGS="$PYTHIA_LDFLAGS -llhapdfdummy"
else
AC_MSG_NOTICE([LHAPDF not linked, but dummy Pythia 8 LHAPDf library not found!])
found_pythia=no
fi
fi
else
found_pythia=no
fi
fi
if test x$found_pythia = xyes ; then
export PYTHIA_LDFLAGS
export PYTHIA_CPPFLAGS
export PYTHIA_DATA
export PYTHIA_LIBDIR
AC_SUBST([PYTHIA_LDFLAGS])
AC_SUBST([PYTHIA_CPPFLAGS])
AC_SUBST([PYTHIA_DATA])
AC_SUBST([PYTHIA_LIBDIR])
AM_CONDITIONAL(ENABLE_GZIP, [test x$have_zlib = xyes])
AC_MSG_NOTICE([Found Pythia 8 libraries and headers])
AC_MSG_NOTICE([PYTHIA_LDFLAGS = $PYTHIA_LDFLAGS])
AC_MSG_NOTICE([PYTHIA_CPPFLAGS = $PYTHIA_CPPFLAGS])
AC_MSG_NOTICE([PYTHIA_DATA = $PYTHIA_DATA])
$1
else
AC_MSG_NOTICE([Could not find complete set of Pythia 8 libraries and headers])
$2
fi
])
Index: contrib/Sacrifice/share/AU2-CT10.params
===================================================================
--- contrib/Sacrifice/share/AU2-CT10.params (revision 896)
+++ contrib/Sacrifice/share/AU2-CT10.params (revision 897)
@@ -1,19 +1,18 @@
6:m0 = 172.5
23:m0 = 91.1876
24:m0 = 80.399
#CTau lifetime cut
ParticleDecays:limitTau0 = on
ParticleDecays:tau0Max = 10.0
# Tune A2 settings
Tune:pp = 5
-PDF:useLHAPDF = on
-PDF:LHAPDFset = CT10.LHgrid
+PDF:pSet = LHAPDF5:CT10.LHgrid
MultipartonInteractions:bProfile = 4
MultipartonInteractions:a1 = 0.10
MultipartonInteractions:pT0Ref = 1.70
MultipartonInteractions:ecmPow = 0.16
-BeamRemnants:reconnectRange = 4.67
+ColourReconnection:range = 4.67
SpaceShower:rapidityOrder=off
\ No newline at end of file
Index: contrib/Sacrifice/share/A2-MSTW2008LO.params
===================================================================
--- contrib/Sacrifice/share/A2-MSTW2008LO.params (revision 896)
+++ contrib/Sacrifice/share/A2-MSTW2008LO.params (revision 897)
@@ -1,19 +1,19 @@
6:m0 = 172.5
23:m0 = 91.1876
24:m0 = 80.399
#CTau lifetime cut
ParticleDecays:limitTau0 = on
ParticleDecays:tau0Max = 10.0
# Tune A2 settings
Tune:pp = 5
-PDF:useLHAPDF = on
-PDF:LHAPDFset = MSTW2008lo68cl.LHgrid
+Tune:preferLHAPDF = 2
+PDF:pSet = LHAPDF5:MSTW2008lo68cl.LHgrid
MultipartonInteractions:bProfile = 4
MultipartonInteractions:a1 = 0.03
MultipartonInteractions:pT0Ref = 1.90
MultipartonInteractions:ecmPow = 0.30
-BeamRemnants:reconnectRange = 2.28
+ColourReconnection:range = 2.28
SpaceShower:rapidityOrder=off
\ No newline at end of file
Index: contrib/Sacrifice/ChangeLog
===================================================================
--- contrib/Sacrifice/ChangeLog (revision 896)
+++ contrib/Sacrifice/ChangeLog (revision 897)
@@ -1,65 +1,70 @@
+2014-11-26 James Monk <jmonk@cern.ch>
+ * Fix multiple weights and CCKW-L cross section
+ * Update A2-MSTW2008LO and AU2-CT10 for new Py8.2 PDF syntax
+ * Add lhapdfdummy to linker only for Pythia version less than 8.2
+
2014-09-18 James Monk <jmonk@cern.ch>
* Update build and params for Pythia 8.200
2014-02-26 James Monk <jmonk@cern.ch>
* change default beam energy to 8000 GeV
2014-02-03 James Monk <jmonk@cern.ch>
* improve header directory structure to include/Sacrifice include/tclap etc.
* Download tarball of MCUtils headers and install in include if not already present there.
* Use the downloaded MCUtils unless otherwise specified
#increase version to 0.9.9, make tarball
2013-11-25 James Monk <jmonk@cern.ch>
* Compatibility with Pythia 8.180
2013-07-29 James Monk <jmonk@cern.ch>
* PTRel_boostVetoedShower.cxx: another vetoed shower, this time implemented with a
boost that evolves during the evtn due to recoil. Should be identical to main31
2013-07-14 James Monk <jmonk@cern.ch>
* HepMC no longer optional. Doesn't really make sense, since HepMC output is the whole point
* Add option to produced gzip compressed output.
Option will only be present if Pythia itself was compiled with gzip support.
2013-07-10 James Monk <jmonk@cern.ch>
* Optional support for MCUtils to provide reduced HepMC size through filtering
2013-07-08 James Monk <jmonk@cern.ch>
* Suppress and Enhance MPI Userhooks. Veto events with MPI above and below a threshold
2013-07-01 James Monk <jmonk@cern.ch>
* update m4 scripts for slc6 gcc 46
* setupPythia.sh script adds LHAPATH
2013-06-19 James Monk <jmonk@cern.ch>
* User hook for vetoed shower using relative pT and reduced scale, a la main31
2013-02-13 James Monk <jmonk@cern.ch>
* Update build system to support Pythia with gzip
2013-01-28 James Monk <jmonk@cern.ch>
* Selection of UserHooks for vetoed shower with PoWHEG
WZVetoedShower.cxx vetoes emissions relative to the beam
QCDVetoedShower.cxx compares each emission to each PoWHEG leg
PoWHEGVetoedShower vetoes relative to the beam, but determines a new
definition of the veto scale
* The above author suggested veto schemes need testing and validating!
* Improved UserHook library loading (local directory, SACRIFICE_LIB_PATH, install lib dir)
2013-01-24 James Monk <jmonk@cern.ch>
* Allow user configuration of the lcg tag for troublesome setups
2012-12-13 James Monk <jmonk@cern.ch>
* Add support for loading user hooks on the cmd line
2012-05-21 James Monk <jmonk@cern.ch>
* Initial check-in to AGILe svn repository
* Supports Pythia 8 with HepMC, LHAPDF, PHOTOS++
* ./configure ^should^ discover all libraries from genser, if available
* Photos support optional (--enable-photos to turn it on)
* ~Replicates the ATLAS setup, including PHOTOS++ wrangling
* Setup script installed in share: source share/setupPythia8.sh
2012-02-22 James Monk <jmonk@cern.ch>
* Initial version of Pythia 8 main program + build system
\ No newline at end of file
Index: contrib/Sacrifice/src/PythiaMain.cxx
===================================================================
--- contrib/Sacrifice/src/PythiaMain.cxx (revision 896)
+++ contrib/Sacrifice/src/PythiaMain.cxx (revision 897)
@@ -1,195 +1,264 @@
#ifdef PYTHIA8176
#include "Pythia.h"
#include "HepMCInterface.h"
#define HepMCConverter HepMC::I_Pythia8
#else
#include "Pythia8/Pythia.h"
#ifdef PYTHIA8200
#include "Pythia8Plugins/HepMC2.h"
#else
#include "Pythia8/Pythia8ToHepMC.h"
#endif
#define HepMCConverter HepMC::Pythia8ToHepMC
#endif
#include "Sacrifice/UserHooksFactory.hh"
#include "Sacrifice/Exceptions.hh"
#include "Sacrifice/BeamParticle.hh"
#include "Sacrifice/Utils.hh"
#include "Sacrifice/HepMCIOHandler.hh"
#include "Sacrifice/MCUtilsHandler.hh"
#include "Sacrifice/PhotosHandler.hh"
#include "Sacrifice/binreloc.h"
#include "tclap/CmdLine.h"
#include "HepMC/GenEvent.h"
#include "HepMC/Units.h"
#include "boost/lexical_cast.hpp"
#include <string>
#include <stdexcept>
int main(int argc, char **argv){
char *envPath=0;
envPath = getenv("PYTHIA8DATA");
string path;
if(envPath){
path = envPath;
}else{
BrInitError brError;
br_init_lib(&brError);
path = br_find_data_dir(DEFAULTDATADIR);
}
//Do this first so we always get the Pythia banner and version information
Pythia8::Pythia pythia(path);
std::string pythiaVersion = boost::lexical_cast<std::string>(pythia.settings.parm("Pythia:versionNumber") + 0.00000000001);
pythiaVersion.erase(5);
std::string message = "Main program for steering Pythia " + pythiaVersion + ". Bug reports to James Monk <jmonk@cern.ch>";
TCLAP::CmdLine cmd(message, ' ', "0.9.9");
Sacrifice::HepMCIOHandler hepMCHandler(cmd);
Sacrifice::PhotosHandler photosHandler(cmd);
Sacrifice::MCUtilsHandler mcutils(cmd);
TCLAP::ValueArg<int> seedArg("r", "random-seed", "Random seed", false, -1, "int");
TCLAP::MultiArg<std::string> inputArg("i", "input", "Input command file", false, "string");
TCLAP::ValueArg<std::string> beam1Arg("f", "beam1", "Forward-going beam type (default PROTON)", false, "PROTON", "string");
TCLAP::ValueArg<std::string> beam2Arg("b", "beam2", "Backward-going beam type (default PROTON)", false, "PROTON", "string");
TCLAP::ValueArg<double> energyArg("e", "collision-energy", "Collision energy in GeV (default 7000 GeV)", false, 8000., "double");
TCLAP::ValueArg<int> nEventsArg("n", "nEvents", "Number of events to generate (default 100)", false, 100, "int");
TCLAP::MultiArg<std::string> paramsArgs("c", "command", "Commands to be read directly in to Pythia. Over-rides command file.", false, "string");
TCLAP::ValueArg<std::string> dataArg("d", "particle-data", "XML file of particle data. Over-rides default in $PYTHIA8DATA.", false, "", "string");
TCLAP::ValueArg<std::string> lhefArg("l", "lhe-file"," Les Houches Event File input", false, "", "string");
TCLAP::ValueArg<std::string> libArg("L", "load-library", "Library of user hooks to be loaded", false, "Plugin", "string");
TCLAP::ValueArg<std::string> hooksArg("u", "user-hook", "Name of user hook to add", false, "", "string");
TCLAP::SwitchArg printArg("w", "write", "Write HepMC events to stdout", false);
+ TCLAP::ValueArg<int> maxFailureArg("m", "max-failures", "Maximum number of failed events", false, 10, "int");
+
cmd.add(seedArg);
cmd.add(inputArg);
cmd.add(beam1Arg);
cmd.add(beam2Arg);
cmd.add(energyArg);
cmd.add(nEventsArg);
cmd.add(paramsArgs);
cmd.add(dataArg);
cmd.add(lhefArg);
cmd.add(libArg);
cmd.add(hooksArg);
cmd.add(printArg);
+ cmd.add(maxFailureArg);
cmd.parse( argc, argv );
HepMCConverter pythiaToHepMC;
pythiaToHepMC.set_store_pdf(true);
if(photosHandler.isEnabled()){
photosHandler.initialise();
}
for(vector<std::string>::const_iterator inputFile = inputArg.getValue().begin();
inputFile != inputArg.getValue().end(); ++inputFile){
std::string path = Sacrifice::findParamFile(*inputFile);
if(!pythia.readFile(path)){
throw std::runtime_error("Could not interpret all of the commands in the input file " + path + "!");
}else{
std::cout<<" Read commands from "<<path<<std::endl<<std::endl;
}
}
for(vector<std::string>::const_iterator command = paramsArgs.getValue().begin();
command != paramsArgs.getValue().end(); ++command){
if(!pythia.readString(*command)){
std::string msg = "Pythia could not understand the command " + *command;
throw std::runtime_error(msg);
}
}
if(seedArg.getValue() > 0){
std::string seedString = "Random:seed=" + boost::lexical_cast<string>(seedArg.getValue());
bool understood = pythia.readString("Random:setSeed=on");
understood = understood && pythia.readString(seedString);
if(! understood) throw std::runtime_error("Your version of Pythia does not understand the random seed commands!");
}
if(photosHandler.isEnabled()){
bool understood = pythia.readString("TimeShower:QEDshowerByL = off");
if(! understood) throw std::runtime_error("Your version of Pythia does not understand the command to turn off QED FSR!");
}
Sacrifice::BeamParticle beam1(beam1Arg.getValue());
Sacrifice::BeamParticle beam2(beam2Arg.getValue());
if(hooksArg.getValue() != ""){
Sacrifice::UserHooksFactory::loadLibrary(libArg.getValue());
if(!pythia.setUserHooksPtr(Sacrifice::UserHooksFactory::create(hooksArg.getValue())))
throw std::runtime_error("Unable to use UserHook: " + hooksArg.getValue());
}
/// @todo This doesn't work at the moment... the beam particles are not correctly handled and process init fails
if(dataArg.getValue() != ""){
if(!pythia.particleData.reInit(dataArg.getValue(), true)) throw std::runtime_error("Could not read particle data file: " + dataArg.getValue());
}
bool isInitialised = true;
+ bool doLHEF = false;
if(lhefArg.getValue() != ""){
isInitialised = isInitialised && pythia.readString("Beams:frameType = 4");
isInitialised = isInitialised && pythia.readString("Beams:LHEF = " + lhefArg.getValue());
+ doLHEF = true;
}else{
isInitialised = isInitialised && pythia.readString("Beams:frameType = 1");
isInitialised = isInitialised && pythia.readString("Beams:idA = " + boost::lexical_cast<string>(beam1.asID()));
isInitialised = isInitialised && pythia.readString("Beams:idB = " + boost::lexical_cast<string>(beam2.asID()));
isInitialised = isInitialised && pythia.readString("Beams:eCM = " + boost::lexical_cast<string>(energyArg.getValue()));
}
isInitialised = isInitialised && pythia.init();
if(!isInitialised) throw std::runtime_error("Could not initialise Pythia");
+ std::vector<std::string> weightIDs;
+ int failureCount=0;
+ double nMerged=0.;
+ double nAccepted=0.;
+
for(int eventNumber = 0; eventNumber < nEventsArg.getValue(); ++eventNumber){
-
+
if(!pythia.next()){
if(pythia.info.atEndOfFile()){
std::cout<<"Reached end of LHE file"<<std::endl;
break;
}
+
+ ++failureCount;
+
+ if(failureCount > maxFailureArg.getValue()){
+ std::cout<<"Number of failed events exceeds maximum of "<<maxFailureArg.getValue()<<std::endl;
+ break;
+ }
+ if(eventNumber == 0) --eventNumber;
}
#ifdef HEPMC_HAS_UNITS ///
HepMC::GenEvent *hepMCEvent = new HepMC::GenEvent(HepMC::Units::GEV, HepMC::Units::MM);
#else
HepMC::GenEvent *hepMCEvent = new HepMC::GenEvent();
#endif /// HEPMC_HAS_UNITS
pythiaToHepMC.fill_next_event(pythia, hepMCEvent);
if(photosHandler.isEnabled()){
photosHandler.process(hepMCEvent);
}
if(mcutils.isAvailable()) mcutils.filter(hepMCEvent);
+ double phaseSpaceWeight = pythia.info.weight();
+ double mergingWeight = pythia.info.mergingWeight();
+ double eventWeight = phaseSpaceWeight*mergingWeight;
+
+ nAccepted += 1.;
+
+ if(fabs(eventWeight) < 1.e-18 ||
+ pythia.event.size() < 2){
+
+ if(eventNumber == 0) --eventNumber;
+ continue;
+ }else{
+ nMerged += eventWeight;
+ }
+
+ hepMCEvent->weights().clear();
+
+ std::vector<std::string>::const_iterator id = weightIDs.begin();
+
+ if(pythia.info.getWeightsDetailedSize() != 0){
+
+ for(std::map<std::string, Pythia8::LHAwgt>::const_iterator wgt = pythia.info.rwgt->wgts.begin();
+ wgt != pythia.info.rwgt->wgts.end(); ++wgt){
+
+ if(eventNumber == 0){
+ weightIDs.push_back(wgt->first);
+ }else{
+ if(*id != wgt->first){
+ throw std::runtime_error("Mismatch in LHE3 weight name. Found" + wgt->first + ", expected " + *id);
+ }
+ ++id;
+ }
+
+ std::map<std::string, Pythia8::LHAweight>::const_iterator weightName = pythia.info.init_weights->find(wgt->first);
+ if(weightName != pythia.info.init_weights->end()){
+ hepMCEvent->weights()[weightName->second.contents] = mergingWeight * wgt->second.contents;
+ }else{
+ hepMCEvent->weights()[wgt->first] = mergingWeight * wgt->second.contents;
+ }
+
+ }
+
+ }else{
+ hepMCEvent->weights().push_back(eventWeight);
+ }
+
if(printArg.getValue()){
hepMCEvent->print();
}
+
hepMCHandler.writeEvent(hepMCEvent);
delete hepMCEvent;
}
pythia.stat();
+
+ double xs = pythia.info.sigmaGen(); // in mb
+ std::cout<<"Cross Section (nb) = "<<xs * 1000. *nMerged / nAccepted<<std::endl;
+
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, May 14, 10:40 AM (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5111223
Default Alt Text
(19 KB)

Event Timeline