wiki:Reweight

Version 14 (modified by Olivier Mattelaer, 9 years ago) ( diff )

--

Description of the method

The method consist to use a sample of events (weighted or unweighted events) and associate to those events a new weight corresponding to a new theoretical hypothesis. This weight can be propagate through the all simulation chain in order to avoid to have to perform the full-simulation on a huge number of sample. This methods works only if the original hypothesis and the new one are both significant in the same part of the phase-space. the new weight is given by $$W_{new} = |M_{new}|2 /|M_{old}|2 * W_{old} $$

Technical details

Limitation

  1. The two theoretical hypothesis should differ ONLY by difference in the model parameters. So this should be the same pdf/cut (you can change model and process definition).
  2. The scale choice for the reweighting is done events by events and is given by the value in the LHE file. The same scale is used for both Hypothesis.
  3. In presence of decay chain the order of the particle in the events file is important. This is important if you want to use this tools with LHE events not produced by MadGraph/MadEvent.

How to get the code

The code is released with any Madgraph version (since 2.0)

Do I need special package

Starting from MG5.2.3.2, you need to have f2py on your machine. The easiest way to install f2py is to install numpy (if not already done).

How to use the code on the flight.

When running the generation of events (./bin/generate_events from the local directory or "launch" via the mg5 interface) you will have two questions. The first one is:

The following switches determine which programs are run:
 1 Run the pythia shower/hadronization:                   pythia=NOT INSTALLED
 2 Run PGS as detector simulator:                            pgs=NOT INSTALLED
 3 Run Delphes as detector simulator:                    delphes=NOT INSTALLED
 4 Decay particles with the MadSpin module:              madspin=OFF
 5 Add weight to events based on coupling parameters:   reweight=OFF
  Either type the switch number (1 to 5) to change its default setting,
  or set any switch explicitly (e.g. type 'madspin=ON' at the prompt)
  Type '0', 'auto', 'done' or just press enter when you are done.
 [0, 4, 5, auto, done, madspin=ON, madspin=OFF, madspin, reweight=ON, ... ][60s to answer] 
>

As you can see the reweight options is OFF by default, to set it on you can either type "5" (not adviced if you script) or "reweight=ON". Then you should have:

The following switches determine which programs are run:
 1 Run the pythia shower/hadronization:                   pythia=NOT INSTALLED
 2 Run PGS as detector simulator:                            pgs=NOT INSTALLED
 3 Run Delphes as detector simulator:                    delphes=NOT INSTALLED
 4 Decay particles with the MadSpin module:              madspin=OFF
 5 Add weight to events based on coupling parameters:   reweight=ON
  Either type the switch number (1 to 5) to change its default setting,
  or set any switch explicitly (e.g. type 'madspin=ON' at the prompt)
  Type '0', 'auto', 'done' or just press enter when you are done.
 [0, 4, 5, auto, done, madspin=ON, madspin=OFF, madspin, reweight=ON, ... ][60s to answer] 

Then the second question is (after that you just press enter on that question):

Do you want to edit a card (press enter to bypass editing)?
  1 / param     : param_card.dat
  2 / run       : run_card.dat
  3 / reweight  : reweight_card.dat
 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 and run_card.
     Type 'help set' for more information on this command.
 [0, done, 1, param, 2, run, 3, reweight, enter path][60s to answer] 

You HAVE TO define/edit the reweight_card.dat, the syntax is explained in the file. The default file is basically empty and will make the re-weighting to crash since both theoretical hypothesis are identical.

How to use the code afterwards.

You can also use the madevent interface as explained below:

  1. go to the process directory.
  2. launch the ./bin/madevent script
  3. type reweight RUN_NAME
  4. then you will see the following question:
    Do you want to edit one cards (press enter to bypass editing)?
      1 / reweight  : reweight_card.dat
     you can also
       - enter the path to a valid card.
     [0, done, 1, reweight, enter path][60s to answer]
    
    If you didn't define the content of this file already. You need to do it. The syntax is explained inside the file, and you can see example below (validation section). The important point, is that the first line should be launch, and then you specify which parameter, you want to modify. This is the exact same syntax has for scripting a scan over parameter.
  5. exit the file and you are done (the script will run).

