Fork me on GitHub

source: git/examples/Validation.cpp@ 2075bc1

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

some bug fixes

  • Property mode set to 100644
File size: 39.1 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 Double_t sig = f1->GetParameter(2);
479 Double_t sigErr = f1->GetParError(2);
480 delete f1;
481 return make_pair (sig, sigErr);
482}
483
484
485TGraphErrors EresGraph(std::vector<resolPlot> *histos, bool central, bool rms = false)
486{
487 Int_t bin;
488 Int_t count = 0;
489 TGraphErrors gr = TGraphErrors(Nbins/2);
490 Double_t sig = 0;
491 Double_t sigErr = 0;
492 for (bin = 0; bin < Nbins; bin++)
493 {
494 if (central == true && histos->at(bin).cenResolHist->GetEntries() > 100)
495 {
496 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).cenResolHist);
497 if (rms == true)
498 {
499 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.second);
500 gr.SetPointError(count,0, sigvalues.second); // to correct
501 }
502 else
503 {
504 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);
505 gr.SetPointError(count,0, sigvalues.second);
506 }
507 count++;
508 }
509
510 else if (central == false && histos->at(bin).fwdResolHist->GetEntries() > 10)
511 {
512 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).fwdResolHist);
513 if (rms == true)
514 {
515 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.second);
516 gr.SetPointError(count,0, sigvalues.second); // to correct
517 }
518 else
519 {
520 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);
521 gr.SetPointError(count,0, sigvalues.second);
522 }
523 count++;
524 }
525
526 }
527 return gr;
528}
529
530
531//------------------------------------------------------------------------------
532
533
534// type 1 : object, 2 : track, 3 : tower
535
536void addGraph(TMultiGraph *mg, TGraphErrors *gr, TLegend *leg, int type)
537{
538
539 gr->SetLineWidth(2);
540
541 switch ( type )
542 {
543 case 1:
544 gr->SetLineColor(objColor);
545 gr->SetLineStyle(objStyle);
546 std::cout << "Adding " << gr->GetName() << std::endl;
547 mg->Add(gr);
548 leg->AddEntry(gr,"Reco","l");
549 break;
550
551 case 2:
552 gr->SetLineColor(trackColor);
553 gr->SetLineStyle(trackStyle);
554 mg->Add(gr);
555 leg->AddEntry(gr,"Track","l");
556 break;
557
558 case 3:
559 gr->SetLineColor(towerColor);
560 gr->SetLineStyle(towerStyle);
561 mg->Add(gr);
562 leg->AddEntry(gr,"Tower","l");
563 break;
564
565 case 0:
566 gr->SetLineColor(objColor);
567 gr->SetLineStyle(objStyle);
568 mg->Add(gr);
569 break;
570
571 default:
572 std::cout << "wrong type, possibles choices are Object, Track and Tower" << std::endl;
573 break;
574 }
575}
576
577void addHist(TH1D *h, TLegend *leg, int type)
578{
579 h->SetLineWidth(2);
580
581 switch ( type )
582 {
583 case 1:
584 h->SetLineColor(objColor);
585 h->SetLineStyle(objStyle);
586 leg->AddEntry(h,"Reco","l");
587 break;
588
589 case 2:
590 h->SetLineColor(trackColor);
591 h->SetLineStyle(trackStyle);
592 leg->AddEntry(h,"Track","l");
593 break;
594
595 case 3:
596 h->SetLineColor(towerColor);
597 h->SetLineStyle(towerStyle);
598 leg->AddEntry(h,"Tower","l");
599 break;
600
601 case 0:
602 h->SetLineColor(objColor);
603 h->SetLineStyle(objStyle);
604 break;
605
606 default:
607 std::cout << "wrong type, possibles choices are Object, Track and Tower" << std::endl;
608 break;
609 }
610}
611
612void DrawAxis(TMultiGraph *mg, TLegend *leg, double max)
613{
614 mg->SetMinimum(0.);
615 mg->SetMaximum(max);
616 mg->GetXaxis()->SetLimits(ptrangemin,ptrangemax);
617 mg->GetYaxis()->SetTitle("resolution");
618 mg->GetXaxis()->SetTitle("p_{T} [GeV]");
619 mg->GetYaxis()->SetTitleSize(0.07);
620 mg->GetXaxis()->SetTitleSize(0.07);
621 mg->GetYaxis()->SetLabelSize(0.06);
622 mg->GetXaxis()->SetLabelSize(0.06);
623 mg->GetYaxis()->SetLabelOffset(0.03);
624 mg->GetYaxis()->SetTitleOffset(1.4);
625 mg->GetXaxis()->SetTitleOffset(1.4);
626
627 mg->GetYaxis()->SetNdivisions(505);
628
629 leg->SetBorderSize(0);
630 leg->SetShadowColor(0);
631 leg->SetFillColor(0);
632 leg->SetFillStyle(0);
633
634 gStyle->SetOptTitle(0);
635 gPad->SetLogx();
636 gPad->SetBottomMargin(0.2);
637 gPad->SetLeftMargin(0.2);
638 gPad->Modified();
639 gPad->Update();
640
641}
642
643void DrawAxis(TH1D *h, TLegend *leg, int type)
644{
645
646 h->GetYaxis()->SetRangeUser(0,1.0);
647 if (type == 0) h->GetXaxis()->SetTitle("p_{T} [GeV]");
648 else h->GetXaxis()->SetTitle("#eta");
649 h->GetYaxis()->SetTitle("efficiency");
650 h->GetYaxis()->SetTitleSize(0.07);
651 h->GetXaxis()->SetTitleSize(0.07);
652 h->GetYaxis()->SetLabelSize(0.06);
653 h->GetXaxis()->SetLabelSize(0.06);
654 h->GetYaxis()->SetLabelOffset(0.03);
655 h->GetYaxis()->SetTitleOffset(1.3);
656 h->GetXaxis()->SetTitleOffset(1.4);
657
658 h->GetYaxis()->SetNdivisions(505);
659
660 leg->SetBorderSize(0);
661 leg->SetShadowColor(0);
662 leg->SetFillColor(0);
663 leg->SetFillStyle(0);
664
665 gStyle->SetOptTitle(0);
666 gStyle->SetOptStat(0);
667 gPad->SetBottomMargin(0.2);
668 gPad->SetLeftMargin(0.2);
669
670 gPad->Modified();
671 gPad->Update();
672
673}
674
675
676void Validation(const char *inputFileElectron, const char *inputFileMuon, const char *inputFilePhoton, const char *inputFileJet, const char *inputFileBJet, const char *inputFileTauJet, const char *outputFile)
677{
678 TChain *chainElectron = new TChain("Delphes");
679 chainElectron->Add(inputFileElectron);
680 ExRootTreeReader *treeReaderElectron = new ExRootTreeReader(chainElectron);
681
682 TChain *chainMuon = new TChain("Delphes");
683 chainMuon->Add(inputFileMuon);
684 ExRootTreeReader *treeReaderMuon = new ExRootTreeReader(chainMuon);
685
686 TChain *chainPhoton = new TChain("Delphes");
687 chainPhoton->Add(inputFilePhoton);
688 ExRootTreeReader *treeReaderPhoton = new ExRootTreeReader(chainPhoton);
689
690 TChain *chainJet = new TChain("Delphes");
691 chainJet->Add(inputFileJet);
692 ExRootTreeReader *treeReaderJet = new ExRootTreeReader(chainJet);
693
694 TChain *chainBJet = new TChain("Delphes");
695 chainBJet->Add(inputFileBJet);
696 ExRootTreeReader *treeReaderBJet = new ExRootTreeReader(chainBJet);
697
698 TChain *chainTauJet = new TChain("Delphes");
699 chainTauJet->Add(inputFileTauJet);
700 ExRootTreeReader *treeReaderTauJet = new ExRootTreeReader(chainTauJet);
701
702 TClonesArray *branchParticleElectron = treeReaderElectron->UseBranch("Particle");
703 TClonesArray *branchTrackElectron = treeReaderElectron->UseBranch("Track");
704 TClonesArray *branchTowerElectron = treeReaderElectron->UseBranch("Tower");
705 TClonesArray *branchElectron = treeReaderElectron->UseBranch("Electron");
706
707 TClonesArray *branchParticleMuon = treeReaderMuon->UseBranch("Particle");
708 TClonesArray *branchTrackMuon = treeReaderMuon->UseBranch("Track");
709 TClonesArray *branchMuon = treeReaderMuon->UseBranch("Muon");
710
711 TClonesArray *branchParticlePhoton = treeReaderPhoton->UseBranch("Particle");
712 TClonesArray *branchTowerPhoton = treeReaderPhoton->UseBranch("Tower");
713 TClonesArray *branchPhoton = treeReaderPhoton->UseBranch("Photon");
714
715 TClonesArray *branchGenJet = treeReaderJet->UseBranch("GenJet");
716 TClonesArray *branchPFJet = treeReaderJet->UseBranch("Jet");
717 TClonesArray *branchCaloJet = treeReaderJet->UseBranch("CaloJet");
718
719 TClonesArray *branchParticleBJet = treeReaderBJet->UseBranch("Particle");
720 TClonesArray *branchPFBJet = treeReaderBJet->UseBranch("Jet");
721
722 TClonesArray *branchParticleTauJet = treeReaderTauJet->UseBranch("Particle");
723 TClonesArray *branchPFTauJet = treeReaderTauJet->UseBranch("Jet");
724
725 TClonesArray *branchScalarHT = treeReaderJet->UseBranch("ScalarHT");
726 TClonesArray *branchMet = treeReaderJet->UseBranch("MissingET");
727
728 ///////////////
729 // Electrons //
730 ///////////////
731
732 // Reconstruction efficiency
733 TString elecs = "Electron";
734 int elID = 11;
735 std::pair<TH1D*,TH1D*> histos_el = GetEff<Electron>(branchElectron, branchParticleElectron, "Electron", elID, treeReaderElectron);
736
737 histos_el.second->SaveAs("test1.pdf");
738
739 // tracking reconstruction efficiency
740 std::pair <TH1D*,TH1D*> histos_eltrack = GetEff<Track>(branchTrackElectron, branchParticleElectron, "electronTrack", elID, treeReaderElectron);
741
742 // Tower reconstruction efficiency
743 std::pair <TH1D*,TH1D*> histos_eltower = GetEff<Tower>(branchTowerElectron, branchParticleElectron, "electronTower", elID, treeReaderElectron);
744
745 // Electron Energy Resolution
746 std::vector<resolPlot> plots_el;
747 HistogramsCollection(&plots_el, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "electrons");
748 GetEres<Electron>(&plots_el, branchElectron, branchParticleElectron, elID, treeReaderElectron);
749 TGraphErrors gr_el = EresGraph(&plots_el, true);
750 TGraphErrors gr_elFwd = EresGraph(&plots_el, false);
751 gr_el.SetName("Electron");
752 gr_elFwd.SetName("ElectronFwd");
753
754 // Electron Track Energy Resolution
755 std::vector<resolPlot> plots_eltrack;
756 HistogramsCollection(&plots_eltrack, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "electronsTracks");
757 GetEres<Track>(&plots_eltrack, branchTrackElectron, branchParticleElectron, elID, treeReaderElectron);
758 TGraphErrors gr_eltrack = EresGraph(&plots_eltrack, true);
759 TGraphErrors gr_eltrackFwd = EresGraph(&plots_eltrack, false);
760 gr_eltrack.SetName("ElectronTracks");
761 gr_eltrackFwd.SetName("ElectronTracksFwd");
762
763 // Electron Tower Energy Resolution
764 std::vector<resolPlot> plots_eltower;
765 HistogramsCollection(&plots_eltower, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "electronsTower");
766 GetEres<Tower>(&plots_eltower, branchTowerElectron, branchParticleElectron, elID, treeReaderElectron);
767 TGraphErrors gr_eltower = EresGraph(&plots_eltower, true);
768 TGraphErrors gr_eltowerFwd = EresGraph(&plots_eltower, false);
769 gr_eltower.SetName("ElectronTower");
770 gr_eltrackFwd.SetName("ElectronTracksFwd");
771
772 // Canvases
773 TString elEff = "electronEff";
774 TCanvas *C_el1 = new TCanvas(elEff,elEff, 1600, 600);
775 C_el1->Divide(2);
776 C_el1->cd(1);
777 TLegend *leg_el1 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
778 leg_el1->SetHeader("#splitline{electrons}{|#eta| < 1.5}");
779 leg_el1->AddEntry("","","");
780
781 gPad->SetLogx();
782 histos_eltrack.first->Draw("][");
783 addHist(histos_eltrack.first, leg_el1, 2);
784 histos_el.first->Draw("same ][");
785 addHist(histos_el.first, leg_el1, 1);
786 DrawAxis(histos_eltrack.first, leg_el1, 0);
787
788 leg_el1->Draw();
789
790 C_el1->cd(2);
791 TLegend *leg_el2 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
792 leg_el2->SetHeader("#splitline{electrons}{1.5 < |#eta| < 2.5}");
793 leg_el2->AddEntry("","","");
794
795 gPad->SetLogx();
796 histos_eltrack.second->Draw("][");
797 addHist(histos_eltrack.second, leg_el2, 2);
798 histos_el.second->Draw("same ][");
799 addHist(histos_el.second, leg_el2, 1);
800
801 DrawAxis(histos_eltrack.second, leg_el2, 0);
802 leg_el2->Draw();
803
804 TString elRes = "electronERes";
805 TString elResFwd = "electronEResForward";
806 TCanvas *C_el2 = new TCanvas(elRes,elRes, 1600, 600);
807 C_el2->Divide(2);
808 C_el2->cd(1);
809 TMultiGraph *mg_el = new TMultiGraph(elRes,elRes);
810 TLegend *leg_el = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
811 leg_el->SetHeader("#splitline{electrons}{|#eta| < 1.5}");
812 leg_el->AddEntry("","","");
813
814 addGraph(mg_el, &gr_eltower, leg_el, 3);
815 addGraph(mg_el, &gr_eltrack, leg_el, 2);
816 addGraph(mg_el, &gr_el, leg_el, 1);
817
818 mg_el->Draw("ACX");
819 leg_el->Draw();
820
821 DrawAxis(mg_el, leg_el, 0.1);
822
823 C_el2->cd(2);
824 TMultiGraph *mg_elFwd = new TMultiGraph(elResFwd,elResFwd);
825 TLegend *leg_elFwd = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
826 leg_elFwd->SetHeader("#splitline{electrons}{1.5 < |#eta| < 2.5}");
827 leg_elFwd->AddEntry("","","");
828
829 addGraph(mg_elFwd, &gr_eltowerFwd, leg_elFwd, 3);
830 addGraph(mg_elFwd, &gr_eltrackFwd, leg_elFwd, 2);
831 addGraph(mg_elFwd, &gr_elFwd, leg_elFwd, 1);
832
833 mg_elFwd->Draw("ACX");
834 leg_elFwd->Draw();
835
836 DrawAxis(mg_elFwd, leg_elFwd, 0.2);
837
838 C_el1->Print("validation.pdf(","pdf");
839 C_el2->Print("validation.pdf","pdf");
840
841 gDirectory->cd(0);
842
843 ///////////
844 // Muons //
845 ///////////
846
847 // Reconstruction efficiency
848 int muID = 13;
849 std::pair<TH1D*,TH1D*> histos_mu = GetEff<Muon>(branchMuon, branchParticleMuon,"Muon", muID, treeReaderMuon);
850
851 // muon tracking reconstruction efficiency
852 std::pair <TH1D*,TH1D*> histos_mutrack = GetEff<Track>(branchTrackMuon, branchParticleMuon, "muonTrack", muID, treeReaderMuon);
853
854 // Muon Energy Resolution
855 std::vector<resolPlot> plots_mu;
856 HistogramsCollection(&plots_mu, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "muons");
857 GetEres<Muon>(&plots_mu, branchMuon, branchParticleMuon, muID, treeReaderMuon);
858 TGraphErrors gr_mu = EresGraph(&plots_mu, true);
859 TGraphErrors gr_muFwd = EresGraph(&plots_mu, false);
860 gr_mu.SetName("Muon");
861 gr_muFwd.SetName("MuonFwd");
862
863 // Muon Track Energy Resolution
864 std::vector<resolPlot> plots_mutrack;
865 HistogramsCollection(&plots_mutrack, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "muonsTracks");
866 GetEres<Track>(&plots_mutrack, branchTrackMuon, branchParticleMuon, muID, treeReaderMuon);
867 TGraphErrors gr_mutrack = EresGraph(&plots_mutrack, true);
868 TGraphErrors gr_mutrackFwd = EresGraph(&plots_mutrack, false);
869 gr_mutrackFwd.SetName("MuonTracksFwd");
870
871 // Canvas
872
873 TString muEff = "muonEff";
874 TCanvas *C_mu1 = new TCanvas(muEff,muEff, 1600, 600);
875 C_mu1->Divide(2);
876 C_mu1->cd(1);
877 TLegend *leg_mu1 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
878 leg_mu1->SetHeader("#splitline{muons}{|#eta| < 1.5}");
879 leg_mu1->AddEntry("","","");
880
881
882 gPad->SetLogx();
883 histos_mutrack.first->Draw("][");
884 addHist(histos_mutrack.first, leg_mu1, 2);
885 histos_mu.first->Draw("same ][");
886 addHist(histos_mu.first, leg_mu1, 1);
887
888 DrawAxis(histos_mutrack.first, leg_mu1, 0);
889
890 leg_mu1->Draw();
891
892 C_mu1->cd(2);
893 TLegend *leg_mu2 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
894 leg_mu2->SetHeader("#splitline{muons}{1.5 < |#eta| < 2.5}");
895 leg_mu2->AddEntry("","","");
896
897 gPad->SetLogx();
898 histos_mutrack.second->Draw("][");
899 addHist(histos_mutrack.second, leg_mu2, 2);
900 histos_mu.second->Draw("same ][");
901 addHist(histos_mu.second, leg_mu2, 1);
902
903 DrawAxis(histos_mutrack.second, leg_mu2, 1);
904 leg_mu2->Draw();
905
906 TString muRes = "muonERes";
907 TString muResFwd = "muonEResFwd";
908
909 TCanvas *C_mu = new TCanvas(muRes,muRes, 1600, 600);
910 C_mu->Divide(2);
911 C_mu->cd(1);
912 TMultiGraph *mg_mu = new TMultiGraph(muRes,muRes);
913 TLegend *leg_mu = new TLegend(topLeftLegXmin,topLeftLegYmin,topLeftLegXmax,topLeftLegYmax);
914 leg_mu->SetHeader("#splitline{muons}{|#eta| < 1.5}");
915 leg_mu->AddEntry("","","");
916
917 addGraph(mg_mu, &gr_mutrack, leg_mu, 2);
918 addGraph(mg_mu, &gr_mu, leg_mu, 1);
919
920 mg_mu->Draw("ACX");
921 leg_mu->Draw();
922
923 DrawAxis(mg_mu, leg_mu, 0.3);
924
925 C_mu->cd(2);
926 TMultiGraph *mg_muFwd = new TMultiGraph(muResFwd,muResFwd);
927 TLegend *leg_muFwd = new TLegend(topLeftLegXmin,topLeftLegYmin,topLeftLegXmax,topLeftLegYmax);
928 leg_muFwd->SetHeader("#splitline{muons}{1.5 < |#eta| < 2.5}");
929 leg_muFwd->AddEntry("","","");
930
931 addGraph(mg_muFwd, &gr_mutrackFwd, leg_muFwd, 2);
932 addGraph(mg_muFwd, &gr_muFwd, leg_muFwd, 1);
933
934 mg_muFwd->Draw("ACX");
935 leg_muFwd->Draw();
936
937 DrawAxis(mg_muFwd, leg_muFwd, 0.3);
938
939 //C_mu1->SaveAs(muEff+".eps");
940 //C_mu->SaveAs(muRes+".eps");
941
942 C_mu1->Print("validation.pdf","pdf");
943 C_mu->Print("validation.pdf","pdf");
944
945 gDirectory->cd(0);
946
947 /////////////
948 // Photons //
949 /////////////
950
951 // Reconstruction efficiency
952 int phID = 22;
953 std::pair<TH1D*,TH1D*> histos_ph = GetEff<Electron>(branchPhoton, branchParticlePhoton, "Photon", phID, treeReaderPhoton);
954 std::pair<TH1D*,TH1D*> histos_phtower = GetEff<Electron>(branchTowerPhoton, branchParticlePhoton, "Photon", phID, treeReaderPhoton);
955
956 // Photon Energy Resolution
957 std::vector<resolPlot> plots_ph;
958 HistogramsCollection(&plots_ph, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "photons");
959 GetEres<Photon>(&plots_ph, branchPhoton, branchParticlePhoton, phID, treeReaderPhoton);
960 TGraphErrors gr_ph = EresGraph(&plots_ph, true);
961 TGraphErrors gr_phFwd = EresGraph(&plots_ph, false);
962 gr_ph.SetName("Photon");
963 gr_phFwd.SetName("PhotonFwd");
964
965
966 // Photon Tower Energy Resolution
967 std::vector<resolPlot> plots_phtower;
968 HistogramsCollection(&plots_phtower, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "photonsTower");
969 GetEres<Tower>(&plots_phtower, branchTowerPhoton, branchParticlePhoton, phID, treeReaderPhoton);
970 TGraphErrors gr_phtower = EresGraph(&plots_phtower, true);
971 TGraphErrors gr_phtowerFwd = EresGraph(&plots_phtower, false);
972 gr_phtower.SetName("PhotonTower");
973 gr_phtowerFwd.SetName("PhotonTowerFwd");
974
975 // Canvas
976
977 TString phEff = "photonEff";
978 TCanvas *C_ph1 = new TCanvas(phEff,phEff, 1600, 600);
979 C_ph1->Divide(2);
980 C_ph1->cd(1);
981 TLegend *leg_ph1 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
982 leg_ph1->SetHeader("#splitline{photons}{|#eta| < 1.5}");
983 leg_ph1->AddEntry("","","");
984
985
986 gPad->SetLogx();
987 histos_phtower.first->Draw("][");
988 addHist(histos_phtower.first, leg_ph1, 3);
989 histos_ph.first->Draw("same ][");
990 addHist(histos_ph.first, leg_ph1, 1);
991
992 DrawAxis(histos_phtower.first, leg_ph1, 0);
993 leg_ph1->Draw();
994
995 C_ph1->cd(2);
996 TLegend *leg_ph2 = new TLegend(effLegXmin,effLegYmin,effLegXmax,effLegYmax);
997 leg_ph2->SetHeader("#splitline{photons}{1.5 < |#eta| < 2.5}");
998 leg_ph2->AddEntry("","","");
999
1000
1001 gPad->SetLogx();
1002 histos_phtower.second->Draw("][");
1003 addHist(histos_phtower.second, leg_ph2, 3);
1004 histos_ph.second->Draw("same ][");
1005 addHist(histos_ph.second, leg_ph2, 1);
1006
1007 DrawAxis(histos_phtower.second, leg_ph2, 1);
1008 leg_ph2->Draw();
1009
1010 C_ph1->SaveAs(phEff+".eps");
1011
1012 TString phRes = "phERes";
1013 TString phResFwd = "phEResFwd";
1014
1015 TCanvas *C_ph = new TCanvas(phRes,phRes, 1600, 600);
1016 C_ph->Divide(2);
1017 C_ph->cd(1);
1018 TMultiGraph *mg_ph = new TMultiGraph(phRes,phRes);
1019 TLegend *leg_ph = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1020 leg_ph->SetHeader("#splitline{photons}{|#eta| < 1.5}");
1021 leg_ph->AddEntry("","","");
1022
1023 addGraph(mg_ph, &gr_phtower, leg_ph, 3);
1024 addGraph(mg_ph, &gr_ph, leg_ph, 1);
1025
1026 mg_ph->Draw("ACX");
1027 leg_ph->Draw();
1028
1029 DrawAxis(mg_ph, leg_ph, 0.3);
1030
1031 C_ph->cd(2);
1032 TMultiGraph *mg_phFwd = new TMultiGraph(phResFwd,phResFwd);
1033 TLegend *leg_phFwd = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1034 leg_phFwd->SetHeader("#splitline{photons}{1.5 < |#eta| < 2.5}");
1035 leg_phFwd->AddEntry("","","");
1036
1037 addGraph(mg_phFwd, &gr_phtowerFwd, leg_phFwd, 3);
1038 addGraph(mg_phFwd, &gr_phFwd, leg_phFwd, 1);
1039
1040 mg_phFwd->Draw("ACX");
1041 leg_phFwd->Draw();
1042
1043 DrawAxis(mg_phFwd, leg_phFwd, 0.3);
1044
1045 C_ph->SaveAs(phRes+".eps");
1046
1047 C_ph1->Print("validation.pdf","pdf");
1048 C_ph->Print("validation.pdf","pdf");
1049
1050 gDirectory->cd(0);
1051
1052 //////////
1053 // Jets //
1054 //////////
1055
1056 // BJets Reconstruction efficiency
1057 int bID = 5;
1058 std::pair<TH1D*,TH1D*> histos_btag = GetEff<Jet>(branchPFBJet, branchParticleBJet,"BTag", bID, treeReaderBJet);
1059
1060 // TauJets Reconstruction efficiency
1061 int tauID = 15;
1062 std::pair<TH1D*,TH1D*> histos_tautag = GetEff<Jet>(branchPFTauJet, branchParticleTauJet,"TauTag", tauID, treeReaderTauJet);
1063
1064 // PFJets Energy Resolution
1065 std::vector<resolPlot> plots_pfjets;
1066 HistogramsCollection(&plots_pfjets, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "PFJet");
1067 GetJetsEres(&plots_pfjets, branchPFJet, branchGenJet, treeReaderJet);
1068 TGraphErrors gr_pfjets = EresGraph(&plots_pfjets, true);
1069 TGraphErrors gr_pfjetsFwd = EresGraph(&plots_pfjets, false);
1070 gr_pfjets.SetName("pfJet");
1071 gr_pfjetsFwd.SetName("pfJetFwd");
1072
1073 // CaloJets Energy Resolution
1074 std::vector<resolPlot> plots_calojets;
1075 HistogramsCollection(&plots_calojets, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "CaloJet");
1076 GetJetsEres(&plots_calojets, branchCaloJet, branchGenJet, treeReaderJet);
1077 TGraphErrors gr_calojets = EresGraph(&plots_calojets, true);
1078 TGraphErrors gr_calojetsFwd = EresGraph(&plots_calojets, false);
1079 gr_calojets.SetName("caloJet");
1080 gr_calojetsFwd.SetName("caloJetFwd");
1081
1082 // MET Resolution vs HT
1083 std::vector<resolPlot> plots_met;
1084 HistogramsCollection(&plots_met, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "MET", -500, 500);
1085 GetMetres(&plots_met, branchScalarHT, branchMet, branchPFJet, treeReaderJet);
1086 TGraphErrors gr_met = EresGraph(&plots_met, true);
1087 gr_calojets.SetName("MET");
1088
1089 // Canvas
1090 TString btagEff = "btagEff";
1091 TCanvas *C_btag1 = new TCanvas(btagEff,btagEff, 1600, 600);
1092 C_btag1->Divide(2);
1093 C_btag1->cd(1);
1094 TLegend *leg_btag1 = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1095 leg_btag1->SetHeader("#splitline{B-tagging}{|#eta| < 1.5}");
1096 leg_btag1->AddEntry("","","");
1097
1098 gPad->SetLogx();
1099 histos_btag.first->Draw();
1100 addHist(histos_btag.first, leg_btag1, 0);
1101
1102 DrawAxis(histos_btag.first, leg_btag1, 0);
1103 leg_btag1->Draw();
1104
1105 C_btag1->cd(2);
1106 TLegend *leg_btag2 = new TLegend(resLegXmin,resLegYmin,resLegXmax+0.05,resLegYmax);
1107 leg_btag2->SetHeader("#splitline{B-tagging}{1.5 < |#eta| < 2.5}");
1108 leg_btag2->AddEntry("","","");
1109
1110 gPad->SetLogx();
1111 histos_btag.second->Draw();
1112 addHist(histos_btag.second, leg_btag2, 0);
1113
1114 DrawAxis(histos_btag.second, leg_btag2, 0);
1115 leg_btag2->Draw();
1116 C_btag1->cd(0);
1117
1118 TString tautagEff = "tautagEff";
1119 TCanvas *C_tautag1 = new TCanvas(tautagEff,tautagEff, 1600, 600);
1120 C_tautag1->Divide(2);
1121 C_tautag1->cd(1);
1122 TLegend *leg_tautag1 = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1123 leg_tautag1->SetHeader("#splitline{#tau-tagging}{|#eta| < 1.5}");
1124 leg_tautag1->AddEntry("","","");
1125
1126 gPad->SetLogx();
1127 histos_tautag.first->Draw();
1128 addHist(histos_tautag.first, leg_tautag1, 0);
1129
1130 DrawAxis(histos_tautag.first, leg_tautag1, 0);
1131 leg_tautag1->Draw();
1132
1133 C_tautag1->cd(2);
1134 TLegend *leg_tautag2 = new TLegend(resLegXmin,resLegYmin,resLegXmax+0.05,resLegYmax);
1135 leg_tautag2->SetHeader("#splitline{#tau-tagging}{1.5 < |#eta| < 2.5}");
1136 leg_tautag2->AddEntry("","","");
1137
1138 gPad->SetLogx();
1139 histos_tautag.second->Draw();
1140 addHist(histos_tautag.second, leg_tautag2, 0);
1141
1142 DrawAxis(histos_tautag.second, leg_tautag2, 0);
1143 leg_tautag2->Draw();
1144 C_tautag1->cd(0);
1145
1146 TString jetRes = "jetERes";
1147 TString jetResFwd = "jetEResFwd";
1148 TCanvas *C_jet = new TCanvas(jetRes,jetRes, 1600, 600);
1149 C_jet->Divide(2);
1150
1151 C_jet->cd(1);
1152 TMultiGraph *mg_jet = new TMultiGraph(jetRes,jetRes);
1153 TLegend *leg_jet = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1154 leg_jet->SetHeader("#splitline{jets}{|#eta| < 1.5}");
1155 leg_jet->AddEntry("","","");
1156
1157 addGraph(mg_jet, &gr_calojets, leg_jet, 3);
1158 addGraph(mg_jet, &gr_pfjets, leg_jet, 1);
1159
1160 mg_jet->Draw("ACX");
1161 leg_jet->Draw();
1162
1163 DrawAxis(mg_jet, leg_jet, 0.25);
1164
1165 C_jet->cd(2);
1166 TMultiGraph *mg_jetFwd = new TMultiGraph(jetResFwd,jetResFwd);
1167 TLegend *leg_jetFwd = new TLegend(resLegXmin,resLegYmin,resLegXmax,resLegYmax);
1168 leg_jetFwd->SetHeader("#splitline{jets}{|#eta| < 1.5}");
1169 leg_jetFwd->AddEntry("","","");
1170
1171 addGraph(mg_jetFwd, &gr_calojetsFwd, leg_jetFwd, 3);
1172 addGraph(mg_jetFwd, &gr_pfjetsFwd, leg_jetFwd, 1);
1173
1174 mg_jetFwd->Draw("ACX");
1175 leg_jetFwd->Draw();
1176
1177 DrawAxis(mg_jetFwd, leg_jetFwd, 0.25);
1178
1179 C_btag1->SaveAs(btagEff+".eps");
1180 C_jet->SaveAs(jetRes+".eps");
1181
1182 TString metRes = "MetRes";
1183 TCanvas *C_met = new TCanvas(metRes,metRes, 800, 600);
1184
1185 TMultiGraph *mg_met = new TMultiGraph(metRes,metRes);
1186 TLegend *leg_met = new TLegend(topLeftLegXmin,topLeftLegYmin+0.2,topLeftLegXmax-0.2,topLeftLegYmax);
1187 leg_met->SetHeader("E_{T}^{miss}");
1188 leg_met->AddEntry("","","");
1189
1190
1191 addGraph(mg_met, &gr_met, leg_met, 0);
1192
1193 mg_met->Draw("ACX");
1194 leg_met->Draw();
1195
1196 DrawAxis(mg_met, leg_met, 300);
1197
1198 mg_met->GetXaxis()->SetTitle("H_{T} [GeV]");
1199 mg_met->GetYaxis()->SetTitle("#sigma(ME_{x}) [GeV]");
1200
1201 C_met->SaveAs(metRes+".eps");
1202
1203 C_jet->Print("validation.pdf","pdf");
1204 C_btag1->Print("validation.pdf","pdf");
1205 C_tautag1->Print("validation.pdf","pdf");
1206 C_met->Print("validation.pdf)","pdf");
1207
1208 TFile *fout = new TFile(outputFile,"recreate");
1209
1210 for (int bin = 0; bin < Nbins; bin++)
1211 {
1212 plots_el.at(bin).cenResolHist->Write();
1213 plots_eltrack.at(bin).cenResolHist->Write();
1214 plots_eltower.at(bin).cenResolHist->Write();
1215 plots_el.at(bin).fwdResolHist->Write();
1216 plots_eltrack.at(bin).fwdResolHist->Write();
1217 plots_eltower.at(bin).fwdResolHist->Write();
1218 }
1219
1220 histos_el.first->Write();
1221 histos_el.second->Write();
1222 histos_eltrack.first->Write();
1223 histos_eltrack.second->Write();
1224 histos_eltower.first->Write();
1225 histos_eltower.second->Write();
1226 C_el1->Write();
1227 C_el2->Write();
1228
1229 histos_mu.first->Write();
1230 histos_mu.second->Write();
1231 histos_mutrack.first->Write();
1232 histos_mutrack.second->Write();
1233 C_mu1->Write();
1234 C_mu->Write();
1235
1236 histos_ph.first->Write();
1237 histos_ph.second->Write();
1238 C_ph1->Write();
1239 C_ph->Write();
1240
1241 for (int bin = 0; bin < Nbins; bin++)
1242 {
1243 plots_pfjets.at(bin).cenResolHist->Write();
1244 plots_pfjets.at(bin).fwdResolHist->Write();
1245 plots_calojets.at(bin).cenResolHist->Write();
1246 plots_calojets.at(bin).fwdResolHist->Write();
1247 plots_met.at(bin).cenResolHist->Write();
1248 }
1249 histos_btag.first->Write();
1250 histos_btag.second->Write();
1251 histos_tautag.first->Write();
1252 histos_tautag.second->Write();
1253 C_btag1->Write();
1254 C_tautag1->Write();
1255 C_jet->Write();
1256 C_met->Write();
1257
1258 fout->Write();
1259
1260 cout << "** Exiting..." << endl;
1261
1262 delete treeReaderElectron;
1263 delete treeReaderMuon;
1264 delete treeReaderPhoton;
1265 delete treeReaderJet;
1266 delete treeReaderBJet;
1267 delete treeReaderTauJet;
1268 delete chainElectron;
1269 delete chainMuon;
1270 delete chainPhoton;
1271 delete chainJet;
1272 delete chainBJet;
1273 delete chainTauJet;
1274}
1275
1276//------------------------------------------------------------------------------
1277
1278int main(int argc, char *argv[])
1279{
1280 char *appName = "Validation";
1281
1282 if(argc != 8)
1283 {
1284 cout << " Usage: " << appName << " input_file_electron input_file_muon input_file_photon input_file_jet input_file_bjet input_file_taujet output_file" << endl;
1285 cout << " input_file_electron - input file in ROOT format ('Delphes' tree)," << endl;
1286 cout << " input_file_muon - input file in ROOT format ('Delphes' tree)," << endl;
1287 cout << " input_file_photon - input file in ROOT format ('Delphes' tree)," << endl;
1288 cout << " input_file_jet - input file in ROOT format ('Delphes' tree)," << endl;
1289 cout << " input_file_bjet - input file in ROOT format ('Delphes' tree)," << endl;
1290 cout << " input_file_taujet - input file in ROOT format ('Delphes' tree)," << endl;
1291 cout << " output_file - output file in ROOT format" << endl;
1292 return 1;
1293 }
1294
1295 gROOT->SetBatch();
1296
1297 int appargc = 1;
1298 char *appargv[] = {appName};
1299 TApplication app(appName, &appargc, appargv);
1300
1301 Validation(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]);
1302}
1303
1304
Note: See TracBrowser for help on using the repository browser.