Page Contents

  1. MadWeight5
    1. Installing the code
    2. Running the code
    3. Tutorial
  2. MadWeight2


Installing the code

program dependencies

  1. Python version 2.6 or 2.7
  2. A fortran compiler (we have tested g77 and gfrotran)
  3. A unix based machine (Linux or Mac but not Windows)
  4. bash
  5. This programs requires typically on a cluster. We currently support (most of) the following cluster:
    • condor
    • pbs
    • SGE
    • SLURM
    • GE
    • LSF
    We can provide help for any type of cluster. A multi-core modes exists as well.


  1. Install the latest MG5_aMC (2.1.0 and later). MadWeight is included in that version. You are ready to go!

Running the code

How to create a MW run?

  1. Execute the script "mg5_amc" inside the bin directory of the MG5_aMC directory.
  2. If you never used MG5, please type "tutorial" and follow instruction.
  3. To create a MadWeight code just type "output madweight PATH" instead of the usual "output PATH"
  4. You have created your MadWeight run. You can either go to the created directory and type "./bin/" to run that code or just type "launch PATH" inside the current interface.

Running MadWeight (input files-parametrisation)?

  1. You can run MadWeight either from the created directory (via the command "./bin/") or via the main mg5_amc shell (with the command "launch PATH")
  2. The code ask you then the following question:
    Do you want to edit a card (press enter to bypass editing)?
      1 / param      : param_card.dat
      2 / run        : run_card.dat
      3 / madweight  : madweight_card.dat
      4 / transfer   : transfer_card.dat
      5 / lhco       : input.lhco
     you can also
       - enter the path to a valid card or banner.
       - use the 'set' command to modify a parameter directly.
         The set option works only for param_card, run_card and madweight_card.
         Type 'help set' for more information on this command.
       - use the 'change_tf' command to set a transfer functions.
     [0, done, 1, param, 2, run, 3, madweight, 4, enter path, ... ][60s to answer]
    • If this is the first time you run in that directory, You *have to* type "change_tf" to define your transfer_function
    • You can type a number to edit the related cards.
      • run_card.dat -> impose some cut in your phase space integration (Normaly you have to remove all cut for MadWeight except if you have divergencies)
      • param_card.dat (initial value for the theoretical parameter: some parameter can be different in running time following what is asked in MadWeight_card.dat->see run option)
      • transfer_card.dat -> See TransferFunction
      • MadWeight_card.dat -> See below
    • You can enter the path to your events sample either here or inside MadWeight_card.

Output format

You have two output file: Events/${RUN_NAME}/weights.out and Events/${RUN_NAME}/output.xml. Note that the weights are NOT normalized to the cross-section. You have to compute tha

  1. weights.out:
      1 1 1 2.86248722993e-26 3.20462163546e-28
    • The first three column are respectively: the LHCO_event_number, the theoretical hyppothesis number, the transfer function parameter set number.
    • The two latest numbers are the value of the weight and the associate error.
  2. output.xml This files contains all the details associate to the computation written in a xml way. By default this output format didn't contain additional information compare to the weights.out, but if you change the log_level in the MadWeight card, then it can contain the value of each jet-parton permutation as well as the (technical) value associate to each channel of integration and potentially the full log associate to each jobs.

More options

  • More options are available via the executable: ./bin/mw_options. This open an invite of commands where you can call each step of the code, redifine your transfer functions, launch a refine and so on. You can type help to have more details on the various options.
  • All the options described for MW2 below are still accessible in the same way (IF they still makes sense like the dir options.).



Note that this version is not maintained anymore.

What is needed to run MadWeight (software)?

  1. MadWeight is MadGraph based, so you need all the software needed to run it in single machine (bash, csh, f77, g77, ...)

Root is not needed

  1. MadWeight uses python scripts. So python must be installed on your computer. The program was created/tested with python 2.4.
  2. MadWeight runs with on different type of cluster (single machine, condor, SGE, BASH). A implementation on any other cluster (like 'pbs' for example) will be done (in one or two day) on demand.
  3. MadWeight can create automatically the graph for the likelihood, for this the code need gnuplot

