Citizen science on Hive - simulating top quark production at CERN’s Large Hadron Collider

in StemSocial2 years ago (edited)

As said in my last weekly particle physics blog, last week was at the same time very emotional and very busy work-wise, so that I did not find the time to write the present post before today. There is however some good in this situation, as it gave more time to a few to embark into our joint citizen science adventure on Hive. On second thought, I may consider writing one of these blogs every other week. I will take a decision depending on how fast the reports originating from the present blog will appear, and on any potential feedback on this matter.

The previous episode was dedicated to the installation of a piece of software that will be heavily used within this citizen particle physics project. I recall that the project requires the simulation of a signal of physics beyond the Standard Model (related to neutrino physics), and how to assess it in future data at CERN’s Large Hadron Collider (from the overwhelming background of the Standard Model). Those simulations will be achieved with this installed software.

I was amazed by the level of engagement and participation following the first post on this project. I had the chance to read (so far, as it is never too late to join us) seven reports from the participants, from agreste, eniolw, gentleshaid (please let us know whether all your problems have been sorted out), mengene, metabs, servelle and travelingmercies. Following our particle physics standards, the author list is alphabetically ordered. I would nevertheless like to single out the work done by @metabs, whose report consists of a comprehensive review on how to get started on a Windows system via a virtual machine.

The goal of the present blog is to allow everyone to become expert users of the MG5aMC software, or at least users that are expert enough to deal with all simulations to be performed during the project. As promised at the end of the previous episode, this post is based on the tutorial shipped with MG5aMC. It however goes independently of it, so that I could explain the physics that comes with it on a step-by-step basis.

Before starting, I acknowledge in advance all potential participants and interested supporters from our community: @agmoore, @agreste, @aiovo, @alexanderalexis, @amestyj, @darlingtonoperez, @eniolw, @firstborn.pob, @gentleshaid, @isnochys, @ivarbjorn, @mengene, @mintrawa, @servelle, @travelingmercies and @yaziris. Feel free to let me know if you want to be added or removed from this list.

[Credits: geralt (Pixabay)]

Top-antitop production at the LHC - task 1

In order to get used to MG5aMC properly, we will simulate collisions such as those ongoing at CERN’s Large Hadron Collider. In each of those collisions, a pair of top quarks (actually, one top quark and one antitop quark) is produced.

Among all particles of the Standard Model of particle physics, the top quark is the heaviest. It can be seen as a heavy big brother of the up quark, one of the elementary particles giving rise to protons and neutrons. For more information, please consider having a look to this blog on the Standard Model and this one in which some information on the top quark is provided. By virtue of its large mass, the top quark is considered as a perfect portal to new particle physics phenomena, and its properties are therefore under deep scrutiny experimentally (to verify whether there is no hint of an anomaly).

Let me now introduce the first task. The MG5aMC code can be started as indicated in the previous episode. I recall that this requires to open a shell, and move to the folder in which MG5aMC has been unpacked (MG5_aMC_v2_9_9 in my case). Then the code is started by typing in the shell:

cd MG5_aMC_v2_9_9;

If everything goes well, you should have a prompt MG5aMC> that is waiting for instructions. We are ready to define the process considered within the code. By checking the screen output we can observe the following

Multiparticle labels:
p = g u c d s u~ c~ d~ s~
j = g u c d s u~ c~ d~ s~
l+ = e+ mu+
l- = e- mu-
vl = ve vm vt
vl~ = ve~ vm~ vt~
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+

The last line is very useful as it indicates all particles that are available within the model of physics (that is by default the Standard Model). We can note the presence of t (a top quark) and t~ (a top antiquark). In addition, the first of the above line defines the elementary particle content of the proton. We can see that it is composed of many quarks and antiquarks, as well as of gluons.

At high energies, a proton is an object made of interacting quarks and antiquarks (the most elementary building blocks of matter and the associated antiparticles) and gluons (the mediators of the strong force). To get more information on this, I refer to the second section of this blog on particle collider simulations.

We thus have all the information necessary to define the collider process of interest, the production of a top-antitop pair in proton-proton collisions. This definition is performed by typing in the MG5aMC command line interface

generate p p > t t~

The syntax is in principle self-explanatory at this stage. > stands for an arrow. The initial state of the process (two protons) is put on its left, each particle being separated by a space. This gives p p as we consider proton-proton collisions. The final state of the process is put on the right of the arrow, each particle being again separated by a space. This gives t t~ as we produce one top quark and one antiquark. The resulting screen output gives:

[Credits: @lemouth]

