running a bash code
Hi there,
I would like to write a .sh code to execute in an external machine, where the bash code should be executed.
If I put the timer to 1, it will not ask me any question when I launch the generation and this if fine. But, there is also the pythia card, the pythia-pgs card and the delphes card.
In the .sh file I write:
./../bin/
in order to send this job to the machine and to run bin/generate_event. How can say to the machine to run after the simple generation also to run also the others without making the question?
Cheers!
I.M.
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Olivier Mattelaer
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
Olivier Mattelaer suggests this article as an answer to your question:
FAQ #2186: “How to script MG5 run?”.
Revision history for this message
|
#2 |
Note that if you just want to keep all the cards as in a previous run then you can also do
./bin/generate_
Cheers,
Olivier
Revision history for this message
|
#3 |
Hi Olivier,
If I understand right, you mean:
1) cd MG directory/ work_area and here build the .sh script
2)in the .sh script should stay first ./../bin/mg5_aMC and write exactly the list of commands to run;
3) and at the end pf the .sh scrit should be ./bin/madevent
so more or less something like this?
#!/bin/bash
cd /afs/cern.
eval `scramv1 runtime -sh`
./../bin/mg5_aMC
import model BSM_gg_hh
generate p p > h h
output RECAS_stuff
launch RECAS_stuff
shower=Pythia6
detector=PGS
analysis=ExRoot
madspin=OFF
reweight=OFF
cd /afs/cern.
eval `scramv2 runtime -sh`
./../bin/madevent > madgraph_1.log
Because I am not getting it really.
What should I do better?
Revision history for this message
|
#4 |
Hi,
No you should do:
echo "import model BSM_gg_hh" > mycmd
echo "generate p p > h h" >> mycmd
#(I let you continue all those line like that)
./../bin/mg5_aMC mycmd > madgraph_1.log
Cheers,
Olivier
> On 28 Sep 2018, at 18:22, Ilirjan Margjeka <email address hidden> wrote:
>
> Question #674480 on MadGraph5_aMC@NLO changed:
> https:/
>
> Ilirjan Margjeka posted a new comment:
> Hi Olivier,
>
> If I understand right, you mean:
>
> 1) cd MG directory/ work_area and here build the .sh script
> 2)in the .sh script should stay first ./../bin/mg5_aMC and write exactly the list of commands to run;
> 3) and at the end pf the .sh scrit should be ./bin/madevent
> so more or less something like this?
>
>
> #!/bin/bash
>
> cd
> /afs/cern.
>
> eval `scramv1 runtime -sh`
>
> ./../bin/mg5_aMC
>
> import model BSM_gg_hh
> generate p p > h h
> output RECAS_stuff
> launch RECAS_stuff
> shower=Pythia6
> detector=PGS
> analysis=ExRoot
> madspin=OFF
> reweight=OFF
>
> cd
> /afs/cern.
>
> eval `scramv2 runtime -sh`
>
> ./../bin/madevent > madgraph_1.log
>
> Because I am not getting it really.
> What should I do better?
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.
Revision history for this message
|
#5 |
Hi Olivier,
I tried as you told me over there doing:
#!/bin/bash
echo "import model BSM_gg_hh" >mycmd
echo "generate p p > h h" >mycmd
echo "output RECAS_stuff" >mycmd
echo "launch RECAS_stuff" >mycmd
echo "shower=Pythia6 " >mycmd
echo "detector=PGS" >mycmd
echo "analysis=ExRoot" >mycmd
cd /MG5_aMC_
eval `scramv1 runtime -sh`
./../bin/mg5_aMC mycmd > py_pgs_del.log
but as error I get:
load MG5 configuration from ../input/
None does not seem to correspond to a valid fastjet-config executable (v3+). We will use fjcore instead.
Please set the 'fastjet'variable to the full (absolute) /PATH/TO/
MG5_aMC> set fastjet /PATH/TO/
set lhapdf to /lustrehome/
Using default text editor "vi". Set another one in ./input/
Using default eps viewer "gv". Set another one in ./input/
No valid web browser found. Please set in ./input/
import /lustrehome/
The import format was not given, so we guess it as command
analysis=ExRoot
^[[1;34mCommand "analysis=ExRoot" not recognized, please try again^[[0m
quit
what should I do?
Cheers
I.M.
Revision history for this message
|
#6 |
and when I do only
./../bin/mg5_aMC > py_pgs_del.log
so without mycmd here, I do get from py_pgs_del.log:
load MG5 configuration from ../input/
None does not seem to correspond to a valid fastjet-config executable (v3+). We will use fjcore instead.
Please set the 'fastjet'variable to the full (absolute) /PATH/TO/
MG5_aMC> set fastjet /PATH/TO/
set lhapdf to /lustrehome/
Using default text editor "vi". Set another one in ./input/
Using default eps viewer "gv". Set another one in ./input/
No valid web browser found. Please set in ./input/
Loading default model: sm
INFO: Restrict model sm with file ../models/
INFO: Run "set stdout_level DEBUG" before import for more information.
INFO: Change particles name to pass to MG5 convention
Defined multiparticle p = g u c d s u~ c~ d~ s~
Defined multiparticle j = g u c d s u~ c~ d~ s~
Defined multiparticle l+ = e+ mu+
Defined multiparticle l- = e- mu-
Defined multiparticle vl = ve vm vt
Defined multiparticle vl~ = ve~ vm~ vt~
Defined multiparticle all = g u c d s u~ c~ d~ s~ a ve vm vt e- mu- ve~ vm~ vt~ e+ mu+ t b t~ b~ z w+ h w- ta- ta+
MG5_aMC>
and nothing else.
It seams that my mash system here doesn't read those commands in that way written over here.
What do you suggest me ?
Cheers
I.M.
Revision history for this message
|
#7 |
HI,
You only put one ">" instead of two ">>".
If you only put one, you remove any previous entry in the file.
Consequently you only have a single line in your mycmd file.
To check that your .sh script works as expected, you can check the content of the mycmd file
which should contain the line that you want.
i.e. that file should contains the lines:
import model BSM_gg_hh
generate p p > h h
output RECAS_stuff
launch RECAS_stuff
shower=Pythia6
detector=PGS
analysis=ExRoot
madspin=OFF
reweight=OFF
Revision history for this message
|
#8 |
Hi Olivier,
yes indeed now the mycmd file has those lines, but the script doesnt make the work:
#!/bin/bash
echo "import model BSM_gg_hh">> mycmd
echo "generate p p > h h">> mycmd
echo "output RECAS_stuff">> mycmd
echo "launch RECAS_stuff">> mycmd
echo "shower=Pythia6">> mycmd
echo "detector=PGS">> mycmd
echo "analysis=ExRoot">> mycmd
echo "madspin=OFF">> mycmd
echo "reweight=OFF">> mycmd
cd /lustrehome/
eval `scramv1 runtime -sh`
./..bin/mg5_aMC mycmd > py_pgs_del.log
but the py_pgs_del.log is totally empty. the job doesn't start.
Revision history for this message
|
#9 |
Anyway, Olivier: I have found the mistake now and it is working!
I used wrong thhose commands where they should be in different place to let the .sh file work, more:
#!/bin/bash
cd /MG5_aMC_
echo "import model BSM_gg_hh"> mycmd
echo "generate p p > h h">> mycmd
echo "output RECAS_stuff">> mycmd
echo "launch RECAS_stuff">> mycmd
echo "shower=Pythia6">> mycmd
echo "detector=PGS">> mycmd
echo "analysis=ExRoot">> mycmd
echo "madspin=OFF">> mycmd
echo "reweight=OFF">> mycmd
eval `scramv1 runtime -sh`
./../bin/mg5_aMC mycmd > py_pgs_del.log 2>&1
now it working perfectly!!
Thank you Olivier!
Revision history for this message
|
#10 |
Thanks Olivier Mattelaer, that solved my question.
Revision history for this message
|
#11 |
Olivier, one more question:
So, in the .sh file to change for example in the par_card.dat from the .sh script how should I do that?
Just like this:
echo "set mt=120" >>mycmd?
or how?
Cheers
I.M.
Revision history for this message
|
#12 |
yes
> On 29 Sep 2018, at 22:17, Ilirjan Margjeka <email address hidden> wrote:
>
> Question #674480 on MadGraph5_aMC@NLO changed:
> https:/
>
> Ilirjan Margjeka posted a new comment:
> Olivier, one more question:
>
> So, in the .sh file to change for example in the par_card.dat from the
> .sh script how should I do that?
>
> Just like this:
>
> echo "set mt=120" >>mycmd?
>
> or how?
>
> Cheers
> I.M.
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.
Revision history for this message
|
#13 |
Thank you Olivier! you are the best!
Revision history for this message
|
#14 |
How can I send 2 and more jobbs at the same time using the same:
echo "import model BSM_gg_hh" >mycmd
echo "generate p p > h h" >mycmd
but for different outputs with respective different conditions from the par_car.dat?
Cheers
I.M.
Revision history for this message
|
#15 |
Not sure what you want here and they are probably plenty of ways of doing it.
For example, can do something like (in your mycmd file)
generate p p > t t~
output DIR1
generate p p > h h [QCD]
output DIR2
launch DIR1
set mt 150
launch DIR2
set mt180
You can also do the same via two mycmd file (which is probably better for the above example)
Cheers,
Olivier
> On 30 Sep 2018, at 13:27, Ilirjan Margjeka <email address hidden> wrote:
>
> Question #674480 on MadGraph5_aMC@NLO changed:
> https:/
>
> Ilirjan Margjeka posted a new comment:
> How can I send 2 and more jobbs at the same time using the same:
>
> echo "import model BSM_gg_hh" >mycmd
> echo "generate p p > h h" >mycmd
>
> but for different outputs with respective different conditions from the
> par_car.dat?
>
> Cheers
> I.M.
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.