HEP MC and Data Analysis Tutorial 2017

Tutorial per il corso di Fisica Nucleare e Subnucleare, Dipartimento di Fisica, Universitą degli Studi di Trieste.





To start

Preliminary steps:

  1. create a folder HiggsTutorial, which will be our "working directory"
  2. download the this version of MadGraph5: MG5_aMC_v2.5.5 from this site: https://launchpad.net/mg5amcnlo/2.0/2.5.x/+download/MG5_aMC_v2.5.5.tar.gz
  3. move the downloaded file (MG5_aMC_v2.5.5.tar.gz) to our working directory and extract it (a new sub-directory MG5_aMC_v2_5_5 should have been created, which we will call "MG5 directory")
  4. copy the script setup.sh (attached here: setup.sh) inside the working directory
  5. from a terminal, from inside the working directory, execute the command source setup.sh: this will setup ROOT, gcc and python, and has to be done each time we open a new termnal (!)
  6. test MadGraph: from inside the MG5 directory, from the terminal execute: ./bin/mg5_aMC; if it works you should be inside the MG5 shell
  7. try to generate a physics process: from inside the MG5 shell, give the command generate p p > t t~ (this should prepare the generation of pp -> ttbar events)
  8. exit MG5 shell, with CTRL+D

MadGraph preparation:

  1. eventually modify the MG5 settings for the used browser and text editor: modify the text file input/mg_configuration.txt accordingly (suggested gedit or nano as text editor, firefox as browser)
  2. enter the MG5 shell: from the MG5 directory, from a terminal (after the setup!) type ./bin/mg5_aMC
  3. type install pythia-pgs to install Pythia6 (parton shower and hadronisation software)
  4. type install Delphes to install the latest version of Delphes (detector simulation and object reconstruction fast simulation software)

Generate Processes with MadGraph

Let's start with the MG5 tutorial:

  1. from the MG5 shell, type tutorial
  2. follow the instructions on the screen

Then let's have one more exercise. What's the cross-section (at LO) for the process pp -> ttbar, with a CME of 7 TeV and a top mass of 172.5 GeV?

  1. if you already have a ttbar directory, you can directly move to point 5
  2. from the MG5 shell, type generate p p > t t~
  3. then create the output directory, still from the MG5 shell, typing output ttbar
  4. exit MG5 (CTRL+D)
  5. enter the ttbar directory
  6. enter the MadEvent shell: ./bin/generate_events
  7. press enter
  8. now we are asked to modify the cards: we want to change both the CME and the top mass, so we have to modify both run_card.dat and param_card.dat
  9. to modify run_card.dat type 2, then ENTER
  10. find the lines with the energies of the two beams and set them to 3500 GeV each
  11. when finished, save the file and exit
  12. now you can modify param_card.dat typing 1, then ENTER
  13. find the line like 6 1.730000e+02 # MT, and set 1.725000e+2 instead of 1.730000e+02
  14. when finished, save the file and exit
  15. then press ENTER and the computation will start
  16. wait few minutes you should get the result: you can read it from the screen or from the file ttbar/crossx.html

Process MadGraph outputs: Pythia and Delphes

We already installed Pythia and Delphes. Now we can turn them on when generating events, in order to also simulate the parton shower and the hadronisation, as well as the detector simulation:

  1. if you already have a ttbar directory, you can directly move to point 5
  2. from the MG5 shell, generate the usual test process generate p p > t t~
  3. create an output directory: output output ttbar
  4. exit MG5 (CTRL+D)
  5. enter the ttbar directory: cd ttbar
  6. enter MadEvent shell: ./bin/generate_events
  7. switch Pythia to ON
  8. switch Delphes to ON (NB: you might need to do it twice, until you see "Delphes" written there)
  9. type 0, ENTER, and then again 0, ENTER
  10. the events will be generated with Pythia and Delphes switched ON
  11. we can give a look at the text file called tag_1_pythia.log inside the directory ttbar/Events/run_01/: this log contains, among other info, the full record of the fort 10 generated events (you can see the initial protons, the inital partons, the intermediate tops and their decay products, as well as all the products of the subsequent parton shower and hadronisation - quite a long list...)
  12. the delphes output file is also stored in the ttbar/Events/run_01/ directory, with a .root extension

