Recipes to run POWHEG BOX for event generation at NLO

POWHEG using CMSSW 5.1.x and above

In order to use POWHEG with CMSSW 5.1.x, the package GeneratorInterface/LHEInterface >= V00-07-13 is needed. Example of python conifguration file can be found in,

https://github.com/cms-sw/genproductions/tree/master/python/EightTeV

For instance,

https://github.com/cms-sw/genproductions/blob/master/python/EightTeV/DYToEE_M-20_CT10_8TeV-powheg_cfg.py

The powheg datacard whose path is specified in the CMSSW python configuration files are located here:

http://www.cern.ch/cms-gen/slc5_ia32_gcc434/powheg/V1.0/8TeV_Summer12/

The powheg code is downloaded by the CMSSW job from here:

http://www.cern.ch/cms-gen/slc5_ia32_gcc434/powheg/V1.0/src/

Two output files are produced, one root file in a format which is not yet supported by CMSSW, at the time these line are written and one ASCII file in Les Houches Event (LHE) format (file with the extension .lhe).

The hadronization can be run with the following cmsDriver command line:

cmsDriver.py MCDBtoEDM --conditions auto:mc -s NONE --eventcontent RAWSIM --datatier GEN --filein file:output.lhe

In order to run with a custom POWHEG datacard which is not in http://www.cern.ch/cms-gen/slc5_ia32_gcc434/powheg/V1.0/8TeV_Summer12/, edit the script,

GeneratorInterface/LHEInterface/data/create_lhe_powheg.sh

such that it retrieves the datacard from you local area instead of from the web space. See line,

http://cmslxr.fnal.gov/lxr/source/GeneratorInterface/LHEInterface/data/create_lhe_powheg.sh#045

This script contains the code which launches POWHEG from CMSSW. Alternatively of editing the script, you can run once CMSSW with one of the python config file from CVS in order to retrieve the POWHEG code for CMSSW environment and then run powheg directly from the POWHEG box using the pwhg_main program (see POWHEG manual). If you make it that way and you need to recompile pwhg_main, please look in the LHEInterface/data/create_lhe_powheg.sh script (CVS rev. >= 1.4) how the code is compiled (make LHAPDF_CONFIG="`pwd`/lhapdf-config-wrap" pwhg_main, where lhadpf-config-wrap is a script produced by create-lhe-powheg).

Set up the required environment - Old method

LHAPDF

The latest version of the LesHouchesAccordPDF interface must be installed and compiled. This package provide the libraries to interface generators to different PDF sets via the LesHouches accord.

  • download it from here and untar it somewhere. To install and compile, execute the following commands:
         ./configure --prefix=/yourpath/LHAPDF5.X.Y
         make
         make install 

  • after installation, export these environment variables in your working area, typically adding the following lines to your shell login script:
         export LHAPDFSYS=/yourpath/LHAPDF5.X.Y
         export PATH=${PATH}:${LHAPDFSYS}/bin
         export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${LHAPDFSYS}/lib 
         setenv LHAPDFSYS /yourpath/LHAPDF5.X.Y
         setenv PATH ${PATH}:${LHAPDFSYS}/bin
         setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${LHAPDFSYS}/lib 

  • finally, you will probably want to download some (NLO!) PDF sets, which can be found from here. Typically, you can use CTEQ6m or MSTW2008NLO. To download them, do as following:
         mkdir /yourpath/LHAPDF5.X.Y/share/lhapdf/PDFSets
         cd /yourpath/LHAPDF5.X.Y/share/lhapdf/PDFSets
         lhapdf-getdata cteq6mE.LHgrid
         lhapdf-getdata MSTW2008nlo_asmzrange.LHgrid 

FASTJET

The (latest) version of the FastJet package must be installed and compiled. It provides a fast implementation of the longitudinally invariant kt, longitudinally invariant inclusive Cambridge/Aachen, and anti-kt jet finder algorithms and a uniform interface to external jet finders (notably SISCone).

  • download it from here and untar it somewhere. To install and compile, execute the following commands:
         ./configure --prefix=/yourpath/FASTJET2.X.Y --enable-d0runiicone
         make
         make install 

  • after installation, export these environment variables in your working area, typically adding the following lines to your shell login script:
         export PATH=${PATH}:/yourpath/FASTJET2.X.Y/bin/ 
         setenv PATH ${PATH}:/yourpath/FASTJET2.X.Y/bin/ 

POWHEG BOX

The POWHEG BOX is a general computer framework for implementing NLO calculations in shower Monte Carlo programs according to the POWHEG method. More infos and references can be found here.
To download, install, and compile the package, do as following:

  • download it via SVN, with the command:
         svn checkout [--revision n] --username anonymous --password anonymous svn://powhegbox.mib.infn.it/releases/POWHEG-BOX-1.0 
    The optional argument --revision n is used to specify which svn version to get. Omitting the argument, one gets the latest version.

  • the main POWHEG-BOX folder contains different sub-folders, one for each process implemented. To compile the code, just do (e.g.):
         cd POWHEG-BOX/VBF_H
         make 
    The executable is created in the same sub-folder, with the name pwhg_main.

Run the event generator

The procedure to produce events is (nearly) the same for all subprocess:

  • change directory to the process sub-folder.

  • some SM parameters, such as W,Z,Higgs and quark masses, CKM couplings etc., are defined in a file called init_couplings.f, and they can be modified as required. This file is linked at compilation time, so any time it is modified, the sub-folder must be re-compiled!

  • some run parameters, such as the number of events to be produced, the center-of-mass energy, the PDF set to be used, etc., are defined in a file called powheg.input. This file is parsed at execution time, therefore there is no need to re-compile the sub-folder.

  • to run the event generator, simply execute pwhg_main. It is recommended to create a run sub-folder containing the pwhg_main and powheg.input files for each different run, and to launch the event generation from there.

Once the program is launched, it may take a while (up to ~1 day) to calculate the grids, and afterwards the event generation starts. Hard events in the form of a LesHouches file are saved in pwgevents.lhe.
A note on random number initialization: the last output in the LesHouches file is a string reporting the last random numbers shot by the generator. In case you want to add more (independent!) events to an existing run, be sure to uncomment the lines beginning with iseed, rand1 and rand2 in the powheg.input file and to write there the numbers read at the end of pwgevents.lhe.

Run the event generator in Milano-Bicocca

  • POWHEG BOX and all the necessary libraries are correctly installed in Milano-Bicocca cluster. The root folder of all programs and libraries is the following:
         /gwterax1/users/benaglia/Generators/ 
    An example of file to launch a production on the cluster CPU is found here:
        /gwterax1/users/benaglia/Generators/POWHEG-BOX/VBF_H/qqH150_WW_lnulnu_7TeV/lancia.sh 

  • a set of useful tools to split and merge LesHouches files are found under /gwpool/users/benaglia/bin and can be downloaded here below:

    • splitLheFile.cpp (download here)
      usage: splitLheFile inFile.lhe #eventsToSkip #eventsToCopy
      description: extract #eventsToCopy events from file inFile.lhe (skipping the first #eventsToSkip events) and copy them into out.lhe

    • mergeLheFiles.cpp (download here)
      usage: mergeLheFiles initialFile.lhe fileToAdd1.lhe fileToAdd2.lhe ...
      description: merge n LHE files into out.lhe

    • addProcToLheFile.cpp (download here)
      usage: addProcToLheFile initialFile.lhe IPROC
      description: add the header required to interface initialFile.lhe to Herwig (via CMSSW) and produces a new out.lhe. Need to specify the correct IPROC value for that process. The header added looks as following:
              <header>
              <herwig6header>
              IPROC = -1910
              </herwig6header>
              </header>
              
      process code
      ggH, H > WW -1610
      qqH, H > WW -1910
      tt -1706
      t -2000

Recipe for dummies

quick installation from scratch on a SL5 (15/08/2010)

  • exec bash
  • wget http://www.hepforge.org/archive/lhapdf/lhapdf-5.8.4.tar.gz
  • tar xzf lhapdf-5.8.4.tar.gz
  • cd lhapdf-5.8.4
  • export FC=g77
  • ./configure --prefix=/gwterax1/users/govoni/Generators/LHAPDF5.8.4
  • make
  • make install
  • export LHAPDFSYS=/gwterax1/users/govoni/Generators/LHAPDF5.8.4
  • export PATH=${PATH}:${LHAPDFSYS}/bin
  • export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${LHAPDFSYS}/lib
  • cd LHAPDF5.8.4/share/lhapdf/
  • mkdir PDFsets
  • cd PDFsets
  • wget http://svn.hepforge.org/lhapdf/pdfsets/5/cteq6mE.LHgrid
  • cd ../../../../
  • wget http://www.lpthe.jussieu.fr/~salam/fastjet/repo/fastjet-2.4.2.tar.gz
  • tar xzf fastjet-2.4.2.tar.gz
  • cd fastjet-2.4.2
  • ./configure --prefix=/gwterax1/users/govoni/Generators/FASTJET2.4.2
  • make install
  • export PATH=${PATH}:/gwterax1/users/govoni/Generators/FASTJET2.4.2/bin/
  • cd ..
  • svn checkout [--revision n] --username anonymous --password anonymous svn://powhegbox.mib.infn.it/releases/POWHEG-BOX-1.0
  • for VBF production
    • cd POWHEG-BOX/VBF_H
    • # modify the makefile with the new library paths according to the installations performed before
    • # modify the Makefile to let the compilation happen with g77
    • # modify init_couplings.f according to the needs of the production
    • make
  • for ggF production
    • cd POWHEG_BOX/gg_H
    • # modify the Makefile to let the compilation happen with g77
    • # modify init_couplings.f according to the needs of the production
    • # get powheg.init from one of the subfolders and modify it according to the needs
    • make

