LHE file generating tables

Asked by GSA on 2018-07-09

Hello Everyone,

Hope you are doing well.
I am having a problem reading the LHE file, but am unable to do so with madanalysis, as I need to have the \sigma and all permutations of pairs of invariant masses in a table, which MA5 doesn't seem to be able to do. The problem is that the LHE file generated from madgraph just has numbers, and I do not know how to get the aforementioned tables.

I apologize if this is a very out of place question, but I have been trying to get this data out for a while, and this seemed like something that madgraph might be able to do (maybe output into a different format?)

Thank you for your help, and have a great day!
-Adi

Question information

Language:
English Edit question
Status:
Open
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Last query:
2018-07-13
Last reply:
2018-07-12

This question was reopened

  • 2018-07-11 by GSA
  • 2018-07-12 by GSA

Hi,

This sounds something that MA5 might be able to do.
But maybe i do not understand what you want to plot (or I do not know MA5 well enough).

In any case, if MA5 does not fit what you need, MG5aMC will not be able to do it in any automatic way.
My advise, would be to use a lhe parser (either the root one, the one of MA5, or the python one shipped within MG5aMC and code (by hand) the list of observables that you want/need.

Cheers,

Olivier

> On 9 Jul 2018, at 20:37, GSA <email address hidden> wrote:
>
> New question #670778 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/670778
>
> Hello Everyone,
>
> Hope you are doing well.
> I am having a problem reading the LHE file, but am unable to do so with madanalysis, as I need to have the \sigma and all permutations of pairs of invariant masses in a table, which MA5 doesn't seem to be able to do. The problem is that the LHE file generated from madgraph just has numbers, and I do not know how to get the aforementioned tables.
>
> I apologize if this is a very out of place question, but I have been trying to get this data out for a while, and this seemed like something that madgraph might be able to do (maybe output into a different format?)
>
> Thank you for your help, and have a great day!
> -Adi
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

GSA (physalpha) said : #2

Hello Mr. Olivier,

Thank you for your quick response.
Essentially, the data in the .lhe file has the particles, and their momentum vectors and energy. I can convert this into the data I need on my own using Mathematica, but I have no clue which number is px which is py etc, for which particle.

I am trying to get this data and use it for another application, but MA5 only gives me a top file with data already sorted into bins of a certain size, instead of the raw data points themselves. That is the sole problem I am having with it, and am unable to use the root one. I will try the python parser, but since I am a beginner at coding, I was wondering if there would be any way to generate these by using MadGraph (or if I am wrong about it, MA5).

Thank you for your help!

-Adi

Hi,

If you use an existing parser you do not need to know which column is px

for example with our (python) parser you can do
lhefile = EventFile('path_to_lhe')
for event in lhefile:
    for particle in event:
 print particle.px

Now if you want to write your own parser, you should look on inspire, for the official documentation of the format. You will get all the convention associated to that format.

Cheers,

Olivier

> On 9 Jul 2018, at 22:47, GSA <email address hidden> wrote:
>
> Question #670778 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/670778
>
> Status: Answered => Open
>
> GSA is still having a problem:
> Hello Mr. Olivier,
>
> Thank you for your quick response.
> Essentially, the data in the .lhe file has the particles, and their momentum vectors and energy. I can convert this into the data I need on my own using Mathematica, but I have no clue which number is px which is py etc, for which particle.
>
> I am trying to get this data and use it for another application, but MA5
> only gives me a top file with data already sorted into bins of a certain
> size, instead of the raw data points themselves. That is the sole
> problem I am having with it, and am unable to use the root one. I will
> try the python parser, but since I am a beginner at coding, I was
> wondering if there would be any way to generate these by using MadGraph
> (or if I am wrong about it, MA5).
>
> Thank you for your help!
>
> -Adi
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

GSA (physalpha) said : #4

Hello Mr. Olivier,

This sounds like a very viable option. While I do not have the technical know-how to write my own parser, your python parser sounds like a great option! Just to clarify once, (in case) you are referring to the parser given in madgraph/various/lhe_parser.py, right?

Thank you very much for your help Mr. Olivier. I think that this will work, once I am sure that I am using the correct file.

Sincerely,
Adi

Yes that's the one,

You can look at the bottom of the file, some example of script that you use to make some plot/...

Cheers,

Olivier

> On 9 Jul 2018, at 23:32, GSA <email address hidden> wrote:
>
> Question #670778 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/670778
>
> Status: Answered => Open
>
> GSA is still having a problem:
> Hello Mr. Olivier,
>
> This sounds like a very viable option. While I do not have the technical
> know-how to write my own parser, your python parser sounds like a great
> option! Just to clarify once, (in case) you are referring to the parser
> given in madgraph/various/lhe_parser.py, right?
>
> Thank you very much for your help Mr. Olivier. I think that this will
> work, once I am sure that I am using the correct file.
>
> Sincerely,
> Adi
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

GSA (physalpha) said : #6

Thanks Olivier Mattelaer, that solved my question.

GSA (physalpha) said : #7

Thank you very much Mr. Olivier. You have really helped me a lot.

I hope you have a great day!

Sincerely,
Adi

GSA (physalpha) said : #8

Greetings Mr. Olivier,

Do you happen to know how I could get the cross section of each event? The code seems a bit unclear for this as I am not very familiar with it, and event.cross and cross[event] do not seem to be working.

Sincerely,
Adi

Hi,

An event does not have anything called cross section.
The closest equivalent that I can see is called weight of the event.

You can access it via event.wgt
Note that the normalisation of such weight is not fix by convention.
Some people like to have
cross_section = sum(weight)
some people like to have
cross_section = average(weight)
some other like to have
weight = 1

You can actually choose in MG5aMC which convention is used.

Cheers,

Olivier

GSA (physalpha) said : #10

Thanks Olivier Mattelaer, that solved my question.

GSA (physalpha) said : #11

Hello Mr. Olivier,

Thank you very much for your help once again. Have a great day!

Sincerely,
Adi

GSA (physalpha) said : #12

Greetings Mr. Olivier,

I just wanted to post for future reference that for event in lhefile f.write(str(event.wgt)) does not work as it prints the same weight out over and over again.

Sincerely,
Adi

GSA (physalpha) said : #13

Greetings Mr. Olivier,

My apologies for the constant issues, but when I took your advice and tried to use the weights. However, I ran into an issue: not only did I get that event.wgt was the same for every event, but that on searching for wgt in the lhe file, there are more than 100 times the number of events (even when searching <\wgt>) .

I was wondering if I had possibly misinterpreted what you had said regarding this?

Thank you for all your help and patience on this issue!

Sincerely,
Adi

Hi,

We generated events which are "unweighted" i.e. where all the events have the same weights.
This provides the best statistical sample for a given number of evetns.

So this is normal that you have the same value for sample generated by MG5aMC.

The lhe file also contains feature for multiple weight by event, which are the weight of the same event
under a different hyppothesis (different scale/pdf/coupling) we use that in MG5aMC to compute the systematics. If you are not sensitive to some of those variations then it makes sense that you recover the original weight.

please take a look at arXiv:1607.00763<http://arXiv.org/abs/arXiv:1607.00763>
where the weight concept is explained in details

Cheers,

Olivier

On 12 Jul 2018, at 04:42, GSA <<email address hidden><mailto:<email address hidden>>> wrote:

Question #670778 on MadGraph5_aMC@NLO changed:
https://answers.launchpad.net/mg5amcnlo/+question/670778

   Status: Solved => Open

GSA is still having a problem:
Greetings Mr. Olivier,

My apologies for the constant issues, but when I took your advice and
tried to use the weights. However, I ran into an issue: not only did I
get that event.wgt was the same for every event, but that on searching
for wgt in the lhe file, there are more than 100 times the number of
events (even when searching <\wgt>) .

I was wondering if I had possibly misinterpreted what you had said
regarding this?

Thank you for all your help and patience on this issue!

Sincerely,
Adi

--
You received this question notification because you are an answer
contact for MadGraph5_aMC@NLO.

GSA (physalpha) said : #15

Greetings Mr. Olivier,

Thank you for the reference paper. I have read it and have a slightly better idea on the weights. Reformulating the question at hand, I meant to indicate that MadAnalysis5 seems to be able to sort stuff into bins, and get a signal sigma (pb/bin) and create a histogram of this. I was wondering how I would be able to create such a histogram using the weights, and the number of events in a certain bin. I tried to simply write # events in a bin as a histogram, but the ones that are automatically generated by running the event in madgraph which calls madanalysis seems to be slightly different!

Sincerely,
adi

Can you help with this problem?

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

To post a message you must log in.