If the file Cards/reweight_card.dat is already defined, you can launch the script with

./bin/madevent reweight RUN_NAME -f

The -f options prevent the question to be asked.

Options

Note all the following options will be available in MG5 version 2.3.2

  1. "change model <XXX>" performed the reweighting within a new model (you then need to profide a full param_card and not a difference)
  2. "change process <XXX>" change the process definition of the process.
  3. "change process <XXX> --add" add one process definition of the process to the new list.
  4. "change output <i>": Three options: 'default'(i.e. lhef version3 format), '2.0' (i.e. lhef version2 format, the main weight is replace), 'unweight' (a new unweighting is applied on the events sample.)
  5. "change helicity <True|False>": perform reweighting for the given helicity (True --default--) or do the sum over helicity.
  6. "change rwgt_dir <PATH>": change directory where the computation is performed. This can be use to avoid to recreate/recompile the fortran executable if pointing to a previously existing directory.

Input/Output format

  1. the output format follows the Leshouches agreement (not yet published): http://phystev.in2p3.fr/wiki/2013:groups:tools_lheextension#the_proposal

as an example the header looks like:

<initrwgt>
<weightgroup type='mg_reweighting'>
<weight id='mg_reweight_1'>set param_card dim6 1 100.0
</weight>
<weight id='mg_reweight_2'>set param_card dim6 2 100.0
</weight>
<weight id='mg_reweight_3'>set param_card dim6 3 100.0
</weight>
</weightgroup>
</initrwgt>

and one associated events:

<event>
 8      0 +7.9887000e-06 1.24664300e+02 7.95774700e-02 1.23856500e-01
        1 -1    0    0  501    0 +0.0000000e+00 +0.0000000e+00 +1.3023196e+03 1.30231957e+03 0.00000000e+00 0.0000e+00 -1.0000e+00
       -2 -1    0    0    0  501 +0.0000000e+00 +0.0000000e+00 -1.4499581e+02 1.44995814e+02 0.00000000e+00 0.0000e+00 1.0000e+00
      -24  2    1    2    0    0 -1.2793809e+01 -8.3954553e+01 -1.1792566e+02 1.65987064e+02 8.02071978e+01 0.0000e+00 0.0000e+00
       23  2    1    2    0    0 +1.2793809e+01 +8.3954553e+01 +1.2752494e+03 1.28132832e+03 9.12640692e+01 0.0000e+00 0.0000e+00
       11  1    3    3    0    0 -1.2462673e+01 +1.3647422e+01 -2.6083861e+01 3.19677669e+01 0.00000000e+00 0.0000e+00 -1.0000e+00
      -12  1    3    3    0    0 -3.3113586e-01 -9.7601975e+01 -9.1841804e+01 1.34019297e+02 0.00000000e+00 0.0000e+00 1.0000e+00
        4  1    4    4  502    0 -1.8321803e+01 +9.0929609e+01 +9.3905973e+02 9.43629724e+02 0.00000000e+00 0.0000e+00 -1.0000e+00
       -4  1    4    4    0  502 +3.1115612e+01 -6.9750557e+00 +3.3618969e+02 3.37698598e+02 0.00000000e+00 0.0000e+00 1.0000e+00
