Error: Can't convert CHARACTER(1) to REAL(8)

Asked by Chayanit

Dear MG Experts,

I am trying to produce LO EWK Z->ll process using the latest version of MG5_aMCatNLO (v.230) to have additional cuts on Mjj (only two leading pT jets not all pairs). So I have implemented new cuts in run_card.dat as follow

 1d5 = mm2hardestjetsmax ! additional Mqq cut max
 120 = mm2hardestjetsmin ! additional Mqq cut min

And I did some hack in Source/cut.inc (add variables to be REAL), Subprocess/cut.f and Subprocess/setcut.f to implement these cuts in the code. But when I tried to launch the process, I got some compilation errors saying that these two variables were set as character (?) and can't convert to real. Could you point me where I am missing here?

run_card.inc:33.26:
         Included at setrun.f:78:

           MM2HARDESTJETSMAX = '1d5'
                               1
     Error: Can't convert CHARACTER(1) to REAL(8) at (1)
     run_card.inc:63.26:
         Included at setrun.f:78:

           MM2HARDESTJETSMIN = '120'
                               1
     Error: Can't convert CHARACTER(1) to REAL(8) at (1)
     make: *** [setrun.o] Error 1
     make: *** Waiting for unfinished jobs....

Thank you in advance and I would really appreciate any suggestions you might have.

With regards,
Chayanit

Question information

Language:
English Edit question
Status:
Answered
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

Hi,

The python parser is not aware of the format that you need for your variable and therefore use the default format which is string.

One simple solution is to add the following lines:
        self.add_param("mm2hardestjetsmax", -1.0, cut=True)
        self.add_param(mm2hardestjetsmin"", 0, cut=True)
in the file banner.py at around line 1520.
(depend on how to run the code you might either need to modify the one in bin/internal or the one in madgraph/various)

To try to make it more automatic, I’ll push in the next version the following change:
=== modified file 'madgraph/various/banner.py'
--- madgraph/various/banner.py 2015-08-20 13:49:51 +0000
+++ madgraph/various/banner.py 2015-08-21 08:17:18 +0000
@@ -1274,7 +1274,12 @@
             if len(line) != 2:
                 continue
             value, name = line
- self.set( name, value, user=True)
+ name = name.lower()
+ if name not in self and ('min' in name or 'max' in name):
+ #looks like an entry added by one user -> add it nicely
+ self.add_param(name, float(value), hidden=True, cut=True)
+ else:
+ self.set( name, value, user=True)

     def write(self, output_file, template=None, python_template=False):
         “""Write the run_card in output_file according to template

This assumes real type as soon as you have a min/max in the additional entry.

Cheers,

Olivier

On 21 Aug 2015, at 07:12, Chayanit <email address hidden> wrote:

> New question #270617 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/270617
>
> Dear MG Experts,
>
> I am trying to produce LO EWK Z->ll process using the latest version of MG5_aMCatNLO (v.230) to have additional cuts on Mjj (only two leading pT jets not all pairs). So I have implemented new cuts in run_card.dat as follow
>
> 1d5 = mm2hardestjetsmax ! additional Mqq cut max
> 120 = mm2hardestjetsmin ! additional Mqq cut min
>
> And I did some hack in Source/cut.inc (add variables to be REAL), Subprocess/cut.f and Subprocess/setcut.f to implement these cuts in the code. But when I tried to launch the process, I got some compilation errors saying that these two variables were set as character (?) and can't convert to real. Could you point me where I am missing here?
>
> run_card.inc:33.26:
> Included at setrun.f:78:
>
> MM2HARDESTJETSMAX = '1d5'
> 1
> Error: Can't convert CHARACTER(1) to REAL(8) at (1)
> run_card.inc:63.26:
> Included at setrun.f:78:
>
> MM2HARDESTJETSMIN = '120'
> 1
> Error: Can't convert CHARACTER(1) to REAL(8) at (1)
> make: *** [setrun.o] Error 1
> make: *** Waiting for unfinished jobs....
>
> Thank you in advance and I would really appreciate any suggestions you might have.
>
> With regards,
> Chayanit
>
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
Chayanit (chayanit-a) said :
#2

Hi Olivier,

Thank you for you prompt reply!

It works when I added two lines you suggested in madgraph/various/banner.py. But I am wondering what do you mean by how to run the code. If I don't wanna touch madgraph/various/banner.py but only bin/internal/banner.py. How should I run the code then?

And after fixing above issue, I run into another issue about additional parameters I added in Subprocess/cut.f around line 66 as follow.

C
C EXTERNAL
C
      REAL*8 R2,DOT,ET,RAP,DJ,SumDot,pt,ALPHAS,PtDot,energy,px,py,pz
      logical cut_bw,setclscales
      external R2,DOT,ET,RAP,DJ,SumDot,pt,ALPHAS,cut_bw,setclscales,PtDot
     & ,energy,px,py,pz