How to start

  1. First you need to have the full package of MadGraph.
  2. You have to duplicate the template directory with a funny name. $>cp -r Template My_proc
  3. You must enter in your process $> cd My_proc
  4. You must switch to MadWeight mode $> ./bin/PassToMadWeight
  5. You must parametrize your proc_card.dat. The paramatrization of the proc_card needs your process in the DECAY CHAIN format, i.e. the W production should be pp > (W+ > e+ve). The MadWeight package also require the knowledge of a transfer functions (but this information can be change after the generation)
  6. You can run MadGraph $> ./bin/newprocess

Your are ready now!!

What is needed to run MadWeight (input files-parametrisation)?

  1. First you need to define your TransferFunction, if there are not well defined already. Follow TransferFunction instructions to create a new one. To use another TransferFunction, you can run the script $> ./bin/
  2. Secondly, you need a sample of event in the LHCO format. This must be placed in the directory "Events" under the name "input.lhco".
  3. Finally, you have to fill in all the following cards.
    • run_card.dat -> impose some cut in your phase space integration (Normaly you have to remove all cut for MadWeight except if you have divergencies)
    • transfer_card.dat -> See TransferFunction
    • MadWeight_card.dat -> See below
    • param_card.dat (initial value for the theoretical parameter: some parameter can be different in running time following what is asked in MadWeight_card.dat->see run option)

How to run and output information

As everything is configured you can simply launch the main schedullar: $> ./bin/

All the result will be putted in the directory Events/MY_NAME. where MY_NAME is the name of the process in the run_card.dat (by default it is fermi) depending of your run option some output file couldn't be there:

MY_NAME_banner.txtall card information leshouches accord
MY_NAME_cross_weights.out cross section for the full process "card_number" "value" "uncertainty" (cross section is given in GeV-2)
MY_NAME_norm_weights.out normalized weight (with cross section) "card_number"."event_number" "value" "uncertainty"
MY_NAME_weights.out unormalized weight "card_number"."event_number" "value" "uncertainty"
input.lhco input events for your analisys leshouches accord

If you want some weight for specific subprocesses, some those output are available in ./SubProcesses/Process_dir/MY_NAME/ cross section are given in P_... directories and weight in MW_P_... directories.

In order to parametrize your local SGE cluster (if you run with this type of cluster), you can edit the file ./Source/MadWeight_File/Tools/sge_schedular

How to run the code partially

They are 6 possibilities:

  • $> ./bin/ -ijk :launches only step i,j,k (all three are integer)
  • $> ./bin/ -i+ :launches all steps after (including) step i
  • $> ./bin/ -i- :launches all steps before (including) step i
  • $> ./bin/ A B C :launches only step A B C (all three are step name)
  • $> ./bin/ A+ :launches all steps after (including) A
  • $> ./bin/ A- :launches all steps before (including) A The different steps are the following:
step value (i) step name (A) program caracteristic
1 param Card creation Creates all the param_card.dat if asked in MadWeight_card
2 analyzer MadweightAnalyzer Analyzes the feynman diagrams, the transfer function and creates the fortran code for the integration
3 compilation Compilation Final compilation for all the SubProcesses
4 event Verif_event Verification of the LHCO file. select the event containing, the exact number of jet/electron/muon.
5 dir Create_dir Creates the directory for each parralel run (one run by param_card and by event)
6 launch launch_job Launches the computation of the weights in the condor cluster
7 control control_job launches the control of the status of the run
8 collect collect_data collects all the data
9 plot plot launches the plot for the likelihood and of some distributions

More option

You can use four more options

-help provides some help
-version provides the version number
relaunch available after the step eight (collect). If some job crashed (or gives zero result) you can relaunch those with this option.
clean[=NAME] When the step 8 (collect) fully succeed and the run is succeeded and finish. you can suppress the event by event log/input/output. This save a lot of memory.\
optional parameter NAME autorizes to clean old run.
refine=VALUE relaunch all the integration where the precision are worse than value. (include since version 2.1.6)

Example of the code.

In the following, we will give you all the information needed to reproduce example presented in articles/procedings/...

  1. WMassMeasurmentExample: determination of the W mass.
  2. SpinMeasurmentExample: discrimination between two spin hyppothesys.

-- Main.OlivierMattelaer - 17 Nov 2008

Last modified 5 years ago Last modified on 02/03/14 15:27:35