[[TOC]] = Student Project BND - Spa September 2019 = == Pre-requisites == To successfully run this tutorial the following prerequisite packages should be installed: - gfortran/gcc/tcl: For linux users gcc/tcl should be already installed. For Mac users you should install XCode. - ROOT: can be downloaded from https://root.cern.ch/downloading-root Go on latest release, and download a version under "Binary distributions". - MadGraph5 a version of MG5 can be downloaded here: https://launchpad.net/mg5amcnlo/2.0/2.5.x/+download/MG5_aMC_v2.5.5.tar.gz - Delphes start from here: https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/QuickTour - Pythia8: following instructions from here (or using the Pythia8 installation in !MadGraph): https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/Pythia8 == 0) Download data sample == From the Delphes main directory, download the pseudo-data file {{{data.root}}} : {{{ wget -O data.root https://cernbox.cern.ch/index.php/s/9BmyMB66JkALj2t/download }}} == 1) Access information in the ROOT file Open the ROOT file (ignore the various warnings) and visualize its content via the TBrowser. {{{ root -l data.root TBrowser t; }}} Open the Delphes Tree and then Event branch (by double-clicking). How many events are in this dataset? Likewise explore the Tree content by looking at other branches. Non trivial information can also be plotted from the command line. {{{ TFile *f = TFile::Open("data.root"); TBrowser browser; f->Get("Delphes")->Draw("Muon.PT"); }}} Some information is not directly accessible from the browser interface but can nevertheless be access via command line. Every Delphes object has a 4-vector (called P4()) member of type TLorentzVector (see here for documentation: https://root.cern.ch/doc/master/classTLorentzVector.html) So for example to plot the magnitude of the 3-momenta of the jets, or the jet invariant mass: {{{ f->Get("Delphes")->Draw("Electron.P4().P()"); f->Get("Delphes")->Draw("Jet.P4().M()"); }}} In order to perform an event-loop with a more sophisticated event selection you will have to write a small python macro. This macro takes as input the {{{data.root}}} and produce an output file that contains a couple of histograms. Copy paste inside a file called {{{macro.py}}}, and run it via the command {{{python example.py histograms.root}}}. The {{{histograms.root}}} file can then be browsed as done before with the data file. {{{ # example event loop macro #!/usr/bin/env python import sys import ROOT if len(sys.argv) < 2: print " Usage: python macro.py data.root histograms.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") branchJet = treeReader.UseBranch("Jet") # Book histograms histMuonMultiplicity = ROOT.TH1F("histMuonMultiplicity", "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() }}}