This command makes the code ready to deal with the quantum field theory calculation associated with the process of interest. It relies on Feynman diagrams, that embed all possibilities to connect the initial state of the process to its final state. For more details, please check out the second section of this blog. Diagrams can be displayed by typing in

display diagrams

I recommend to type this command to see that we have many options to produce a top-antitop pair at colliders such as the LHC, from different initial states (any combination formed from the constituents of the two proton would work).

A Fortran code for top-antitop production at the LHC - task 2

Now, it is time to instruct the code to extract an equation from these diagrams (a heavy integral) and convert it to a Fortran code. From this equation, it will then become possible to simulate collisions as they would occur in nature. For details, I once again refer to this older blog. The code is obtained by typing in

output some_name

In this command, some_name can be replaced by your favourite name, and corresponds to the folder in which the results will be stored. This gives:

[Credits: @lemouth]

We next quit MG5aMC by typing


The following item on our to-do list is to list the content of the current folder (through the Linux command ls). We see a sub-folder named some_name. You can check out its content for the fun and admire the Fortran code that will allow us to simulate LHC collisions leading to the production of a top-antitop pair.

In practice, you can try to mimic what I did in the screenshot below. Feel free to open any file with a text editor if you are curious ;)

[Credits: @lemouth]

Computing the rate to top-antitop production at the LHC - task 3

Having a Fortran code dedicated to a given calculation is great. Compiling it and running it is better. These tasks are highly automated and there is not much to do on your side. Please go back to the folder in which MG5aMC has been installed, and restart the code as mentioned above. Then type

launch some_name

That’s all! MG5aMC will compile the code, execute it and produce the output. For this week we are not interested in understanding how to interpret the results. The goal is instead to solely produce them, and verify whether everything runs smoothly without any problem.

As an outcome of the launch command, there is an interactive menu allowing us to discuss with MG5aMC. We need to tell it to use Pythia8 and MadSpin (for which f2py, that is part of NumPy, should be present on the system; if this is not the case, please proceed with its installation). This is achieved as follows.

  • To enable Pythia8, press 1 (then press enter).
  • To enable MadSpin, press 4 (then press enter).

We should then get something like this:

[Credits: @lemouth]

Pythia8 allows us to simulate the strongly-interacting environment of the LHC. This includes parton showering (radiation of strongly-interacting particles by other strongly-interacting particles) and hadronisation (formation of composite objects made of quarks and gluons). For more information, feel free to check out this blog. On the other hand, MadSpin deals with the decay of the produced top quarks, that are instable particles (see here).

The next step is to set the simulation parameters. First press enter so that a new menu is displayed.

[Credits: @lemouth]

We have four cards to play with.

  • The param_card allows us to change the parameters of the particle physics model.
  • The run_card allows us to change the collider settings.
  • The pythia8_card allows us to change the parameters of Pythia8.
  • The madspin_card allows us to modify how heavy instable particles decay.

Let’s keep everything as default for now, with one exception. We open the run_card (by pressing 2 and the enter), and then go to line 129. This line should read

True  = use_syst      ! Enable systematics studies

and needs to be changed into

False  = use_syst      ! Enable systematics studies

In order to do it, MG5aMC should in principle detect a text editor coming with your machine and open the file with it. In my case it is VIM, so that it is sufficient to type

129 G d d i

and then edit the line. Finally, the file can be saved by typing


If you don’t do that, please don’t worry. The code should just crash because some packages are missing… So please do it ;)

Then, it is sufficient to press enter. The simulation starts and will produce some long output printed to the screen. Please check it out. In the middle of it, you should see something similar to

[Credits: @lemouth]

This number (505.491 ± 0.6866 pb) corresponds to the production rate of a top-antitop pair at the LHC. The result that you will obtain could be slightly different from mine. The reason is that MG5aMC achieve a Monte Carlo simulation based on some random scan. Small numerical discrepancies are possible, although the numbers should be compatible within their uncertainties (here we have a per-mille level precision).

In the performed calculations, we kept all default values in the run_card, so that 10,000 collisions have been simulated. With a larger number, a larger precision is automatically obtained.

The units of the rate may be strange to you. Those consist of picobarns (abbreviated to pb). In order to understand what they mean, we can invoke the amount of recorded LHC data: 140/fb. This number is given in inverse femtobarns. 1 inverse femtobarn is equal to 1,000 inverse picobarns, so that the amount of recorded LHC data reads 140,000/pb. Multiplying the calculated rate in pb by 140,000/pb, we obtain a dimensionless quantity of about 70,000,000. This consists of the amount of top-antitop events excepted in current data.

