Invariant mass of four particles

Asked by shibasipu

Dear Olivier,
                             I am trying to define the invariant mass of four particles. For this, I am going through the faq https://answers.launchpad.net/mg5amcnlo/+question/237441 For this, I am including the following lines in "kin_func.f".

double precision function XYZA1(p1,p2,p3,p4)
C****************************************************************************
C User function for plotting and cuts
C****************************************************************************
      implicit none
      double precision p1(0:3),p2(0:3),p3(0:3),p4(0:3)
      double precision sumdot
      external sumdot

      XYZA1=dsqrt(max(Sumdot(p1,p2,p3,p4,1d0),0d0))

      end

double precision function SumDot(P1,P2,P3,P4,dsign)
c************************************************************************
c Invarient mass of 4 particles
c************************************************************************
      IMPLICIT NONE
      double precision p1(0:3),p2(0:3),p3(0:3),p4(0:3),dsign
      integer i
      double precision ptot(0:3)
      double precision dot
      external dot

      do i=0,3
         ptot(i)=p1(i)+dsign*p2(i)+dsign*p3(i)+dsign*p4(i)
      enddo
      SumDot = dot(ptot,ptot)

      RETURN
      END

After this, while during "make", I am getting the following error message.
[shibananda@localhost MadAnalysis]$ make
gfortran -O -w -ffixed-line-length-132 -c kin_func.f
kin_func.f:411.132:

                                                                           1
kin_func.f:392.132:

                                                                           2
Error: Global name 'sumdot' at (1) is already being used as a FUNCTION at (2)
make: *** [kin_func.o] Error 1

Please suggest some help.

Regards,
Shiba

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
Rikkert Frederix Edit question
Solved by:
shibasipu
Solved:
Last query:
Last reply:
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

Hi,

SumDot do not take that many argument.
one way is to first sum all the momenta and then call mij

Cheers,

Olivier
> On Dec 7, 2015, at 08:17, shibasipu <email address hidden> wrote:
>
> Question #277050 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/277050
>
> Description changed to:
> Dear Olivier,
> I am trying to define the invariant mass of four particles. For this, I am going through the faq https://answers.launchpad.net/mg5amcnlo/+question/237441 For this, I am including the following lines in "kin_func.f".
>
> double precision function XYZA1(p1,p2,p3,p4)
> C****************************************************************************
> C User function for plotting and cuts
> C****************************************************************************
> implicit none
> double precision p1(0:3),p2(0:3),p3(0:3),p4(0:3)
> double precision sumdot
> external sumdot
>
> XYZA1=dsqrt(max(Sumdot(p1,p2,p3,p4,1d0),0d0))
>
> end
>
>
> double precision function SumDot(P1,P2,P3,P4,dsign)
> c************************************************************************
> c Invarient mass of 4 particles
> c************************************************************************
> IMPLICIT NONE
> double precision p1(0:3),p2(0:3),p3(0:3),p4(0:3),dsign
> integer i
> double precision ptot(0:3)
> double precision dot
> external dot
>
> do i=0,3
> ptot(i)=p1(i)+dsign*p2(i)+dsign*p3(i)+dsign*p4(i)
> enddo
> SumDot = dot(ptot,ptot)
>
> RETURN
> END
>
> After this, while during "make", I am getting the following error message.
> [shibananda@localhost MadAnalysis]$ make
> gfortran -O -w -ffixed-line-length-132 -c kin_func.f
> kin_func.f:411.132:
>
>
> 1
> kin_func.f:392.132:
>
>
> 2
> Error: Global name 'sumdot' at (1) is already being used as a FUNCTION at (2)
> make: *** [kin_func.o] Error 1
>
>
> Please suggest some help.
>
>
> Regards,
> Shiba
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
shibasipu (shibasipu) said :
#2

Dear Olivier,
                             thanks for your reply. I am not getting your point how to proceed. Could you please clarify your point again(it will be better if you could give few sample lines for the point you are talking about) ?

I am trying in a different way. Now I am changing "SumDot" variable to a new name "SumDot1" (Since "SumDot" variable is used for two body invariant mass.). In principle, this should work. But, this is not solving my purpose. Is not it the right way ?

Regards,
Shiba

Revision history for this message
Rikkert Frederix (frederix) said :
#3

dear Shiba,

Indeed SumDot() was already defined, and it's taking only 2 momenta. You've included a 2nd function with the same name, which makes FORTRAN not compile. Renaming your SumDot to something else (e.g. SumDot4) should do the trick.

Best,
Rikkert

Revision history for this message
shibasipu (shibasipu) said :
#4

Dear Rikkert,
                            Thanks. After renaming to "SumDot4", it is not working. I have send the "kin_func.f" to your e-mail.

1. I have included the invariant mass for four particles in the variable "XYZA1(p1,p2,p3,p4)".