But the compilation complains

     gfortran -O -w -fbounds-check -fPIC -ffixed-line-length-132 -w -o madevent driver.o myamp.o genps.o unwgt.o setcuts.o get_color.o cuts.o cluster.o reweight.o initcluster.o addmothers.o setscales.o idenparts.o auto_dsig.o auto_dsig1.o auto_dsig10.o auto_dsig11.o auto_dsig12.o auto_dsig13.o auto_dsig14.o auto_dsig15.o auto_dsig16.o auto_dsig17.o auto_dsig18.o auto_dsig19.o auto_dsig2.o auto_dsig20.o auto_dsig3.o auto_dsig4.o auto_dsig5.o auto_dsig6.o auto_dsig7.o auto_dsig8.o auto_dsig9.o matrix1.o matrix10.o matrix11.o matrix12.o matrix13.o matrix14.o matrix15.o matrix16.o matrix17.o matrix18.o matrix19.o matrix2.o matrix20.o matrix3.o matrix4.o matrix5.o matrix6.o matrix7.o matrix8.o matrix9.o -L../../lib/ -ldhelas -ldsample -lmodel -lgeneric -lpdf -lcernlib
     Undefined symbols for architecture x86_64:
       "_energy_", referenced from:
           _passcuts_ in cuts.o
       "_px_", referenced from:
           _passcuts_ in cuts.o
       "_py_", referenced from:
           _passcuts_ in cuts.o
       "_pz_", referenced from:
           _passcuts_ in cuts.o
     ld: symbol(s) not found for architecture x86_64
     collect2: error: ld returned 1 exit status
     make: *** [madevent] Error 1

Do you have any idea why? Thanks again for your help.

Best wishes,
Chayanit

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

Hi,

> How should I run the code then?

If it works, it means that you launch the code in the correct way.
They are two valid way either via
./bin/generate_events
or
./bin/madevent

without touching the madgraph/various/banner.py
you can not run your code directly from the ./bin/mg5_aMC (or ./bin/mg5) executable.

> Do you have any idea why? Thanks again for your help.

Is this expected that you define energy/px/py/pz as function?
If yes, did you define such function?
The code did not seem to find those.

Cheers,

Olivier

On 21 Aug 2015, at 11:11, Chayanit <email address hidden> wrote:

> Question #270617 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/270617
>
> Status: Answered => Open
>
> Chayanit is still having a problem:
> Hi Olivier,
>
> Thank you for you prompt reply!
>
> It works when I added two lines you suggested in
> madgraph/various/banner.py. But I am wondering what do you mean by how
> to run the code. If I don't wanna touch madgraph/various/banner.py but
> only bin/internal/banner.py. How should I run the code then?
>
> And after fixing above issue, I run into another issue about additional
> parameters I added in Subprocess/cut.f around line 66 as follow.
>
> C
> C EXTERNAL
> C
> REAL*8 R2,DOT,ET,RAP,DJ,SumDot,pt,ALPHAS,PtDot,energy,px,py,pz
> logical cut_bw,setclscales
> external R2,DOT,ET,RAP,DJ,SumDot,pt,ALPHAS,cut_bw,setclscales,PtDot
> & ,energy,px,py,pz
>
> But the compilation complains
>
> gfortran -O -w -fbounds-check -fPIC -ffixed-line-length-132 -w -o madevent driver.o myamp.o genps.o unwgt.o setcuts.o get_color.o cuts.o cluster.o reweight.o initcluster.o addmothers.o setscales.o idenparts.o auto_dsig.o auto_dsig1.o auto_dsig10.o auto_dsig11.o auto_dsig12.o auto_dsig13.o auto_dsig14.o auto_dsig15.o auto_dsig16.o auto_dsig17.o auto_dsig18.o auto_dsig19.o auto_dsig2.o auto_dsig20.o auto_dsig3.o auto_dsig4.o auto_dsig5.o auto_dsig6.o auto_dsig7.o auto_dsig8.o auto_dsig9.o matrix1.o matrix10.o matrix11.o matrix12.o matrix13.o matrix14.o matrix15.o matrix16.o matrix17.o matrix18.o matrix19.o matrix2.o matrix20.o matrix3.o matrix4.o matrix5.o matrix6.o matrix7.o matrix8.o matrix9.o -L../../lib/ -ldhelas -ldsample -lmodel -lgeneric -lpdf -lcernlib
> Undefined symbols for architecture x86_64:
> "_energy_", referenced from:
> _passcuts_ in cuts.o
> "_px_", referenced from:
> _passcuts_ in cuts.o
> "_py_", referenced from:
> _passcuts_ in cuts.o
> "_pz_", referenced from:
> _passcuts_ in cuts.o
> ld: symbol(s) not found for architecture x86_64
> collect2: error: ld returned 1 exit status
> make: *** [madevent] Error 1
>
> Do you have any idea why? Thanks again for your help.
>
> Best wishes,
> Chayanit
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Can you help with this problem?

Provide an answer of your own, or ask Chayanit for more information if necessary.

To post a message you must log in.