<rwgt>
<wgt id='mg_reweight_1'> 4.55278761371e-06 </wgt>
<wgt id='mg_reweight_2'> 2.65941887458e-06 </wgt>
<wgt id='mg_reweight_3'> 8.68203803896e-06 </wgt>
</rwgt>
</event>
  1. The reweight_card in that case was:
    launch
       set Dim6 1 100
       set Dim6 2 0
       set Dim6 3 0
       set Dim6 4 0
       set Dim6 5 0
    launch
       set Dim6 1 0
       set Dim6 2 100
       set Dim6 3 0
       set Dim6 4 0
       set Dim6 5 0
    launch
       set Dim6 1 0
       set Dim6 2 0
       set Dim6 3 100
       set Dim6 4 0
       set Dim6 5 0
    

Note:

  1. The production events were in this case made via the SM where all those coefficient were in fact set to zero. Therefore all the line setting the line to zero were superfluous, and this is the reason why they didn't appear in the banner.
  2. You can also specify a path to a param_card in the reweight_card. The content of the header being computed automatically with the difference of the two param_card.

  1. The cross-section of the original file and those associated with the new hyppothesis are printed at the end of the script:
    INFO: Original cross-section: 0.80086112072 +- 0.0025669959099 pb 
    INFO: Computed cross-section: 
    INFO: 119 : 5.0238030968 
    INFO: 120 : 4.46724081967 
    INFO: 121 : 0.790019392142 
    
  1. An example of the full log is:
    ************************************************************
    *                                                          *
    *           W E L C O M E  to  M A D G R A P H  5          *
    *                      M A D E V E N T                     *
    *                                                          *
    *                 *                       *                *
    *                   *        * *        *                  *
    *                     * * * * 5 * * * *                    *
    *                   *        * *        *                  *
    *                 *                       *                *
    *                                                          *
    *         VERSION 2.0.0.beta3           2013-02-14         *
    *                                                          *
    *    The MadGraph Development Team - Please visit us at    *
    *    https://server06.fynu.ucl.ac.be/projects/madgraph     *
    *                                                          *
    *               Type 'help' for in-line help.              *
    *                                                          *
    ************************************************************
    INFO: load configuration from /Users/omatt/.mg5/mg5_configuration.txt  
    INFO: load configuration from /Users/omatt/Documents/eclipse/reweight_module/PROC_sm_11/Cards/me5_configuration.txt  
    INFO: load configuration from /Users/omatt/Documents/eclipse/reweight_module/input/mg5_configuration.txt  
    INFO: load configuration from /Users/omatt/Documents/eclipse/reweight_module/PROC_sm_11/Cards/me5_configuration.txt  
    MGME5>reweight run_01
    Do you want to edit one cards (press enter to bypass editing)?
      1 / reweight  : reweight_card.dat
     you can also
       - enter the path to a valid card.
     [0, done, 1, reweight, enter path][60s to answer] 
    >1
    open /Users/omatt/Documents/eclipse/reweight_module/PROC_sm_11/Cards/reweight_card.dat
    Do you want to edit one cards (press enter to bypass editing)?
      1 / reweight  : reweight_card.dat
     you can also
       - enter the path to a valid card.
     [0, done, 1, reweight, enter path] 
    >
    INFO: Extracting the banner ... 
    INFO: process: p p > e+ e- 
    INFO: options:  
    INFO: Running Reweight 
    launch
    INFO: detected model: sm. Loading... 
    INFO: generating the square matrix element for reweighting 
    INFO: generate p p > e+ e- ; 
    INFO: Done 1.197 
    set aewm1 100
    INFO: modify param_card information BLOCK sminputs with id (1,) set to 100.0 
    Do you want to edit one cards (press enter to bypass editing)?
      1 / param     : param_card.dat
      9 / plot      : plot_card.dat
     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 and run_card.
         Type 'help set' for more information on this command.
     [0, done, 1, param, 9, plot, enter path]
    The answer to the previous question is not set in your input file
    Use 0 value
    INFO: starts to compute weight for events with the following modification to the param_card: 
    INFO: set param_card sminputs 1 100.0 
     
    INFO: Event nb 0 current time: 23h39 
    INFO: Event nb 1000  0.61s  
    INFO: Event nb 2000  1.1s  
    INFO: Event nb 3000  1.5s  
    INFO: Event nb 4000  2.1s  
    INFO: Event nb 5000  2.5s  
    INFO: Event nb 6000  2.9s  
    INFO: Event nb 7000  3.3s  
    INFO: Event nb 8000  3.8s  
    INFO: Event nb 9000  4.2s  
    INFO: All event done  (nb_event: 10000)  4.6s  
    INFO: Event /Users/omatt/Documents/eclipse/reweight_module/PROC_sm_11/Events/run_01/unweighted_events.lhe have now the additional weight 
    INFO: new cross-section is : 1135.25 pb 
    launch
    set aewm1 200
    INFO: modify param_card information BLOCK sminputs with id (1,) set to 200.0 
    Do you want to edit one cards (press enter to bypass editing)?
      1 / param     : param_card.dat
      9 / plot      : plot_card.dat
     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 and run_card.
         Type 'help set' for more information on this command.
     [0, done, 1, param, 9, plot, enter path]
    The answer to the previous question is not set in your input file
    Use 0 value
    INFO: starts to compute weight for events with the following modification to the param_card: 
    INFO: set param_card sminputs 1 200.0 
     
    INFO: Event nb 0 current time: 23h39 
    INFO: Event nb 1000  0.48s  
    INFO: Event nb 2000  1s  
    INFO: Event nb 3000  1.5s  
    INFO: Event nb 4000  2s  
    INFO: Event nb 5000  2.4s  
    INFO: Event nb 6000  2.9s  
    INFO: Event nb 7000  3.3s  
    INFO: Event nb 8000  3.8s  
    INFO: Event nb 9000  4.2s  
    INFO: All event done  (nb_event: 10000)  4.7s  
    INFO: Event /Users/omatt/Documents/eclipse/reweight_module/PROC_sm_11/Events/run_01/unweighted_events.lhe have now the additional weight 
    INFO: new cross-section is : 1095.28 pb 
    launch
    set aewm1 300
    INFO: modify param_card information BLOCK sminputs with id (1,) set to 300.0 
    Do you want to edit one cards (press enter to bypass editing)?
      1 / param     : param_card.dat
      9 / plot      : plot_card.dat
     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 and run_card.
         Type 'help set' for more information on this command.
     [0, done, 1, param, 9, plot, enter path]
    The answer to the previous question is not set in your input file
    Use 0 value
    INFO: starts to compute weight for events with the following modification to the param_card: 
    INFO: set param_card sminputs 1 300.0 
     
    INFO: Event nb 0 current time: 23h39 
    INFO: Event nb 1000  0.62s  
    INFO: Event nb 2000  1.1s  
    INFO: Event nb 3000  1.5s  
    INFO: Event nb 4000  2s  
    INFO: Event nb 5000  2.5s  
    INFO: Event nb 6000  2.9s  
    INFO: Event nb 7000  3.4s  
    INFO: Event nb 8000  3.8s  
    INFO: Event nb 9000  4.3s  
    INFO: All event done  (nb_event: 10000)  4.7s  
    INFO: Event /Users/omatt/Documents/eclipse/reweight_module/PROC_sm_11/Events/run_01/unweighted_events.lhe have now the additional weight 
    INFO: new cross-section is : 1329.52 pb 
    INFO: Original cross-section: 949.58665707 +- 2.2589158361 pb 
    INFO: Computed cross-section: 
    INFO: 1 : 1135.24526333 
    INFO: 2 : 1095.27584154 
    INFO: 3 : 1329.51775579 
    

