MadGraph overwrites entire param_card.dat when updating dependent parameter aS

Asked by Jean-Loup Tastet

Hi,

I have encountered a weird issue while helping a student with MadGraph. When generating the decays of a new particle using `generate n1 > all all` with a custom model (that works fine with my own install; I can attach it if needed), MadGraph seems to update the value of the strong coupling constant in order to match the one of its default PDF set.

    INFO: Update the dependent parameter of the param_card.dat
    WARNING: update the strong coupling value (alpha_s) to the value from the pdf selected: 0.13

So far, so good. However, instead of changing only the value of aS to 0.13 (from the model-specified default 0.118), it overwrites the entire param_card.dat, that has just been edited, thus discarding our changes (we checked that the file changed on-disk after our edits, and is then reset by MadGraph). This does not happen if aS is already set to 0.13, either manually or after running MadGraph a first time. This is quite unintuitive behaviour, and to me it looks like a bug. The expected behaviour would be to just "set aS 0.13" while preserving the values of the other parameters.

In order to find out which part of the code was responsible, we made param_card.dat read-only after editing it, in order to cause MadGraph to crash and produce a backtrace. The relevant part seems to be the following (I’ll attach the full logs below):

  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/common_run_interface.py", line 6565, in postcmd
    self.do_update('dependent', timer=20)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/common_run_interface.py", line 6615, in do_update
    self.update_dependent(self.mother_interface, self.me_dir, self.param_card,
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/common_run_interface.py", line 6788, in update_dependent
    param_card.write(path)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/models/check_param_card.py", line 546, in write
    open(outpath,'w').write(text)

I should probably mention that the "build-in" PDFs do not seem to work in my student’s install, however the externally-installed LHAPDF (from Homebrew) works perfectly fine when generating collisions (not decays) and specifying "lhapdf = pdlabel" and the "lhaid".

Here is the system information, in case it can be helpful:
- MadGraph5_aMC@NLO version 3.4.2 (2023-01-20)
- macOS Monterey 12.5
- Python 3.10.9 (installed within pyenv)
- $ pip freeze
    attrs==22.2.0
    click==8.1.3
    cycler==0.11.0
    jsonpatch==1.32
    jsonpointer==2.3
    jsonschema==4.17.3
    kiwisolver==1.4.4
    lxml==4.9.2
    matplotlib==3.2.2 # For compatibility with the version of MadAnalysis currently supplied with MadGraph
    numpy==1.24.2
    pyhf==0.6.3
    pyparsing==3.0.9
    pyrsistent==0.19.3
    python-dateutil==2.8.2
    PyYAML==6.0
    scipy==1.10.1
    six==1.16.0
    tqdm==4.64.1

Although we have figured out how to work around this issue, I would really appreciate if you could take a quick look at it, in case there is some bug hiding behind it. I have used the search function in Launchpad to search for similar issues, but I did not see anything that was obviously related.

I remain at your disposal should you need extra information, log files, etc...

Many thanks in advance,
Jean-Loup

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Olivier Mattelaer
Solved:
Last query:
Last reply:
Revision history for this message
Jean-Loup Tastet (jltastet) said :
#1

run_01_tag_1_banner.txt
---

<LesHouchesEvents version="3.0">
<header>
<!--
#*********************************************************************
# *
# MadGraph5_aMC@NLO *
# *
# Going Beyond *
# *
# http://madgraph.hep.uiuc.edu *
# http://madgraph.phys.ucl.ac.be *
# http://amcatnlo.cern.ch *
# *
# The MadGraph5_aMC@NLO team *
# *
#....................................................................*
# *
# This file contains all the information necessary to reproduce *
# the events generated: *
# *
# 1. software version *
# 2. proc_card : code generation info including model *
# 3. param_card : model primary parameters in the LH format *
# 4. run_card : running parameters (collider and cuts) *
# 5. pythia_card : present only if pythia has been run *
# 6. pgs_card : present only if pgs has been run *
# 7. delphes_cards : present only if delphes has been run *
# *
# *
#*********************************************************************
-->
<MGVersion>
3.4.2
</MGVersion>
<MG5ProcCard>
<![CDATA[
#************************************************************
#* MadGraph5_aMC@NLO *
#* *
#* * * *
#* * * * * *
#* * * * * 5 * * * * *
#* * * * * *
#* * * *
#* *
#* *
#* VERSION 3.4.2 2023-01-20 *
#* *
#* The MadGraph5_aMC@NLO Development Team - Find us at *
#* https://server06.fynu.ucl.ac.be/projects/madgraph *
#* *
#************************************************************
#* *
#* Command File for MadGraph5_aMC@NLO *
#* *
#* run as ./bin/mg5_aMC filename *
#* *
#************************************************************
set group_subprocesses Auto
set ignore_six_quark_processes False
set low_mem_multicore_nlo_generation False
set complex_mass_scheme False
set include_lepton_initiated_processes False
set gauge unitary
set loop_optimized_output True
set loop_color_flows False
set max_npoint_for_channel 0
set default_unset_couplings 99
set max_t_for_channel 99
set zerowidth_tchannel True
set nlo_mixed_expansion True
import model sm
define p = g u c d s u~ c~ d~ s~
define j = g u c d s u~ c~ d~ s~
define l+ = e+ mu+
define l- = e- mu-
define vl = ve vm vt
define vl~ = ve~ vm~ vt~
import model /Users/<redacted>/Desktop/MG5_aMC_v3_4_1/models/SM\
_HeavyN_ALP_LO_UFO_Py3
generate n1 > all all
output /Users/<redacted>/madfiles/prueba8
]]>
</MG5ProcCard>
<MGProcCard>
#*********************************************************************
# MadGraph/MadEvent *
# http://madgraph.hep.uiuc.edu *
# *
# proc_card.dat *
#*********************************************************************
# *
# This Files is generated by MADGRAPH 5 *
# *
# WARNING: This Files is generated for MADEVENT (compatibility issue)*
# This files is NOT a valid MG4 proc_card.dat *
# Running this in MG4 will NEVER reproduce the result of MG5*
# *
#*********************************************************************
#*********************************************************************
# Process(es) requested : mg2 input *
#*********************************************************************
# Begin PROCESS # This is TAG. Do not modify this line
n1 > all all #Process
# Be carefull the coupling are here in MG5 convention

end_coup # End the couplings input

done # this tells MG there are no more procs
# End PROCESS # This is TAG. Do not modify this line
#*********************************************************************
# Model information *
#*********************************************************************
# Begin MODEL # This is TAG. Do not modify this line
SM_HeavyN_ALP_LO_UFO_Py3
# End MODEL # This is TAG. Do not modify this line
#*********************************************************************
# Start multiparticle definitions *
#*********************************************************************
# Begin MULTIPARTICLES # This is TAG. Do not modify this line

# End MULTIPARTICLES # This is TAG. Do not modify this line
</MGProcCard>
<MGRunCard>
<![CDATA[
#*********************************************************************
# MadGraph5_aMC@NLO *
# *
# run_card.dat MadEvent *
# *
# This file is used to set the parameters of the run. *
# *
# Some notation/conventions: *
# *
# Lines starting with a '# ' are info or comments *
# *
# mind the format: value = variable ! comment *
# *
# To display more options, you can type the command: *
# update to_full *
#*********************************************************************
#
#*********************************************************************
# Tag name for the run (one word) *
#*********************************************************************
  tag_1 = run_tag ! name of the run
#*********************************************************************
# Number of events and rnd seed *
# Warning: Do not generate more than 1M events in a single run *
#*********************************************************************
  10000 = nevents ! Number of unweighted events requested
 21 = iseed ! rnd seed (0=assigned automatically=default))
#*********************************************************************
# Collider type and energy *
# lpp: 0=No PDF, 1=proton, -1=antiproton, 2=elastic photon of proton,*
# +/-3=PDF of electron/positron beam *
# +/-4=PDF of muon/antimuon beam *
#*********************************************************************
     1 = lpp1 ! beam 1 type
     1 = lpp2 ! beam 2 type
     6500.0 = ebeam1 ! beam 1 total energy in GeV
     6500.0 = ebeam2 ! beam 2 total energy in GeV
# To see polarised beam options: type "update beam_pol"

#*********************************************************************
# PDF CHOICE: this automatically fixes alpha_s and its evol. *
# pdlabel: lhapdf=LHAPDF (installation needed) [1412.7420] *
# iww=Improved Weizsaecker-Williams Approx.[hep-ph/9310350] *
# eva=Effective W/Z/A Approx. [21yy.zzzzz] *
# none=No PDF, same as lhapdf with lppx=0 *
#*********************************************************************
     nn23lo1 = pdlabel ! PDF set
     230000 = lhaid ! if pdlabel=lhapdf, this is the lhapdf number
# To see heavy ion options: type "update ion_pdf"
#*********************************************************************
# Renormalization and factorization scales *
#*********************************************************************
 False = fixed_ren_scale ! if .true. use fixed ren scale
     False = fixed_fac_scale ! if .true. use fixed fac scale
 91.188 = scale ! fixed ren scale
 91.188 = dsqrt_q2fact1 ! fixed fact scale for pdf1
 91.188 = dsqrt_q2fact2 ! fixed fact scale for pdf2
 -1 = dynamical_scale_choice ! Choose one of the preselected dynamical choices
 1.0 = scalefact ! scale factor for event-by-event scales

#*********************************************************************
# Type and output format
#*********************************************************************
  False = gridpack !True = setting up the grid pack
  -1.0 = time_of_flight ! threshold (in mm) below which the invariant livetime is not written (-1 means not written)
  average = event_norm ! average/sum. Normalization of the weight in the LHEF
# To see MLM/CKKW merging options: type "update MLM" or "update CKKW"

#*********************************************************************
#
#*********************************************************************
# Phase-Space Optimization strategy (basic options)
#*********************************************************************
   0 = nhel ! using helicities importance sampling or not.
                             ! 0: sum over helicity, 1: importance sampling
   2 = sde_strategy ! default integration strategy (hep-ph/2021.00773)
                             ! 1 is old strategy (using amp square)
        ! 2 is new strategy (using only the denominator)
# To see advanced option for Phase-Space optimization: type "update psoptim"
#*********************************************************************
# Generation bias, check the wiki page below for more information: *
# 'cp3.irmp.ucl.ac.be/projects/madgraph/wiki/LOEventGenerationBias' *
#*********************************************************************
 None = bias_module ! Bias type of bias, [None, ptj_bias, -custom_folder-]
 {} = bias_parameters ! Specifies the parameters of the module.
#
#*******************************
# Parton level cuts definition *
#*******************************
  0.0 = dsqrt_shat ! minimal shat for full process
#
#
#*********************************************************************
# BW cutoff (M+/-bwcutoff*Gamma) ! Define on/off-shell for "$" and decay
#*********************************************************************
  15.0 = bwcutoff ! (M+/-bwcutoff*Gamma)
#*********************************************************************
# Standard Cuts *
#*********************************************************************
# Minimum and maximum pt's (for max, -1 means no cut) *
#*********************************************************************
 0.0 = ptl ! minimum pt for the charged leptons
 0.0 = misset ! minimum missing Et (sum of neutrino's momenta)
 -1.0 = ptlmax ! maximum pt for the charged leptons
 -1.0 = missetmax ! maximum missing Et (sum of neutrino's momenta)
 {} = pt_min_pdg ! pt cut for other particles (use pdg code). Applied on particle and anti-particle
 {} = pt_max_pdg ! pt cut for other particles (syntax e.g. {6: 100, 25: 50})
#
# For display option for energy cut in the partonic center of mass frame type 'update ecut'
#
#*********************************************************************
# Maximum and minimum absolute rapidity (for max, -1 means no cut) *
#*********************************************************************
 -1.0 = etal ! max rap for the charged leptons
 0.0 = etalmin ! main rap for the charged leptons
 {} = eta_min_pdg ! rap cut for other particles (use pdg code). Applied on particle and anti-particle
 {} = eta_max_pdg ! rap cut for other particles (syntax e.g. {6: 2.5, 23: 5})
#*********************************************************************
# Minimum and maximum DeltaR distance *
#*********************************************************************
#*********************************************************************
# Minimum and maximum invariant mass for pairs *
#*********************************************************************
 {} = mxx_min_pdg ! min invariant mass of a pair of particles X/X~ (e.g. {6:250})
 {'default': False} = mxx_only_part_antipart ! if True the invariant mass is applied only
                       ! to pairs of particle/antiparticle and not to pairs of the same pdg codes.
#*********************************************************************
# Inclusive cuts *
#*********************************************************************
 0.0 = ptheavy ! minimum pt for at least one heavy final state
#*********************************************************************
# maximal pdg code for quark to be considered as a light jet *
# (otherwise b cuts are applied) *
#*********************************************************************
 4 = maxjetflavor ! Maximum jet pdg code
#*********************************************************************
#
#*********************************************************************
# Store info for systematics studies *
# WARNING: Do not use for interference type of computation *
#*********************************************************************
   False = use_syst ! Enable systematics studies
#
systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++]
['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule
]]>
</MGRunCard>
<slha>
######################################################################
## PARAM_CARD AUTOMATICALY GENERATED BY MG5 ####
######################################################################
###################################
## INFORMATION FOR ALPCOUPLINGS
###################################
BLOCK ALPCOUPLINGS #
      1 1.000000e-05 # fainverse
      2 1.000000e+00 # cb
      3 1.000000e+00 # cw
      4 1.000000e+00 # cg
###################################
## INFORMATION FOR ALPSCOUPLINGS
###################################
BLOCK ALPSCOUPLINGS #
      5 1.000000e+00 # cq
      6 1.000000e+00 # cl
      7 5.000000e-01 # cu
      8 1.000000e-01 # cd
      9 5.000000e-01 # ce
      10 1.000000e+00 # cn
###################################
## INFORMATION FOR CKMBLOCK
###################################
BLOCK CKMBLOCK #
      1 2.277360e-01 # cabi
###################################
## INFORMATION FOR MASS
###################################
BLOCK MASS #
      1 5.040000e-03 # md
      2 2.550000e-03 # mu
      3 1.010000e-01 # ms
      4 1.270000e+00 # mc
      5 4.700000e+00 # mb
      6 1.733000e+02 # mt
      11 5.110000e-04 # me
      13 1.056600e-01 # mmu
      15 1.777000e+00 # mta
      23 9.118760e+01 # mz
      25 1.257000e+02 # mh
      9900012 1.000000e+03 # mn1
      9900036 1.000000e-06 # malp
      12 0.000000e+00 # ve : 0.0
      14 0.000000e+00 # vm : 0.0
      16 0.000000e+00 # vt : 0.0
      21 0.000000e+00 # g : 0.0
      22 0.000000e+00 # a : 0.0
      24 7.995123e+01 # w+ : cmath.sqrt(mz__exp__2/2. + cmath.sqrt(mz__exp__4/4. - (aew*cmath.pi*mz__exp__2)/(gf*sqrt__2)))
###################################
## INFORMATION FOR NUMIXING
###################################
BLOCK NUMIXING #
      1 3.330000e-01 # ven
      2 3.330000e-01 # vmun
      3 3.330000e-01 # vtan
###################################
## INFORMATION FOR SMINPUTS
###################################
BLOCK SMINPUTS #
      1 1.279400e+02 # aewm1
      2 1.174560e-05 # gf
      3 1.300000e-01 # as (note that parameter not used if you use a pdf set)
###################################
## INFORMATION FOR YUKAWA
###################################
BLOCK YUKAWA #
      1 5.040000e-03 # ymdo
      2 2.550000e-03 # ymup
      3 1.010000e-01 # yms
      4 1.270000e+00 # ymc
      5 4.700000e+00 # ymb
      6 1.733000e+02 # ymt
      11 5.110000e-04 # yme
      13 1.056600e-01 # ymm
      15 1.777000e+00 # ymtau
###################################
## INFORMATION FOR DECAY
###################################
DECAY 6 1.350000e+00 # wt
DECAY 23 2.495200e+00 # wz
DECAY 24 2.085000e+00 # ww
DECAY 25 4.170000e-03 # wh
DECAY 9900012 1.000000e+00 # wn1
DECAY 9900036 1.000000e-09 # walp
DECAY 1 0.000000e+00 # d : 0.0
DECAY 2 0.000000e+00 # u : 0.0
DECAY 3 0.000000e+00 # s : 0.0
DECAY 4 0.000000e+00 # c : 0.0
DECAY 5 0.000000e+00 # b : 0.0
DECAY 11 0.000000e+00 # e- : 0.0
DECAY 12 0.000000e+00 # ve : 0.0
DECAY 13 0.000000e+00 # mu- : 0.0
DECAY 14 0.000000e+00 # vm : 0.0
DECAY 15 0.000000e+00 # ta- : 0.0
DECAY 16 0.000000e+00 # vt : 0.0
DECAY 21 0.000000e+00 # g : 0.0
DECAY 22 0.000000e+00 # a : 0.0
###################################
## INFORMATION FOR QNUMBERS 9900012
###################################
BLOCK QNUMBERS 9900012 # n1
      1 0 # 3 times electric charge
      2 2 # number of spin states (2s+1)
      3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
      4 0 # particle/antiparticle distinction (0=own anti)
###################################
## INFORMATION FOR QNUMBERS 9900036
###################################
BLOCK QNUMBERS 9900036 # alp
      1 0 # 3 times electric charge
      2 1 # number of spin states (2s+1)
      3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
      4 0 # particle/antiparticle distinction (0=own anti)
</slha>
<MGGenerationInfo>
# Number of Events : 10000
# Integrated weight (pb) : 436.23299999999995
</MGGenerationInfo>
</header>
</LesHouchesEvents>

Revision history for this message
Jean-Loup Tastet (jltastet) said :
#2

ME5_debug (after making param_card.dat read-only)
---

#************************************************************
#* MadGraph5_aMC@NLO/MadEvent *
#* *
#* * * *
#* * * * * *
#* * * * * 5 * * * * *
#* * * * * *
#* * * *
#* *
#* *
#* VERSION 3.4.2 2023-01-20 *
#* *
#* The MadGraph5_aMC@NLO Development Team - Find us at *
#* https://server06.fynu.ucl.ac.be/projects/madgraph *
#* *
#************************************************************
#* *
#* Command File for MadEvent *
#* *
#* run as ./bin/madevent.py filename *
#* *
#************************************************************
generate_events run_01
Traceback (most recent call last):
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/extended_cmd.py", line 1544, in onecmd
    return self.onecmd_orig(line, **opt)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/extended_cmd.py", line 1493, in onecmd_orig
    return func(arg, **opt)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/madevent_interface.py", line 2396, in do_generate_events
    switch_mode = self.ask_run_configuration(mode, args)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/madevent_interface.py", line 6422, in ask_run_configuration
    self.ask_edit_cards(cards, plot=False, first_cmd=first_cmd)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/common_run_interface.py", line 1040, in ask_edit_cards
    self.ask_edit_card_static(cards, mode, plot, self.options['timeout'],
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/common_run_interface.py", line 1112, in ask_edit_card_static
    out = ask(question, '0', possible_answer, timeout=int(1.5*timeout),
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/extended_cmd.py", line 1149, in ask
    value = Cmd.timed_input(question, default, timeout=timeout,
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/extended_cmd.py", line 1760, in timed_input
    result = fct(question)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/extended_cmd.py", line 2123, in __call__
    return self.cmdloop()
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/extended_cmd.py", line 2291, in cmdloop
    super(SmartQuestion,self).cmdloop(intro)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/extended_cmd.py", line 179, in cmdloop
    stop = self.postcmd(stop, line)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/common_run_interface.py", line 6565, in postcmd
    self.do_update('dependent', timer=20)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/common_run_interface.py", line 6615, in do_update
    self.update_dependent(self.mother_interface, self.me_dir, self.param_card,
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/madgraph/interface/common_run_interface.py", line 6788, in update_dependent
    param_card.write(path)
  File "/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/models/check_param_card.py", line 546, in write
    open(outpath,'w').write(text)
PermissionError: [Errno 13] Permission denied: '/Users/<redacted>/Desktop/MG5_aMC_v3_4_1/prueba5/Cards/param_card.dat'
Related File: /Users/<redacted>/Desktop/MG5_aMC_v3_4_1/prueba5/Cards/param_card.dat
                              Run Options
                              -----------
               stdout_level : 20 (user set)

                         MadEvent Options
                         ----------------
     automatic_html_opening : True
        notification_center : True
                   run_mode : 2
              cluster_queue : None (user set)
               cluster_time : None (user set)
               cluster_size : 100
             cluster_memory : 100 (user set)
                    nb_core : 4 (user set)
          cluster_temp_path : None

                      Configuration Options
                      ---------------------
               pythia8_path : /Users/<redacted>/Desktop/MG5_aMC_v3_4_1/HEPTools/pythia8 (user set)
                  hwpp_path : None (user set)
                thepeg_path : None (user set)
                 hepmc_path : None (user set)
           madanalysis_path : None (user set)
          madanalysis5_path : /Users/<redacted>/Desktop/MG5_aMC_v3_4_1/HEPTools/madanalysis5/madanalysis5 (user set)
            pythia-pgs_path : None (user set)
                    td_path : None (user set)
               delphes_path : None (user set)
        exrootanalysis_path : None (user set)
               syscalc_path : None (user set)
                 rivet_path : None
                  yoda_path : None
                     lhapdf : lhapdf-config
                 lhapdf_py2 : None
                 lhapdf_py3 : lhapdf-config (user set)
                    timeout : 60
              f2py_compiler : None
          f2py_compiler_py2 : None
          f2py_compiler_py3 : None
                web_browser : None
                 eps_viewer : None
                text_editor : None
           fortran_compiler : None
               cpp_compiler : None
                auto_update : 7 (user set)
               cluster_type : condor
      cluster_status_update : (600, 30)
           cluster_nb_retry : 1
         cluster_local_path : None
         cluster_retry_wait : 300
#************************************************************
#* MadGraph5_aMC@NLO *
#* *
#* * * *
#* * * * * *
#* * * * * 5 * * * * *
#* * * * * *
#* * * *
#* *
#* *
#* VERSION 3.4.2 2023-01-20 *
#* *
#* The MadGraph5_aMC@NLO Development Team - Find us at *
#* https://server06.fynu.ucl.ac.be/projects/madgraph *
#* *
#************************************************************
#* *
#* Command File for MadGraph5_aMC@NLO *
#* *
#* run as ./bin/mg5_aMC filename *
#* *
#************************************************************
set group_subprocesses Auto
set ignore_six_quark_processes False
set low_mem_multicore_nlo_generation False
set complex_mass_scheme False
set include_lepton_initiated_processes False
set gauge unitary
set loop_optimized_output True
set loop_color_flows False
set max_npoint_for_channel 0
set default_unset_couplings 99
set max_t_for_channel 99
set zerowidth_tchannel True
set nlo_mixed_expansion True
import model sm
define p = g u c d s u~ c~ d~ s~
define j = g u c d s u~ c~ d~ s~
define l+ = e+ mu+
define l- = e- mu-
define vl = ve vm vt
define vl~ = ve~ vm~ vt~
import model /Users/<redacted>/Desktop/MG5_aMC_v3_4_1/models/SM\
_HeavyN_ALP_LO_UFO_Py3
generate n1 > all all
output prueba5
######################################################################
## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL ####
######################################################################
## ##
## Width set on Auto will be computed following the information ##
## present in the decay.py files of the model. ##
## See arXiv:1402.1178 for more details. ##
## ##
######################################################################

###################################
## INFORMATION FOR ALPCOUPLINGS
###################################
Block alpcouplings
    1 1.000000e-05 # faInverse
    2 1.000000e+00 # cB
    3 1.000000e+00 # cw
    4 1.000000e+00 # cG

###################################
## INFORMATION FOR ALPSCOUPLINGS
###################################
Block alpscouplings
    5 1.000000e+00 # cQ
    6 1.000000e+00 # cL
    7 5.000000e-01 # cu
    8 1.000000e-01 # cd
    9 5.000000e-01 # ce
   10 1.000000e+00 # cN

###################################
## INFORMATION FOR CKMBLOCK
###################################
Block ckmblock
    1 2.277360e-01 # cabi

###################################
## INFORMATION FOR MASS
###################################
Block mass
    1 5.040000e-03 # MD
    2 2.550000e-03 # MU
    3 1.010000e-01 # MS
    4 1.270000e+00 # MC
    5 4.700000e+00 # MB
    6 1.733000e+02 # MT
   11 5.110000e-04 # Me
   13 1.056600e-01 # MMU
   15 1.777000e+00 # MTA
   23 9.118760e+01 # MZ
   25 1.257000e+02 # MH
  9900012 2.000000e+02 # mN1
  9900036 1.000000e-06 # malp
## Dependent parameters, given by model restrictions.
## Those values should be edited following the
## analytical expression. MG5 ignores those values
## but they are important for interfacing the output of MG5
## to external program such as Pythia.
  12 0.000000e+00 # ve : 0.0
  14 0.000000e+00 # vm : 0.0
  16 0.000000e+00 # vt : 0.0
  21 0.000000e+00 # g : 0.0
  22 0.000000e+00 # a : 0.0
  24 7.995123e+01 # w+ : cmath.sqrt(MZ__exp__2/2. + cmath.sqrt(MZ__exp__4/4. - (aEW*cmath.pi*MZ__exp__2)/(Gf*sqrt__2)))

###################################
## INFORMATION FOR NUMIXING
###################################
Block numixing
    1 3.330000e-01 # VeN
    2 3.330000e-01 # VmuN
    3 3.330000e-01 # VtaN

###################################
## INFORMATION FOR SMINPUTS
###################################
Block sminputs
    1 1.279400e+02 # aEWM1
    2 1.174560e-05 # Gf
    3 1.184000e-01 # aS (Note that Parameter not used if you use a PDF set)

###################################
## INFORMATION FOR YUKAWA
###################################
Block yukawa
    1 5.040000e-03 # ymdo
    2 2.550000e-03 # ymup
    3 1.010000e-01 # yms
    4 1.270000e+00 # ymc
    5 4.700000e+00 # ymb
    6 1.733000e+02 # ymt
   11 5.110000e-04 # yme
   13 1.056600e-01 # ymm
   15 1.777000e+00 # ymtau

###################################
## INFORMATION FOR DECAY
###################################
DECAY 6 1.350000e+00 # WT
DECAY 23 2.495200e+00 # WZ
DECAY 24 2.085000e+00 # WW
DECAY 25 4.170000e-03 # WH
DECAY 9900012 1.000000e+00 # WN1
DECAY 9900036 1.000000e-09 # Walp
## Dependent parameters, given by model restrictions.
## Those values should be edited following the
## analytical expression. MG5 ignores those values
## but they are important for interfacing the output of MG5
## to external program such as Pythia.
DECAY 1 0.000000e+00 # d : 0.0
DECAY 2 0.000000e+00 # u : 0.0
DECAY 3 0.000000e+00 # s : 0.0
DECAY 4 0.000000e+00 # c : 0.0
DECAY 5 0.000000e+00 # b : 0.0
DECAY 11 0.000000e+00 # e- : 0.0
DECAY 12 0.000000e+00 # ve : 0.0
DECAY 13 0.000000e+00 # mu- : 0.0
DECAY 14 0.000000e+00 # vm : 0.0
DECAY 15 0.000000e+00 # ta- : 0.0
DECAY 16 0.000000e+00 # vt : 0.0
DECAY 21 0.000000e+00 # g : 0.0
DECAY 22 0.000000e+00 # a : 0.0
#===========================================================
# QUANTUM NUMBERS OF NEW STATE(S) (NON SM PDG CODE)
#===========================================================

Block QNUMBERS 9900012 # n1
        1 0 # 3 times electric charge
        2 2 # number of spin states (2S+1)
        3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
        4 0 # Particle/Antiparticle distinction (0=own anti)
Block QNUMBERS 9900036 # alp
        1 0 # 3 times electric charge
        2 1 # number of spin states (2S+1)
        3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
        4 0 # Particle/Antiparticle distinction (0=own anti)
#*********************************************************************
# MadGraph5_aMC@NLO *
# *
# run_card.dat MadEvent *
# *
# This file is used to set the parameters of the run. *
# *
# Some notation/conventions: *
# *
# Lines starting with a '# ' are info or comments *
# *
# mind the format: value = variable ! comment *
# *
# To display more options, you can type the command: *
# update to_full *
#*********************************************************************
#
#*********************************************************************
# Tag name for the run (one word) *
#*********************************************************************
  tag_1 = run_tag ! name of the run
#*********************************************************************
# Number of events and rnd seed *
# Warning: Do not generate more than 1M events in a single run *
#*********************************************************************
  10000 = nevents ! Number of unweighted events requested
  0 = iseed ! rnd seed (0=assigned automatically=default))
#*********************************************************************
# Collider type and energy *
# lpp: 0=No PDF, 1=proton, -1=antiproton, 2=elastic photon of proton,*
# +/-3=PDF of electron/positron beam *
# +/-4=PDF of muon/antimuon beam *
#*********************************************************************
     1 = lpp1 ! beam 1 type
     1 = lpp2 ! beam 2 type
     6500.0 = ebeam1 ! beam 1 total energy in GeV
     6500.0 = ebeam2 ! beam 2 total energy in GeV
# To see polarised beam options: type "update beam_pol"

#*********************************************************************
# PDF CHOICE: this automatically fixes alpha_s and its evol. *
# pdlabel: lhapdf=LHAPDF (installation needed) [1412.7420] *
# iww=Improved Weizsaecker-Williams Approx.[hep-ph/9310350] *
# eva=Effective W/Z/A Approx. [21yy.zzzzz] *
# none=No PDF, same as lhapdf with lppx=0 *
#*********************************************************************
     nn23lo1 = pdlabel ! PDF set
     230000 = lhaid ! if pdlabel=lhapdf, this is the lhapdf number
# To see heavy ion options: type "update ion_pdf"
#*********************************************************************
# Renormalization and factorization scales *
#*********************************************************************
 False = fixed_ren_scale ! if .true. use fixed ren scale
     False = fixed_fac_scale ! if .true. use fixed fac scale
 91.188 = scale ! fixed ren scale
 91.188 = dsqrt_q2fact1 ! fixed fact scale for pdf1
 91.188 = dsqrt_q2fact2 ! fixed fact scale for pdf2
 -1 = dynamical_scale_choice ! Choose one of the preselected dynamical choices
 1.0 = scalefact ! scale factor for event-by-event scales

#*********************************************************************
# Type and output format
#*********************************************************************
  False = gridpack !True = setting up the grid pack
  -1.0 = time_of_flight ! threshold (in mm) below which the invariant livetime is not written (-1 means not written)
  average = event_norm ! average/sum. Normalization of the weight in the LHEF
# To see MLM/CKKW merging options: type "update MLM" or "update CKKW"

#*********************************************************************
#
#*********************************************************************
# Phase-Space Optimization strategy (basic options)
#*********************************************************************
   0 = nhel ! using helicities importance sampling or not.
                             ! 0: sum over helicity, 1: importance sampling
   2 = sde_strategy ! default integration strategy (hep-ph/2021.00773)
                             ! 1 is old strategy (using amp square)
        ! 2 is new strategy (using only the denominator)
# To see advanced option for Phase-Space optimization: type "update psoptim"
#*********************************************************************
# Generation bias, check the wiki page below for more information: *
# 'cp3.irmp.ucl.ac.be/projects/madgraph/wiki/LOEventGenerationBias' *
#*********************************************************************
 None = bias_module ! Bias type of bias, [None, ptj_bias, -custom_folder-]
 {} = bias_parameters ! Specifies the parameters of the module.
#
#*******************************
# Parton level cuts definition *
#*******************************
  0.0 = dsqrt_shat ! minimal shat for full process
#
#
#*********************************************************************
# BW cutoff (M+/-bwcutoff*Gamma) ! Define on/off-shell for "$" and decay
#*********************************************************************
  15.0 = bwcutoff ! (M+/-bwcutoff*Gamma)
#*********************************************************************
# Standard Cuts *
#*********************************************************************
# Minimum and maximum pt's (for max, -1 means no cut) *
#*********************************************************************
 0.0 = ptl ! minimum pt for the charged leptons
 0.0 = misset ! minimum missing Et (sum of neutrino's momenta)
 -1.0 = ptlmax ! maximum pt for the charged leptons
 -1.0 = missetmax ! maximum missing Et (sum of neutrino's momenta)
 {} = pt_min_pdg ! pt cut for other particles (use pdg code). Applied on particle and anti-particle
 {} = pt_max_pdg ! pt cut for other particles (syntax e.g. {6: 100, 25: 50})
#
# For display option for energy cut in the partonic center of mass frame type 'update ecut'
#
#*********************************************************************
# Maximum and minimum absolute rapidity (for max, -1 means no cut) *
#*********************************************************************
 -1.0 = etal ! max rap for the charged leptons
 0.0 = etalmin ! main rap for the charged leptons
 {} = eta_min_pdg ! rap cut for other particles (use pdg code). Applied on particle and anti-particle
 {} = eta_max_pdg ! rap cut for other particles (syntax e.g. {6: 2.5, 23: 5})
#*********************************************************************
# Minimum and maximum DeltaR distance *
#*********************************************************************
#*********************************************************************
# Minimum and maximum invariant mass for pairs *
#*********************************************************************
 {} = mxx_min_pdg ! min invariant mass of a pair of particles X/X~ (e.g. {6:250})
 {'default': False} = mxx_only_part_antipart ! if True the invariant mass is applied only
                       ! to pairs of particle/antiparticle and not to pairs of the same pdg codes.
#*********************************************************************
# Inclusive cuts *
#*********************************************************************
 0.0 = ptheavy ! minimum pt for at least one heavy final state
#*********************************************************************
# maximal pdg code for quark to be considered as a light jet *
# (otherwise b cuts are applied) *
#*********************************************************************
 4 = maxjetflavor ! Maximum jet pdg code
#*********************************************************************
#
#*********************************************************************
# Store info for systematics studies *
# WARNING: Do not use for interference type of computation *
#*********************************************************************
   False = use_syst ! Enable systematics studies
#
systematics = systematics_program ! none, systematics [python], SysCalc [depreceted, C++]
['--mur=0.5,1,2', '--muf=0.5,1,2', '--pdf=errorset'] = systematics_arguments ! see: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Systematics#Systematicspythonmodule

Revision history for this message
Jean-Loup Tastet (jltastet) said :
#3

I could not find a way to attach files to this issue, however I can email you our UFO model "SM_HeavyN_ALP_LO_UFO_Py3" if this would be helpful.

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#4

Hi Jean-Loup,

Thanks for the information, this is the first time that someone reported the issue of parameter discarded due to this new feature of MG5aMC. I will try to reproduce this bug.
In case this is model/benchmark specific, can I ask you which of the parameter you tried to change and that the change was discarded? And maybe which method you use to edit the file?

For the model you can send it to me at <email address hidden> (Can I ask you to put a link to this webpage? This will be so helpfull)

Thanks,

Olivier

Revision history for this message
Jean-Loup Tastet (jltastet) said :
#5

Hi Olivier,

We edited param_card.dat by entering the corresponding number when prompted by MadGraph, which opened our text editor in the background, and then making the edits and saving the file (we used Aquamacs, but I don’t think this matters since we checked that Cards/param_card.dat was indeed changed on disk).

In our tests, any parameters that we modified got reset to their default value, although for the example I sent, I think we only changed the HNL mass "mn1" to be 200. (but in the banner file you can only see the default value of 1e3, since it was already reset).
Interestingly, the capitalisation of comments (variable names after the "#") is also changed. After the "reset", they are all lowercase, so MadGraph is not just copying param_card_default.dat).

Regarding the model, I will send it to you separately by email. Currently it is not published, because it is not quite production-ready (it has a bunch of bad defaults, among other things).

Unfortunately, I was myself not able to reproduce this bug on my own install. However, if needed I can ask the student to run some more tests and report the logs and output.

Thanks again for your help,
Jean-Loup

Revision history for this message
Best Olivier Mattelaer (olivier-mattelaer) said :
#6

Hi,

Thanks for the additional details and the model.
Unfortunately, I'm not able to reproduce the error.

Is Aquamacs tells madgraph correctly when the edition of the file is done?
One way to test is to re-open the file a second time and do not perform edition that second time (or do and check if only those second edition are discarded).

What I have in mind is that the following happen
1) you open the file
2) aquamacs returns the hand to MG5aMC that reads the file to learn the content and propose to the user to edit another file/enter command to edit futher
3) you edit the file opened by aquamacs
4) you quit the interface

In that sequence, MG5aMC might indeed read the file too early.
and therefore not realize that some parameter have been changed.

Maybe I should add a check that the file was not edited after the late read on disk but if that is the issue, it might be difficult to be bulletproof (but I can certainly improve).

Cheers,

Olivier

Revision history for this message
Jean-Loup Tastet (jltastet) said :
#7

Hi Olivier,

I see! I may have wrongly assumed that MadGraph only processes the cards when entering "done" and launching the generation.

Indeed, Aquamacs opens in the background and immediately returns the hand to MadGraph, which displays the prompt again. I noticed it, but since the file was changed, I thought the issue was to be found somewhere else. It would also explain why it does not occur on my laptop (I use vim).

I will check with the student if this is indeed the cause, using e.g. nano in non-graphical mode instead of Aquamacs (it should still be more beginner-friendly than vim).

Is it expected, however, that MadGraph overwrites the file when entering "done"? (I see how this could actually make sense, to ensure that the recorded parameters are consistent with its internal parameters.)

Maybe a simple "INFO: configuration unchanged" or similar could help, displayed as soon as MadGraph reads the file and sees no change (e.g. same hash before and after). It would at least make it clearer to the user that MadGraph processes the cards immediately (to my shame, I have used it for years without ever noticing).

So, I will check and report if this solves the issue.

Many thanks again for your help and insights!

Cheers,
Jean-Loup

Revision history for this message
Jean-Loup Tastet (jltastet) said :
#8

Indeed, it seems that we missed this last line in mg5_configuration.txt. My bad.

#! Prefered Text Editor
#! Default: use the shell default Editor
#! or try to find one available on the system
#! Be careful: Only shell based editor are allowed

I actually used emacs successfully in graphical mode in the past (and on Linux), but indeed it wasn’t returning immediately.

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#9

Hi,

OK, thanks for the confirmation of what the problem is.
So this is nothing super new in a way but this issue might have been enhanced with the new handling of alphas.

I do agree with you that I could add at least a warning if nothing changed. a
And maybe a threshold like if the file is open in less than a .5s which and then act accordingly.

Thanks for the report.

Olivier

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#10

Hi,

here is a patch:

> diff --git a/madgraph/interface/common_run_interface.py b/madgraph/interface/common_run_interface.py
> index 83ae78151..c7c7c80e2 100755
> --- a/madgraph/interface/common_run_interface.py
> +++ b/madgraph/interface/common_run_interface.py
> @@ -7493,6 +7493,7 @@ class AskforEditCard(cmd.OneLinePathCompletion):
> elif os.path.basename(answer.replace('_card.dat','')) in self.modified_card:
> self.write_card(os.path.basename(answer.replace('_card.dat','')))
>
> + start = time.time()
> try:
> self.mother_interface.exec_cmd('open %s' % path)
> except InvalidCmd as error:
> @@ -7510,6 +7511,9 @@ You can also copy/paste, your event file here.''')
> self.open_file(path)
> else:
> raise
> + if time.time() - start < .35:
> + print(time.time()-start)
> + self.mother_interface.ask("Are you really that fast? If you are using an editor that returns directly. Please confirm that you have finised to edit the file", 'y')
> self.reload_card(path)
>
> def reload_card(self, path):

This is a basic timer that check if the file was closed directly or not and ask user confirmation for when the file is actually edited.

I have checked by using VSCode and on my machine the time measure for the operation was then:
0.2s. While if I use emacs and close the editor directly (manually without editting) I'm at best at 0.38.

So I have put the threshold at 0.35s. Can you check how long it take for aquamacs?
To check if 0.35s is reasonable or not?

Thanks,

Olivier

> On 8 Mar 2023, at 23:20, Jean-Loup Tastet <email address hidden> wrote:
>
> Question #705763 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/705763
>
> Jean-Loup Tastet posted a new comment:
> Indeed, it seems that we missed this last line in mg5_configuration.txt.
> My bad.
>
> #! Prefered Text Editor
> #! Default: use the shell default Editor
> #! or try to find one available on the system
> #! Be careful: Only shell based editor are allowed
>
> I actually used emacs successfully in graphical mode in the past (and on
> Linux), but indeed it wasn’t returning immediately.
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
Jean-Loup Tastet (jltastet) said :
#11

Hi Olivier,

I applied the patch to my install, but I didn’t manage to trigger it. I installed Aquamacs to try to reproduce the issue, but it worked correctly and only returned the hand to MadGraph after saving and closing the file (even when adding an "&" after the path).

The student also applied the patch, but had already switched to nano (which successfully fixed the issue!), so it didn’t get triggered either.

So I don’t know what was going wrong, and now the original mg5_configuration.txt is lost...

I know some editors that can take significantly more time to open than 0.35 s (e.g. Spacemacs can take several seconds because it checks for updates), but if they open in the background this shouldn’t matter anyway (?). It also doesn’t return immediately, so I couldn’t time it.

So the threshold looks quite reasonable to me. Honestly, it could even be a bit larger, because it seems quite uncommon to open a file to close it immediately (without even looking at it), and in this case having to press "y" is not a big annoyance.

If you want, I can ask again the student to re-try with Aquamacs. Just let me know.

In any case, many thanks again for your help and helping us solve our problem!

Cheers,
Jean-Loup

Revision history for this message
Jean-Loup Tastet (jltastet) said :
#12

Thanks Olivier Mattelaer, that solved my question.