Modified Instructions for generating MC in cdf v6.1.4_mc

  1. We first generate the Madgraph events. Then, we have to modify the Madgraph code in order to fix lepton masses and to convert the madgraph output to the old format. Finally, we simulate and run production on the CAF.
    Please, be aware the your tarball should be compiled on a computer with SLF V4 for better CAF compatibility. Also you may want to strip your executables to make them smaller.
  2. Go to http://madgraph.phys.ucl.ac.be/. Register for a user name and password if you don't have one already. Enter as the process b g > l+l- b. The browser will be directed to a page with a link to download the code. Download the code into a new directory and unpack it (tar zxvf madevent.tar.gz).
  3. We need to edit the Cards/run-card.dat file to get the correct settings for the Tevatron. The easiest thing to do is to just copy the one from /cdf/data49a/paramon/MG_ME_V4.0/sasha_proc1/Cards/run_card.dat. However, you have to replace the line 2 = lpp2 with -1 = lpp2. lpp2 is the 2nd beam type; at the Tevatron, it's anti-protons which is what -1 means. I have no idea what 2 means.
  4. Now generate the events:
    ./bin/generate_events 0 Zb Zb
  5. When this stops running, there will be the file Zb_unweighted_events.lhe.gz in the directory
  6. No we are going to convert your *.lhe file to the old Magraph format and fix the lepton masses at the same time.

    Ssh to cdf49.uchicago.edu, and create a new directory in your scratch space. Move the unweighted events to this new directory and use gunzip to unpack the file (gunzip Zb_unweighted_events.dat).
  7. cd /cdf/data49a/paramon/lhe_pymass/
  8. Edit mapyex.f. The MAPYEX routine converts from the new Madgraph event format .lhe into the old format .dat. In addition the program fixes the masses of fermions (some of those are zero by default so that your muons may look like electrons).
    The program was originally written by  Johan Alwall in 2005. Then is was corrected/validated by Steve Mrenna and me. It is based on  MadEvent-Pythia interface madpyt.
    We need to give the input and output files.

    The input file is a *.lhe file.
    e.g. OPEN (LNHIN, FILE='tzc_unweighted_events.lhe', ERR=90 )

    The output file is in the line
    OPEN (81,file='tzc.gen',status='unknown',form='formatted')

    Change this to whatever you wish.
  9. Back in the directory on your scratch space, type 'make'.
  10. Type ./mapyex to run the program. After this quits, it will tell you how many events passed. Remember this for later.
  11. Now that we have a correct madgraph file, we need to run it through simulation and production. To do this, go to another area on your scratch
    space and copy the files from /cdf/scratch/paramon/mc_6.1.4mc/
  12. Go into this directory. Copy the modified Madgraph file to the dat/ directory.
  13. Now, edit the file config_zstuff_madgraph.tcsh. Change the variable MG_TTBARG to the modified Madgraph file. The variable D_MG_TTBARG gives the book name. For us, this can be whatever we want
    (though it's best to keep the same format -- ?ewk?? -- to ensure nothing breaks), but if we were to run these officially, we'd need to get a name from some higher power. Finally, set the variable
    N_MG_TTBARG to the number of events in the modified Madgraph file, which is the output of Soshi's code.
  14. Run config_zstuff_madgraph.tcsh. It will give you a list of parameters to check if they're ok. They should be, so type 'y'. This creates the file mcProduction/book/cdfpewk/zewk0b. Check to make sure
    this is ok. Also, remember the N_SECTIONS parameter in this file and NEV_PER_SECTION, which should be 2000. We'll need them later.
  15. Now you want to add a few lines to your dataset definition file (mcProduction/book/cdfpewk/zewk0b)

    EVENT_SIZE 300
    SEGMENT_SIZE 500
    FILTER_EFF 100


    The modified file should look like:

    #-------------------------------------------------------------
    # ME-based generator interfaced by LesHouchesModule.
    #-------------------------------------------------------------
    DSID zewk0b
    BOOK cdfpewk
    DSNAME ME_based_generator
    GENERATION_MODE 0
    MC_PROCESS_TCL run_LesHouches_zexo0b.tcl
    FILTER_TCL mc_postgenNoFilter.tcl
    MINBIAS_TCL mc_Pythia_Minbias.tcl
    NEV_PER_INV_NB 0.0870259663102952
    NEV_PER_SECTION 2000
    FIRST_RUN 141572
    LAST_RUN 212133
    RUN_LIST runlist_si_1invfb
    N_SECTIONS 1524
    EVENT_SIZE 300
    SEGMENT_SIZE 500
    FILTER_EFF 100
    #-------------------------------------------------------------
  16. Now, we need to add some files to the tarball we're going to submit to the CAF:

    a. gunzip MCProd_6_1_4mc_b.tar.gz

    b. tar --file MCProd_6_1_4mc_b.tar --append dat/zb_unweighted_events.dat (this is the modified Madgraph output)

    c. tar --file MCProd_6_1_4mc_b.tar --append mcProduction/tcl/run_LesHouches_zewk0b.tcl (here and below, replace zewk0b with the dataset name if necessary)

    d. tar --file MCProd_6_1_4mc_b.tar --delete mcProduction/book/cdfpewk/zewk0b (if you get an error here, don't worry about it)

    e. tar --file MCProd_6_1_4mc_b.tar --append mcProduction/book/cdfpewk/zewk0b

    f. gzip MCProd_6_1_4mc_b.tar

  17. Before submissions we need to find out two things:


    a. Number of sections.
    To find the # of section execute:
    mcProduction/scripts/DSdef2SegmentList mcProduction/book/cdfpewk/zewk0b 500 300 0 100

    i.e.
    mcProduction/scripts/DSdef2SegmentList mcProduction/book/cdfpewk/zewk0b SEGMENT_SIZE EVENT_SIZE 0 FILTER_EFF


    b. Output destination

    If you don't know this, open up icaf_gftp (setup cdfsoft2 development and kinit first). The right hand side of the window should say something like: ftp://cwolfe@fcdfdata113.fnal.gov/export/data1/cwolfe/icaf
    So, the output destination in this case is cwolfe@fcdfdata113.fnal.gov:/export/data1/cwolfe/icaf
    Remember it for later use.

    * Do not forget about ':'
  18. Finally, we can submit the jobs; first we start with a small test job:

    Put your output destination instead of cwolfe@fcdfdata113.fnal.gov/export/data1/cwolfe/icaf

    ./mcProduction/scripts/submit_MCProd -f caf -b cdfpewk -d zewk0b -q long -o cwolfe@fcdfdata113.fnal.gov:/export/data1/cwolfe/icaf -t MCProd_6_1_4mc_b.tar.gz -s 1:1

    Wait till that finishes, and check the output (did it run ok?). If things are fine, run over the whole set:

    ./mcProduction/scripts/submit_MCProd -f caf -b cdfpewk -d zewk0b -q long -o cwolfe@fcdfdata113.fnal.gov:/export/data1/cwolfe/icaf -t MCProd_6_1_4mc_b.tar.gz -s 1:n

    *where n is the number of sections.
  19. Finally, when those jobs are done, copy the output to a directory on the disk /cdf/s3/ on the local Chicago cluster. Then we can ntuple...

    *To copy your production file to a local disk you may do:

    kinit -f
    ssh cwolfe@fcdfdata113.fnal.gov
    cd /export/data1/cwolfe/icaf
    ....
  20. If something does not work, please tell me.