| 1 | [[TOC]] |
| 2 | |
| 3 | = Delphes Tutorial - DESY March 2020 = |
| 4 | |
| 5 | == Pre-requisites == |
| 6 | |
| 7 | To successfully run this tutorial the Delphes virtual machine should be installed, see here for more information: |
| 8 | |
| 9 | https://twiki.cern.ch/twiki/bin/view/VBSCan/PREFIT20 |
| 10 | |
| 11 | |
| 12 | |
| 13 | - gcc/tcl: |
| 14 | |
| 15 | For linux users gcc/tcl should be already installed. For Mac users you should install XCode. |
| 16 | |
| 17 | - ROOT: |
| 18 | |
| 19 | can be downloaded from https://root.cern.ch/downloading-root |
| 20 | Go on latest release, and download a version under "Binary distributions". |
| 21 | |
| 22 | - Pythia8: |
| 23 | |
| 24 | following instructions from here (or using the Pythia8 installation in !MadGraph): |
| 25 | |
| 26 | https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/Pythia8 |
| 27 | |
| 28 | The solutions for all the exercises can be found in the attachment file (suggestion: download file locally). |
| 29 | |
| 30 | == I) Event generation with Pythia8 + Delphes sample == |
| 31 | |
| 32 | This exercise will teach how to configure the Pythia8 event generator for a simple production of e+e- -> ZH events. Next, you will generate events and simulate the detector with the DelphesPythia8 executable. |
| 33 | |
| 34 | 1) Create a Pythia8 configuration card that generates N=10k events of ee->Zh->mumu at sqrt(s)=240 GeV (call it "examples/Pythia8/config_ee_zh_zmumu.cmd"). |
| 35 | |
| 36 | {{{ |
| 37 | Main:numberOfEvents = 10000 ! number of events to generate |
| 38 | |
| 39 | Beams:idA = 11 ! first beam, e- = -11 |
| 40 | Beams:idB = -11 ! second beam, e+ = 11 |
| 41 | Beams:eCM = 240. ! CM energy of collision |
| 42 | |
| 43 | ! Higgsstrahlung process |
| 44 | HiggsSM:ffbar2HZ = on |
| 45 | |
| 46 | ! 5) Force the Z decays to muons |
| 47 | 23:onMode = off |
| 48 | 23:onIfAny = 13 -13 |
| 49 | }}} |
| 50 | |
| 51 | 2) Produce Delphes events using the above Pythia8 configuration (this command should run Pythia and Delphes on the fly!), using the CEPC detector card "cards/delphes_card_CEPC.tcl" |
| 52 | |
| 53 | {{{ |
| 54 | ./DelphesPythia8 cards/delphes_card_CEPC.tcl examples/Pythia8/config_ee_zh_zmumu.cmd delphes_ee_zh_zmumu.root |
| 55 | }}} |
| 56 | |
| 57 | == II) Simple Tree analysis == |
| 58 | |
| 59 | |
| 60 | 1) Open Delphes ROOT tree and explore the branches |
| 61 | |
| 62 | {{{ |
| 63 | root -l delphes_ee_zh_zmumu.root |
| 64 | gSystem->Load("libDelphes"); |
| 65 | TBrowser t; |
| 66 | }}} |
| 67 | |
| 68 | |
| 69 | Note: Most objects are described in terms of pp specific variables (PT, Eta, Phi). |
| 70 | This is simply for historical reasons (and makes of course no difference whatsoever) since Delphes was developed originally as a tool for LHC physics. To plot ee-like variables, one needs to write the translation (or make use of the very useful TLorentzVector of ROOT, see part III). |
| 71 | |
| 72 | 2) Interactively draw the muon multiplicity and the jet multiplicity. You first have to double-click on the root file icon in the TBrowser. Do you understand these distributions? |
| 73 | |
| 74 | {{{ |
| 75 | Delphes->Draw("Muon_size"); |
| 76 | Delphes->Draw("Jet_size"); |
| 77 | }}} |
| 78 | |
| 79 | == III) Write a simple analysis macro == |
| 80 | |
| 81 | 1) Write down the formula for the recoil Higgs mass. |
| 82 | |
| 83 | 2) You can find a simple analysis macro in "example/Example1.py". It can be executed like this: |
| 84 | |
| 85 | {{{ |
| 86 | python examples/Example1.py delphes_ee_zh_zmumu.root out.root |
| 87 | }}} |
| 88 | |
| 89 | This Example1.py macro does not produce anything interesting here (it most likely produce an empty plot). The above command is simply shown as an example for how to run a macro. You should open Example1.py with a text editor, and write a small analysis that first selects events with two muons and then reconstructs and plot the recoil Higgs mass using the formula found in III.1) |
| 90 | |
| 91 | |
| 92 | Solution: |
| 93 | |
| 94 | {{{ |
| 95 | # Recoil Mass macro |
| 96 | #!/usr/bin/env python |
| 97 | |
| 98 | import sys |
| 99 | import ROOT |
| 100 | |
| 101 | if len(sys.argv) < 2: |
| 102 | print " Usage: python examples/MissingMass.py delphes_ee_zh_zmumu.root hist_mrec.root" |
| 103 | sys.exit(1) |
| 104 | |
| 105 | ROOT.gSystem.Load("libDelphes") |
| 106 | |
| 107 | try: |
| 108 | ROOT.gInterpreter.Declare('#include "classes/SortableObject.h"') |
| 109 | ROOT.gInterpreter.Declare('#include "classes/DelphesClasses.h"') |
| 110 | ROOT.gInterpreter.Declare('#include "external/ExRootAnalysis/ExRootTreeReader.h"') |
| 111 | except: |
| 112 | pass |
| 113 | |
| 114 | inputFile = sys.argv[1] |
| 115 | outputFile = sys.argv[2] |
| 116 | |
| 117 | # Create chain of root trees |
| 118 | chain = ROOT.TChain("Delphes") |
| 119 | chain.Add(inputFile) |
| 120 | |
| 121 | # Create object of class ExRootTreeReader |
| 122 | treeReader = ROOT.ExRootTreeReader(chain) |
| 123 | numberOfEntries = treeReader.GetEntries() |
| 124 | |
| 125 | # Get pointers to branches used in this analysis |
| 126 | branchMuon = treeReader.UseBranch("Muon") |
| 127 | |
| 128 | # Book histograms |
| 129 | histMass = ROOT.TH1F("mass", "M_{recoil} [GeV]", 60, 100.0, 160.0) |
| 130 | |
| 131 | ptot = ROOT.TLorentzVector(0.,0.,0.,240.) |
| 132 | # Loop over all events |
| 133 | for entry in range(0, numberOfEntries): |
| 134 | # Load selected branches with data from specified event |
| 135 | treeReader.ReadEntry(entry) |
| 136 | |
| 137 | # If event contains at least 2 muons |
| 138 | if branchMuon.GetEntries() > 1: |
| 139 | |
| 140 | mu1 = branchMuon.At(0) |
| 141 | mu2 = branchMuon.At(1) |
| 142 | |
| 143 | pll = mu1.P4() + mu2.P4() |
| 144 | ph = ptot - pll |
| 145 | |
| 146 | histMass.Fill(ph.M()) |
| 147 | |
| 148 | out_root = ROOT.TFile(outputFile,"RECREATE") |
| 149 | histMass.Write() |
| 150 | }}} |
| 151 | |
| 152 | == IV) Modify the Delphes detector card == |
| 153 | |
| 154 | |
| 155 | You have now produced a Delphes simulated event with the hypothetical CEPC default detector configuration. |
| 156 | |
| 157 | 1) Can you think of 2 detector parameters that determine and drive the sensitivity of the Higgs recoil measurement in this particular final state? |
| 158 | |
| 159 | 2) Identify where they are configured in the delphes detector card. |
| 160 | |
| 161 | 3) Create two new detector configurations by degrading these two parameters by a sizable factor. |
| 162 | |
| 163 | 4) Reproduce a Delphes sample with these new configurations and observe the impact on the recoil mass distribution. |
| 164 | |