diff --git a/GeneratorInterface/LHEInterface/data/run_amcatnlo_tarball.sh b/GeneratorInterface/LHEInterface/data/run_amcatnlo_tarball.sh new file mode 100755 index 0000000000000..aa96ef388a981 --- /dev/null +++ b/GeneratorInterface/LHEInterface/data/run_amcatnlo_tarball.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +#set -o verbose + +echo " ______________________________________ " +echo " Running Madgraph5 " +echo " ______________________________________ " + +repo=${1} +echo "%MSG-MG5 repository = $repo" + +name=${2} +echo "%MSG-MG5 gridpack = $name" + +nevt=${3} +echo "%MSG-MG5 number of events requested = $nevt" + +rnum=${4} +echo "%MSG-MG5 random seed used for the run = $rnum" + +LHEWORKDIR=`pwd` + +if [[ -d madevent ]] + then + echo 'madevent directory found' + echo 'Setting up the environment' + rm -rf madevent +fi +mkdir madevent; cd madevent + +# retrieve the wanted gridpack from the official repository +fn-fileget -c `cmsGetFnConnect frontier://smallfiles` ${repo}/${name}_tarball.tar.gz +#cp -p /afs/cern.ch/work/b/bendavid/CMSSWgen62/genproductions/bin/aMCatNLO/${name}_tarball.tar.gz ./ + +#check the structure of the tarball +tar xzf ${name}_tarball.tar.gz ; rm -f ${name}_tarball.tar.gz ; + +# force the f77 compiler to be the CMS defined one +ln -sf `which gfortran` f77 +ln -sf `which gfortran` g77 +PATH=`pwd`:${PATH} + +cd mgbasedir/${name} + +#replace the seed in the run card with ${rnum} +sed -i "s#[0-9]\+ *= *iseed# ${rnum} = iseed#g" Cards/run_card.dat + +#replace the number of events in the run_card +sed -i "s#[0-9]\+ *= *nevents# ${nevt} = nevents#g" Cards/run_card.dat + +run_card_seed=`fgrep "${rnum} = iseed" Cards/run_card.dat | awk '{print $1}'` +run_card_nevents=`fgrep "${nevt} = nevents" Cards/run_card.dat | awk '{print $1}'` + +if [[ $run_card_seed -eq $rnum ]] ;then + echo "run_card_seed = ${run_card_seed}" +else + echo "%MSG-MG5 Error: Seed numbers $run_card_seed doesnt match ( $rnum )" + exit 1 +fi + +if [[ $run_card_nevents -eq $nevt ]] ;then + echo "run_card_nevents = ${run_card_nevents}" +else + echo "%MSG-MG5 Error: Number of events $run_card_nevents doesnt match ( $nevt )" + exit 1 +fi + +if [ -f Cards/madspin_card.dat ] ;then + #set random seed for madspin + rnum2=$(($rnum+1000000)) + sed -i "s#\# set seed 1# set seed ${rnum2}#g" Cards/madspin_card.dat + madspin_card_seed=`fgrep " set seed ${rnum2}" Cards/madspin_card.dat | awk '{print $3}'` + if [[ $madspin_card_seed -eq $rnum2 ]] ;then + echo "madevent seed = $rnum, madspin seed = $rnum2, madspin_card_seed = $madspin_card_seed" + else + echo "%MSG-MG5 Error: Madspin seed $madspin_card_seed doesnt match ( $rnum2 )" + exit 1 + fi +fi + +#generate events +bin/generate_events -fox -n ${name} + +if [[ -d Events/${name}_decayed_1 ]] + then + mv Events/${name}_decayed_1/events.lhe.gz $LHEWORKDIR/${name}_final.lhe.gz +else + mv Events/${name}/events.lhe.gz $LHEWORKDIR/${name}_final.lhe.gz +fi + +cd $LHEWORKDIR +gzip -d ${name}_final.lhe.gz +#cp ${name}_final.lhe ${name}_final.lhe.bak + +ls -l +echo + +exit 0 + diff --git a/GeneratorInterface/LHEInterface/src/LHEEvent.cc b/GeneratorInterface/LHEInterface/src/LHEEvent.cc index b27ab6484da24..1eeca224e6b15 100644 --- a/GeneratorInterface/LHEInterface/src/LHEEvent.cc +++ b/GeneratorInterface/LHEInterface/src/LHEEvent.cc @@ -104,15 +104,6 @@ LHEEvent::LHEEvent(const boost::shared_ptr &runInfo, } else continue; } - size_t found = line.find("amcatnlo"); - double NEVT = 1.0; - if ( found != std::string::npos) { - std::string avalue = line.substr(found+1,line.size()); - found = avalue.find("_"); - avalue = avalue.substr(found+1,avalue.size()); - NEVT = atof(avalue.c_str()); - } - hepeup.XWGTUP = hepeup.XWGTUP*NEVT; comments.push_back(line + "\n"); } diff --git a/SimDataFormats/GeneratorProducts/src/LHERunInfoProduct.cc b/SimDataFormats/GeneratorProducts/src/LHERunInfoProduct.cc index fe67c88ed5894..c97d8de2e95f5 100644 --- a/SimDataFormats/GeneratorProducts/src/LHERunInfoProduct.cc +++ b/SimDataFormats/GeneratorProducts/src/LHERunInfoProduct.cc @@ -239,7 +239,11 @@ bool LHERunInfoProduct::mergeProduct(const LHERunInfoProduct &other) if (header->tag() == "" || header->tag().find("Alpgen") == 0 || header->tag() == "MGGridCard" || - header->tag() == "MGGenerationInfo") { + header->tag() == "MGGenerationInfo" || + header->tag() == "MGRunCard" || + header->tag() == "mgruncard" || + header->tag() == "MadSpin" || + header->tag() == "madspin") { addHeader(*header); headers.insert(*header); } else