| 33 | == MadGraph5/MadEvent basic tutorial (@Leading Order) == |
| 34 | |
| 35 | In this part you are going to learn how to generate pardon-level and showered events with MadGraph5 (interfaced with Pythia6). |
| 36 | |
| 37 | 0) Create a new directory: |
| 38 | |
| 39 | {{{ |
| 40 | mkdir DelphesTutorial |
| 41 | cd DelphesTutorial |
| 42 | }}} |
| 43 | |
| 44 | 1) Download and install MG5 by typing in a terminal: |
| 45 | {{{ |
| 46 | wget https://launchpad.net/mg5amcnlo/2.0/2.4.0/+download/MG5_aMC_v2.4.0.tar.gz |
| 47 | tar xzvf MG5_aMC_v2.4.0.tar.gz |
| 48 | }}} |
| 49 | 2) Launch MG5: |
| 50 | {{{ |
| 51 | cd MG5_aMC_v2_4_0 |
| 52 | ./bin/mg5_aMC |
| 53 | }}} |
| 54 | 3) Install Pythia6 and !MadAnalysis: |
| 55 | {{{ |
| 56 | install pythia-pgs |
| 57 | install MadAnalysis |
| 58 | }}} |
| 59 | 4) Generate a LO Drell-Yan process: |
| 60 | {{{ |
| 61 | generate p p > e+ e- |
| 62 | display diagrams |
| 63 | }}} |
| 64 | 5) Generate a LO Higgs process: |
| 65 | {{{ |
| 66 | generate p p > h > e+ e- mu+ mu- |
| 67 | }}} |
| 68 | The diagram generation fails ... do you understand why? Type instead: |
| 69 | {{{ |
| 70 | import model heft |
| 71 | generate p p > h > e+ e- mu+ mu- |
| 72 | display diagrams |
| 73 | }}} |
| 74 | This generates also diagrams containing photon internal lines. To veto that diagram type the following: |
| 75 | {{{ |
| 76 | generate p p > h > e+ e- mu+ mu- / a |
| 77 | display diagrams |
| 78 | }}} |
| 79 | 6) Let's generate some events |
| 80 | {{{ |
| 81 | output pp_h_eemm |
| 82 | launch pp_h_eemm |
| 83 | }}} |
| 84 | |
| 85 | You will be prompted with a screen asking questions ... Type "ENTER". Another screen comes and asks you if you want to edit a bunch of configuration cards: |
| 86 | |
| 87 | - "param_card.dat" is where the parameters of the model are stored (masses, couplings) |
| 88 | - "run_card.dat" is where the parameters of run are defined (ecm, number of events, |
| 89 | generation level cuts ..) |
| 90 | - "pythia_card.dat" is where parameters of the shower are defined |
| 91 | |
| 92 | Open "param_card.dat" and "run_card.dat" by typing respectively "1" and "2"and have a look at them, but do not modify them for now. The editor is "vi", so to quit type ":q". Type ENTER to launch the parton-level generation. |
| 93 | |
| 94 | 7) When it's done, you should be prompted with a web browser. If not quit MG5 by typing "exit", and open the html file that was created and the end of the run with your web browser: |
| 95 | {{{ |
| 96 | firefox [MG5DIR]/pp_h_eemm/Events/index.html |
| 97 | }}} |
| 98 | Click on "Results and Event Database" and then on "LHE plots". Have a look at the automatically generated parton-level plots. Explain the Ecm plot (this is the total invariant mass of the system, i.e of the four final state leptons). |
| 99 | 8) Enter in MG5 again, and type: |
| 100 | {{{ |
| 101 | ./bin/mg5_aMC |
| 102 | import model heft |
| 103 | }}} |
| 104 | {{{ |
| 105 | generate p p > h , h > e+ e- mu+ mu- / a |
| 106 | display diagrams |
| 107 | }}} |
| 108 | Then: |
| 109 | {{{ |
| 110 | output pp_h_eemm_res |
| 111 | launch pp_h_eemm_res |
| 112 | }}} |
| 113 | Note the different syntax. |
| 114 | This time, when you will be prompted with the screen asking questions ... Type "1". This will activate parton and hadronization with Pythia6, and then type ENTER. |
| 115 | When the generation is done, have a look again at the parton-level plots. |
| 116 | |
| 117 | 7) Generate a new set of events, this time setting in the param_card mH = 750 GeV. !! Note that since we are keeping the higgs width value corresponding to mH = 125 GeV, this won't be a proper SM higgs with mH = 750 GeV !! |
| 118 | |
| 119 | For this we don't need to re-generate the diagrams, we can simply type "launch" and edit the param_card by changing the higgs mass when prompted. If everything worked smoothly you should have two event samples with 10k events each. Events are stored in [MG5DIR]/pp_h_eemm_res/Events/run_01(02) |
| 120 | |
| 121 | Now to quit MG5, type "exit". In each run sub-directory, only two files are interesting for us: |
| 122 | |
| 123 | - "unweighted_events.lhe" contains hard-interaction events only, pre-hadronization and PS, |
| 124 | it is human readable, in so-called Les-Houches Event format (in short LHE) |
| 125 | - "tag_1_pythia_events.hep" contains showered and hadronized events, it is the event file |
| 126 | that we are going to give as input to the Delphes simulation. |
| 127 | |
| 128 | This ends the very basic introduction to MG5. For an extensive list of tutorials, lectures about this tool (including matching, NLO generation, etc..) , have a look at the !MadGraph School 2015 page: |
| 129 | |
| 130 | http://www.physics.sjtu.edu.cn/madgraphschool/ |
| 131 | |
| 132 | == Delphes Tutorial == |
| 133 | |
| 134 | === Part I - Getting Started === |
| 135 | |
| 136 | 0) Go back to the !DelphesTutorial directory |
| 137 | |
| 138 | 1) Get Delphes: |
| 139 | {{{ |
| 140 | git clone https://github.com/delphes/delphes.git |
| 141 | cd delphes |
| 142 | }}} |
| 143 | or, if you don't have "git" installed, simply type: |
| 144 | {{{ |
| 145 | wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.3.2.tar.gz |
| 146 | tar -zxf Delphes-3.3.2.tar.gz |
| 147 | mv Delphes-3.3.2 delphes |
| 148 | cd delphes |
| 149 | }}} |
| 150 | 2) Install it: |
| 151 | {{{ |
| 152 | ./configure |
| 153 | make -j 4 |
| 154 | }}} |
| 155 | 3) Unzip the event files previously generated with MG5, and move them in your delphes directory |
| 156 | {{{ |
| 157 | gunzip ../MG5_aMC_v2_4_0/pp_h_eemm_res/Events/run_01/tag_1_pythia_events.hep.gz |
| 158 | gunzip ../MG5_aMC_v2_4_0/pp_h_eemm_res/Events/run_02/tag_1_pythia_events.hep.gz |
| 159 | }}} |
| 160 | {{{ |
| 161 | mkdir -p input |
| 162 | mv ../MG5_aMC_v2_4_0/pp_h_eemm_res/Events/run_01/tag_1_pythia_events.hep input/pp_h_eemm_m125.hep |
| 163 | mv ../MG5_aMC_v2_4_0/pp_h_eemm_res/Events/run_02/tag_1_pythia_events.hep input/pp_h_eemm_m750.hep |
| 164 | }}} |
| 165 | |
| 166 | 4) Finally, let's run Delphes. If the compilation went right, you should have three executables: |
| 167 | |
| 168 | - DelphesLHEF -> should not be used |
| 169 | - DelphesHepMC -> to be used on HepMC input format (*.hepmc) |
| 170 | - DelphesSTDHEP -> to be used on STDHEP input format (*.hep) |
| 171 | |
| 172 | Type for instructions (note that output file comes before input file): |
| 173 | {{{ |
| 174 | ./DelphesSTDHEP |
| 175 | }}} |
| 176 | To run on our your input file, type: |
| 177 | {{{ |
| 178 | ./DelphesSTDHEP cards/delphes_card_CMS.tcl delphes_output_m125.root input/pp_h_eemm_m125.hep |
| 179 | }}} |
| 180 | 5) Open freshly produced Delphes output with ROOT, and explore it. |
| 181 | {{{ |
| 182 | root -l delphes_output_m125.root |
| 183 | TBrowser t; |
| 184 | }}} |
| 185 | In the browser, double click on the "delphes_output_m125.root", and then on the "Delphes" tree. Play around by double clicking on the various branches/observables. |
| 186 | |
| 187 | You can then play plot important observable with a simple selection with the following syntax: |
| 188 | {{{ |
| 189 | Delphes->Draw("Muon.PT", "Muon.PT > 20"); |
| 190 | Delphes->Draw("Electron.PT", "Electron.PT > 20"); |
| 191 | }}} |
| 192 | - Note 1: Delphes - tree name, it can be learnt e.g. from TBrowser |
| 193 | - Note 2: Muon/Electron - branch name; PT - variable (leaf) of this branch |
| 194 | {{{ |
| 195 | Delphes->Draw("Muon.Eta", "Muon.PT > 20"); |
| 196 | Delphes->Draw("Electron.Eta", "Electron.PT > 20"); |
| 197 | Delphes->Draw("Jet_size","Electron_size > 1 && Muon_size > 1"); |
| 198 | }}} |
| 199 | Objects are already ordered in PT, you can then plot leading ele/mu in this way: |
| 200 | {{{ |
| 201 | Delphes->Draw("Muon[0].PT", "Muon.PT > 20"); |
| 202 | Delphes->Draw("Electron[0].PT", "Electron.PT > 20"); |
| 203 | }}} |
| 204 | For more information on ROOT trees: |
| 205 | |
| 206 | http://cp3.irmp.ucl.ac.be/downloads/RootTreeDescription.html |
| 207 | |
| 208 | === Part II - Run a macro-based analysis on Delphes output === |
| 209 | |
| 210 | 1) The macro examples/Example3.C produces resolution plots comparing reconstructed vs MC truth quantities. Run it on the delphes output: |
| 211 | |
| 212 | root -b -q examples/Example3.C'("delphes_output_m125.root")' |
| 213 | |
| 214 | It produces a bunch of plots in "png" format. Open them with your favourite image viewer: |
| 215 | |
| 216 | {{{ |
| 217 | open *.png |
| 218 | }}} |
| 219 | or |
| 220 | {{{ |
| 221 | eog *.png |
| 222 | }}} |
| 223 | |
| 224 | Understand: |
| 225 | |
| 226 | - Why is the eta resolution plot for electron and muons different compared to photons? |
| 227 | - Where do photons come from? |
| 228 | - Why is the jet resolution plot shifted? |
| 229 | |
| 230 | |
| 231 | 2) Let's now run a real event selection, and plot some interesting quantities. We select events with: |
| 232 | |
| 233 | - >= 2 opposite sign isolated electrons , pT > 10 GeV, |eta| < 2.5 |
| 234 | - >= 2 opposite sign isolated muons , pT > 10 GeV, |eta| < 2.5 |
| 235 | |
| 236 | Construct 3 invariant masses and fill them in histograms: |
| 237 | |
| 238 | - min( m(e+ e-), m(mu+ mu-) ) |
| 239 | - max( m(e+ e-), m(mu+ mu-) ) |
| 240 | - m (e+ e- mu+ mu-) |
| 241 | |
| 242 | Open the "HZZ.C" macro with your favorite text editor, and make sure you understand what it |
| 243 | does. Then run it: |
| 244 | {{{ |
| 245 | root -b -q examples/HZZ.C'("delphes_output_m125.root")'; |
| 246 | }}} |
| 247 | Some plots are produced. Open the produced png file. |
| 248 | |
| 249 | - Explain the left plot. |
| 250 | - Appreciate the effect of detector resolution by comparing the gen and reco histograms |
| 251 | |
| 252 | Now redo this analysis, but this time using the mH = 750 GeV input file. Do not edit directly the HZZ.C file, make a copy of it and edit the copy rather. |
| 253 | |
| 254 | - Spot and explain the differences with the mH = 125 GeV case. |
| 255 | |