2. Also, I have added the function "SumDot4" after the "SumDot" function. Please have a look to the file(the file that I have sent )

Please suggest some help.

Revision history for this message
Rikkert Frederix (frederix) said :
#5

What's the error message?

Best,
Rikkert

Revision history for this message
shibasipu (shibasipu) said :
#6

Dear Rikkert,
                               After doing "make" , I am getting the following error message.

[shibananda@localhost MadAnalysis]$ make
gfortran -O -w -ffixed-line-length-132 -c kin_func.f
kin_func.f:408.9:

      END
         1
Error: Expecting END FUNCTION statement at (1)
kin_func.f:414.132:

                                                                           1
Error: Unexpected IMPLICIT NONE statement at (1)
kin_func.f:415.25:

      double precision p1(0:3),p2(0:3),p3(0:3),p4(0:3),dsign
                         1
Error: Symbol 'p1' at (1) already has basic type of REAL
kin_func.f:416.15:

      integer i
               1
Error: Symbol 'i' at (1) already has basic type of INTEGER
kin_func.f:417.27:

      double precision ptot(0:3)
                           1
Error: Symbol 'ptot' at (1) already has basic type of REAL
kin_func.f:418.26:

      double precision dot
                          1
Error: Symbol 'dot' at (1) already has basic type of REAL
kin_func.f:419.18:

      external dot
                  1
Error: Duplicate EXTERNAL attribute specified at (1)
kin_func.f:424.13:

      SumDot4 = dot(ptot,ptot)
             1
Error: Symbol 'sumdot4' at (1) has no IMPLICIT type
kin_func.f:422.55:

         ptot(i)=p1(i)+dsign*p2(i)+dsign*p3(i)+dsign*p4(i)
                                                       1
Error: Function 'p4' at (1) has no IMPLICIT type
make: *** [kin_func.o] Error 1
[shibananda@localhost MadAnalysis]$

Regards,
Shiba

Revision history for this message
Rikkert Frederix (frederix) said :
#7

In fortran lines need to start with at least 6 white spaces (if they are not comments). Your SumDot4 function does not start with 6 white spaces.

Best,
Rikkert

Revision history for this message
shibasipu (shibasipu) said :
#8

thank you very much. Now it is working. In the meanwhile, I have written another program for invariant mass of four particles without the function "SumDot4". Please have a look.

double precision function XYZA1(p1,p2,p3,p4)
C****************************************************************************
C User function for plotting and cuts
C****************************************************************************
      implicit none
      double precision p1(0:3),p2(0:3),p3(0:3),p4(0:3)
      integer i
      real *8 temp,temp1
      temp = (p1(0)+p2(0)+p3(0)+p4(0))**2
      temp1 = 0
      do i = 1,3
      temp1 = temp1 + (p1(i)+p2(i)+p3(i)+p4(i))**2
      end do
      XYZA1 = sqrt(temp-temp1)
      end

Please comment on the new program.

Regards,
Shiba

Revision history for this message
shibasipu (shibasipu) said :
#9

Dear Rikkert,
                             Sorry for lengthing this thread. Now, after successfully doing "make", there is no data and plot is coming for XYZA1(p1,p2,p3,p4) i.e. the invariant mass for four particles. I have also correctly defined this variable in the "plot_card.dat".

Could you please tell me where am I making mistake ?

Regards,
Shiba

Revision history for this message
Rikkert Frederix (frederix) said :
#10

Sorry, but you need to give me more information. Simply saying "it doesn't work" does not allow me to understand why it might not be working and what you are doing wrong.

Best,
Rikkert

Revision history for this message
shibasipu (shibasipu) said :
#11

Sorry Rikkert not providing detailed info. earlier. Actually, I am generating the process e- e- > e- e+ mu- mu+. I want the distributions for m(e-,e+,mu-,mu+). For this, I have used the variable XYZA1(p1,p2,p3,p4) in the "kin_func.f" file. Also, I have correctly used this variable in the "plot_card.dat". But finally no data and plot is coming for this variable. I have sent the relevant files (like plot_card.dat , plots.log,plot.log ) to your e-mail.

Regards,
Shiba

Revision history for this message
Rikkert Frederix (frederix) said :
#12

What is your collision energy?

Best,
Rikkert

Revision history for this message
shibasipu (shibasipu) said :
#13

root s = 1000 GeV.

Regards,
Shiba

Revision history for this message
Rikkert Frederix (frederix) said :
#14

Then it's no wonder that you get an empty plot: your plot-range does not include 1000 GeV. (Given that you use a lepton collider at 1000 GeV, this plot will simply be a spike at 1000 GeV).

best,
Rikkert

Revision history for this message
shibasipu (shibasipu) said :
#15

thank you very much. Now I got the plot after changing the plot range.

Regards,
Shiba