MG5aMC thus calculates the rate of any given process, and we can extract from this information the amount of collisions that should be recorded and related to the process considered. This is thus a very useful quantity!

Checking out whether everything went fine - task 4

In the rest of the screen output, we can verify that MadSpin handled the decay of the produced top quarks and antiquarks as expected. Please verify that you see something like this on your screen.

[Credits: @lemouth]

Similarly, we can verify that parton showering and hadronisation went fine:

[Credits: @lemouth]

We now have on our disk a file containing 10,000 LHC collisions in which a top-antitop pair has been produced. By exiting the code (through typing exit), we can verify that those events are well available on disk.

cd some_name/Events/run_01_decayed_1
ls -lrt

We should have here a file if about 800 MB named tag_1_pythia8_events.hepmc.gz. This is the file we will analyse to understand the physics that is in there. But this will be for the next episode. Reaching this stage is enough for this week.

Summary: mastering particle collider simulations

Two weeks ago, we spent time on the installation of a program named MG5aMC. In the blog of this week, I proposed a few tasks to get used to this program. This is an incontrovertible prerequisite before being able to fully work on our citizen science particle physics project on Hive.

I proposed here something very simple: the simulation of 10,000 proton-proton collisions such as those happening in the Large Hadron Collider. In those collisions, a top quark and an antitop quark are produced.

Those simulated collisions were quite accurate in the sense that they include the core process considered, the decay of the top and antitop quarks, parton showering and hadronisation. Somewhat, they are as close as possible as what is going on in true collisions. The missing steps concern the simulation of the detector, and the reconstruction of the obtained events. A collision indeed generally leads to thousands of produced particles. However, these correspond only to a handful of higher-level objects that can be reconstructed and used in an analysis.

As usual, I warmly welcome everyone interested to try out the tasks proposed this week. I am here to help, answer questions and solve problems. If you are new to this and interested in joining us, please check the previous blogs on the topic (here and there), as well as the reports available from the #citizenscience tag.

If you are a participant to the project, I am looking forward to read a blog detailing your progress. Please make sure to notify me and use the #citizenscience tag.

Have a nice week, full of particle physics!


I was finally able to get everything in place. We were able to uncover a bug in @metabs report in the process. I should be ready to carryout the tasks above in no time.

And the bug is now fixed! See, that is why someone else has to validate the procedures :)

Two pairs of eyes are always superior to one! This is also how I see the next steps for this project. We need cross-validation to make sure everything we do will be correct.

Ooohh I didn't know that. It is super great to see everyone helping each other (and also nice to read that everything had been sorted out! ;) ).

Good luck with the list of tasks for this week. Please let me also know whether this is fine in terms of volume. Is it good enough, not enough or too much. Thanks in advance!


Hi, this part was a bit more difficult but i succeeded.
You could edit to make it easier:
Task 3:
. to enable Pythia8 press 1 (then enter)
. to enable MadSpin press 4 (then enter)
. when runing run_card.dat: first press esc to be able to use the arrows keys to reach the line 129 we need to modify, then play with the "INSER" and "SUPPR" keys of our keyboard to modify True to False, and type ":qa!" to exit the editor. (that was the hardest part for me and i solved it by doing that, maybe there is an easier way)
I'll make a post in Citizenscience for all steps.
My final result:


 2 years ago (edited)

Thanks a lot for the suggestion. I have updated the post for what concern Pythia8 and MadSpin. I definitely agree with you and a bullet list is easier to read.

For the editing of the run card, I am less sure (I am at least missing some pieces of information). What to do in practice actually depends on your text editor. In my case it is VIM, so that it is sufficient to type

129 G d d i

and then edit the line. Finally, the file can be saved by typing


Therefore, if you provide some information about your text editor, I will add this more consistently to the post.

In addition, I am very happy to read that you managed to go through everything, and I am looking forward to have a look at your report. By curiosity, how long did it take you? This will allow me to tune the amount of work requested in every post.


PS: I have finally added information on how to do it with VIM.

I think it took me over an hour, but since I fumbled it, that's not the reference time. I don't have time today, but I'll start the task again tomorrow by trying the right editor's commands and watch the time.

Don't worry. There is no need to restart everything. The order of magnitude of the time it took you is enough. In fact, I think that an hour is a reasonable amount of time so that it stays cool and funny without becoming a burden. Please let me know when you report will be released.


Hi my post is released, i think it needs between 30 mn and one hour for the task depending of linux skills.

Excellent! I will check it out before going to sleep. Thank you for your contribution!

Great explanation as always! I will be on it as soon as possible.

Great! I am looking forward to see how you will manage. ^^

Please also consider keeping me updated about the volume of tasks required in this blog. Is it too small, just as needed or too large? Moreover, what is your opinion about the rhythm. Is one post every two weeks fine, or should I move to one post per week?

Thanks in advance for your feedback and sorry for the nasty questions :)

I think the volume of tasks at the moment is manageable, it's ok, and doing it every other week is also fine for me. They' not nasty questions at all!

Hehe :) Thanks for answering. It is useful for adjusting the (bi-)weekly tasks.


Sure. I just made my report btw. Please, take a look, I had some issues.

I will check out later today. Thanks for your contribution and participation to this project!

Hello dear friend @lemouth, last week I was able to see the article of some of the participants, who already took the first step and managed to install the program, I could see that it was the first learning for many and they fulfilled their first goal.

Today reading your article, I realize that this project has already begun to consolidate, with these first activities I am sure that a good debate will begin with the participants and to clarify certain concerns.

The methodology you use is very good, in a few weeks time, some will already know a little more about particle physics.

See you later, have a great week.

Thanks a lot for your support and comment. I know you are super busy and won't have the time to take part to the project (which is fine). Therefore, just knowing that you follow us and that you keep an eye of what is going on is really great and makes me happy!

In practice, the timeline I have in mind is to rely on the first two months for preparation tasks, before next entering into the main part of the project. I prefer to move on little by little than going too fast and losing everyone. Let's see where this will lead us ;)

Cheers, and have a nice week!

I got everything up to 'run-card'. I typed 2, pressed enter and below is the message I got

PS: I was able to edit the text to false and saved with :wq. After pressing enter, it keeps taking me back.

When it takes you back, I assume that MG5aMC asks you again which cards you want to edit. Can you press 2 (the run card) and verify whether the lines that need to be changed have been changed? If this is the case, then you should just press enter to validate everything and move forward.

If the run card has in contrast not been updated, then there is something weird. What you can do is to save your file with :wq!. The question mark will force it to obey. I don't understand why the swp file is not automatically deleted.

Please let me know first about everything above. Then we will see how to move further (I have options in mind).

What needs to be changed has actually been changed. When I typed :wq and press entered, I didn't expect it to take me back to selecting a card for editing again. At least, that's now the way it is in your own screenshot.

Then you can press enter and move on. This means that you are happy with the cards as they are, and that MG5aMC can proceed with the simulations. Does it work?

This is what I get when I pressed enter

This looks good. You can save the file (press :wq in VIM) and move forward. Does it work?

I was taken back here and when I press 2 to run-car, the cycle continues

If you press 2, you tell the code that you want to edit the run card again (and therefore the loop). When you are happy with all the cards, it suffices to simply press enter without anything else. Can you please try?

Screen Shot 2022-03-30 at 10.05.51 PM.png

This week's tasks are overwhelmingly good! I was supposed to explore the software before this post comes out but wasn't able to do that. So, I guess, I do agree with your proposal that tasks come every other week. :)
Just a question out of curiosity, I was trying to check what does launch detector simulation do from this webpage. I was instructed to call pythia folder_name_events in the shell, however, the prompt shows that the command pythia (see below)

Screen Shot 2022-03-30 at 10.24.59 PM.png

I'm just actually curious what will happen when detector simulation is launched. Excited to write about this week's progress report over the weekend. 🤓 Thank you!

Thanks for this great feedback and everything that you tried. I am really excited to read your full report :)

So, I guess, I do agree with your proposal that tasks come every other week. :)

At the end, this is also better for me as putting everything in place is more time-consuming than what I naively thought initially ;)

It is nice to see you trying the software in many ways. I will help you to run pythia8 independently. In order to do so, you need to start from hard process events (and not from the beginning where we just have nothing). This is done through

  launch STEMsocial_rocks --laststep=parton
Another possibility is to run it directly.
  cd STEMsocial_rocks;

And then you should follow what is printed to the screen. Note that here, STEMsocial_rocks is the name of my working directory.

For what concerns the simulation of the detector effects, this will be the topic of the next two blogs related to this project. Here, we won't use MG5aMC, but instead a framework called the SFS framework (SFS standing for Simplified Fast Simulator) that I developed a couple of years ago.

As a side note, I am considering to write a full blog on this on Monday, so that some material will be ready for the next citizen science tasks :)


I almost have it! Had some issues running this week tasks... almost in all of them, but hey, i think it is very close to be finished!

I am very happy to read this, and I am looking forward to read your report with a description of all these issues.

Note that you can always feel free to notify me directly, if you have any question. Please remember that I am here to help ^^

It has been, and still is, a bit a bumpy road. My last attempt, finished with a message that there was no space, and that is strange because the VM is only 9 GB out of the 30 it could be at maximum and there is still some extra GBs on my physical hardisk. I will have to run it again today:

Mhh this seems weird.

Maybe could you check out how much disk space is used / free directly from the VM? In any case, this issue has definitely nothing to do with the simulation package itself (so that I am afraid I cannot be of any decent help).

Good luck in fixing this.

I know, I am a bit puzzled, everything makes me think there si actually free space there but I delete everything, restart and get the same output again. And my tag_1_pythia8_events.hepmc file placed in the folder keeps weighting all the time the same, which is kind of strange.

Can you please run

 df -h --output=source,fstype,size,used,avail,pcent,target -x tmpfs -x devtmpfs

in a terminal? This should tell you how much diskspace you effectively have on the VM.

I think I have the issue. So, when setting up the virtual disk, you have to set a maximum size (despite it allocates directly all that space or it is dynamically allocated). So, at first I set that at 10GB, then i changed that to 25GB. But of course, the system still knows that its partitions are of 10GB, so probably what i really have is some unformatted empty space there.

Not sure if i will try to install gparted an try to resize the partitions, have to check if you can really do that without wipping them, or most probably I will restart the process completely and create a new VM with more space.

I agree that creating a fresh VM may be a faster solution. I am unsure here... But at least the problem is fully identified and you have to options on how to move on. Please keep me posted!


Job well done boss, it hasn't been an easy road I must testify though the journey is time consuming, more reading,more explanations, more understanding, and very many more, MORE STRENGTH BOSS. To the project, bravo to the software installation as I have known the little I have tried wasn't easy though,. In the absence of my contribution physically, my mind is with the team....CANT WAIT TO SEE IT SUCCESSFUL.

Hehe! Thanks for being so supportive to all participants, and to the project as a whole. Yes, it takes time. However, the rewards will just be amazing when the project will get completed. We are however not there (at least yet).


Yes boss, I understand its just a matter of time, more diligence and hard work which you and your team is putting in will make successfully done. More agility boss, you got my support

Thank you!

Have a !BEER

Thank you! I always like having a beer ^^

Glad to see this many people interested in this project ! Good luck ! :)

Is there still no way to convince you to join us? :D

I'm not sure I have the time to follow this project as closely as I would like to, sorry :(
I will try to follow the tasks one of these days and if I can catch up with you I will let you know ;)

That's fine, don't worry. You already told me how busy you were and there is nothing wrong with it ;)

I would change my mind immediately if we learn during this project how you are able to do so many different things each days, I could use this super power ^^

Mmmh... Clones? :D

Nice one thanks for sharing

Thank you very much. The pleasure was truly for me ;)

Nice hope to see you some other time friend

You will, as I won't probably move very far from here ;)

Nice I will certainly look out and keep in touch.

Great Post!


Thanks for passing by and your support!

Hi, @lemouth. I just posted my second report. Everything went well, though the Phythia log shows some errors and warnings. cheers!

Thanks for letting me know and for your participation to the project. I will check the report later this evening, and give it some comments if needed. I imagine that this may actually be needed as you mentioned issues with Pythia8.


The rewards earned on this comment will go directly to the person sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at


You have received a 1UP from @luizeba!

The following @oneup-cartel family members will soon upvote your post:
@stem-curator, @vyb-curator, @pob-curator, @neoxag-curator
And they will bring !PIZZA 🍕

Learn more about our delegation service to earn daily rewards. Join the family on Discord.

Hello dear friend @lemouth, last week I was able to see the article of some of the participants, who already took the first step and managed to install the program, I could see that it was the first learning for many and they fulfilled their first goal.

Today reading your article, I realize that this project has already begun to consolidate, with these first activities I am sure that a good debate will begin with the participants and to clarify certain concerns.

The methodology you use is very good, in a few weeks time, some will already know a little more about particle physics.

See you later, have a great week.

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support. 

Your content has been voted as a part of Encouragement program. Keep up the good work!

Use Ecency daily to boost your growth on platform!

Support Ecency
Vote for new Proposal
Delegate HP and earn more

Hey @lemouth, here is a little bit of BEER from @isnochys for you. Enjoy it!

Learn how to earn FREE BEER each day by staking your BEER.

Congratulations @lemouth! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You distributed more than 82000 upvotes.
Your next target is to reach 83000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Hive Power Up Month - Feedback from February day 25
 2 years ago Reveal Comment
 2 years ago Reveal Comment