To read Delphes outputsē

  1. dowload the file MyReader.C from here: MyReader.C, and put it inside the directory Delphes/examples (note: it's inside MG5 directory)
  2. open the file with a text editor
  3. uncomment the proper lines in order to create, fill and show a histogram, then save the file
  4. run the macro on the latest MG5 run output: from a terminal (again after the usual setup!), go to the directory Delphes and type root -l 'examples/MyReader.C("../ttbar/Events/run_XX/tag_1_delphes_events.root")'

Main exercise: Higgs to 4 leptons


  • select events coming from h->ZZ->4 lep and to produce a histogram with the reconstructed Higgs mass in these events
  • compare "data" with MC simulation for Higgs signal and ZZ background
  • everything should be done at CME = 8 TeV, considering the data integrated luminosity of 25 $fb^{-1}$

Where to get the data:

Generate the signal:

  • as usual, ./bin/mg5_aMC
  • IMPORTANT: before the generate command, type import model heft
  • generate p p > h > l+ l- l+ l-
  • output h4lep
  • exit MG5, enter h4lep directory, enter MadEvent: ./bin/generate_events
  • set Pythia ON, Delphes ON, the rest OFF
  • when prompted, modify the run card:
    • set the CME to 8 TeV (4000 GeV each beam)
    • check that False  = cut_decays (should be by default in latest MG5)
  • (eventually change the Higgs mass in the param card)
  • IMPORTANT: later we will multiply the signal x-sec given by MG5 by 10 (at LO both the x-sec and the BR are underestimated)

Generate the background (ZZ->4lep):

  • as usual, ./bin/mg5_aMC
  • generate p p > l+ l- l+ l- /h (the /h excludes the Higgs as intermediate state)
  • output zz4lep
  • exit MG5, enter zz4lep directory, enter MadEvent: ./bin/generate_events
  • set Pythia ON, Delphes ON, the rest OFF
  • when prompted, modify the run card:
    • set the CME to 8 TeV (4000 GeV each beam)
    • check that False  = cut_decays (should be by default in latest MG5)

How to produce the final plot:

  • look at the code MyHiggs4l.C: MyHiggs4l.C
    • use it as a template for your macro to create a histogram out of each delphes output files (signal, background, data)
    • the two inputs to the macro are the name of the root file with the delphes output and the output file where to store the histogram
    • example:
      • root -l -b -q 'examples/MyHiggs4l.C("../h4lep/Events/run_01/tag_1_delphes_events.root","signal.root")'
      • root -l -b -q 'examples/MyHiggs4l.C("../zz4lep/Events/run_01/tag_1_delphes_events.root","background.root")'
      • root -l -b -q 'examples/MyHiggs4l.C("data_events.root","data.root")'
  • then look at the code MyHistMerger.C: MyHistMerger.C
    • use it as a template for your code to read the three inputs and merge them in a final plot
    • note the signal x-sec multiplied by 10

-- MichelePinamonti - 2017-12-13

Topic attachments
I Attachment History Action Size Date Who Comment
C source code filec MyHiggs4l.C r2 r1 manage 2.4 K 2017-12-14 - 12:07 MichelePinamonti  
C source code filec MyHistMerger.C r1 manage 1.1 K 2017-12-14 - 09:04 MichelePinamonti  
C source code filec MyReader.C r2 r1 manage 1.7 K 2017-12-14 - 12:07 MichelePinamonti  
Unknown file formatroot data_events.root r1 manage 7908.9 K 2017-12-14 - 09:03 MichelePinamonti  
Unix shell scriptsh setup.sh r2 r1 manage 0.3 K 2017-12-14 - 12:08 MichelePinamonti  
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2017-12-14 - MichelePinamonti
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback