File indexing completed on 2024-04-06 12:13:49
0001
0002
0003
0004 EXPECTED_ARGS=6
0005
0006 if [ $
0007 then
0008 echo "Usage: `basename $0` repository name process card Nevents RandomSeed "
0009 echo "process names are: Dijet Zj WW hvq WZ W_ew-BW Wbb Wj VBF_Hgg_H W Z Wp_Wp_J_J VBF_Wp_Wp ZZ"
0010 echo "Example: ./create_lhe_powheg.sh slc5_ia32_gcc434/powheg/V1.0/src powhegboxv1.0_Jan2012 Z slc5_ia32_gcc434/powheg/V1.0/8TeV_Summer12/DYToEE_M-20_8TeV-powheg/v1/DYToEE_M-20_8TeV-powheg.input 1000 1212"
0011 exit 1
0012 fi
0013
0014 echo " ______________________________________ "
0015 echo " Running Powheg "
0016 echo " ______________________________________ "
0017
0018 repo=${1}
0019 echo "%MSG-POWHEG repository = $repo"
0020
0021 name=${2}
0022 echo "%%MSG-POWHEG name = $name"
0023
0024 process=${3}
0025 echo "%MSG-POWHEG process = $process"
0026
0027 cardinput=${4}
0028 echo "%MSG-POWHEG location of the card = $cardinput"
0029
0030 nevt=${5}
0031 echo "%MSG-POWHEG number of events requested = $nevt"
0032
0033 rnum=${6}
0034 echo "%MSG-POWHEG random seed used for the run = $rnum"
0035
0036 ncpu=${7}
0037 echo "%MSG-POWHEG thread count requested = $ncpu (ignored)"
0038
0039 seed=$rnum
0040 file="events"
0041
0042 export PRODHOME=`pwd`
0043 export RELEASE=${CMSSW_VERSION}
0044 export WORKDIR=`pwd`
0045
0046
0047 wget --no-check-certificate http://cms-project-generators.web.cern.ch/cms-project-generators/${cardinput} -O powheg.input
0048 card="$WORKDIR/powheg.input"
0049
0050
0051 scram project -n ${name} CMSSW ${RELEASE} ; cd ${name} ; mkdir -p work ; cd work
0052 eval `scram runtime -sh`
0053
0054
0055
0056
0057 export PATH=`pwd`:${PATH}
0058
0059
0060
0061
0062
0063 newinstallationdir=`scram tool info fastjet | grep FASTJET_BASE |cut -d "=" -f2`
0064 cp ${newinstallationdir}/bin/fastjet-config ./fastjet-config.orig
0065
0066 oldinstallationdir=`cat fastjet-config.orig | grep installationdir | head -n 1 | cut -d"=" -f2`
0067 sed -e "s#${oldinstallationdir}#${newinstallationdir}#g" fastjet-config.orig > fastjet-config
0068 chmod +x fastjet-config
0069
0070
0071 newinstallationdirlha=`scram tool info lhapdf | grep LHAPDF_BASE |cut -d "=" -f2`
0072 cp ${newinstallationdirlha}/bin/lhapdf-config ./lhapdf-config.orig
0073 oldinstallationdirlha=`cat lhapdf-config.orig | grep prefix | head -n 1 | cut -d"=" -f2`
0074 sed -e "s#prefix=${oldinstallationdirlha}#prefix=${newinstallationdirlha}#g" lhapdf-config.orig > lhapdf-config
0075 chmod +x lhapdf-config
0076
0077
0078
0079
0080 wget --no-check-certificate http://cms-project-generators.web.cern.ch/cms-project-generators/${repo}/${name}.tar.gz -O ${name}.tar.gz
0081 tar xzf ${name}.tar.gz
0082
0083
0084 patch POWHEG-BOX/cernroutines.f <<EOF
0085 *** POWHEG-BOX/cernroutines_orig.f Wed Mar 14 11:48:14 2012
0086 --- POWHEG-BOX/cernroutines.f Wed Mar 14 11:48:29 2012
0087 ***************
0088 *** 790,815 ****
0089
0090
0091
0092 ! c
0093 ! FUNCTION LENOCC (CHV)
0094 ! C
0095 ! C CERN PROGLIB
0096 ! C ORIG. March 85, A.Petrilli, re-write 21/02/89, JZ
0097 ! C
0098 ! C- Find last non-blank character in CHV
0099 !
0100 ! CHARACTER CHV*(*)
0101 !
0102 ! N = LEN(CHV)
0103 !
0104 ! DO 17 JJ= N,1,-1
0105 ! IF (CHV(JJ:JJ).NE.' ') GO TO 99
0106 ! 17 CONTINUE
0107 ! JJ = 0
0108 !
0109 ! 99 LENOCC = JJ
0110 ! RETURN
0111 ! END
0112 c
0113 c
0114 c
0115 --- 790,815 ----
0116
0117
0118
0119 ! ccccccc
0120 ! cccccc FUNCTION LENOCC (CHV)
0121 ! ccccccC
0122 ! ccccccC CERN PROGLIB
0123 ! ccccccC ORIG. March 85, A.Petrilli, re-write 21/02/89, JZ
0124 ! ccccccC
0125 ! ccccccC- Find last non-blank character in CHV
0126 ! cccccc
0127 ! cccccc CHARACTER CHV*(*)
0128 ! cccccc
0129 ! cccccc N = LEN(CHV)
0130 ! cccccc
0131 ! cccccc DO 17 JJ= N,1,-1
0132 ! cccccc IF (CHV(JJ:JJ).NE.' ') GO TO 99
0133 ! cccccc 17 CONTINUE
0134 ! cccccc JJ = 0
0135 ! cccccc
0136 ! cccccc 99 LENOCC = JJ
0137 ! cccccc RETURN
0138 ! cccccc END
0139 c
0140 c
0141 c
0142
0143 EOF
0144
0145 cd POWHEG-BOX/${process}
0146
0147 mv Makefile Makefile.orig
0148 cat Makefile.orig | sed -e "s#STATIC[ \t]*=[ \t]*-static#STATIC=-dynamic#g" | sed -e "s#PDF[ \t]*=[ \t]*native#PDF=lhapdf#g"> Makefile
0149 echo "LIBS+=-lz -lstdc++" >> Makefile
0150
0151
0152 LHA_BASE="`readlink -f "$LHAPATH/../../../"`"
0153
0154
0155 if [ `basename $LHA_BASE` == "5.8.5" ]
0156 then
0157 LHA_BASE="`echo "$LHA_BASE" | sed 's@slc5_amd64_gcc462/external/lhapdf/5.8.5@slc5_amd64_gcc462/external/lhapdf/5.8.5-cms@'`"
0158 fi
0159
0160 LHA_BASE_OLD="`$LHA_BASE/bin/lhapdf-config --prefix`"
0161 cat > lhapdf-config-wrap <<EOF
0162
0163 "$LHA_BASE/bin/lhapdf-config" "\$@" | sed "s|$LHA_BASE_OLD|$LHA_BASE|g"
0164 EOF
0165 chmod a+x lhapdf-config-wrap
0166
0167 make LHAPDF_CONFIG="`pwd`/lhapdf-config-wrap" pwhg_main
0168 mkdir workdir
0169 cd workdir
0170 cat ${card} | sed -e "s#SEED#${seed}#g" | sed -e "s#NEVENTS#${nevt}#g" > powheg.input
0171 cat powheg.input
0172 ../pwhg_main &> log_${process}_${seed}.txt
0173
0174 cat pwgevents.lhe | grep -v "Random number generator exit values" > ${file}_final.lhe
0175 ls -l ${file}_final.lhe
0176 pwd
0177 cp ${file}_final.lhe ${WORKDIR}/.
0178
0179
0180
0181 echo "Output ready with log_${process}_${seed}.txt and ${file}_final.lhe at `pwd` and $WORKDIR"
0182 echo "End of job on " `date`
0183 exit 0;