[[TOC]] = Delphes Tutorial - DESY March 2020 = == Pre-requisites == To successfully run this tutorial the Delphes virtual machine should be installed, see here for more information: https://twiki.cern.ch/twiki/bin/view/VBSCan/PREFIT20 If you have successfully produced Pythia8 event files in the MadGraph and Parton Shower lecture (Admir Greljo, Ilaria Brivio), copy (or move) the pp->ll (SM and BSM) into the Delphes directory Delphes-3.4.2 FIXME: find out how these files where named during tutorial If not you can download the files from here (but it might take a while): {{{ cd Delphes-3.4.2 curl -o pp_ll_sm.hepmc https://cernbox.cern.ch/index.php/s/4rnlQ0bybBYvLTS/download curl -o pp_ll_bsm.hepmc https://cernbox.cern.ch/index.php/s/DfDDS5QixZaBsYO/download }}} == I) Produce Delphes root files == In this section you will run Delphes Fast Detector simulation using the default CMS card. Delphes will produce a ROOT file starting from the hepmc format produced by MG5+Pythia8. ./DelphesHepMC cards/delphes_card_CMS.tcl pp_ll_sm.root pp_ll_sm.hepmc ./DelphesHepMC cards/delphes_card_CMS.tcl pp_ll_bsm.root pp_ll_bsm.hepmc == II) Simple Interactive Tree analysis == 1) Open Delphes ROOT tree and explore the branches {{{ root -l pp_ll_sm.root gSystem->Load("libDelphes"); TBrowser t; }}} 2) Interactively draw the muon and electron multiplicity. You first have to double-click on the root file icon in the TBrowser. Do you understand these distributions? {{{ Delphes->Draw("Muon_size"); Delphes->Draw("Electron_size"); }}} 3) Compare the leading muon transverse momentum and pseudo-rapidity in the SM and the BSM sample. {{{ Delphes->Draw("Muon_size"); Delphes->Draw("Electron_size"); }}} == III) Write a simple analysis macro == 1) Write down the formula for the recoil Higgs mass. 2) You can find a simple analysis macro in "example/Example1.py". It can be executed like this: {{{ python examples/Example1.py delphes_ee_zh_zmumu.root out.root }}} 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) Solution: {{{ # Recoil Mass macro #!/usr/bin/env python import sys import ROOT if len(sys.argv) < 2: print " Usage: python examples/MissingMass.py delphes_ee_zh_zmumu.root hist_mrec.root" sys.exit(1) ROOT.gSystem.Load("libDelphes") try: ROOT.gInterpreter.Declare('#include "classes/SortableObject.h"') ROOT.gInterpreter.Declare('#include "classes/DelphesClasses.h"') ROOT.gInterpreter.Declare('#include "external/ExRootAnalysis/ExRootTreeReader.h"') except: pass inputFile = sys.argv[1] outputFile = sys.argv[2] # Create chain of root trees chain = ROOT.TChain("Delphes") chain.Add(inputFile) # Create object of class ExRootTreeReader treeReader = ROOT.ExRootTreeReader(chain) numberOfEntries = treeReader.GetEntries() # Get pointers to branches used in this analysis branchMuon = treeReader.UseBranch("Muon") # Book histograms histMass = ROOT.TH1F("mass", "M_{recoil} [GeV]", 60, 100.0, 160.0) ptot = ROOT.TLorentzVector(0.,0.,0.,240.) # Loop over all events for entry in range(0, numberOfEntries): # Load selected branches with data from specified event treeReader.ReadEntry(entry) # If event contains at least 2 muons if branchMuon.GetEntries() > 1: mu1 = branchMuon.At(0) mu2 = branchMuon.At(1) pll = mu1.P4() + mu2.P4() ph = ptot - pll histMass.Fill(ph.M()) out_root = ROOT.TFile(outputFile,"RECREATE") histMass.Write() }}} == IV) Modify the Delphes detector card == You have now produced a Delphes simulated event with the hypothetical CEPC default detector configuration. 1) Can you think of 2 detector parameters that determine and drive the sensitivity of the Higgs recoil measurement in this particular final state? 2) Identify where they are configured in the delphes detector card. 3) Create two new detector configurations by degrading these two parameters by a sizable factor. 4) Reproduce a Delphes sample with these new configurations and observe the impact on the recoil mass distribution.