Fork me on GitHub

source: git/examples/Validation.cpp@ 1160e4f

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 1160e4f was 1160e4f, checked in by Alexandre Mertens <alexandre.mertens@…>, 8 years ago

double fit in Gauss

  • Property mode set to 100644
File size: 39.3 KB
Line 
1/*
2 * Delphes: a framework for fast simulation of a generic collider experiment
3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19
20#include <iostream>
21#include <utility>
22#include <vector>
23#include <typeinfo>
24
25#include "TROOT.h"
26#include "TSystem.h"
27#include "TApplication.h"
28
29#include "TString.h"
30
31#include "TH1.h"
32#include "TH2.h"
33#include "TMath.h"
34#include "TStyle.h"
35#include "TGraph.h"
36#include "TCanvas.h"
37#include "THStack.h"
38#include "TLegend.h"
39#include "TPaveText.h"
40#include "TClonesArray.h"
41#include "TLorentzVector.h"
42#include "TGraphErrors.h"
43#include "TMultiGraph.h"
44
45#include "classes/DelphesClasses.h"
46
47#include "ExRootAnalysis/ExRootTreeReader.h"
48#include "ExRootAnalysis/ExRootTreeWriter.h"
49#include "ExRootAnalysis/ExRootTreeBranch.h"
50#include "ExRootAnalysis/ExRootResult.h"
51#include "ExRootAnalysis/ExRootUtilities.h"
52
53using namespace std;
54
55//------------------------------------------------------------------------------
56
57double ptrangemin = 10;
58double ptrangemax = 10000;
59static const int Nbins = 20;
60
61int objStyle = 1;
62int trackStyle = 7;
63int towerStyle = 3;
64
65Color_t objColor = kBlack;
66Color_t trackColor = kBlack;
67Color_t towerColor = kBlack;
68
69double effLegXmin = 0.22;
70double effLegXmax = 0.7;
71double effLegYmin = 0.22;
72double effLegYmax = 0.5;
73
74double resLegXmin = 0.62;
75double resLegXmax = 0.9;
76double resLegYmin = 0.52;
77double resLegYmax = 0.85;
78
79double topLeftLegXmin = 0.22;
80double topLeftLegXmax = 0.7;
81double topLeftLegYmin = 0.52;
82double topLeftLegYmax = 0.85;
83
84
85struct resolPlot
86{
87 TH1 *cenResolHist;
88 TH1 *fwdResolHist;
89 double ptmin;
90 double ptmax;
91 double xmin;
92 double xmax;
93 TString obj;
94
95 resolPlot();
96 resolPlot(double ptdown, double ptup, TString object);
97 void set(double ptdown, double ptup, TString object, double xmin = 0, double xmax = 2);
98 void print(){std::cout << ptmin << std::endl;}
99};
100
101
102resolPlot::resolPlot()
103{
104}
105
106resolPlot::resolPlot(double ptdown, double ptup, TString object)
107{
108 this->set(ptdown,ptup,object);
109}
110
111void resolPlot::set(double ptdown, double ptup, TString object, double xmin, double xmax)
112{
113 ptmin = ptdown;
114 ptmax = ptup;
115 obj = object;
116
117 cenResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", 200, xmin, xmax);
118 fwdResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_fwd", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_fwd", 200, xmin, xmax);
119}
120
121void HistogramsCollection(std::vector<resolPlot> *histos, double ptmin, double ptmax, TString obj, double xmin = 0, double xmax = 2)
122{
123 double width;
124 double ptdown;
125 double ptup;
126 resolPlot ptemp;
127
128 for (int i = 0; i < Nbins; i++)
129 {
130 width = (ptmax - ptmin) / Nbins;
131 ptdown = TMath::Power(10,ptmin + i * width );
132 ptup = TMath::Power(10,ptmin + (i+1) * width );
133 ptemp.set(ptdown, ptup, obj, xmin, xmax);
134 histos->push_back(ptemp);
135 }
136}
137
138//------------------------------------------------------------------------------
139
140class ExRootResult;
141class ExRootTreeReader;
142
143//------------------------------------------------------------------------------
144
145void BinLogX(TH1*h)
146{
147 TAxis *axis = h->GetXaxis();
148 int bins = axis->GetNbins();
149
150 Axis_t from = axis->GetXmin();
151 Axis_t to = axis->GetXmax();
152 Axis_t width = (to - from) / bins;
153 Axis_t *new_bins = new Axis_t[bins + 1];
154
155 for (int i = 0; i <= bins; i++)
156 {
157 new_bins[i] = TMath::Power(10, from + i * width);
158 }
159 axis->Set(bins, new_bins);
160 delete new_bins;
161}
162
163
164//------------------------------------------------------------------------------
165
166template<typename T>
167std::pair<TH1D*, TH1D*> GetEff(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, ExRootTreeReader *treeReader)
168{
169
170 cout << "** Computing Efficiency of reconstructing "<< branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
171
172 Long64_t allEntries = treeReader->GetEntries();
173
174 GenParticle *particle;
175 T *recoObj;
176
177 TLorentzVector recoMomentum, genMomentum, bestRecoMomentum;
178
179 Float_t deltaR;
180 Float_t pt, eta;
181 Long64_t entry;
182
183 Int_t i, j;
184
185 TH1D *histGenPtcen = new TH1D(name+" gen spectra Pt",name+" gen spectra cen", Nbins, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax));
186 TH1D *histRecoPtcen = new TH1D(name+" reco spectra Pt",name+" reco spectra cen", Nbins, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax));
187 TH1D *histGenPtfwd = new TH1D(name+" gen spectra Eta",name+" gen spectra fwd", Nbins, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax));
188 TH1D *histRecoPtfwd = new TH1D(name+" reco spectra Eta",name+" reco spectra fwd", Nbins, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax));
189
190 histGenPtcen->SetDirectory(0);
191 histRecoPtcen->SetDirectory(0);
192 histGenPtfwd->SetDirectory(0);
193 histRecoPtfwd->SetDirectory(0);
194
195 BinLogX(histGenPtcen);
196 BinLogX(histRecoPtcen);
197 BinLogX(histGenPtfwd);
198 BinLogX(histRecoPtfwd);
199
200 // Loop over all events
201 for(entry = 0; entry < allEntries; ++entry)
202 {
203 // Load selected branches with data from specified event
204 treeReader->ReadEntry(entry);
205
206 // Loop over all generated particle in event
207 for(i = 0; i < branchParticle->GetEntriesFast(); ++i)
208 {
209
210 particle = (GenParticle*) branchParticle->At(i);
211 genMomentum = particle->P4();
212
213 deltaR = 999;
214
215 if (particle->PID == pdgID && genMomentum.Pt() > ptrangemin && genMomentum.Pt() < ptrangemax )
216 {
217
218 // Loop over all reco object in event
219 for(j = 0; j < branchReco->GetEntriesFast(); ++j)
220 {
221 recoObj = (T*)branchReco->At(j);
222 recoMomentum = recoObj->P4();
223 // this is simply to avoid warnings from initial state particle
224 // having infite rapidity ...
225 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue;
226
227 // take the closest parton candidate
228 if(TMath::Abs(pdgID) == 5)
229 {
230 Jet *jet = (Jet *)recoObj;
231 if(jet->BTag != 1) continue;
232 }
233 if(TMath::Abs(pdgID) == 15)
234 {
235 Jet *jet = (Jet *)recoObj;
236 if(jet->TauTag != 1) continue;
237 }
238 if(genMomentum.DeltaR(recoMomentum) < deltaR)
239 {
240 deltaR = genMomentum.DeltaR(recoMomentum);
241 bestRecoMomentum = recoMomentum;
242 }
243 }
244
245 pt = genMomentum.Pt();
246 eta = genMomentum.Eta();
247
248 if (TMath::Abs(eta) < 1.5)
249 {
250 histGenPtcen->Fill(pt);
251 if(deltaR < 0.3) { histRecoPtcen->Fill(pt); }
252 }
253 else if (TMath::Abs(eta) < 2.5)
254 {
255 histGenPtfwd->Fill(pt);
256 if(deltaR < 0.3) { histRecoPtfwd->Fill(pt); }
257
258 }
259 }
260 }
261 }
262
263
264 std::pair<TH1D*,TH1D*> histos;
265
266 histRecoPtcen->Divide(histGenPtcen);
267 histRecoPtfwd->Divide(histGenPtfwd);
268
269 histos.first = histRecoPtcen;
270 histos.second = histRecoPtfwd;
271
272 return histos;
273}
274
275template<typename T>
276void GetEres(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, ExRootTreeReader *treeReader)
277{
278 Long64_t allEntries = treeReader->GetEntries();
279
280 cout << "** Computing resolution of " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
281
282 GenParticle *particle;
283 T* recoObj;
284
285 TLorentzVector recoMomentum, genMomentum, bestGenMomentum;
286
287 Float_t deltaR;
288 Float_t pt, eta;
289 Long64_t entry;
290
291 Int_t i, j, bin;
292
293 // Loop over all events
294 for(entry = 0; entry < allEntries; ++entry)
295 {
296 // Load selected branches with data from specified event
297 treeReader->ReadEntry(entry);
298
299 // Loop over all reconstructed jets in event
300 for(i = 0; i < branchReco->GetEntriesFast(); ++i)
301 {
302 recoObj = (T*) branchReco->At(i);
303 recoMomentum = recoObj->P4();
304
305 deltaR = 999;
306
307 // Loop over all hard partons in event
308 for(j = 0; j < branchParticle->GetEntriesFast(); ++j)
309 {
310 particle = (GenParticle*) branchParticle->At(j);
311 if (particle->PID == pdgID && particle->Status == 1)
312 {
313 genMomentum = particle->P4();
314
315 // this is simply to avoid warnings from initial state particle
316 // having infite rapidity ...
317 if(genMomentum.Px() == 0 && genMomentum.Py() == 0) continue;
318
319 // take the closest parton candidate
320 if(genMomentum.DeltaR(recoMomentum) < deltaR)
321 {
322 deltaR = genMomentum.DeltaR(recoMomentum);
323 bestGenMomentum = genMomentum;
324 }
325 }
326 }
327
328 if(deltaR < 0.3)
329 {
330 pt = bestGenMomentum.E();
331 eta = TMath::Abs(bestGenMomentum.Eta());
332
333 for (bin = 0; bin < Nbins; bin++)
334 {
335 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta < 2.5)
336 {
337 if (eta < 1.5) {histos->at(bin).cenResolHist->Fill(recoMomentum.E()/bestGenMomentum.E());}
338 else if (eta < 2.5) {histos->at(bin).fwdResolHist->Fill(recoMomentum.E()/bestGenMomentum.E());}
339 }
340 }
341 }
342 }
343 }
344}
345void GetJetsEres(std::vector<resolPlot> *histos, TClonesArray *branchJet, TClonesArray *branchGenJet, ExRootTreeReader *treeReader)
346{
347
348 Long64_t allEntries = treeReader->GetEntries();
349
350 cout << "** Computing resolution of " << branchJet->GetName() << " induced by " << branchGenJet->GetName() << endl;
351
352 Jet *jet, *genjet;
353
354 TLorentzVector jetMomentum, genJetMomentum, bestGenJetMomentum;
355
356 Float_t deltaR;
357 Float_t pt, eta;
358 Long64_t entry;
359
360 Int_t i, j, bin;
361
362 // Loop over all events
363 for(entry = 0; entry < allEntries; ++entry)
364 {
365 // Load selected branches with data from specified event
366 treeReader->ReadEntry(entry);
367
368 if(entry%10000 == 0) cout << "Event number: "<< entry <<endl;
369
370 // Loop over all reconstructed jets in event
371 for(i = 0; i < TMath::Min(2,branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i)
372 {
373
374 jet = (Jet*) branchJet->At(i);
375 jetMomentum = jet->P4();
376
377 deltaR = 999;
378
379 // Loop over all hard partons in event
380 for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j)
381 {
382 genjet = (Jet*) branchGenJet->At(j);
383
384 genJetMomentum = genjet->P4();
385
386 // this is simply to avoid warnings from initial state particle
387 // having infite rapidity ...
388 if(genJetMomentum.Px() == 0 && genJetMomentum.Py() == 0) continue;
389
390 // take the closest parton candidate
391 if(genJetMomentum.DeltaR(jetMomentum) < deltaR)
392 {
393 deltaR = genJetMomentum.DeltaR(jetMomentum);
394 bestGenJetMomentum = genJetMomentum;
395 }
396 }
397
398 if(deltaR < 0.25)
399 {
400 pt = genJetMomentum.Pt();
401 eta = TMath::Abs(genJetMomentum.Eta());
402
403 for (bin = 0; bin < Nbins; bin++)
404 {
405 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta < 1.5)
406 {
407 histos->at(bin).cenResolHist->Fill(jetMomentum.Pt()/bestGenJetMomentum.Pt());
408 }
409 else if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta < 2.5)
410 {
411 histos->at(bin).fwdResolHist->Fill(jetMomentum.Pt()/bestGenJetMomentum.Pt());
412 }
413
414 }
415 }
416 }
417 }
418}
419
420void GetMetres(std::vector<resolPlot> *histos, TClonesArray *branchScalarHT, TClonesArray *branchMet, TClonesArray *branchJet, ExRootTreeReader *treeReader)
421{
422
423 Long64_t allEntries = treeReader->GetEntries();
424
425 cout << "** Computing resolution of " << branchMet->GetName() << " vs " << branchScalarHT->GetName() << endl;
426
427 MissingET *met;
428 ScalarHT *scalarHT;
429
430 Long64_t entry;
431
432 Int_t bin;
433 Double_t ht;
434
435 Jet *jet;
436 TLorentzVector p1, p2;
437
438 // Loop over all events
439 for(entry = 0; entry < allEntries; ++entry)
440 {
441 // Load selected branches with data from specified event
442 treeReader->ReadEntry(entry);
443
444 if(entry%10000 == 0) cout << "Event number: "<< entry <<endl;
445
446 if (branchJet->GetEntriesFast() > 1)
447 {
448
449 jet = (Jet*) branchJet->At(0);
450 p1 = jet->P4();
451 jet = (Jet*) branchJet->At(1);
452 p2 = jet->P4();
453
454 met = (MissingET*) branchMet->At(0);
455 scalarHT = (ScalarHT*) branchScalarHT->At(0);
456 ht = scalarHT->HT;
457
458 if(p1.Pt() < 0.75*ht/2) continue;
459 if(p2.Pt() < 0.75*ht/2) continue;
460
461 for (bin = 0; bin < Nbins; bin++)
462 {
463 if(ht > histos->at(bin).ptmin && ht < histos->at(bin).ptmax )
464 {
465 histos->at(bin).cenResolHist->Fill(met->P4().Px());
466 histos->at(bin).fwdResolHist->Fill(met->P4().Py());
467 }
468 }
469 }
470 }
471}
472
473
474std::pair<Double_t, Double_t> GausFit(TH1* hist)
475{
476 TF1 *f1 = new TF1("f1", "gaus", hist->GetMean()-2*hist->GetRMS(), hist->GetMean()+2*hist->GetRMS());
477 hist->Fit("f1","RQ");
478
479 TF1 *f2 = new TF1("f2", "gaus", f1->GetParameter(1) - 2*f1->GetParameter(2), f1->GetParameter(1) + 2*f1->GetParameter(2));
480 hist->Fit("f2","RQ");
481
482 Double_t sig = f2->GetParameter(2);
483 Double_t sigErr = f2->GetParError(2);
484
485 delete f1;
486 return make_pair (sig, sigErr);
487}
488
489
490TGraphErrors EresGraph(std::vector<resolPlot> *histos, bool central, bool rms = false)
491{
492 Int_t bin;
493 Int_t count = 0;
494 TGraphErrors gr = TGraphErrors(Nbins/2);
495 Double_t sig = 0;
496 Double_t sigErr = 0;
497 for (bin = 0; bin < Nbins; bin++)
498 {
499 if (central == true && histos->at(bin).cenResolHist->GetEntries() > 100)
500 {
501 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).cenResolHist);
502 if (rms == true)
503 {
504 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.second);
505 gr.SetPointError(count,0, sigvalues.second); // to correct
506 }
507 else
508 {
509 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);
510 gr.SetPointError(count,0, sigvalues.second);
511 }
512 count++;
513 }
514
515 else if (central == false && histos->at(bin).fwdResolHist->GetEntries() > 10)
516 {
517 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).fwdResolHist);
518 if (rms == true)
519 {
520 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.second);
521 gr.SetPointError(count,0, sigvalues.second); // to correct
522 }
523 else
524 {
525 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);
526 gr.SetPointError(count,0, sigvalues.second);
527 }
528 count++;
529 }
530
531 }
532 return gr;
533}
534
535
536//------------------------------------------------------------------------------
537
538
539// type 1 : object, 2 : track, 3 : tower
540
541void addGraph(TMultiGraph *mg, TGraphErrors *gr, TLegend *leg, int type)
542{
543
544 gr->SetLineWidth(2);
545
546 switch ( type )
547 {
548 case 1:
549 gr->SetLineColor(objColor);
550 gr->SetLineStyle(objStyle);
551 std::cout << "Adding " << gr->GetName() << std::endl;
552 mg->Add(gr);
553 leg->AddEntry(gr,"Reco","l");
554 break;
555
556 case 2:
557 gr->SetLineColor(trackColor);
558 gr->SetLineStyle(trackStyle);
559 mg->Add(gr);
560 leg->AddEntry(gr,"Track","l");
561 break;
562
563 case 3:
564 gr->SetLineColor(towerColor);
565 gr->SetLineStyle(towerStyle);
566 mg->Add(gr);
567 leg->AddEntry(gr,"Tower","l");
568 break;
569
570 case 0:
571 gr->SetLineColor(objColor);
572 gr->SetLineStyle(objStyle);
573 mg->Add(gr);
574 break;
575
576 default:
577 std::cout << "wrong type, possibles choices are Object, Track and Tower" << std::endl;
578 break;
579 }
580}
581
582void addHist(TH1D *h, TLegend *leg, int type)
583{
584 h->SetLineWidth(2);
585
586 switch ( type )
587 {
588 case 1:
589 h->SetLineColor(objColor);
590 h->SetLineStyle(objStyle);
591 leg->AddEntry(h,"Reco","l");
592 break;
593
594 case 2:
595 h->SetLineColor(trackColor);
596 h->SetLineStyle(trackStyle);
597 leg->AddEntry(h,"Track","l");
598 break;
599
600 case 3:
601 h->SetLineColor(towerColor);
602 h->SetLineStyle(towerStyle);
603 leg->AddEntry(h,"Tower","l");
604 break;
605
606 case 0:
607 h->SetLineColor(objColor);
608 h->SetLineStyle(objStyle);
609 break;
610
611 default:
612 std::cout << "wrong type, possibles choices are Object, Track and Tower" << std::endl;
613 break;
614 }
615}
616
617void DrawAxis(TMultiGraph *mg, TLegend *leg, double max)
618{
619 mg->SetMinimum(0.);
620 mg->SetMaximum(max);
621 mg->GetXaxis()->SetLimits(ptrangemin,ptrangemax);
622 mg->GetYaxis()->SetTitle("resolution");
623 mg->GetXaxis()->SetTitle("p_{T} [GeV]");
624 mg->GetYaxis()->SetTitleSize(0.07);
625 mg->GetXaxis()->SetTitleSize(0.07);
626 mg->GetYaxis()->SetLabelSize(0.06);
627 mg->GetXaxis()->SetLabelSize(0.06);
628 mg->GetYaxis()->SetLabelOffset(0.03);
629 mg->GetYaxis()->SetTitleOffset(1.4);
630 mg->GetXaxis()->SetTitleOffset(1.4);
631
632 mg->GetYaxis()->SetNdivisions(505);
633
634 leg->SetBorderSize(0);
635 leg->SetShadowColor(0);
636 leg->SetFillColor(0);
637 leg->SetFillStyle(0);
638
639 gStyle->SetOptTitle(0);
640 gPad->SetLogx();
641 gPad->SetBottomMargin(0.2);
642 gPad->SetLeftMargin(0.2);
643 gPad->Modified();
644 gPad->Update();
645
646}
647
648void DrawAxis(TH1D *h, TLegend *leg, int type)
649{
650
651 h->GetYaxis()->SetRangeUser(0,1.0);
652 if (type == 0) h->GetXaxis()->SetTitle("p_{T} [GeV]");
653 else h->GetXaxis()->SetTitle("#eta");
654 h->GetYaxis()->SetTitle("efficiency");
655 h->GetYaxis()->SetTitleSize(0.07);
656 h->GetXaxis()->SetTitleSize(0.07);
657 h->GetYaxis()->SetLabelSize(0.06);
658 h->GetXaxis()->SetLabelSize(0.06);
659 h->GetYaxis()->SetLabelOffset(0.03);
660 h->GetYaxis()->SetTitleOffset(1.3);
661 h->GetXaxis()->SetTitleOffset(1.4);
662
663 h->GetYaxis()->SetNdivisions(505);
664
665 leg->SetBorderSize(0);
666 leg->SetShadowColor(0);
667 leg->SetFillColor(0);
668 leg->SetFillStyle(0);
669
670 gStyle->SetOptTitle(0);
671 gStyle->SetOptStat(0);
672 gPad->SetBottomMargin(0.2);
673 gPad->SetLeftMargin(0.2);
674
675 gPad->Modified();
676 gPad->Update();
677
678}
679
680
681void Validation(const char *inputFileElectron, const char *inputFileMuon, const char *inputFilePhoton, const char *inputFileJet, const char *inputFileBJet, const char *inputFileTauJet, const char *outputFile)
682{
683 TChain *chainElectron = new TChain("Delphes");
684 chainElectron->Add(inputFileElectron);
685 ExRootTreeReader *treeReaderElectron = new ExRootTreeReader(chainElectron);
686
687 TChain *chainMuon = new TChain("Delphes");
688 chainMuon->Add(inputFileMuon);
689 ExRootTreeReader *treeReaderMuon = new ExRootTreeReader(chainMuon);
690
691 TChain *chainPhoton = new TChain("Delphes");
692 chainPhoton->Add(inputFilePhoton);
693 ExRootTreeReader *treeReaderPhoton = new ExRootTreeReader(chainPhoton);
694
695 TChain *chainJet = new TChain("Delphes");
696 chainJet->Add(inputFileJet);
697 ExRootTreeReader *treeReaderJet = new ExRootTreeReader(chainJet);
698
699 TChain *chainBJet = new TChain("Delphes");
700 chainBJet->Add(inputFileBJet);
701 ExRootTreeReader *treeReaderBJet = new ExRootTreeReader(chainBJet);
702
703 TChain *chainTauJet = new TChain("Delphes");
704 chainTauJet->Add(inputFileTauJet);
705 ExRootTreeReader *treeReaderTauJet = new ExRootTreeReader(chainTauJet);
706
707 TClonesArray *branchParticleElectron = treeReaderElectron->UseBranch("Particle");
708 TClonesArray *branchTrackElectron = treeReaderElectron->UseBranch("Track");
709 TClonesArray *branchTowerElectron = treeReaderElectron->UseBranch("Tower");
710 TClonesArray *branchElectron = treeReaderElectron->UseBranch("Electron");
711
712 TClonesArray *branchParticleMuon = treeReaderMuon->UseBranch("Particle");
713 TClonesArray *branchTrackMuon = treeReaderMuon->UseBranch("Track");
714 TClonesArray *branchMuon = treeReaderMuon->UseBranch("Muon");
715
716 TClonesArray *branchParticlePhoton = treeReaderPhoton->UseBranch("Particle");
717 TClonesArray *branchTowerPhoton = treeReaderPhoton->UseBranch("Tower");
718 TClonesArray *branchPhoton = treeReaderPhoton->UseBranch("Photon");
719
720 TClonesArray *branchGenJet = treeReaderJet->UseBranch("GenJet");
721 TClonesArray *branchPFJet = treeReaderJet->UseBranch("Jet");
722 TClonesArray *branchCaloJet = treeReaderJet->UseBranch("CaloJet");
723
724 TClonesArray *branchParticleBJet = treeReaderBJet->UseBranch("Particle");
725 TClonesArray *branchPFBJet = treeReaderBJet->UseBranch("Jet");
726
727 TClonesArray *branchParticleTauJet = treeReaderTauJet->UseBranch("Particle");
728 TClonesArray *branchPFTauJet = treeReaderTauJet->UseBranch("Jet");
729
730 TClonesArray *branchScalarHT = treeReaderJet->UseBranch("ScalarHT");
731 TClonesArray *branchMet = treeReaderJet->UseBranch("MissingET");
732
733 ///////////////
734 // Electrons //
735 ///////////////
736
737 // Reconstruction efficiency
738 TString elecs = "Electron";
739 int elID = 11;
740 std::pair<TH1D*,TH1D*> histos_el = GetEff<Electron>(branchElectron, branchParticleElectron, "Electron", elID, treeReaderElectron);
741
742 histos_el.second->SaveAs("test1.pdf");
743
744 // tracking reconstruction efficiency
745 std::pair <TH1D*,TH1D*> histos_eltrack = GetEff<Track>(branchTrackElectron, branchParticleElectron, "electronTrack", elID, treeReaderElectron);
746
747 // Tower reconstruction efficiency
748 std::pair <TH1D*,TH1D*> histos_eltower = GetEff<Tower>(branchTowerElectron, branchParticleElectron, "electronTower", elID, treeReaderElectron);
749
750 // Electron Energy Resolution
751 std::vector<resolPlot> plots_el;
752 HistogramsCollection(&plots_el, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "electrons");
753 GetEres<Electron>(&plots_el, branchElectron, branchParticleElectron, elID, treeReaderElectron);
754 TGraphErrors gr_el = EresGraph(&plots_el, true);
755 TGraphErrors gr_elFwd = EresGraph(&plots_el, false);
756 gr_el.SetName("Electron");
757 gr_elFwd.SetName("ElectronFwd");
758
759 // Electron Track Energy Resolution
760 std::vector<resolPlot> plots_eltrack;
761 HistogramsCollection(&plots_eltrack, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "electronsTracks");
762 GetEres<Track>(&plots_eltrack, branchTrackElectron, branchParticleElectron, elID, treeReaderElectron);
763 TGraphErrors gr_eltrack = EresGraph(&plots_eltrack, true);
764 TGraphErrors gr_eltrackFwd = EresGraph(&plots_eltrack, false);
765 gr_eltrack.SetName("ElectronTracks");
766 gr_eltrackFwd.SetName("ElectronTracksFwd");
767
768 // Electron Tower Energy Resolution
769 std::vector<resolPlot> plots_eltower;
770 HistogramsCollection(&plots_eltower, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "electronsTower");
771 GetEres<Tower>(&plots_eltower, branchTowerElectron, branchParticleElectron, elID, treeReaderElectron);
772 TGraphErrors gr_eltower = EresGraph(&plots_eltower, true);
773 TGraphErrors gr_eltowerFwd = EresGraph(&plots_eltower, false);
774 gr_eltower.SetName("ElectronTower");
775 gr_eltrackFwd.SetName("ElectronTracksFwd");
776
777 // Canvases
778 TString elEff = "electronEff";
779 TCanvas *C_el1 = new TCanvas(elEff,elEff, 1600, 600);
780 C_el1->Divide(2);
781 C_el1->cd(1);
782 TLegend *leg_el1 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
783 leg_el1->SetHeader("#splitline{electrons}{|#eta| < 1.5}");
784 leg_el1->AddEntry("","","");
785
786 gPad->SetLogx();
787 histos_eltrack.first->Draw("][");
788 addHist(histos_eltrack.first, leg_el1, 2);
789 histos_el.first->Draw("same ][");
790 addHist(histos_el.first, leg_el1, 1);
791 DrawAxis(histos_eltrack.first, leg_el1, 0);
792
793 leg_el1->Draw();
794
795 C_el1->cd(2);
796 TLegend *leg_el2 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
797 leg_el2->SetHeader("#splitline{electrons}{1.5 < |#eta| < 2.5}");
798 leg_el2->AddEntry("","","");
799
800 gPad->SetLogx();
801 histos_eltrack.second->Draw("][");
802 addHist(histos_eltrack.second, leg_el2, 2);
803 histos_el.second->Draw("same ][");
804 addHist(histos_el.second, leg_el2, 1);
805
806 DrawAxis(histos_eltrack.second, leg_el2, 0);
807 leg_el2->Draw();
808
809 TString elRes = "electronERes";
810 TString elResFwd = "electronEResForward";
811 TCanvas *C_el2 = new TCanvas(elRes,elRes, 1600, 600);
812 C_el2->Divide(2);
813 C_el2->cd(1);
814 TMultiGraph *mg_el = new TMultiGraph(elRes,elRes);
815 TLegend *leg_el = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
816 leg_el->SetHeader("#splitline{electrons}{|#eta| < 1.5}");
817 leg_el->AddEntry("","","");
818
819 addGraph(mg_el, &gr_eltower, leg_el, 3);
820 addGraph(mg_el, &gr_eltrack, leg_el, 2);
821 addGraph(mg_el, &gr_el, leg_el, 1);
822
823 mg_el->Draw("ACX");
824 leg_el->Draw();
825
826 DrawAxis(mg_el, leg_el, 0.1);
827
828 C_el2->cd(2);
829 TMultiGraph *mg_elFwd = new TMultiGraph(elResFwd,elResFwd);
830 TLegend *leg_elFwd = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
831 leg_elFwd->SetHeader("#splitline{electrons}{1.5 < |#eta| < 2.5}");
832 leg_elFwd->AddEntry("","","");
833
834 addGraph(mg_elFwd, &gr_eltowerFwd, leg_elFwd, 3);
835 addGraph(mg_elFwd, &gr_eltrackFwd, leg_elFwd, 2);
836 addGraph(mg_elFwd, &gr_elFwd, leg_elFwd, 1);
837
838 mg_elFwd->Draw("ACX");
839 leg_elFwd->Draw();
840
841 DrawAxis(mg_elFwd, leg_elFwd, 0.2);
842
843 C_el1->Print("validation.pdf(","pdf");
844 C_el2->Print("validation.pdf","pdf");
845
846 gDirectory->cd(0);
847
848 ///////////
849 // Muons //
850 ///////////
851
852 // Reconstruction efficiency
853 int muID = 13;
854 std::pair<TH1D*,TH1D*> histos_mu = GetEff<Muon>(branchMuon, branchParticleMuon,"Muon", muID, treeReaderMuon);
855
856 // muon tracking reconstruction efficiency
857 std::pair <TH1D*,TH1D*> histos_mutrack = GetEff<Track>(branchTrackMuon, branchParticleMuon, "muonTrack", muID, treeReaderMuon);
858
859 // Muon Energy Resolution
860 std::vector<resolPlot> plots_mu;
861 HistogramsCollection(&plots_mu, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "muons");
862 GetEres<Muon>(&plots_mu, branchMuon, branchParticleMuon, muID, treeReaderMuon);
863 TGraphErrors gr_mu = EresGraph(&plots_mu, true);
864 TGraphErrors gr_muFwd = EresGraph(&plots_mu, false);
865 gr_mu.SetName("Muon");
866 gr_muFwd.SetName("MuonFwd");
867
868 // Muon Track Energy Resolution
869 std::vector<resolPlot> plots_mutrack;
870 HistogramsCollection(&plots_mutrack, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "muonsTracks");
871 GetEres<Track>(&plots_mutrack, branchTrackMuon, branchParticleMuon, muID, treeReaderMuon);
872 TGraphErrors gr_mutrack = EresGraph(&plots_mutrack, true);
873 TGraphErrors gr_mutrackFwd = EresGraph(&plots_mutrack, false);
874 gr_mutrackFwd.SetName("MuonTracksFwd");
875
876 // Canvas
877
878 TString muEff = "muonEff";
879 TCanvas *C_mu1 = new TCanvas(muEff,muEff, 1600, 600);
880 C_mu1->Divide(2);
881 C_mu1->cd(1);
882 TLegend *leg_mu1 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
883 leg_mu1->SetHeader("#splitline{muons}{|#eta| < 1.5}");
884 leg_mu1->AddEntry("","","");
885
886
887 gPad->SetLogx();
888 histos_mutrack.first->Draw("][");
889 addHist(histos_mutrack.first, leg_mu1, 2);
890 histos_mu.first->Draw("same ][");
891 addHist(histos_mu.first, leg_mu1, 1);
892
893 DrawAxis(histos_mutrack.first, leg_mu1, 0);
894
895 leg_mu1->Draw();
896
897 C_mu1->cd(2);
898 TLegend *leg_mu2 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
899 leg_mu2->SetHeader("#splitline{muons}{1.5 < |#eta| < 2.5}");
900 leg_mu2->AddEntry("","","");
901
902 gPad->SetLogx();
903 histos_mutrack.second->Draw("][");
904 addHist(histos_mutrack.second, leg_mu2, 2);
905 histos_mu.second->Draw("same ][");
906 addHist(histos_mu.second, leg_mu2, 1);
907
908 DrawAxis(histos_mutrack.second, leg_mu2, 1);
909 leg_mu2->Draw();
910
911 TString muRes = "muonERes";
912 TString muResFwd = "muonEResFwd";
913
914 TCanvas *C_mu = new TCanvas(muRes,muRes, 1600, 600);
915 C_mu->Divide(2);
916 C_mu->cd(1);
917 TMultiGraph *mg_mu = new TMultiGraph(muRes,muRes);
918 TLegend *leg_mu = new TLegend(topLeftLegXmin,topLeftLegYmin,topLeftLegXmax,topLeftLegYmax);
919 leg_mu->SetHeader("#splitline{muons}{|#eta| < 1.5}");
920 leg_mu->AddEntry("","","");
921
922 addGraph(mg_mu, &gr_mutrack, leg_mu, 2);
923 addGraph(mg_mu, &gr_mu, leg_mu, 1);
924
925 mg_mu->Draw("ACX");
926 leg_mu->Draw();
927
928 DrawAxis(mg_mu, leg_mu, 0.3);
929
930 C_mu->cd(2);
931 TMultiGraph *mg_muFwd = new TMultiGraph(muResFwd,muResFwd);
932 TLegend *leg_muFwd = new TLegend(topLeftLegXmin,topLeftLegYmin,topLeftLegXmax,topLeftLegYmax);
933 leg_muFwd->SetHeader("#splitline{muons}{1.5 < |#eta| < 2.5}");
934 leg_muFwd->AddEntry("","","");
935
936 addGraph(mg_muFwd, &gr_mutrackFwd, leg_muFwd, 2);
937 addGraph(mg_muFwd, &gr_muFwd, leg_muFwd, 1);
938
939 mg_muFwd->Draw("ACX");
940 leg_muFwd->Draw();
941
942 DrawAxis(mg_muFwd, leg_muFwd, 0.3);
943
944 //C_mu1->SaveAs(muEff+".eps");
945 //C_mu->SaveAs(muRes+".eps");
946
947 C_mu1->Print("validation.pdf","pdf");
948 C_mu->Print("validation.pdf","pdf");
949
950 gDirectory->cd(0);
951
952 /////////////
953 // Photons //
954 /////////////
955
956 // Reconstruction efficiency
957 int phID = 22;
958 std::pair<TH1D*,TH1D*> histos_ph = GetEff<Electron>(branchPhoton, branchParticlePhoton, "Photon", phID, treeReaderPhoton);
959 std::pair<TH1D*,TH1D*> histos_phtower = GetEff<Electron>(branchTowerPhoton, branchParticlePhoton, "Photon", phID, treeReaderPhoton);
960
961 // Photon Energy Resolution
962 std::vector<resolPlot> plots_ph;
963 HistogramsCollection(&plots_ph, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "photons");
964 GetEres<Photon>(&plots_ph, branchPhoton, branchParticlePhoton, phID, treeReaderPhoton);
965 TGraphErrors gr_ph = EresGraph(&plots_ph, true);
966 TGraphErrors gr_phFwd = EresGraph(&plots_ph, false);
967 gr_ph.SetName("Photon");
968 gr_phFwd.SetName("PhotonFwd");
969
970
971 // Photon Tower Energy Resolution
972 std::vector<resolPlot> plots_phtower;
973 HistogramsCollection(&plots_phtower, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "photonsTower");
974 GetEres<Tower>(&plots_phtower, branchTowerPhoton, branchParticlePhoton, phID, treeReaderPhoton);
975 TGraphErrors gr_phtower = EresGraph(&plots_phtower, true);
976 TGraphErrors gr_phtowerFwd = EresGraph(&plots_phtower, false);
977 gr_phtower.SetName("PhotonTower");
978 gr_phtowerFwd.SetName("PhotonTowerFwd");
979
980 // Canvas
981
982 TString phEff = "photonEff";
983 TCanvas *C_ph1 = new TCanvas(phEff,phEff, 1600, 600);
984 C_ph1->Divide(2);
985 C_ph1->cd(1);
986 TLegend *leg_ph1 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
987 leg_ph1->SetHeader("#splitline{photons}{|#eta| < 1.5}");
988 leg_ph1->AddEntry("","","");
989
990
991 gPad->SetLogx();
992 histos_phtower.first->Draw("][");
993 addHist(histos_phtower.first, leg_ph1, 3);
994 histos_ph.first->Draw("same ][");
995 addHist(histos_ph.first, leg_ph1, 1);
996
997 DrawAxis(histos_phtower.first, leg_ph1, 0);
998 leg_ph1->Draw();
999
1000 C_ph1->cd(2);
1001 TLegend *leg_ph2 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
1002 leg_ph2->SetHeader("#splitline{photons}{1.5 < |#eta| < 2.5}");
1003 leg_ph2->AddEntry("","","");
1004
1005
1006 gPad->SetLogx();
1007 histos_phtower.second->Draw("][");
1008 addHist(histos_phtower.second, leg_ph2, 3);
1009 histos_ph.second->Draw("same ][");
1010 addHist(histos_ph.second, leg_ph2, 1);
1011
1012 DrawAxis(histos_phtower.second, leg_ph2, 1);
1013 leg_ph2->Draw();
1014
1015 C_ph1->SaveAs(phEff+".eps");
1016
1017 TString phRes = "phERes";
1018 TString phResFwd = "phEResFwd";
1019
1020 TCanvas *C_ph = new TCanvas(phRes,phRes, 1600, 600);
1021 C_ph->Divide(2);
1022 C_ph->cd(1);
1023 TMultiGraph *mg_ph = new TMultiGraph(phRes,phRes);
1024 TLegend *leg_ph = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1025 leg_ph->SetHeader("#splitline{photons}{|#eta| < 1.5}");
1026 leg_ph->AddEntry("","","");
1027
1028 addGraph(mg_ph, &gr_phtower, leg_ph, 3);
1029 addGraph(mg_ph, &gr_ph, leg_ph, 1);
1030
1031 mg_ph->Draw("ACX");
1032 leg_ph->Draw();
1033
1034 DrawAxis(mg_ph, leg_ph, 0.3);
1035
1036 C_ph->cd(2);
1037 TMultiGraph *mg_phFwd = new TMultiGraph(phResFwd,phResFwd);
1038 TLegend *leg_phFwd = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1039 leg_phFwd->SetHeader("#splitline{photons}{1.5 < |#eta| < 2.5}");
1040 leg_phFwd->AddEntry("","","");
1041
1042 addGraph(mg_phFwd, &gr_phtowerFwd, leg_phFwd, 3);
1043 addGraph(mg_phFwd, &gr_phFwd, leg_phFwd, 1);
1044
1045 mg_phFwd->Draw("ACX");
1046 leg_phFwd->Draw();
1047
1048 DrawAxis(mg_phFwd, leg_phFwd, 0.3);
1049
1050 C_ph->SaveAs(phRes+".eps");
1051
1052 C_ph1->Print("validation.pdf","pdf");
1053 C_ph->Print("validation.pdf","pdf");
1054
1055 gDirectory->cd(0);
1056
1057 //////////
1058 // Jets //
1059 //////////
1060
1061 // BJets Reconstruction efficiency
1062 int bID = 5;
1063 std::pair<TH1D*,TH1D*> histos_btag = GetEff<Jet>(branchPFBJet, branchParticleBJet,"BTag", bID, treeReaderBJet);
1064
1065 // TauJets Reconstruction efficiency
1066 int tauID = 15;
1067 std::pair<TH1D*,TH1D*> histos_tautag = GetEff<Jet>(branchPFTauJet, branchParticleTauJet,"TauTag", tauID, treeReaderTauJet);
1068
1069 // PFJets Energy Resolution
1070 std::vector<resolPlot> plots_pfjets;
1071 HistogramsCollection(&plots_pfjets, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "PFJet");
1072 GetJetsEres(&plots_pfjets, branchPFJet, branchGenJet, treeReaderJet);
1073 TGraphErrors gr_pfjets = EresGraph(&plots_pfjets, true);
1074 TGraphErrors gr_pfjetsFwd = EresGraph(&plots_pfjets, false);
1075 gr_pfjets.SetName("pfJet");
1076 gr_pfjetsFwd.SetName("pfJetFwd");
1077
1078 // CaloJets Energy Resolution
1079 std::vector<resolPlot> plots_calojets;
1080 HistogramsCollection(&plots_calojets, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "CaloJet");
1081 GetJetsEres(&plots_calojets, branchCaloJet, branchGenJet, treeReaderJet);
1082 TGraphErrors gr_calojets = EresGraph(&plots_calojets, true);
1083 TGraphErrors gr_calojetsFwd = EresGraph(&plots_calojets, false);
1084 gr_calojets.SetName("caloJet");
1085 gr_calojetsFwd.SetName("caloJetFwd");
1086
1087 // MET Resolution vs HT
1088 std::vector<resolPlot> plots_met;
1089 HistogramsCollection(&plots_met, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "MET", -500, 500);
1090 GetMetres(&plots_met, branchScalarHT, branchMet, branchPFJet, treeReaderJet);
1091 TGraphErrors gr_met = EresGraph(&plots_met, true);
1092 gr_calojets.SetName("MET");
1093
1094 // Canvas
1095 TString btagEff = "btagEff";
1096 TCanvas *C_btag1 = new TCanvas(btagEff,btagEff, 1600, 600);
1097 C_btag1->Divide(2);
1098 C_btag1->cd(1);
1099 TLegend *leg_btag1 = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1100 leg_btag1->SetHeader("#splitline{B-tagging}{|#eta| < 1.5}");
1101 leg_btag1->AddEntry("","","");
1102
1103 gPad->SetLogx();
1104 histos_btag.first->Draw();
1105 addHist(histos_btag.first, leg_btag1, 0);
1106
1107 DrawAxis(histos_btag.first, leg_btag1, 0);
1108 leg_btag1->Draw();
1109
1110 C_btag1->cd(2);
1111 TLegend *leg_btag2 = new TLegend(resLegXmin,resLegYmin,resLegXmax+0.05,resLegYmax);
1112 leg_btag2->SetHeader("#splitline{B-tagging}{1.5 < |#eta| < 2.5}");
1113 leg_btag2->AddEntry("","","");
1114
1115 gPad->SetLogx();
1116 histos_btag.second->Draw();
1117 addHist(histos_btag.second, leg_btag2, 0);
1118
1119 DrawAxis(histos_btag.second, leg_btag2, 0);
1120 leg_btag2->Draw();
1121 C_btag1->cd(0);
1122
1123 TString tautagEff = "tautagEff";
1124 TCanvas *C_tautag1 = new TCanvas(tautagEff,tautagEff, 1600, 600);
1125 C_tautag1->Divide(2);
1126 C_tautag1->cd(1);
1127 TLegend *leg_tautag1 = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1128 leg_tautag1->SetHeader("#splitline{#tau-tagging}{|#eta| < 1.5}");
1129 leg_tautag1->AddEntry("","","");
1130
1131 gPad->SetLogx();
1132 histos_tautag.first->Draw();
1133 addHist(histos_tautag.first, leg_tautag1, 0);
1134
1135 DrawAxis(histos_tautag.first, leg_tautag1, 0);
1136 leg_tautag1->Draw();
1137
1138 C_tautag1->cd(2);
1139 TLegend *leg_tautag2 = new TLegend(resLegXmin,resLegYmin,resLegXmax+0.05,resLegYmax);
1140 leg_tautag2->SetHeader("#splitline{#tau-tagging}{1.5 < |#eta| < 2.5}");
1141 leg_tautag2->AddEntry("","","");
1142
1143 gPad->SetLogx();
1144 histos_tautag.second->Draw();
1145 addHist(histos_tautag.second, leg_tautag2, 0);
1146
1147 DrawAxis(histos_tautag.second, leg_tautag2, 0);
1148 leg_tautag2->Draw();
1149 C_tautag1->cd(0);
1150
1151 TString jetRes = "jetERes";
1152 TString jetResFwd = "jetEResFwd";
1153 TCanvas *C_jet = new TCanvas(jetRes,jetRes, 1600, 600);
1154 C_jet->Divide(2);
1155
1156 C_jet->cd(1);
1157 TMultiGraph *mg_jet = new TMultiGraph(jetRes,jetRes);
1158 TLegend *leg_jet = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1159 leg_jet->SetHeader("#splitline{jets}{|#eta| < 1.5}");
1160 leg_jet->AddEntry("","","");
1161
1162 addGraph(mg_jet, &gr_calojets, leg_jet, 3);
1163 addGraph(mg_jet, &gr_pfjets, leg_jet, 1);
1164
1165 mg_jet->Draw("ACX");
1166 leg_jet->Draw();
1167
1168 DrawAxis(mg_jet, leg_jet, 0.25);
1169
1170 C_jet->cd(2);
1171 TMultiGraph *mg_jetFwd = new TMultiGraph(jetResFwd,jetResFwd);
1172 TLegend *leg_jetFwd = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1173 leg_jetFwd->SetHeader("#splitline{jets}{|#eta| < 1.5}");
1174 leg_jetFwd->AddEntry("","","");
1175
1176 addGraph(mg_jetFwd, &gr_calojetsFwd, leg_jetFwd, 3);
1177 addGraph(mg_jetFwd, &gr_pfjetsFwd, leg_jetFwd, 1);
1178
1179 mg_jetFwd->Draw("ACX");
1180 leg_jetFwd->Draw();
1181
1182 DrawAxis(mg_jetFwd, leg_jetFwd, 0.25);
1183
1184 C_btag1->SaveAs(btagEff+".eps");
1185 C_jet->SaveAs(jetRes+".eps");
1186
1187 TString metRes = "MetRes";
1188 TCanvas *C_met = new TCanvas(metRes,metRes, 800, 600);
1189
1190 TMultiGraph *mg_met = new TMultiGraph(metRes,metRes);
1191 TLegend *leg_met = new TLegend(topLeftLegXmin,topLeftLegYmin+0.2,topLeftLegXmax-0.2,topLeftLegYmax);
1192 leg_met->SetHeader("E_{T}^{miss}");
1193 leg_met->AddEntry("","","");
1194
1195
1196 addGraph(mg_met, &gr_met, leg_met, 0);
1197
1198 mg_met->Draw("ACX");
1199 leg_met->Draw();
1200
1201 DrawAxis(mg_met, leg_met, 300);
1202
1203 mg_met->GetXaxis()->SetTitle("H_{T} [GeV]");
1204 mg_met->GetYaxis()->SetTitle("#sigma(ME_{x}) [GeV]");
1205
1206 C_met->SaveAs(metRes+".eps");
1207
1208 C_jet->Print("validation.pdf","pdf");
1209 C_btag1->Print("validation.pdf","pdf");
1210 C_tautag1->Print("validation.pdf","pdf");
1211 C_met->Print("validation.pdf)","pdf");
1212
1213 TFile *fout = new TFile(outputFile,"recreate");
1214
1215 for (int bin = 0; bin < Nbins; bin++)
1216 {
1217 plots_el.at(bin).cenResolHist->Write();
1218 plots_eltrack.at(bin).cenResolHist->Write();
1219 plots_eltower.at(bin).cenResolHist->Write();
1220 plots_el.at(bin).fwdResolHist->Write();
1221 plots_eltrack.at(bin).fwdResolHist->Write();
1222 plots_eltower.at(bin).fwdResolHist->Write();
1223 }
1224
1225 histos_el.first->Write();
1226 histos_el.second->Write();
1227 histos_eltrack.first->Write();
1228 histos_eltrack.second->Write();
1229 histos_eltower.first->Write();
1230 histos_eltower.second->Write();
1231 C_el1->Write();
1232 C_el2->Write();
1233
1234 histos_mu.first->Write();
1235 histos_mu.second->Write();
1236 histos_mutrack.first->Write();
1237 histos_mutrack.second->Write();
1238 C_mu1->Write();
1239 C_mu->Write();
1240
1241 histos_ph.first->Write();
1242 histos_ph.second->Write();
1243 C_ph1->Write();
1244 C_ph->Write();
1245
1246 for (int bin = 0; bin < Nbins; bin++)
1247 {
1248 plots_pfjets.at(bin).cenResolHist->Write();
1249 plots_pfjets.at(bin).fwdResolHist->Write();
1250 plots_calojets.at(bin).cenResolHist->Write();
1251 plots_calojets.at(bin).fwdResolHist->Write();
1252 plots_met.at(bin).cenResolHist->Write();
1253 }
1254 histos_btag.first->Write();
1255 histos_btag.second->Write();
1256 histos_tautag.first->Write();
1257 histos_tautag.second->Write();
1258 C_btag1->Write();
1259 C_tautag1->Write();
1260 C_jet->Write();
1261 C_met->Write();
1262
1263 fout->Write();
1264
1265 cout << "** Exiting..." << endl;
1266
1267 delete treeReaderElectron;
1268 delete treeReaderMuon;
1269 delete treeReaderPhoton;
1270 delete treeReaderJet;
1271 delete treeReaderBJet;
1272 delete treeReaderTauJet;
1273 delete chainElectron;
1274 delete chainMuon;
1275 delete chainPhoton;
1276 delete chainJet;
1277 delete chainBJet;
1278 delete chainTauJet;
1279}
1280
1281//------------------------------------------------------------------------------
1282
1283int main(int argc, char *argv[])
1284{
1285 char *appName = "Validation";
1286
1287 if(argc != 8)
1288 {
1289 cout << " Usage: " << appName << " input_file_electron input_file_muon input_file_photon input_file_jet input_file_bjet input_file_taujet output_file" << endl;
1290 cout << " input_file_electron - input file in ROOT format ('Delphes' tree)," << endl;
1291 cout << " input_file_muon - input file in ROOT format ('Delphes' tree)," << endl;
1292 cout << " input_file_photon - input file in ROOT format ('Delphes' tree)," << endl;
1293 cout << " input_file_jet - input file in ROOT format ('Delphes' tree)," << endl;
1294 cout << " input_file_bjet - input file in ROOT format ('Delphes' tree)," << endl;
1295 cout << " input_file_taujet - input file in ROOT format ('Delphes' tree)," << endl;
1296 cout << " output_file - output file in ROOT format" << endl;
1297 return 1;
1298 }
1299
1300 gROOT->SetBatch();
1301
1302 int appargc = 1;
1303 char *appargv[] = {appName};
1304 TApplication app(appName, &appargc, appargv);
1305
1306 Validation(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]);
1307}
1308
1309
Note: See TracBrowser for help on using the repository browser.