Event listing in lhe file

Asked by A.Hayreter

Dear MG5 team,
I am having a bit weird problem with lhe file. I am working on a decay process and the event listing in lhe file does not seem to follow the correct timeline. So here is what I do;

import model sm-full
generate H > ta+ ta- , (ta+ > vt~ mu+ vm), (ta- > vt mu- vm~)

an event tag is as follows

<event>
 9 1 0.2943950E-09 0.9118800E+02 0.7818608E-02 0.1130116E+00
       25 -1 0 0 0 0 0.00000000000E+00 0.00000000000E+00 0.99999998245E-14 0.12500000000E+03 0.12500000000E+03 0. 0.
      -16 1 3 3 0 0 -0.19374689176E+02 0.10851555430E+02 -0.26652696428E+01 0.22366012121E+02 0.00000000000E+00 0. 1.
      -15 2 1 0 0 0 -0.55053913281E+02 0.28670910826E+02 -0.70808033326E+01 0.62500000000E+02 0.17770000000E+01 0. 0.
       15 2 1 0 0 0 0.55053913281E+02 -0.28670910826E+02 0.70808033326E+01 0.62500000000E+02 0.17770000000E+01 0. 0.
      -13 1 3 3 0 0 -0.30206349136E+02 0.15116762279E+02 -0.40388551879E+01 0.34018576472E+02 0.10566000000E+00 0. 1.
       14 1 3 3 0 0 -0.54728749688E+01 0.27025931172E+01 -0.37667850195E+00 0.61154114068E+01 0.00000000000E+00 0. -1.
       16 1 4 4 0 0 0.45590765839E+01 -0.27033684310E+01 0.80823525773E+00 0.53615878622E+01 0.00000000000E+00 0. -1.
       13 1 4 4 0 0 0.85832078310E+01 -0.44788348629E+01 0.63525549158E+00 0.97028929693E+01 0.10566000000E+00 0. -1.
      -14 1 4 4 0 0 0.41911628866E+02 -0.21488707532E+02 0.56373125832E+01 0.47435519168E+02 0.00000000000E+00 0. 1.
</event>

As you can see the second particle in the list (PID = -16) is in the wrong timeline, it is supposed to be after PID = 15.
This issue troubles when I analyse my root file. So is this a bug or what is it?

thanks for your help in advance.

Cheers.

Question information

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

Hi,

It is neither a bug or something physical.
It is just that the order of the line should not be ordered.

If you want to guarantee that the decay product are written after the associate decay.
You can reprocess the file to ensure that point. We have the code ready in our
madgraph/various/lhe_parser.py file.

At the end of this file, you have example on how to use this parser for advance study.

In your case you do something similar to the first example (line 1963).
but instead on the loop over the particle of the events, you can just cal the function
event.reorder_mother_child()

Then the new lhe should have the property that you want.

Cheers,

Olivier

> On Feb 12, 2016, at 10:47, A.Hayreter <email address hidden> wrote:
>
> New question #285185 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/285185
>
> Dear MG5 team,
> I am having a bit weird problem with lhe file. I am working on a decay process and the event listing in lhe file does not seem to follow the correct timeline. So here is what I do;
>
> import model sm-full
> generate H > ta+ ta- , (ta+ > vt~ mu+ vm), (ta- > vt mu- vm~)
>
> an event tag is as follows
>
> <event>
> 9 1 0.2943950E-09 0.9118800E+02 0.7818608E-02 0.1130116E+00
> 25 -1 0 0 0 0 0.00000000000E+00 0.00000000000E+00 0.99999998245E-14 0.12500000000E+03 0.12500000000E+03 0. 0.
> -16 1 3 3 0 0 -0.19374689176E+02 0.10851555430E+02 -0.26652696428E+01 0.22366012121E+02 0.00000000000E+00 0. 1.
> -15 2 1 0 0 0 -0.55053913281E+02 0.28670910826E+02 -0.70808033326E+01 0.62500000000E+02 0.17770000000E+01 0. 0.
> 15 2 1 0 0 0 0.55053913281E+02 -0.28670910826E+02 0.70808033326E+01 0.62500000000E+02 0.17770000000E+01 0. 0.
> -13 1 3 3 0 0 -0.30206349136E+02 0.15116762279E+02 -0.40388551879E+01 0.34018576472E+02 0.10566000000E+00 0. 1.
> 14 1 3 3 0 0 -0.54728749688E+01 0.27025931172E+01 -0.37667850195E+00 0.61154114068E+01 0.00000000000E+00 0. -1.
> 16 1 4 4 0 0 0.45590765839E+01 -0.27033684310E+01 0.80823525773E+00 0.53615878622E+01 0.00000000000E+00 0. -1.
> 13 1 4 4 0 0 0.85832078310E+01 -0.44788348629E+01 0.63525549158E+00 0.97028929693E+01 0.10566000000E+00 0. -1.
> -14 1 4 4 0 0 0.41911628866E+02 -0.21488707532E+02 0.56373125832E+01 0.47435519168E+02 0.00000000000E+00 0. 1.
> </event>
>
> As you can see the second particle in the list (PID = -16) is in the wrong timeline, it is supposed to be after PID = 15.
> This issue troubles when I analyse my root file. So is this a bug or what is it?
>
> thanks for your help in advance.
>
> Cheers.
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
A.Hayreter (alperhayreter) said :
#2

Hi Olivier, thank you very much for quick reply. In lhe_parser.py file I modified as follows in Example 1;

  for event in lhe:
            for particle in event:
                # modify particle attribute: here remove the mass
- particle.mass = 0
- particle.vtim = 2 # The one associate to distance travelled by the particle.
+ event.reorder_mother_child()

now how do I run this parser on my event file?

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

Hi,

It would also be better to also remove the line
> for particle in event:

> now how do I run this parser on my event file?

1) ensure that the if statement before the example is on True
2) ensure that you put the correct path to your event file
3) do
cd madgraph/various
python lhe_parser.py

Cheers,

Olivier

> On Feb 12, 2016, at 13:02, A.Hayreter <email address hidden> wrote:
>
> Question #285185 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/285185
>
> Status: Answered => Open
>
> A.Hayreter is still having a problem:
> Hi Olivier, thank you very much for quick reply. In lhe_parser.py file I
> modified as follows in Example 1;
>
> for event in lhe:
> for particle in event:
> # modify particle attribute: here remove the mass
> - particle.mass = 0
> - particle.vtim = 2 # The one associate to distance travelled by the particle.
> + event.reorder_mother_child()
>
> now how do I run this parser on my event file?
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
A.Hayreter (alperhayreter) said :
#4

When I follow your instructions I get the following error;

Traceback (most recent call last):
  File "lhe_parser.py", line 1672, in <module>
    event.reorder_mother_child()
  File "lhe_parser.py", line 895, in reorder_mother_child
    tomove, position = i, particle.mother1-1
TypeError: unsupported operand type(s) for -: 'Particle' and 'int'

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

Hi,

Ok then it means that this function is now broken.., Too bad.
If you are fluent in Python, you can fix it (sound not too difficult)
otherwise the best is to write your own code doing such post-processing.

Cheers,

Olivier

> On Feb 12, 2016, at 13:57, A.Hayreter <email address hidden> wrote:
>
> Question #285185 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/285185
>
> Status: Answered => Open
>
> A.Hayreter is still having a problem:
> When I follow your instructions I get the following error;
>
> Traceback (most recent call last):
> File "lhe_parser.py", line 1672, in <module>
> event.reorder_mother_child()
> File "lhe_parser.py", line 895, in reorder_mother_child
> tomove, position = i, particle.mother1-1
> TypeError: unsupported operand type(s) for -: 'Particle' and 'int'
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
A.Hayreter (alperhayreter) said :
#6

Alright, I will try to fix it.
Thanks anyways Olivier.

Revision history for this message
A.Hayreter (alperhayreter) said :
#7

Hi Olivier,

I think I fixed the problem in lhe_parser.py file, here is what I changed;

    def reorder_mother_child(self):
        """check and correct the mother/child position.
           only correct one order by call (but this is a recursive call)"""

        tomove, position = None, None
        for i,particle in enumerate(self):
- if i < particle.mother1:
+ if isinstance(particle.mother1,float) and i < particle.mother1:
                # move i after particle.mother1
- tomove, position = i, particle.mother1 -1
+ tomove, position = i, int(particle.mother1) -1
                break
- if i < particle.mother2:
+ if isinstance(particle.mother2,float) and i < particle.mother2:
- tomove, position = i, particle.mother2 -1
+ tomove, position = i, int(particle.mother2) -1

        # nothing to change -> we are done
        if not tomove:
            return

with this form, the child particle is replaced with the next mother (the child is moved to the next line), but if you need to move further (in my case I had to move 2 lines below) then the position of the child has to be modified accordingly (in my case I used position = int (particle.mother1) )

Cheers.