events production

  • go to the right folder with account "benaglia" and prepare the folder for generation
       cd /gwterax1/users/benaglia/Generators/POWHEG-BOX/gg_H
       cp -r ggH130_WW_lnulnu_CTEQ6m_7TeV new_folder_for_new_mass
       
  • modify the parameters in file powheg.input according to your needs
       hmass 170            ! Higgs boson mass
       hwidth 0.3724        ! Higgs boson width
       
  • modify the folder name in lancia.sh
  • delete the old grid files .dat before running the new generation
  • run the generation
       qsub -V -d ./ -q production lancia.sh
       
  • split the LHE files if the case with splitLheFile (for the herwig hadronization, the l v l v, l v T v, T v T v cases have to be distringuished - where l = e,mu)
  • add the header with the proper process to each LHE file, by means of addProcToLheFile, processes may be for example:
    process code
    qqH, H > WW -1910
    ggH, H > WW -1610

  • for the validation of the CMSSW production procedure (to be run from CMSSW_RELEASE/src/Configuration/GenProduction/python/):
    • prepare the environment:
            scram project CMSSW CMSSW_RELEASE
            cd CMSSW_RELEASE/src
            cvs co Configuration/GenProduction/python/PythiaUESettings_cfi.py
            cvs co Configuration/GenProduction/python/HERWIGPP_custom.py
            cvs co Configuration/GenProduction/python/PythiaUEP0Settings_cfi.py
            
    • prepare the fragment:
      • download an existing fragment
                 cvs co Configuration/GenProduction/python/CHOOSE_ONE_FRAGMENT_TO_MODOFY.py
                 
      • modify it according to the needs, change name and save it as GENERATOR_FRAGMENT_FOR_THE_PRODUCTION.py
    • test the reading of the MCDB article:
            cmsDriver.py SOME_NAME \
            -s NONE  --conditions START3X_V25::All \
            --filein=mcdb:MCDB_ARTICLE_ID \
            --datatier GEN -n 10
            
    • test the GEN step
            cmsDriver.py Configuration/GenProduction/python/GENERATOR_FRAGMENT_FOR_THE_PRODUCTION.py \
            -s GEN \
            --conditions START3X_V25::All \
            --datatier GEN-SIM-RAW \
            --eventcontent RAWSIM -n 10 \
            --customise Configuration/GenProduction/HERWIGPP_custom.py \
            --filein=file: FILE_PRODUCED_BY_THE_PREVOIUS_COMMAND_EXECUTION.root
            
    • test the production up to HLT
            cmsDriver.py Configuration/GenProduction/python/POWHEG_HERWIG6_ggH130_lvlv_7TeV_cff.py \
            -s GEN,SIM,DIGI,L1,DIGI2RAW,HLT \
            --conditions START3X_V25::All \
            --datatier GEN-SIM-RAW \
            --eventcontent RAWSIM -n 10   \
            --customise Configuration/GenProduction/HERWIGPP_custom.py \
            --filein=file:SAME_FILE_AS_BEFORE.root
            

hadronization with CMSSW

  • login to hercules and setup the slc4 environment (for the CMSSW_3_1_6):
       source  /gwpool/initcms/slc4-cmssw.(c)sh
       
  • go to the CMSSW folder and, if necessary, prepare the release
       cd /gwterax1/users/benaglia/Generators/CMSSW
       scram project CMSSW CMSSW_3_1_6
       

scripts for the LHE products handling

Scripts can be found in the attached scripts.tgz file.

setHeader.sh

Sets an header that can be read by the upload2mcdb_hepml.pl script. Makes use of prova_header.lhe.

shorten.sh

Removes the last line of a file, used to get rid of the very last "#Random..." line, which prevents the CMS production to run. An example of usage:
for fil in `find . -name "*lhe" | grep -v 7TeV` ; do \
../../shorten.sh $fil ;
done

splitLheFile.cpp

Divides the LHE files into smaller pieces. An example of usage:
   for fol in `ls | grep ggH_ZZ_2l2b_inf_` ; do  echo $fol ; cd $fol ;
   ../../../splitLheFile pwgevents.lhe 0 110000 $fol.2v2b.lhe ;
   ../../../splitLheFile pwgevents.lhe 110000 110000 $fol.2e2b.lhe ;
   ../../../splitLheFile pwgevents.lhe 220000 110000 $fol.2u2b.lhe ;
   cd .. ; done 

upload2mcdb_hepml.pl

Uploads the LHE file to MCDB automatically. An example of usage:
../../upload2mcdb_hepml.pl --header hepml --category "H and Z/W" ./qqH_WW_lvlv_fast_230/h_qqH_WW_lvlv_fast_230.TvTv.lhe

-- AndreaBenaglia - 14-Apr-2010

Topic attachments
I Attachment History Action Size Date Who Comment
C source code filecpp addProcToLheFile.cpp r1 manage 1.0 K 2010-12-21 - 15:05 AndreaBenaglia  
C source code filecpp mergeLheFiles.cpp r1 manage 1.9 K 2013-01-07 - 23:39 AndreaBenaglia  
Compressed Zip archivetgz scripts.tgz r1 manage 9.2 K 2011-01-12 - 11:03 PietroGovoni  
C source code filecpp splitLheFile.cpp r2 r1 manage 1.3 K 2010-12-21 - 15:04 AndreaBenaglia  
Edit | Attach | Watch | Print version | History: r29 < r28 < r27 < r26 < r25 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r29 - 2014-09-09 - PhilDudero
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback