Fork me on GitHub

WorkBook/Tutorials/Prefit: tutorial_solution (1).txt

File tutorial_solution (1).txt, 9.0 KB (added by Michele Selvaggi, 5 years ago)
Line 
1I. =============================================================================
2
3
4./DelphesHepMC cards/delphes_card_CMS.tcl pp_ll_bsm.root pp_ll_bsm.hepmc
5./DelphesHepMC cards/delphes_card_CMS.tcl pp_ll_sm.root pp_ll_sm.hepmc
6
7
8
9II. ============================================================================
10
111) -----------------------------------------------------------------------------
12
13root
14gSystem->Load("libDelphes");
15TFile *f = TFile::Open("pp_ll_sm.root");
16TBrowser t;
17
18... in the browser double-click on the file name pp_ll_sm.root and then on the
19on the Delphes tree. Double-click on the Electron branch and then on Electron.PT
20
212) -----------------------------------------------------------------------------
22
23root
24gSystem->Load("libDelphes");
25TFile *f = TFile::Open("pp_ll_sm.root");
26TCanvas c1
27f->Get("Delphes")->Draw("Muon_size");
28TCanvas c2
29f->Get("Delphes")->Draw("Electron_size");
30
31Explanation:
32
33We are looking at Drell-Yan event pp-> ee/mumu.
34The multiplicity of electrons and muons should be either 0 or 2. However due to
35reconstruction/detector acceptance in-efficiencies we see some events with only
361 lepton.
37
383) -----------------------------------------------------------------------------
39
40root
41gSystem->Load("libDelphes");
42TFile *fsm = TFile::Open("pp_ll_sm.root");
43TFile *fbsm = TFile::Open("pp_ll_bsm.root");
44
45
46
47TCanvas c1
48fbsm->Get("Delphes")->Draw("Electron[0].PT");
49TCanvas c2
50fsm->Get("Delphes")->Draw("Electron[0].PT");
51
52TCanvas c3
53fbsm->Get("Delphes")->Draw("Electron[0].Eta");
54TCanvas c4
55fsm->Get("Delphes")->Draw("Electron[0].Eta");
56
57
58Explanation:
59
60The BSM sample contains leptons much higher pT and these are necessarily
61produced at central rapidities.
62
63III.============================================================================
64
65III.1) -------------------------------------------------------------------------
66
67#!/usr/bin/env python
68
69import sys
70import ROOT
71
72if len(sys.argv) < 2:
73 print " Usage: python examples/InvariantMass.py pp_ll_sm.root histo_sm.root"
74 sys.exit(1)
75
76ROOT.gSystem.Load("libDelphes")
77
78try:
79 ROOT.gInterpreter.Declare('#include "classes/SortableObject.h"')
80 ROOT.gInterpreter.Declare('#include "classes/DelphesClasses.h"')
81 ROOT.gInterpreter.Declare('#include "external/ExRootAnalysis/ExRootTreeReader.h"')
82except:
83 pass
84
85inputFile = sys.argv[1]
86outputFile = sys.argv[2]
87
88# Create chain of root trees
89chain = ROOT.TChain("Delphes")
90chain.Add(inputFile)
91
92# Create object of class ExRootTreeReader
93treeReader = ROOT.ExRootTreeReader(chain)
94numberOfEntries = treeReader.GetEntries()
95
96# Get pointers to branches used in this analysis
97branchMuon = treeReader.UseBranch("Muon")
98branchElectron = treeReader.UseBranch("Electron")
99
100# Book histograms
101histMass_mumu_sm = ROOT.TH1F("mass_mumu_sm", "m [GeV]", 60, 60.0, 120.0)
102histMass_mumu_bsm = ROOT.TH1F("mass_mumu_bsm", "m [GeV]", 60, 1000.0, 3000.0)
103
104histMass_ee_sm = ROOT.TH1F("mass_ee_sm", "m [GeV]", 60, 60.0, 120.0)
105histMass_ee_bsm = ROOT.TH1F("mass_ee_bsm", "m [GeV]", 60, 1000.0, 3000.0)
106
107# Loop over all events
108for entry in range(0, numberOfEntries):
109 # Load selected branches with data from specified event
110 treeReader.ReadEntry(entry)
111
112 # If event contains at least 2 muons
113 if branchMuon.GetEntries() > 1:
114
115 mu1 = branchMuon.At(0)
116 mu2 = branchMuon.At(1)
117 ptot = mu1.P4() + mu2.P4()
118
119 histMass_mumu_sm.Fill(ptot.M())
120 histMass_mumu_bsm.Fill(ptot.M())
121
122 # If event contains at least 2 muons
123 if branchElectron.GetEntries() > 1:
124
125 ele1 = branchElectron.At(0)
126 ele2 = branchElectron.At(1)
127 ptot = ele1.P4() + ele2.P4()
128
129 histMass_ee_sm.Fill(ptot.M())
130 histMass_ee_bsm.Fill(ptot.M())
131
132
133out_root = ROOT.TFile(outputFile,"RECREATE")
134
135histMass_mumu_sm.Write()
136histMass_mumu_bsm.Write()
137histMass_ee_sm.Write()
138histMass_ee_bsm.Write()
139
140
141III.2) -------------------------------------------------------------------------
142
143python examples/InvariantMass.py pp_ll_sm.root histo_sm.root
144python examples/InvariantMass.py pp_ll_bsm.root histo_bsm.root
145
146III.3) -------------------------------------------------------------------------
147
148root -l histo_sm.root
149
150((TH1F *)_file0->Get("mass_mumu_sm"))->SetLineColor(kRed+1);
151((TH1F *)_file0->Get("mass_mumu_sm"))->SetLineWidth(3);
152((TH1F *)_file0->Get("mass_ee_sm"))->SetLineColor(kBlue);
153((TH1F *)_file0->Get("mass_ee_sm"))->SetLineWidth(3);
154
155_file0->Get("mass_mumu_sm")->Draw();
156_file0->Get("mass_ee_sm")->Draw("SAME");
157
158Explanation:
159
160At low pT the muon and electron resolution is dominated by the tracker. Muon
161resolution is better since less interaction with material (brehmstralung)
162
163III.4) -------------------------------------------------------------------------
164
165root -l histo_bsm.root
166
167((TH1F *)_file0->Get("mass_mumu_bsm"))->SetLineColor(kRed+1);
168((TH1F *)_file0->Get("mass_mumu_bsm"))->SetLineWidth(3);
169((TH1F *)_file0->Get("mass_ee_bsm"))->SetLineColor(kBlue);
170((TH1F *)_file0->Get("mass_ee_bsm"))->SetLineWidth(3);
171
172_file0->Get("mass_ee_bsm")->Draw();
173_file0->Get("mass_mumu_bsm")->Draw("SAME");
174
175Explanation:
176
177At high pT the muon resolution is worse because muon track is essentially a
178straight line, and the pT is measured from the curvature. Conversely, electrons
179are well measured at high pT because their resolution is dominated by the calori-
180meter measurement (where sigma E/E ~ cst)
181
182
183IV.=============================================================================
184
185IV.1) --------------------------------------------------------------------------
186
187The two parameters are the muon momentum resolution and the reconstruction efficiency.
188One can for instance worsen both of them by replacing the existing parameterisations by:
189
190IV.2) --------------------------------------------------------------------------
191
192The relevant modules are called "MuonMomentumSmearing" and "MuonTrackingEfficiency"
193
194IV.3) --------------------------------------------------------------------------
195
196
197--> to decrease the muon efficiency we can replace the MuonTrackingEfficiency
198block in the card by the following (reduces the efficiency by 20%)
199
200################################################
201module Efficiency MuonTrackingEfficiency {
202 set InputArray ParticlePropagator/muons
203 set OutputArray muons
204
205 # set EfficiencyFormula {efficiency formula as a function of eta and pt}
206
207 # tracking efficiency formula for muons
208 set EfficiencyFormula { 0.8 * ( (pt <= 0.1) * (0.00) +
209 (abs(eta) <= 1.5) * (pt > 0.1 && pt <= 1.0) * (0.75) +
210 (abs(eta) <= 1.5) * (pt > 1.0 && pt <= 1.0e3) * (0.99) +
211 (abs(eta) <= 1.5) * (pt > 1.0e3 ) * (0.99 * exp(0.5 - pt*5.0e-4)) +
212
213 (abs(eta) > 1.5 && abs(eta) <= 2.5) * (pt > 0.1 && pt <= 1.0) * (0.70) +
214 (abs(eta) > 1.5 && abs(eta) <= 2.5) * (pt > 1.0 && pt <= 1.0e3) * (0.98) +
215 (abs(eta) > 1.5 && abs(eta) <= 2.5) * (pt > 1.0e3) * (0.98 * exp(0.5 - pt*5.0e-4)) +
216 (abs(eta) > 2.5) * (0.00))}
217}
218################################################
219
220--> to decrease the muon efficiency we can replace the MuonMomentumSearing
221block in the card by the following (worsens the resolution by a factor 10)
222
223################################################
224module MomentumSmearing MuonMomentumSmearing {
225 set InputArray MuonTrackingEfficiency/muons
226 set OutputArray muons
227
228 # set ResolutionFormula {resolution formula as a function of eta and pt}
229
230 # resolution formula for muons
231 set ResolutionFormula { 2 * ( (abs(eta) <= 0.5) * (pt > 0.1) * sqrt(0.01^2 + pt^2*1.0e-4^2) +
232 (abs(eta) > 0.5 && abs(eta) <= 1.5) * (pt > 0.1) * sqrt(0.015^2 + pt^2*1.5e-4^2) +
233 (abs(eta) > 1.5 && abs(eta) <= 2.5) * (pt > 0.1) * sqrt(0.025^2 + pt^2*3.5e-4^2))}
234}
235################################################
236
237
238
239IV.4) --------------------------------------------------------------------------
240
241./DelphesHepMC cards/delphes_card_CMS_mod1.tcl pp_ll_bsm_mod1.root pp_ll_bsm.hepmc
242./DelphesHepMC cards/delphes_card_CMS_mod2.tcl pp_ll_bsm_mod2.root pp_ll_bsm.hepmc
243
244python examples/InvariantMass.py pp_ll_bsm_mod1.root histo_bsm_mod1.root
245python examples/InvariantMass.py pp_ll_bsm_mod2.root histo_bsm_mod2.root
246
247
248## compare effect of efficiency/resolution reduction
249
250root -l histo_bsm.root histo_bsm_mod1.root histo_bsm_mod2.root
251((TH1F *)_file0->Get("mass_mumu_bsm"))->SetLineColor(kRed+1);
252((TH1F *)_file0->Get("mass_mumu_bsm"))->SetLineWidth(3);
253((TH1F *)_file1->Get("mass_mumu_bsm"))->SetLineColor(kBlue+1);
254((TH1F *)_file1->Get("mass_mumu_bsm"))->SetLineWidth(3);
255((TH1F *)_file2->Get("mass_mumu_bsm"))->SetLineColor(kGreen+2);
256((TH1F *)_file2->Get("mass_mumu_bsm"))->SetLineWidth(3);
257
258_file0->Get("mass_mumu_bsm")->Draw();
259_file1->Get("mass_mumu_bsm")->Draw("SAME");
260_file2->Get("mass_mumu_bsm")->Draw("SAME");