Validation

  1. The comparison for the full cross-section are done like this:

./bin/madevent ./Cards/reweight_card.dat

p p > e+ e- cross-section

  1. The reweight_card is the following:
    launch
     set aewm1 100
    launch 
     set aewm1 200
    launch 
     set aewm1 300
    
  2. The associated cross-section are
    1. 1135.25 pb
    2. 1095.28 pb
    3. 1329.52 pb
  3. The cross-section computed with MadEvent are
    1. 1130 +- 2.815 pb
    2. 1098 +- 2.478 pb
    3. 1336 +- 2.777 pb

EWDIM6 Validation

input

  1. The model use for this validation is the EWDIM6 (See: http://arxiv.org/abs/arXiv:1205.4231). 10k events where generated with the standard model (cross-section: 0.8008 ± 0.0026 pb)
  2. The reweight_card was:
    launch
       set Dim6 1 100
       set Dim6 2 0
       set Dim6 3 0
       set Dim6 4 0
       set Dim6 5 0
    launch
       set Dim6 1 10
       set Dim6 2 0
       set Dim6 3 0
       set Dim6 4 0
       set Dim6 5 0
    launch
       set Dim6 1 1
       set Dim6 2 0
       set Dim6 3 0
       set Dim6 4 0
       set Dim6 5 0
    launch
       set Dim6 1 0.1
       set Dim6 2 0
       set Dim6 3 0
       set Dim6 4 0
       set Dim6 5 0
    launch
       set Dim6 1 0.01
       set Dim6 2 0
       set Dim6 3 0
       set Dim6 4 0
       set Dim6 5 0
    

The same scan was done for the three first coupling (CWWW, CW, CB)

result:

  1. For CWWW
Coupling value ($TeV{-2}$) Reweight cross-section (pb) MadEvent cross-section (pb) Status
0.01 0.800810008029 0.7973 ± 0.0023 OK
0.1 0.800903791291 0.799 ± 0.0026 OK
1 0.802209013071 0.7987 ± 0.0025 OK
10 0.85200014698 0.8584 ± 0.00092 OK
100 5.0238030968 6.09 ± 0.0082 FAIL
100 5.04763 6.09 ± 0.0082 FAIL (make with a sample of 100k events)

The last entry fails since the expected distribution for such value of the coupling is too different from the distribution of the Standard Model. Such discrepancy are expected in this case. One hint is that the cross-section is an order of magnitude higher than the original one (Looking at the distribution confirm this). The inversed reweight (i.e. starting from the CWW=100 sample of events and reweight to find back the SM) is working properly. It returned: 0.803341120226

The various distribution for those generation are in attachment of this web page. The dashed blue curve is the one produced by reweighting. While the solid black is the curve generated by MadEvent. All sample are done with 100k events for the comparison of distributions.

  1. For CW
Coupling value ($TeV{-2}$) Reweight cross-section (pb) MadEvent cross-section (pb) Status
0.01 0.800798262059 0.7953 +- 0.002497 OK
0.1 0.801379445746 0.7988 ± 0.0023 OK
1 0.806872565125 0.8065 ± 0.0023 OK
10 0.889336417677 0.8832 ± 0.003 OK
100 4.46724081967 4.519 ± 0.015 FAIL
100 4.44273 4.519 ± 0.015 FAIL (make with a sample of 100k events)

Same comment as for the previous coupling.

  1. For CB
Coupling value ($TeV{-2}$) Reweight cross-section (pb) MadEvent cross-section (pb) Status
0.01 0.800798262059 0.7977 ± 0.0027 OK
0.1 0.800782626532 0.7985 ± 0.0024 OK
1 0.800626859275 0.7981 +- 0.002365 OK
10 0.799127987884 0.7971 ± 0.0024 OK
100 0.790019392142 0.7852 ± 0.0026 OK
100 0.786698206995 0.7852 ± 0.0026 OK (make with a sample of 100k events)

This operator has less impact on the cross-section/distributions, and therefore even a large value of the coupling is still working fine.

Note:

  1. The cross-section obtained for 100k events sample is 0.7989 ± 0.00087
  2. The statistical fluctuation of the original sample is reflected on the reweighing cross-section (as expected)

Attachments (6)

Note: See TracWiki for help on using the wiki.