Issues running MadEvent from script

Asked by Joel Jones

Hi, my student has an analysis implemented in a series of scripts, one of which calls MadEvent via:

./bin/madevent "${config_path}"

where config_path="${PWD}/HN_run_config.txt" . The contents of HN_run_config.txt are:

launch
shower=Pythia8
detector=OFF
analysis=OFF
0
0

This works well on his local PC. However, when running this on Amazon Web Service batch, we get error messages (these are recorded on AWS Cloud Watch, there is no terminal):

import command /Collider/2023_LLHN_CONCYTEC/HN_run_config.txt
launch
stty: 'standard input': Inappropriate ioctl for device
The following switches determine which programs are run:
/===========================================================================\
| 1. Choose the shower/hadronization program  shower = OFF |
| 2. Choose the detector simulation program detector = OFF |
| 3. Choose an analysis package (plot/convert) analysis = Not Avail. |
| 4. Decay onshell particles  madspin = OFF |
| 5. Add weights to events for new hypp. reweight = OFF |
\===========================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
The following switches determine which programs are run:
/===========================================================================\
| 1. Choose the shower/hadronization program  shower = OFF |
| 2. Choose the detector simulation program detector = OFF |
| 3. Choose an analysis package (plot/convert) analysis = Not Avail. |
| 4. Decay onshell particles  madspin = OFF |
| 5. Add weights to events for new hypp. reweight = OFF |
\===========================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
[1;34m"OFF" not valid option for "analysis"
[1;31mCommand "import command /Collider/2023_LLHN_CONCYTEC/HN_run_config.txt" interrupted in sub-command:
"launch" with error:
InvalidCmd : can not be mapped to an integer
The following switches determine which programs are run:
/===========================================================================\
| 1. Choose the shower/hadronization program  shower = OFF |
| 2. Choose the detector simulation program detector = OFF |
| 3. Choose an analysis package (plot/convert) analysis = Not Avail. |
| 4. Decay onshell particles  madspin = OFF |
| 5. Add weights to events for new hypp. reweight = OFF |
\===========================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
INFO:
[1;34mcommand not executed: 0
quit
INFO:
launch in debug mode

So, I was wondering if you could provide any insight on what could be going on. The interesting thing is that earlier we run mg5_aMC through a script, and that does work (ie, no stty nor InvalidCmd errors). I am convinced that the "script within script within script" approach of my student is probably having conflicts with the AWS running of MadEvent. Could you please give me an idea of why would such errors normally appear in MadEvent?

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
Joel Jones (n-jones-j) said :
#1

Update, if the input file is:

launch
shower=Pythia8

Then I get:
import command HN_run_config.txt
launch
stty: 'standard input': Inappropriate ioctl for device
The following switches determine which programs are run:
/===========================================================================\
| 1. Choose the shower/hadronization program  shower = OFF |
| 2. Choose the detector simulation program detector = OFF |
| 3. Choose an analysis package (plot/convert) analysis = Not Avail. |
| 4. Decay onshell particles  madspin = OFF |
| 5. Add weights to events for new hypp. reweight = OFF |
\===========================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
The following switches determine which programs are run:
/===========================================================================\
| 1. Choose the shower/hadronization program  shower = OFF |
| 2. Choose the detector simulation program detector = OFF |
| 3. Choose an analysis package (plot/convert) analysis = Not Avail. |
| 4. Decay onshell particles  madspin = OFF |
| 5. Add weights to events for new hypp. reweight = OFF |
\===========================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
[1mThe answer to the previous question is not set in your input file
[1mUse EOF value
[1;31mCommand "import command HN_run_config.txt" interrupted in sub-command:
"launch" with error:
InvalidCmd : can not be mapped to an integer
INFO:
quit
INFO:
launch in debug mode

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

Do you have a debug file generated?

Revision history for this message
Joel Jones (n-jones-j) said :
#3

Ok, I ran MadEvent in debug mode. The errors from MadEvent were the same, except for these lines:

Running MG5 in debug mode
No module named 'madgraph'
[1;32mDEBUG: No hepmc reader since No module named 'madgraph' [lhe_parser.py at line 50] 

You might want to know that the original script calls Madgraph within the container to generate the process.

The contents of the debug file are:

#************************************************************
#* MadGraph5_aMC@NLO/MadEvent *
#* *
#* * * *
#* * * * * *
#* * * * * 5 * * * * *
#* * * * * *
#* * * *
#* *
#* *
#* VERSION 2.9.11 20xx-xx-xx *
#* *
#* 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 *
#* *
#************************************************************
launch
Traceback (most recent call last):
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/banner.py", line 1418, in format_variable
    value = float(value.replace('d','e'))
ValueError: could not convert string to float: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/extended_cmd.py", line 1541, in onecmd
    return self.onecmd_orig(line, **opt)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/extended_cmd.py", line 1490, in onecmd_orig
    return func(arg, **opt)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/extended_cmd.py", line 1176, in do_import
    self.import_command_file(args[1])
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/extended_cmd.py", line 1689, in import_command_file
    self.exec_cmd(line, precmd=True)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/extended_cmd.py", line 1570, in exec_cmd
    stop = Cmd.onecmd_orig(current_interface, line, **opt)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/extended_cmd.py", line 1490, in onecmd_orig
    return func(arg, **opt)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/madevent_interface.py", line 2677, in do_launch
    self.do_generate_events(line, *args, **opt)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/madevent_interface.py", line 2466, in do_generate_events
    switch_mode = self.ask_run_configuration(mode, args)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/madevent_interface.py", line 6275, in ask_run_configuration
    self.ask_edit_cards(cards, plot=False, first_cmd=first_cmd)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/common_run_interface.py", line 983, in ask_edit_cards
    self.ask_edit_card_static(cards, mode, plot, self.options['timeout'],
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/common_run_interface.py", line 1055, in ask_edit_card_static
    out = ask(question, '0', possible_answer, timeout=int(1.5*timeout),
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/extended_cmd.py", line 1112, in ask
    question_instance = obj(question, allow_arg=choices, default=default,
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/common_run_interface.py", line 4607, in __init__
    new_vars = set(getattr(self, 'init_%s' % name)(cards))
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/common_run_interface.py", line 4723, in init_run
    self.run_card = banner_mod.RunCard(self.paths['run'], consistency='warning')
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/banner.py", line 2331, in __init__
    super(RunCard, self).__init__(*args, **opts)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/banner.py", line 1005, in __init__
    self.read(finput, **opt)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/banner.py", line 2393, in read
    self.set( name, value, user=True)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/banner.py", line 1488, in set
    self.__setitem__(name, value, change_userdefine=user, raiseerror=raiseerror)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/banner.py", line 1252, in __setitem__
    value = self.format_variable(value, targettype, name=name)
  File "/Collider/MG5_aMC_v2_9_11/val-HN_ZH/bin/internal/banner.py", line 1420, in format_variable
    raise InvalidCmd("%s can not be mapped to an integer" % value)
internal.InvalidCmd: can not be mapped to an integer
                              Run Options
                              -----------
               stdout_level : None

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

                      Configuration Options
                      ---------------------
               pythia8_path : /Collider/MG5_aMC_v2_9_11/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 : None (user set)
            pythia-pgs_path : None (user set)
                    td_path : None (user set)
               delphes_path : /Collider/MG5_aMC_v2_9_11/Delphes (user set)
        exrootanalysis_path : None (user set)
               syscalc_path : None (user set)
                     lhapdf : /Collider/LHAPDF/bin/lhapdf-config (user set)
                 lhapdf_py2 : None
                 lhapdf_py3 : None
                    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

After this the debug file continues with the run and param cards, but I guess they are irrelevant for this problem.

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

So the issue is within the file run_card.dat where some entry is not correctly formatted and leads to the crash.
So I guess that I would need your run_card to understand which line expects a float and does not receive it.
From the debug file, I would expect that you have a line of the type
     = PARAMETER_NAME
Where the value for the parameter is just missing.

Cheers,

Olivier

Revision history for this message
Joel Jones (n-jones-j) said :
#5

Oh dear, it was that. Thank you so much, we thought it was due to something completely different.

Revision history for this message
Joel Jones (n-jones-j) said :
#6

Thanks Olivier Mattelaer, that solved my question.