Fork me on GitHub

source: git/examples/Validation.cpp@ 9cd3a4d

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 9cd3a4d was dd5e213, checked in by Pavel Demin <pavel.demin@…>, 8 years ago

add dynamic allocation of arrays to Validation.cpp

  • Property mode set to 100644
File size: 102.2 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
57static const int Nbins = 50;
58
59int objStyle = 1;
60int trackStyle = 7;
61int towerStyle = 3;
62
63Color_t objColor = kBlack;
64Color_t trackColor = kBlack;
65Color_t towerColor = kBlack;
66
67double effLegXmin = 0.22;
68double effLegXmax = 0.7;
69double effLegYmin = 0.22;
70double effLegYmax = 0.5;
71
72double resLegXmin = 0.62;
73double resLegXmax = 0.9;
74double resLegYmin = 0.52;
75double resLegYmax = 0.85;
76
77double topLeftLegXmin = 0.22;
78double topLeftLegXmax = 0.7;
79double topLeftLegYmin = 0.52;
80double topLeftLegYmax = 0.85;
81
82unsigned int k;
83
84
85struct resolPlot
86{
87 TH1* resolHist;
88 double ptmin;
89 double ptmax;
90 double etamin;
91 double etamax;
92 double xmin;
93 double xmax;
94 TString obj;
95
96 resolPlot();
97 resolPlot(double ptdown, double ptup, TString object);
98 resolPlot(double etadown, double etaup, double ptdown, double ptup, TString object);
99 void set(double ptdown, double ptup, TString object, double xmin = 0, double xmax = 2);
100 void set(double etadown, double etaup, double ptdown, double ptup, TString object, double xmin = 0, double xmax = 2);
101 void print(){std::cout << ptmin << std::endl;}
102};
103
104
105resolPlot::resolPlot()
106{
107}
108
109resolPlot::resolPlot(double ptdown, double ptup, TString object)
110{
111 this->set(ptdown,ptup,object);
112}
113
114resolPlot::resolPlot(double etadown, double etaup, double ptdown, double ptup, TString object)
115{
116 this->set(etadown, etaup, ptdown, ptup, object);
117}
118
119void resolPlot::set(double ptdown, double ptup, TString object, double xmin, double xmax)
120{
121 ptmin = ptdown;
122 ptmax = ptup;
123 obj = object;
124
125 resolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax), obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax), 1000, xmin, xmax);
126}
127
128void resolPlot::set(double etadown, double etaup, double ptdown, double ptup, TString object, double xmin, double xmax)
129{
130 etamin = etadown;
131 etamax = etaup;
132 ptmin = ptdown;
133 ptmax = ptup;
134 obj = object;
135
136 resolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_"+Form("%4.2f",etamin)+"_"+Form("%4.2f",etamax), obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_"+Form("%4.2f",etamin)+"_"+Form("%4.2f",etamax), 1000, xmin, xmax);
137}
138
139
140
141void HistogramsCollection(std::vector<resolPlot> *histos, double ptmin, double ptmax, TString obj, double xmin = 0, double xmax = 2)
142{
143 double width;
144 double ptdown;
145 double ptup;
146 resolPlot ptemp;
147
148 for (int i = 0; i < Nbins; i++)
149 {
150 width = (ptmax - ptmin) / Nbins;
151 ptdown = TMath::Power(10,ptmin + i * width );
152 ptup = TMath::Power(10,ptmin + (i+1) * width );
153 ptemp.set(ptdown, ptup, obj, xmin, xmax);
154 histos->push_back(ptemp);
155 }
156}
157
158
159void HistogramsCollectionVsEta(std::vector<resolPlot> *histos, double etamin, double etamax, double ptmin, double ptmax, TString obj, double xmin = 0, double xmax = 2)
160{
161 resolPlot ptemp;
162 double width;
163 double etadown;
164 double etaup;
165
166 for (int i = 0; i < Nbins; i++)
167 {
168 width = (etamax - etamin) / Nbins;
169 etadown = etamin + i * width;
170 etaup = etamin + (i+1) * width;
171
172 ptemp.set(etadown, etaup, ptmin, ptmax, obj, xmin, xmax);
173 histos->push_back(ptemp);
174 }
175}
176
177
178//------------------------------------------------------------------------------
179
180class ExRootResult;
181class ExRootTreeReader;
182
183//------------------------------------------------------------------------------
184
185void BinLogX(TH1*h)
186{
187 TAxis *axis = h->GetXaxis();
188 int bins = axis->GetNbins();
189
190 Axis_t from = axis->GetXmin();
191 Axis_t to = axis->GetXmax();
192 Axis_t width = (to - from) / bins;
193 Axis_t *new_bins = new Axis_t[bins + 1];
194
195 for (int i = 0; i <= bins; i++)
196 {
197 new_bins[i] = TMath::Power(10, from + i * width);
198 }
199 axis->Set(bins, new_bins);
200 delete new_bins;
201}
202
203
204//------------------------------------------------------------------------------
205
206template<typename T>
207TH1D* GetEffPt(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)
208{
209
210 cout << "** Computing Efficiency of reconstructing "<< branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
211
212 Long64_t allEntries = treeReader->GetEntries();
213
214 GenParticle *particle;
215 T *recoObj;
216
217 TLorentzVector recoMomentum, genMomentum, bestRecoMomentum;
218
219 Float_t deltaR;
220 Float_t pt, eta;
221 Long64_t entry;
222
223 Int_t i, j;
224
225 TH1D *histGenPt = new TH1D(name+" gen spectra Pt",name+" gen spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax));
226 TH1D *histRecoPt = new TH1D(name+" reco spectra Pt",name+" reco spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax));
227
228 histGenPt->SetDirectory(0);
229 histRecoPt->SetDirectory(0);
230
231 BinLogX(histGenPt);
232 BinLogX(histRecoPt);
233
234 // Loop over all events
235 for(entry = 0; entry < allEntries; ++entry)
236 {
237 // Load selected branches with data from specified event
238 treeReader->ReadEntry(entry);
239
240 // Loop over all generated particle in event
241 for(i = 0; i < branchParticle->GetEntriesFast(); ++i)
242 {
243
244 particle = (GenParticle*) branchParticle->At(i);
245 genMomentum = particle->P4();
246
247 deltaR = 999;
248
249 pt = genMomentum.Pt();
250 eta = TMath::Abs(genMomentum.Eta());
251
252
253 if(eta > etamax || eta < etamin ) continue;
254
255 //cout<<"b parton: "<<pt<<endl;
256 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax )
257 {
258 // Loop over all reco object in event
259 for(j = 0; j < branchReco->GetEntriesFast(); ++j)
260 {
261 recoObj = (T*)branchReco->At(j);
262 recoMomentum = recoObj->P4();
263 // this is simply to avoid warnings from initial state particle
264 // having infite rapidity ...
265 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue;
266
267
268
269 // take the closest parton candidate
270 if(TMath::Abs(pdgID) == 5)
271 {
272 Jet *jet = (Jet *)recoObj;
273 if( !(jet->BTag & (1 << 0)) ) continue;
274
275 //if(jet->BTag != ) continue;
276 }
277
278 if(TMath::Abs(pdgID) == 4)
279 {
280 Jet *jet = (Jet *)recoObj;
281 if( !(jet->BTag & (1 << 0)) ) continue;
282 }
283
284 if(TMath::Abs(pdgID) == 1)
285 {
286 Jet *jet = (Jet *)recoObj;
287 if( !(jet->BTag & (1 << 0)) ) continue;
288 }
289
290 if(TMath::Abs(pdgID) == 15)
291 {
292 Jet *jet = (Jet *)recoObj;
293 if(jet->TauTag != 1) continue;
294 }
295
296
297 if(genMomentum.DeltaR(recoMomentum) < deltaR)
298 {
299 deltaR = genMomentum.DeltaR(recoMomentum);
300 bestRecoMomentum = recoMomentum;
301 }
302 }
303 histGenPt->Fill(pt);
304 if(deltaR < 0.3 && bestRecoMomentum.Pt()> 0.20*pt ) { histRecoPt->Fill(pt);}
305
306 }
307 }
308 }
309
310 histRecoPt->Sumw2();
311 histGenPt->Sumw2();
312
313 histRecoPt->Divide(histGenPt);
314 histRecoPt->Scale(100.);
315
316 return histRecoPt;
317}
318
319template<typename T>
320TH1D* GetEffEta(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)
321{
322
323 cout << "** Computing Efficiency of reconstructing "<< branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
324
325 Long64_t allEntries = treeReader->GetEntries();
326
327 GenParticle *particle;
328 T *recoObj;
329
330 TLorentzVector recoMomentum, genMomentum, bestRecoMomentum;
331
332 Float_t deltaR;
333 Float_t pt, eta;
334 Long64_t entry;
335
336 Int_t i, j;
337
338 TH1D *histGenEta = new TH1D(name+" gen spectra Eta",name+" gen spectra", Nbins, etamin, etamax);
339 TH1D *histRecoEta = new TH1D(name+" reco spectra Eta",name+" reco spectra", Nbins, etamin, etamax);
340
341 histGenEta->SetDirectory(0);
342 histRecoEta->SetDirectory(0);
343
344 // Loop over all events
345 for(entry = 0; entry < allEntries; ++entry)
346 {
347 // Load selected branches with data from specified event
348 treeReader->ReadEntry(entry);
349
350 // Loop over all generated particle in event
351 for(i = 0; i < branchParticle->GetEntriesFast(); ++i)
352 {
353
354 particle = (GenParticle*) branchParticle->At(i);
355 genMomentum = particle->P4();
356
357 deltaR = 999;
358
359 pt = genMomentum.Pt();
360 eta = genMomentum.Eta();
361
362 if(pt > ptmax || pt < ptmin ) continue;
363
364 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax )
365 {
366 // Loop over all reco object in event
367 for(j = 0; j < branchReco->GetEntriesFast(); ++j)
368 {
369 recoObj = (T*)branchReco->At(j);
370 recoMomentum = recoObj->P4();
371 // this is simply to avoid warnings from initial state particle
372 // having infite rapidity ...
373 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue;
374
375 // take the closest parton candidate
376 if(TMath::Abs(pdgID) == 5)
377 {
378 Jet *jet = (Jet *)recoObj;
379 if( !(jet->BTag & (1 << 0)) ) continue;
380
381 }
382
383 if(TMath::Abs(pdgID) == 4)
384 {
385 Jet *jet = (Jet *)recoObj;
386 if( !(jet->BTag & (1 << 0)) ) continue;
387 }
388
389 if(TMath::Abs(pdgID) == 1)
390 {
391 Jet *jet = (Jet *)recoObj;
392 if( !(jet->BTag & (1 << 0)) ) continue;
393 }
394
395 if(TMath::Abs(pdgID) == 15)
396 {
397 Jet *jet = (Jet *)recoObj;
398 if(jet->TauTag != 1) continue;
399 }
400 if(genMomentum.DeltaR(recoMomentum) < deltaR)
401 {
402 deltaR = genMomentum.DeltaR(recoMomentum);
403 bestRecoMomentum = recoMomentum;
404 }
405 }
406
407 histGenEta->Fill(eta);
408 if(deltaR < 0.3) { histRecoEta->Fill(eta); }
409
410 }
411 }
412 }
413
414 histRecoEta->Sumw2();
415 histGenEta->Sumw2();
416
417 histRecoEta->Divide(histGenEta);
418 histRecoEta->Scale(100.);
419
420 return histRecoEta;
421}
422
423
424
425template<typename T>
426TH1D* GetTauEffPt(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)
427{
428
429 cout << "** Computing Efficiency of reconstructing "<< branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
430
431 Long64_t allEntries = treeReader->GetEntries();
432
433 GenParticle *particle;
434 T *recoObj;
435
436 TLorentzVector recoMomentum, genMomentum, bestRecoMomentum;
437
438 Float_t deltaR;
439 Float_t pt, eta;
440 Long64_t entry;
441
442 Int_t i, j;
443
444 TH1D *histGenPt = new TH1D(name+" gen spectra Pt",name+" gen spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax));
445 TH1D *histRecoPt = new TH1D(name+" reco spectra Pt",name+" reco spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax));
446
447 histGenPt->SetDirectory(0);
448 histRecoPt->SetDirectory(0);
449
450 BinLogX(histGenPt);
451 BinLogX(histRecoPt);
452
453 // Loop over all events
454 for(entry = 0; entry < allEntries; ++entry)
455 {
456 // Load selected branches with data from specified event
457 treeReader->ReadEntry(entry);
458
459 // Loop over all generated particle in event
460 for(i = 0; i < branchParticle->GetEntriesFast(); ++i)
461 {
462
463 particle = (GenParticle*) branchParticle->At(i);
464 genMomentum = particle->P4();
465
466 deltaR = 999;
467
468 pt = genMomentum.Pt();
469 eta = TMath::Abs(genMomentum.Eta());
470
471 if(eta > etamax || eta < etamin ) continue;
472
473 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax )
474 {
475 // Loop over all reco object in event
476 for(j = 0; j < branchReco->GetEntriesFast(); ++j)
477 {
478 recoObj = (T*)branchReco->At(j);
479 recoMomentum = recoObj->P4();
480 // this is simply to avoid warnings from initial state particle
481 // having infite rapidity ...
482 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue;
483
484 if(TMath::Abs(pdgID) == 1)
485 {
486 Jet *jet = (Jet *)recoObj;
487 if( jet->TauTag != 1 ) continue;
488 }
489
490 if(TMath::Abs(pdgID) == 15)
491 {
492 Jet *jet = (Jet *)recoObj;
493 if(jet->TauTag != 1) continue;
494 }
495
496 if(genMomentum.DeltaR(recoMomentum) < deltaR)
497 {
498 deltaR = genMomentum.DeltaR(recoMomentum);
499 bestRecoMomentum = recoMomentum;
500 }
501 }
502
503 histGenPt->Fill(pt);
504 if(deltaR < 0.3) { histRecoPt->Fill(pt); }
505
506 }
507 }
508 }
509
510 histRecoPt->Sumw2();
511 histGenPt->Sumw2();
512
513
514 histRecoPt->Divide(histGenPt);
515 histRecoPt->Scale(100.);
516 if(TMath::Abs(pdgID) == 15) histRecoPt->Scale(1/0.648);
517
518 return histRecoPt;
519}
520
521template<typename T>
522TH1D* GetTauEffEta(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)
523{
524
525 cout << "** Computing Efficiency of reconstructing "<< branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
526
527 Long64_t allEntries = treeReader->GetEntries();
528
529 GenParticle *particle;
530 T *recoObj;
531
532 TLorentzVector recoMomentum, genMomentum, bestRecoMomentum;
533
534 Float_t deltaR;
535 Float_t pt, eta;
536 Long64_t entry;
537
538 Int_t i, j;
539
540 TH1D *histGenEta = new TH1D(name+" gen spectra Eta",name+" gen spectra", Nbins, etamin, etamax);
541 TH1D *histRecoEta = new TH1D(name+" reco spectra Eta",name+" reco spectra", Nbins, etamin, etamax);
542
543 histGenEta->SetDirectory(0);
544 histRecoEta->SetDirectory(0);
545
546 // Loop over all events
547 for(entry = 0; entry < allEntries; ++entry)
548 {
549 // Load selected branches with data from specified event
550 treeReader->ReadEntry(entry);
551
552 // Loop over all generated particle in event
553 for(i = 0; i < branchParticle->GetEntriesFast(); ++i)
554 {
555
556 particle = (GenParticle*) branchParticle->At(i);
557 genMomentum = particle->P4();
558
559 deltaR = 999;
560
561 pt = genMomentum.Pt();
562 eta = genMomentum.Eta();
563
564 if(pt > ptmax || pt < ptmin ) continue;
565
566 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax )
567 {
568 // Loop over all reco object in event
569 for(j = 0; j < branchReco->GetEntriesFast(); ++j)
570 {
571 recoObj = (T*)branchReco->At(j);
572 recoMomentum = recoObj->P4();
573 // this is simply to avoid warnings from initial state particle
574 // having infite rapidity ...
575 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue;
576
577 if(TMath::Abs(pdgID) == 1)
578 {
579 Jet *jet = (Jet *)recoObj;
580 if( jet->TauTag != 1 ) continue;
581 }
582
583 if(TMath::Abs(pdgID) == 15)
584 {
585 Jet *jet = (Jet *)recoObj;
586 if(jet->TauTag != 1) continue;
587 }
588
589 if(genMomentum.DeltaR(recoMomentum) < deltaR)
590 {
591 deltaR = genMomentum.DeltaR(recoMomentum);
592 bestRecoMomentum = recoMomentum;
593 }
594 }
595
596 histGenEta->Fill(eta);
597 if(deltaR < 0.3) { histRecoEta->Fill(eta); }
598
599 }
600 }
601 }
602
603 histRecoEta->Sumw2();
604 histGenEta->Sumw2();
605
606 histRecoEta->Divide(histGenEta);
607 histRecoEta->Scale(100.);
608 if(TMath::Abs(pdgID) == 15) histRecoEta->Scale(1/0.648);
609
610 return histRecoEta;
611}
612
613
614template<typename T>
615void GetPtres(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t etaMin, Double_t etaMax, ExRootTreeReader *treeReader)
616{
617 Long64_t allEntries = treeReader->GetEntries();
618
619 cout << "** Computing pt resolution of " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
620
621 GenParticle *particle;
622 T* recoObj;
623
624 TLorentzVector recoMomentum, genMomentum, bestGenMomentum;
625
626 Float_t deltaR;
627 Float_t pt, eta;
628 Long64_t entry;
629
630 Int_t i, j, bin;
631
632 // Loop over all events
633 for(entry = 0; entry < allEntries; ++entry)
634 {
635 // Load selected branches with data from specified event
636 treeReader->ReadEntry(entry);
637
638 // Loop over all reconstructed jets in event
639 for(i = 0; i < branchReco->GetEntriesFast(); ++i)
640 {
641 recoObj = (T*) branchReco->At(i);
642 recoMomentum = recoObj->P4();
643
644 deltaR = 999;
645
646 // Loop over all hard partons in event
647 for(j = 0; j < branchParticle->GetEntriesFast(); ++j)
648 {
649 particle = (GenParticle*) branchParticle->At(j);
650 if (particle->PID == pdgID && particle->Status == 1)
651 {
652 genMomentum = particle->P4();
653
654 // this is simply to avoid warnings from initial state particle
655 // having infite rapidity ...
656 if(genMomentum.Px() == 0 && genMomentum.Py() == 0) continue;
657
658 // take the closest parton candidate
659 if(genMomentum.DeltaR(recoMomentum) < deltaR)
660 {
661 deltaR = genMomentum.DeltaR(recoMomentum);
662 bestGenMomentum = genMomentum;
663 }
664 }
665 }
666
667 if(deltaR < 0.3)
668 {
669 pt = bestGenMomentum.Pt();
670 eta = TMath::Abs(bestGenMomentum.Eta());
671
672 for (bin = 0; bin < Nbins; bin++)
673 {
674 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > etaMin && eta < etaMax)
675 {
676 histos->at(bin).resolHist->Fill(recoMomentum.Pt()/bestGenMomentum.Pt());
677 }
678 }
679 }
680 }
681 }
682}
683
684
685template<typename T>
686void GetEres(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t etaMin, Double_t etaMax, ExRootTreeReader *treeReader)
687{
688 Long64_t allEntries = treeReader->GetEntries();
689
690 cout << "** Computing e resolution of " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
691
692 GenParticle *particle;
693 T* recoObj;
694
695 TLorentzVector recoMomentum, genMomentum, bestGenMomentum;
696
697 Float_t deltaR;
698 Float_t e, eta;
699 Long64_t entry;
700
701 Int_t i, j, bin;
702
703 // Loop over all events
704 for(entry = 0; entry < allEntries; ++entry)
705 {
706 // Load selected branches with data from specified event
707 treeReader->ReadEntry(entry);
708
709 // Loop over all reconstructed jets in event
710 for(i = 0; i < branchReco->GetEntriesFast(); ++i)
711 {
712 recoObj = (T*) branchReco->At(i);
713 recoMomentum = recoObj->P4();
714
715 deltaR = 999;
716
717 // Loop over all hard partons in event
718 for(j = 0; j < branchParticle->GetEntriesFast(); ++j)
719 {
720 particle = (GenParticle*) branchParticle->At(j);
721 if (particle->PID == pdgID && particle->Status == 1)
722 {
723 genMomentum = particle->P4();
724
725 // this is simply to avoid warnings from initial state particle
726 // having infite rapidity ...
727 if(genMomentum.Px() == 0 && genMomentum.Py() == 0) continue;
728
729 // take the closest parton candidate
730 if(genMomentum.DeltaR(recoMomentum) < deltaR)
731 {
732 deltaR = genMomentum.DeltaR(recoMomentum);
733 bestGenMomentum = genMomentum;
734 }
735 }
736 }
737
738 if(deltaR < 0.3)
739 {
740 e = bestGenMomentum.E();
741 eta = TMath::Abs(bestGenMomentum.Eta());
742
743 for (bin = 0; bin < Nbins; bin++)
744 {
745 if(e > histos->at(bin).ptmin && e < histos->at(bin).ptmax && eta > etaMin && eta < etaMax)
746 {
747 histos->at(bin).resolHist->Fill(recoMomentum.E()/bestGenMomentum.E());
748 }
749 }
750 }
751 }
752 }
753}
754
755
756template<typename T>
757void GetPtresVsEta(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t ptMin, Double_t ptMax, ExRootTreeReader *treeReader)
758{
759 Long64_t allEntries = treeReader->GetEntries();
760
761 cout << "** Computing pt resolution of " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
762
763 GenParticle *particle;
764 T* recoObj;
765
766 TLorentzVector recoMomentum, genMomentum, bestGenMomentum;
767
768 Float_t deltaR;
769 Float_t pt, eta;
770 Long64_t entry;
771
772 Int_t i, j, bin;
773
774 // Loop over all events
775 for(entry = 0; entry < allEntries; ++entry)
776 {
777 // Load selected branches with data from specified event
778 treeReader->ReadEntry(entry);
779
780 // Loop over all reconstructed jets in event
781 for(i = 0; i < branchReco->GetEntriesFast(); ++i)
782 {
783 recoObj = (T*) branchReco->At(i);
784 recoMomentum = recoObj->P4();
785
786 deltaR = 999;
787
788 // Loop over all hard partons in event
789 for(j = 0; j < branchParticle->GetEntriesFast(); ++j)
790 {
791 particle = (GenParticle*) branchParticle->At(j);
792 if (particle->PID == pdgID && particle->Status == 1)
793 {
794 genMomentum = particle->P4();
795
796 // this is simply to avoid warnings from initial state particle
797 // having infite rapidity ...
798 if(genMomentum.Px() == 0 && genMomentum.Py() == 0) continue;
799
800 // take the closest parton candidate
801 if(genMomentum.DeltaR(recoMomentum) < deltaR)
802 {
803 deltaR = genMomentum.DeltaR(recoMomentum);
804 bestGenMomentum = genMomentum;
805 }
806 }
807 }
808
809 if(deltaR < 0.3)
810 {
811 pt = bestGenMomentum.Pt();
812 eta = bestGenMomentum.Eta();
813
814 for (bin = 0; bin < Nbins; bin++)
815 {
816 if(eta > histos->at(bin).etamin && eta < histos->at(bin).etamax && pt > ptMin && pt < ptMax)
817 {
818 histos->at(bin).resolHist->Fill(recoMomentum.Pt()/bestGenMomentum.Pt());
819 }
820 }
821 }
822 }
823 }
824}
825
826template<typename T>
827void GetEresVsEta(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t eMin, Double_t eMax, ExRootTreeReader *treeReader)
828{
829 Long64_t allEntries = treeReader->GetEntries();
830
831 cout << "** Computing E resolution of " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
832
833 GenParticle *particle;
834 T* recoObj;
835
836 TLorentzVector recoMomentum, genMomentum, bestGenMomentum;
837
838 Float_t deltaR;
839 Float_t e, eta;
840 Long64_t entry;
841
842 Int_t i, j, bin;
843
844 // Loop over all events
845 for(entry = 0; entry < allEntries; ++entry)
846 {
847 // Load selected branches with data from specified event
848 treeReader->ReadEntry(entry);
849
850 // Loop over all reconstructed jets in event
851 for(i = 0; i < branchReco->GetEntriesFast(); ++i)
852 {
853 recoObj = (T*) branchReco->At(i);
854 recoMomentum = recoObj->P4();
855
856 deltaR = 999;
857
858 // Loop over all hard partons in event
859 for(j = 0; j < branchParticle->GetEntriesFast(); ++j)
860 {
861 particle = (GenParticle*) branchParticle->At(j);
862 if (particle->PID == pdgID && particle->Status == 1)
863 {
864 genMomentum = particle->P4();
865
866 // this is simply to avoid warnings from initial state particle
867 // having infite rapidity ...
868 if(genMomentum.Px() == 0 && genMomentum.Py() == 0) continue;
869
870 // take the closest parton candidate
871 if(genMomentum.DeltaR(recoMomentum) < deltaR)
872 {
873 deltaR = genMomentum.DeltaR(recoMomentum);
874 bestGenMomentum = genMomentum;
875 }
876 }
877 }
878
879 if(deltaR < 0.3)
880 {
881 e = bestGenMomentum.E();
882 eta = bestGenMomentum.Eta();
883
884
885
886 for (bin = 0; bin < Nbins; bin++)
887 {
888 if(eta > histos->at(bin).etamin && eta < histos->at(bin).etamax && e > eMin && e < eMax)
889 {
890 histos->at(bin).resolHist->Fill(recoMomentum.E()/bestGenMomentum.E());
891 }
892 }
893 }
894 }
895 }
896}
897
898
899
900void GetJetsEres(std::vector<resolPlot> *histos, TClonesArray *branchJet, TClonesArray *branchGenJet, ExRootTreeReader *treeReader, Double_t etaMin, Double_t etaMax)
901{
902
903 Long64_t allEntries = treeReader->GetEntries();
904
905 cout << "** Computing resolution of " << branchJet->GetName() << " induced by " << branchGenJet->GetName() << endl;
906
907 Jet *jet, *genjet;
908
909 TLorentzVector jetMomentum, genJetMomentum, bestGenJetMomentum;
910
911 Float_t deltaR;
912 Float_t pt, eta;
913 Long64_t entry;
914
915 Int_t i, j, bin;
916
917 // Loop over all events
918 for(entry = 0; entry < allEntries; ++entry)
919 {
920 // Load selected branches with data from specified event
921 treeReader->ReadEntry(entry);
922
923 if(entry%10000 == 0) cout << "Event number: "<< entry <<endl;
924
925 // Loop over all reconstructed jets in event
926 for(i = 0; i < TMath::Min(2,branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i)
927 {
928
929 jet = (Jet*) branchJet->At(i);
930 jetMomentum = jet->P4();
931
932 deltaR = 999;
933
934 // Loop over all hard partons in event
935 for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j)
936 {
937 genjet = (Jet*) branchGenJet->At(j);
938
939 genJetMomentum = genjet->P4();
940
941 // this is simply to avoid warnings from initial state particle
942 // having infite rapidity ...
943 if(genJetMomentum.Px() == 0 && genJetMomentum.Py() == 0) continue;
944
945 // take the closest parton candidate
946 if(genJetMomentum.DeltaR(jetMomentum) < deltaR)
947 {
948 deltaR = genJetMomentum.DeltaR(jetMomentum);
949 bestGenJetMomentum = genJetMomentum;
950 }
951 }
952
953 if(deltaR < 0.3)
954 {
955 pt = genJetMomentum.E();
956 eta = genJetMomentum.Eta();
957
958 for (bin = 0; bin < Nbins; bin++)
959 {
960 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta < etaMax && eta > etaMin)
961 {
962 histos->at(bin).resolHist->Fill(jetMomentum.E()/bestGenJetMomentum.E());
963 }
964 }
965 }
966 }
967 }
968}
969
970void GetJetsEresVsEta(std::vector<resolPlot> *histos, TClonesArray *branchJet, TClonesArray *branchGenJet, ExRootTreeReader *treeReader, Double_t eMin, Double_t eMax)
971{
972
973 Long64_t allEntries = treeReader->GetEntries();
974
975 cout << "** Computing resolution of " << branchJet->GetName() << " induced by " << branchGenJet->GetName() << endl;
976
977 Jet *jet, *genjet;
978
979 TLorentzVector jetMomentum, genJetMomentum, bestGenJetMomentum;
980
981 Float_t deltaR;
982 Float_t pt, eta;
983 Long64_t entry;
984
985 Int_t i, j, bin;
986
987 // Loop over all events
988 for(entry = 0; entry < allEntries; ++entry)
989 {
990 // Load selected branches with data from specified event
991 treeReader->ReadEntry(entry);
992
993 if(entry%10000 == 0) cout << "Event number: "<< entry <<endl;
994
995 // Loop over all reconstructed jets in event
996 for(i = 0; i < TMath::Min(2,branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i)
997 {
998
999 jet = (Jet*) branchJet->At(i);
1000 jetMomentum = jet->P4();
1001
1002 deltaR = 999;
1003
1004 // Loop over all hard partons in event
1005 for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j)
1006 {
1007 genjet = (Jet*) branchGenJet->At(j);
1008
1009 genJetMomentum = genjet->P4();
1010
1011 // this is simply to avoid warnings from initial state particle
1012 // having infite rapidity ...
1013 if(genJetMomentum.Px() == 0 && genJetMomentum.Py() == 0) continue;
1014
1015 // take the closest parton candidate
1016 if(genJetMomentum.DeltaR(jetMomentum) < deltaR)
1017 {
1018 deltaR = genJetMomentum.DeltaR(jetMomentum);
1019 bestGenJetMomentum = genJetMomentum;
1020 }
1021 }
1022
1023 if(deltaR < 0.3)
1024 {
1025
1026 pt = genJetMomentum.E();
1027 eta = genJetMomentum.Eta();
1028
1029 for (bin = 0; bin < Nbins; bin++)
1030 {
1031 if(eta > histos->at(bin).etamin && eta < histos->at(bin).etamax && pt < eMax && pt > eMin)
1032 {
1033 histos->at(bin).resolHist->Fill(jetMomentum.E()/bestGenJetMomentum.E());
1034 }
1035 }
1036 }
1037 }
1038 }
1039}
1040
1041
1042
1043std::pair<Double_t, Double_t> GausFit(TH1* hist)
1044{
1045 TF1 *f1 = new TF1("f1", "gaus", hist->GetMean()-2*hist->GetRMS(), hist->GetMean()+2*hist->GetRMS());
1046 hist->Fit("f1","RQ");
1047
1048 TF1 *f2 = new TF1("f2", "gaus", f1->GetParameter(1) - 2*f1->GetParameter(2), f1->GetParameter(1) + 2*f1->GetParameter(2));
1049 hist->Fit("f2","RQ");
1050
1051 Double_t sig = f2->GetParameter(2);
1052 Double_t sigErr = f2->GetParError(2);
1053
1054 delete f1;
1055 delete f2;
1056 return make_pair (sig, sigErr);
1057}
1058
1059
1060TGraphErrors EresGraph(std::vector<resolPlot> *histos, bool rms = false)
1061{
1062 Int_t bin;
1063 Int_t count = 0;
1064 TGraphErrors gr = TGraphErrors(Nbins/2);
1065 double val, error;
1066 for (bin = 0; bin < Nbins; bin++)
1067 {
1068 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).resolHist);
1069 if (rms == true)
1070 {
1071 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, 100*histos->at(bin).resolHist->GetRMS());
1072 //gr.SetPointError(count,0, 100*sigvalues.second); // to correct
1073 error = 100*histos->at(bin).resolHist->GetRMSError();
1074 val = 100*histos->at(bin).resolHist->GetRMS();
1075 if(error > 0.2*val) error = 0.2*val;
1076 gr.SetPointError(count,0, error); // to correct
1077 }
1078 else
1079 {
1080
1081 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, 100*sigvalues.first);
1082 error = 100*sigvalues.second;
1083 val = 100*sigvalues.first;
1084 if(error > 0.2*val) error = 0.2*val;
1085 gr.SetPointError(count,0, error); // to correct
1086 //gr.SetPointError(count,0, 100*sigvalues.second);
1087 }
1088 count++;
1089 }
1090
1091 return gr;
1092}
1093
1094TGraphErrors MetResGraph(std::vector<resolPlot> *histos, bool rms = false)
1095{
1096 Int_t bin;
1097 Int_t count = 0;
1098 TGraphErrors gr = TGraphErrors(Nbins/2);
1099 double val, error;
1100 for (bin = 0; bin < Nbins; bin++)
1101 {
1102 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).resolHist);
1103 if (rms == true)
1104 {
1105 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, histos->at(bin).resolHist->GetRMS());
1106 error = histos->at(bin).resolHist->GetRMSError();
1107 val = histos->at(bin).resolHist->GetRMS();
1108 if(error > 0.2*val) error = 0.2*val;
1109 gr.SetPointError(count,0, error); // to correct
1110 }
1111 else
1112 {
1113
1114 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);
1115 val = sigvalues.first;
1116 error = sigvalues.second;
1117 if(error > 0.2*val) error = 0.2*val;
1118 gr.SetPointError(count,0, error);
1119 //gr.SetPointError(count,0, 100*sigvalues.second);
1120 }
1121 count++;
1122 }
1123
1124 return gr;
1125}
1126
1127
1128
1129TGraphErrors EresGraphVsEta(std::vector<resolPlot> *histos, bool rms = false)
1130{
1131 Int_t bin;
1132 Int_t count = 0;
1133 TGraphErrors gr = TGraphErrors(Nbins/2);
1134 double val, error;
1135 for (bin = 0; bin < Nbins; bin++)
1136 {
1137
1138 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).resolHist);
1139 if (rms == true)
1140 {
1141 gr.SetPoint(count,(histos->at(bin).etamin+histos->at(bin).etamax)/2.0, histos->at(bin).resolHist->GetRMS());
1142 error = 100*histos->at(bin).resolHist->GetRMSError();
1143 val = 100*histos->at(bin).resolHist->GetRMS();
1144 if(error > 0.2*val) error = 0.2*val;
1145 gr.SetPointError(count,0, error); // to correct
1146 }
1147 else
1148 {
1149 gr.SetPoint(count,(histos->at(bin).etamin+histos->at(bin).etamax)/2.0, 100*sigvalues.first);
1150 val = 100*sigvalues.first;
1151 error = 100*sigvalues.second;
1152 if(error > 0.2*val) error = 0.2*val;
1153 gr.SetPointError(count,0, error);
1154 //gr.SetPointError(count,0, 100*sigvalues.second);
1155 }
1156 count++;
1157 }
1158
1159 return gr;
1160}
1161
1162void GetMetres(std::vector<resolPlot> *histos, TClonesArray *branchScalarHT, TClonesArray *branchMet, TClonesArray *branchJet, ExRootTreeReader *treeReader)
1163{
1164
1165 Long64_t allEntries = treeReader->GetEntries();
1166
1167 cout << "** Computing resolution of " << branchMet->GetName() << " vs " << branchScalarHT->GetName() << endl;
1168
1169 MissingET *met;
1170 ScalarHT *scalarHT;
1171
1172 Long64_t entry;
1173
1174 Int_t bin;
1175 Double_t ht;
1176
1177 Jet *jet;
1178 TLorentzVector p1, p2;
1179
1180 // Loop over all events
1181 for(entry = 0; entry < allEntries; ++entry)
1182 {
1183 // Load selected branches with data from specified event
1184 treeReader->ReadEntry(entry);
1185
1186 if(entry%10000 == 0) cout << "Event number: "<< entry <<endl;
1187
1188 if (branchJet->GetEntriesFast() > 1)
1189 {
1190
1191 jet = (Jet*) branchJet->At(0);
1192 p1 = jet->P4();
1193 jet = (Jet*) branchJet->At(1);
1194 p2 = jet->P4();
1195
1196 met = (MissingET*) branchMet->At(0);
1197 scalarHT = (ScalarHT*) branchScalarHT->At(0);
1198 ht = scalarHT->HT;
1199
1200 if(p1.Pt() < 0.75*ht/2) continue;
1201 if(p2.Pt() < 0.75*ht/2) continue;
1202
1203 for (bin = 0; bin < Nbins; bin++)
1204 {
1205 if(ht > histos->at(bin).ptmin && ht < histos->at(bin).ptmax )
1206 {
1207 histos->at(bin).resolHist->Fill(met->P4().Px());
1208 }
1209 }
1210 }
1211 }
1212}
1213
1214
1215
1216//------------------------------------------------------------------------------
1217
1218
1219void addResoGraph(TMultiGraph *mg, TGraphErrors *gr, TLegend *leg, int style, Color_t color, TString text)
1220{
1221
1222 gr->SetLineWidth(2);
1223 gr->SetLineColor(color);
1224 gr->SetMarkerStyle(style);
1225 gr->SetMarkerColor(color);
1226 gr->SetMarkerSize(1.5);
1227
1228 std::cout << "Adding " << gr->GetName() << std::endl;
1229 mg->Add(gr);
1230 leg->AddEntry(gr,text,"p");
1231
1232}
1233
1234
1235void DrawAxis(TMultiGraph *mg, TLegend *leg, double xmin, double xmax, double ymin, double ymax, TString tx, TString ty, bool logx = 0, bool logy = 0)
1236{
1237 mg->SetMinimum(ymin);
1238 mg->SetMaximum(ymax);
1239 mg->GetXaxis()->SetLimits(xmin,xmax);
1240
1241 mg->GetXaxis()->SetTitle(tx);
1242 mg->GetYaxis()->SetTitle(ty);
1243
1244 mg->GetYaxis()->SetTitleSize(0.07);
1245 mg->GetXaxis()->SetTitleSize(0.07);
1246 mg->GetYaxis()->SetLabelSize(0.06);
1247 mg->GetXaxis()->SetLabelSize(0.06);
1248 mg->GetYaxis()->SetLabelOffset(0.03);
1249 mg->GetYaxis()->SetTitleOffset(1.4);
1250 mg->GetXaxis()->SetTitleOffset(1.4);
1251
1252 mg->GetXaxis()->SetTitleFont(132);
1253 mg->GetYaxis()->SetTitleFont(132);
1254 mg->GetXaxis()->SetLabelFont(132);
1255 mg->GetYaxis()->SetLabelFont(132);
1256
1257 mg->GetYaxis()->SetNdivisions(505);
1258
1259 leg->SetTextFont(132);
1260 leg->SetBorderSize(0);
1261 leg->SetShadowColor(0);
1262 leg->SetFillColor(0);
1263 leg->SetFillStyle(0);
1264
1265 gStyle->SetOptTitle(0);
1266
1267 if(logx) gPad->SetLogx();
1268 if(logy) gPad->SetLogy();
1269
1270
1271 //gPad->SetGridx();
1272 //gPad->SetGridy();
1273 gPad->SetBottomMargin(0.2);
1274 gPad->SetLeftMargin(0.2);
1275 gPad->Modified();
1276 gPad->Update();
1277
1278}
1279
1280
1281void Validation(const char *inputFilePion,
1282 const char *inputFileElectron,
1283 const char *inputFileMuon,
1284 const char *inputFilePhoton,
1285 const char *inputFileNeutralHadron,
1286 const char *inputFileJet,
1287 const char *inputFileBJet,
1288 const char *inputFileCJet,
1289 const char *inputFileTauJet,
1290 const char *outputFile,
1291 const char *version)
1292{
1293
1294 TChain *chainPion = new TChain("Delphes");
1295 chainPion->Add(inputFilePion);
1296 ExRootTreeReader *treeReaderPion = new ExRootTreeReader(chainPion);
1297
1298 TChain *chainElectron = new TChain("Delphes");
1299 chainElectron->Add(inputFileElectron);
1300 ExRootTreeReader *treeReaderElectron = new ExRootTreeReader(chainElectron);
1301
1302 TChain *chainMuon = new TChain("Delphes");
1303 chainMuon->Add(inputFileMuon);
1304 ExRootTreeReader *treeReaderMuon = new ExRootTreeReader(chainMuon);
1305
1306 TChain *chainPhoton = new TChain("Delphes");
1307 chainPhoton->Add(inputFilePhoton);
1308 ExRootTreeReader *treeReaderPhoton = new ExRootTreeReader(chainPhoton);
1309
1310 TChain *chainNeutralHadron = new TChain("Delphes");
1311 chainNeutralHadron->Add(inputFileNeutralHadron);
1312 ExRootTreeReader *treeReaderNeutralHadron = new ExRootTreeReader(chainNeutralHadron);
1313
1314 TChain *chainJet = new TChain("Delphes");
1315 chainJet->Add(inputFileJet);
1316 ExRootTreeReader *treeReaderJet = new ExRootTreeReader(chainJet);
1317
1318 TChain *chainBJet = new TChain("Delphes");
1319 chainBJet->Add(inputFileBJet);
1320 ExRootTreeReader *treeReaderBJet = new ExRootTreeReader(chainBJet);
1321
1322 TChain *chainCJet = new TChain("Delphes");
1323 chainCJet->Add(inputFileCJet);
1324 ExRootTreeReader *treeReaderCJet = new ExRootTreeReader(chainCJet);
1325
1326 TChain *chainTauJet = new TChain("Delphes");
1327 chainTauJet->Add(inputFileTauJet);
1328 ExRootTreeReader *treeReaderTauJet = new ExRootTreeReader(chainTauJet);
1329
1330 TClonesArray *branchParticleElectron = treeReaderElectron->UseBranch("Particle");
1331 TClonesArray *branchTrackElectron = treeReaderElectron->UseBranch("Track");
1332 TClonesArray *branchElectron = treeReaderElectron->UseBranch("Electron");
1333 TClonesArray *branchElectronPF = treeReaderElectron->UseBranch("ElectronPF");
1334
1335 TClonesArray *branchParticleMuon = treeReaderMuon->UseBranch("Particle");
1336 TClonesArray *branchTrackMuon = treeReaderMuon->UseBranch("Track");
1337 TClonesArray *branchMuon = treeReaderMuon->UseBranch("Muon");
1338
1339 TClonesArray *branchParticlePion = treeReaderPion->UseBranch("Particle");
1340 TClonesArray *branchTrackPion = treeReaderPion->UseBranch("Track");
1341 TClonesArray *branchPion = treeReaderPion->UseBranch("Pion");
1342
1343 TClonesArray *branchParticlePhoton = treeReaderPhoton->UseBranch("Particle");
1344 TClonesArray *branchTowerPhoton = treeReaderPhoton->UseBranch("Tower");
1345 TClonesArray *branchPhoton = treeReaderPhoton->UseBranch("Photon");
1346
1347 TClonesArray *branchParticleNeutralHadron = treeReaderNeutralHadron->UseBranch("Particle");
1348 TClonesArray *branchTowerNeutralHadron = treeReaderNeutralHadron->UseBranch("Tower");
1349
1350 TClonesArray *branchGenJet = treeReaderJet->UseBranch("GenJet");
1351 TClonesArray *branchParticleJet = treeReaderJet->UseBranch("Particle");
1352 TClonesArray *branchPFJet = treeReaderJet->UseBranch("PFJet");
1353 TClonesArray *branchCaloJet = treeReaderJet->UseBranch("CaloJet");
1354 TClonesArray *branchJet = treeReaderJet->UseBranch("Jet");
1355
1356 TClonesArray *branchParticleBJet = treeReaderBJet->UseBranch("Particle");
1357 TClonesArray *branchPFBJet = treeReaderBJet->UseBranch("Jet");
1358
1359 TClonesArray *branchParticleCJet = treeReaderCJet->UseBranch("Particle");
1360 TClonesArray *branchPFCJet = treeReaderCJet->UseBranch("Jet");
1361
1362 TClonesArray *branchParticleTauJet = treeReaderTauJet->UseBranch("Particle");
1363 TClonesArray *branchPFTauJet = treeReaderTauJet->UseBranch("Jet");
1364
1365 TClonesArray *branchGenScalarHT = treeReaderJet->UseBranch("GenScalarHT");
1366 TClonesArray *branchMet = treeReaderJet->UseBranch("PFMissingET");
1367 TClonesArray *branchCaloMet = treeReaderJet->UseBranch("CaloMissingET");
1368
1369 std::vector<Color_t> colors;
1370
1371 colors.push_back(kBlack);
1372 colors.push_back(kBlue);
1373 colors.push_back(kRed);
1374 colors.push_back(kGreen+1);
1375 colors.push_back(kMagenta+1);
1376 colors.push_back(kOrange);
1377
1378 std::vector<Int_t> markerStyles;
1379
1380 markerStyles.push_back(20);
1381 markerStyles.push_back(21);
1382 markerStyles.push_back(22);
1383 markerStyles.push_back(23);
1384 markerStyles.push_back(33);
1385 markerStyles.push_back(34);
1386
1387 TString pdfOutput(outputFile);
1388 pdfOutput.ReplaceAll(".root", ".pdf");
1389
1390 TString figPath = inputFilePion;
1391 figPath.ReplaceAll(".root", "");
1392 figPath.ReplaceAll("root", "www/fig");
1393 Int_t lastSlash = figPath.Last('/');
1394 Int_t sizePath = figPath.Length();
1395 figPath.Remove(lastSlash+1,sizePath);
1396
1397 TString header = pdfOutput;
1398 header.ReplaceAll(".pdf", "");
1399 header.ReplaceAll("validation_", "");
1400 lastSlash = header.Last('/');
1401 sizePath = header.Length();
1402 header.Remove(0,lastSlash+1);
1403
1404 TString vrs(version);
1405
1406 TPaveText *pave = new TPaveText(0.0, 0.89, 0.94, 0.94,"NDC");
1407 pave->SetTextAlign(30);
1408 pave->SetTextFont(132);
1409 pave->SetBorderSize(0);
1410 pave->SetShadowColor(0);
1411 pave->SetFillColor(0);
1412 pave->SetFillStyle(0);
1413 pave->AddText("Delphes "+vrs+" - "+header);
1414
1415 TString s_etaMin, s_etaMax, s_eta, s_pt, s_e;
1416
1417 Double_t ptMin = 1.;
1418 Double_t ptMax = 50000.;
1419
1420 Double_t etaMin = -6.;
1421 Double_t etaMax = 6.;
1422
1423 std::vector<Double_t> ptVals;
1424
1425 ptVals.push_back(1.);
1426 ptVals.push_back(10.);
1427 ptVals.push_back(100.);
1428 ptVals.push_back(1000.);
1429 ptVals.push_back(10000.);
1430
1431 std::vector<Double_t> etaVals;
1432
1433 etaVals.push_back(0.);
1434 etaVals.push_back(1.5);
1435 etaVals.push_back(2.5);
1436 etaVals.push_back(4.0);
1437 etaVals.push_back(6.0);
1438
1439 const int n_etabins = etaVals.size()-1;
1440 const int n_ptbins = ptVals.size();
1441
1442 //////////////////////////
1443 // Tracking performance //
1444 //////////////////////////
1445
1446 // --------- Pion Tracks --------- //
1447
1448 TMultiGraph *mg_trkpi_res_pt = new TMultiGraph("","");
1449 TMultiGraph *mg_trkpi_eff_pt = new TMultiGraph("","");
1450 TMultiGraph *mg_trkpi_res_eta = new TMultiGraph("","");
1451 TMultiGraph *mg_trkpi_eff_eta = new TMultiGraph("","");
1452
1453 TLegend *leg_trkpi_res_pt = new TLegend(0.55,0.22,0.90,0.48);
1454 TLegend *leg_trkpi_eff_pt = (TLegend*)leg_trkpi_res_pt->Clone();
1455 TLegend *leg_trkpi_res_eta = (TLegend*)leg_trkpi_res_pt->Clone();
1456 TLegend *leg_trkpi_eff_eta = (TLegend*)leg_trkpi_res_eta->Clone();
1457
1458 TGraphErrors *gr_trkpi_res_pt = new TGraphErrors[n_etabins];
1459 TGraphErrors *gr_trkpi_eff_pt = new TGraphErrors[n_etabins];
1460 TGraphErrors *gr_trkpi_res_eta = new TGraphErrors[n_ptbins];
1461 TGraphErrors *gr_trkpi_eff_eta = new TGraphErrors[n_ptbins];
1462 TH1D* h_trkpi_eff_pt, *h_trkpi_eff_eta;
1463
1464 std::vector<resolPlot> *plots_trkpi_res_pt = new std::vector<resolPlot>[n_etabins];
1465 std::vector<resolPlot> *plots_trkpi_res_eta = new std::vector<resolPlot>[n_ptbins];
1466
1467 // loop over eta bins
1468 for (k = 0; k < etaVals.size()-1; k++)
1469 {
1470 HistogramsCollection(&plots_trkpi_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkpi");
1471 GetPtres<Track>(&plots_trkpi_res_pt[k], branchTrackPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k+1), treeReaderPion);
1472 gr_trkpi_res_pt[k] = EresGraph(&plots_trkpi_res_pt[k]);
1473
1474 h_trkpi_eff_pt = GetEffPt<Track>(branchTrackPion, branchParticlePion, "Pion", 211, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderPion);
1475 gr_trkpi_eff_pt[k] = TGraphErrors(h_trkpi_eff_pt);
1476
1477 s_etaMin = Form("%.1f",etaVals.at(k));
1478 s_etaMax = Form("%.1f",etaVals.at(k+1));
1479
1480 s_eta = "#pi^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax;
1481
1482 gr_trkpi_res_pt[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax);
1483 gr_trkpi_eff_pt[k].SetName("trkEff_"+s_etaMin+"_"+s_etaMax);
1484
1485 addResoGraph(mg_trkpi_res_pt, &gr_trkpi_res_pt[k], leg_trkpi_res_pt, markerStyles.at(k), colors.at(k), s_eta);
1486 addResoGraph(mg_trkpi_eff_pt, &gr_trkpi_eff_pt[k], leg_trkpi_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
1487 }
1488
1489 // loop over pt
1490 for (k = 0; k < ptVals.size(); k++)
1491 {
1492 HistogramsCollectionVsEta(&plots_trkpi_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkpi", 0.0, 2.0);
1493 GetPtresVsEta<Track>(&plots_trkpi_res_eta[k], branchTrackPion, branchParticlePion, 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPion);
1494 gr_trkpi_res_eta[k] = EresGraphVsEta(&plots_trkpi_res_eta[k]);
1495
1496 h_trkpi_eff_eta = GetEffEta<Track>(branchTrackPion, branchParticlePion, "Pion", 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderPion);
1497 gr_trkpi_eff_eta[k] = TGraphErrors(h_trkpi_eff_eta);
1498
1499 s_pt = Form("#pi^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k));
1500 if(ptVals.at(k) >= 1000.) s_pt = Form("#pi^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
1501
1502 addResoGraph(mg_trkpi_res_eta, &gr_trkpi_res_eta[k], leg_trkpi_res_eta, markerStyles.at(k), colors.at(k), s_pt );
1503 addResoGraph(mg_trkpi_eff_eta, &gr_trkpi_eff_eta[k], leg_trkpi_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
1504
1505 }
1506
1507 TCanvas *c_trkpi_res_pt = new TCanvas("","", 800, 600);
1508
1509 mg_trkpi_res_pt->Draw("APE");
1510 DrawAxis(mg_trkpi_res_pt, leg_trkpi_res_pt, ptMin, ptMax, 0.01, 100, "p_{T} [GeV]", "(track resolution in p_{T})/p_{T} (%)", true, true);
1511 leg_trkpi_res_pt->Draw();
1512 pave->Draw();
1513
1514 c_trkpi_res_pt->Print(pdfOutput+"(","pdf");
1515 c_trkpi_res_pt->Print(figPath+"img_trkpi_res_pt.pdf","pdf");
1516 c_trkpi_res_pt->Print(figPath+"img_trkpi_res_pt.png","png");
1517
1518 TCanvas *c_trkpi_res_eta = new TCanvas("","", 800, 600);
1519
1520 mg_trkpi_res_eta->Draw("APE");
1521 DrawAxis(mg_trkpi_res_eta, leg_trkpi_res_eta, etaMin, etaMax, 0.01, 100, " #eta ", "(track resolution in p_{T})/p_{T} (%)", false, true);
1522 leg_trkpi_res_eta->Draw();
1523 pave->Draw();
1524
1525 c_trkpi_res_eta->Print(pdfOutput,"pdf");
1526 c_trkpi_res_eta->Print(figPath+"img_trkpi_res_eta.pdf","pdf");
1527 c_trkpi_res_eta->Print(figPath+"img_trkpi_res_eta.png","png");
1528
1529 TCanvas *c_trkpi_eff_pt = new TCanvas("","", 800, 600);
1530
1531 mg_trkpi_eff_pt->Draw("APE");
1532 DrawAxis(mg_trkpi_eff_pt, leg_trkpi_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "tracking efficiency (%)", true, false);
1533 leg_trkpi_eff_pt->Draw();
1534 pave->Draw();
1535
1536 c_trkpi_eff_pt->Print(pdfOutput,"pdf");
1537 c_trkpi_eff_pt->Print(figPath+"img_trkpi_eff_pt.pdf","pdf");
1538 c_trkpi_eff_pt->Print(figPath+"img_trkpi_eff_pt.png","png");
1539
1540 TCanvas *c_trkpi_eff_eta = new TCanvas("","", 800, 600);
1541
1542 mg_trkpi_eff_eta->Draw("APE");
1543 DrawAxis(mg_trkpi_eff_eta, leg_trkpi_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "tracking efficiency (%)", false, false);
1544 leg_trkpi_eff_eta->Draw();
1545 pave->Draw();
1546
1547
1548 c_trkpi_eff_eta->Print(pdfOutput,"pdf");
1549 c_trkpi_eff_eta->Print(figPath+"img_trkpi_eff_eta.pdf","pdf");
1550 c_trkpi_eff_eta->Print(figPath+"img_trkpi_eff_eta.png","png");
1551
1552 // --------- Electron Tracks --------- //
1553
1554 TMultiGraph *mg_trkele_res_pt = new TMultiGraph("","");
1555 TMultiGraph *mg_trkele_eff_pt = new TMultiGraph("","");
1556 TMultiGraph *mg_trkele_res_eta = new TMultiGraph("","");
1557 TMultiGraph *mg_trkele_eff_eta = new TMultiGraph("","");
1558
1559 TLegend *leg_trkele_res_pt = new TLegend(0.55,0.22,0.90,0.48);
1560 TLegend *leg_trkele_eff_pt = (TLegend*)leg_trkele_res_pt->Clone();
1561 TLegend *leg_trkele_res_eta = (TLegend*)leg_trkele_res_pt->Clone();
1562 TLegend *leg_trkele_eff_eta = (TLegend*)leg_trkele_res_eta->Clone();
1563
1564 TGraphErrors *gr_trkele_res_pt = new TGraphErrors[n_etabins];
1565 TGraphErrors *gr_trkele_eff_pt = new TGraphErrors[n_etabins];
1566 TGraphErrors *gr_trkele_res_eta = new TGraphErrors[n_ptbins];
1567 TGraphErrors *gr_trkele_eff_eta = new TGraphErrors[n_ptbins];
1568
1569 TH1D* h_trkele_eff_pt, *h_trkele_eff_eta;
1570
1571 std::vector<resolPlot> *plots_trkele_res_pt = new std::vector<resolPlot>[n_etabins];
1572 std::vector<resolPlot> *plots_trkele_res_eta = new std::vector<resolPlot>[n_ptbins];
1573
1574 // loop over eta bins
1575 for (k = 0; k < etaVals.size()-1; k++)
1576 {
1577 HistogramsCollection(&plots_trkele_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkele");
1578 GetPtres<Track>(&plots_trkele_res_pt[k], branchTrackElectron, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);
1579 gr_trkele_res_pt[k] = EresGraph(&plots_trkele_res_pt[k]);
1580
1581 h_trkele_eff_pt = GetEffPt<Track>(branchTrackElectron, branchParticleElectron, "Electron", 11, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);
1582 gr_trkele_eff_pt[k] = TGraphErrors(h_trkele_eff_pt);
1583
1584 s_etaMin = Form("%.1f",etaVals.at(k));
1585 s_etaMax = Form("%.1f",etaVals.at(k+1));
1586
1587 s_eta = "e^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax;
1588
1589 gr_trkele_res_pt[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax);
1590 gr_trkele_eff_pt[k].SetName("trkEff_"+s_etaMin+"_"+s_etaMax);
1591
1592 addResoGraph(mg_trkele_res_pt, &gr_trkele_res_pt[k], leg_trkele_res_pt, markerStyles.at(k), colors.at(k), s_eta);
1593 addResoGraph(mg_trkele_eff_pt, &gr_trkele_eff_pt[k], leg_trkele_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
1594 }
1595
1596 // loop over pt
1597 for (k = 0; k < ptVals.size(); k++)
1598 {
1599 HistogramsCollectionVsEta(&plots_trkele_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkele", 0.0, 2.0);
1600 GetPtresVsEta<Track>(&plots_trkele_res_eta[k], branchTrackElectron, branchParticleElectron, 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderElectron);
1601 gr_trkele_res_eta[k] = EresGraphVsEta(&plots_trkele_res_eta[k]);
1602
1603 h_trkele_eff_eta = GetEffEta<Track>(branchTrackElectron, branchParticleElectron, "Electron", 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderElectron);
1604 gr_trkele_eff_eta[k] = TGraphErrors(h_trkele_eff_eta);
1605
1606 s_pt = Form("e^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k));
1607 if(ptVals.at(k) >= 1000.) s_pt = Form("e^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
1608
1609 addResoGraph(mg_trkele_res_eta, &gr_trkele_res_eta[k], leg_trkele_res_eta, markerStyles.at(k), colors.at(k), s_pt );
1610 addResoGraph(mg_trkele_eff_eta, &gr_trkele_eff_eta[k], leg_trkele_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
1611
1612 }
1613
1614 TCanvas *c_trkele_res_pt = new TCanvas("","", 800, 600);
1615
1616 mg_trkele_res_pt->Draw("APE");
1617 DrawAxis(mg_trkele_res_pt, leg_trkele_res_pt, ptMin, ptMax, 0.01, 100, "p_{T} [GeV]", "(track resolution in p_{T})/p_{T} (%)", true, true);
1618 leg_trkele_res_pt->Draw();
1619 pave->Draw();
1620
1621 c_trkele_res_pt->Print(pdfOutput,"pdf");
1622 c_trkele_res_pt->Print(figPath+"img_trkele_res_pt.pdf","pdf");
1623 c_trkele_res_pt->Print(figPath+"img_trkele_res_pt.png","png");
1624
1625 TCanvas *c_trkele_res_eta = new TCanvas("","", 800, 600);
1626
1627 mg_trkele_res_eta->Draw("APE");
1628 DrawAxis(mg_trkele_res_eta, leg_trkele_res_eta, etaMin, etaMax, 0.01, 100, " #eta ", "(track resolution in p_{T})/p_{T} (%)", false, true);
1629 leg_trkele_res_eta->Draw();
1630 pave->Draw();
1631
1632 c_trkele_res_eta->Print(pdfOutput,"pdf");
1633 c_trkele_res_eta->Print(figPath+"img_trkele_res_eta.pdf","pdf");
1634 c_trkele_res_eta->Print(figPath+"img_trkele_res_eta.png","png");
1635
1636 TCanvas *c_trkele_eff_pt = new TCanvas("","", 800, 600);
1637
1638 mg_trkele_eff_pt->Draw("APE");
1639 DrawAxis(mg_trkele_eff_pt, leg_trkele_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "tracking efficiency (%)", true, false);
1640 leg_trkele_eff_pt->Draw();
1641 pave->Draw();
1642
1643 c_trkele_eff_pt->Print(pdfOutput,"pdf");
1644 c_trkele_eff_pt->Print(figPath+"img_trkele_eff_pt.pdf","pdf");
1645 c_trkele_eff_pt->Print(figPath+"img_trkele_eff_pt.png","png");
1646
1647 TCanvas *c_trkele_eff_eta = new TCanvas("","", 800, 600);
1648
1649 mg_trkele_eff_eta->Draw("APE");
1650 DrawAxis(mg_trkele_eff_eta, leg_trkele_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "tracking efficiency (%)", false, false);
1651 leg_trkele_eff_eta->Draw();
1652 pave->Draw();
1653
1654 c_trkele_eff_eta->Print(pdfOutput,"pdf");
1655 c_trkele_eff_eta->Print(figPath+"img_trkele_eff_eta.pdf","pdf");
1656 c_trkele_eff_eta->Print(figPath+"img_trkele_eff_eta.png","png");
1657
1658
1659 // --------- Muon Tracks --------- //
1660
1661 TMultiGraph *mg_trkmu_res_pt = new TMultiGraph("","");
1662 TMultiGraph *mg_trkmu_eff_pt = new TMultiGraph("","");
1663 TMultiGraph *mg_trkmu_res_eta = new TMultiGraph("","");
1664 TMultiGraph *mg_trkmu_eff_eta = new TMultiGraph("","");
1665
1666 TLegend *leg_trkmu_res_pt = new TLegend(0.55,0.22,0.90,0.48);
1667 TLegend *leg_trkmu_eff_pt = (TLegend*)leg_trkmu_res_pt->Clone();
1668
1669 TLegend *leg_trkmu_res_eta = (TLegend*)leg_trkmu_res_pt->Clone();
1670 TLegend *leg_trkmu_eff_eta = (TLegend*)leg_trkmu_res_eta->Clone();
1671
1672
1673 TGraphErrors *gr_trkmu_res_pt = new TGraphErrors[n_etabins];
1674 TGraphErrors *gr_trkmu_eff_pt = new TGraphErrors[n_etabins];
1675 TGraphErrors *gr_trkmu_res_eta = new TGraphErrors[n_ptbins];
1676 TGraphErrors *gr_trkmu_eff_eta = new TGraphErrors[n_ptbins];
1677
1678 TH1D* h_trkmu_eff_pt, *h_trkmu_eff_eta;
1679
1680 std::vector<resolPlot> *plots_trkmu_res_pt = new std::vector<resolPlot>[n_etabins];
1681 std::vector<resolPlot> *plots_trkmu_res_eta = new std::vector<resolPlot>[n_ptbins];
1682
1683 // loop over eta bins
1684 for (k = 0; k < etaVals.size()-1; k++)
1685 {
1686 HistogramsCollection(&plots_trkmu_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkmu");
1687 GetPtres<Track>(&plots_trkmu_res_pt[k], branchTrackMuon, branchParticleMuon, 13, etaVals.at(k), etaVals.at(k+1), treeReaderMuon);
1688 gr_trkmu_res_pt[k] = EresGraph(&plots_trkmu_res_pt[k]);
1689
1690 h_trkmu_eff_pt = GetEffPt<Track>(branchTrackMuon, branchParticleMuon, "Muon", 13, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderMuon);
1691 gr_trkmu_eff_pt[k] = TGraphErrors(h_trkmu_eff_pt);
1692
1693 s_etaMin = Form("%.1f",etaVals.at(k));
1694 s_etaMax = Form("%.1f",etaVals.at(k+1));
1695
1696 s_eta = "#mu^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax;
1697
1698 gr_trkmu_res_pt[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax);
1699 gr_trkmu_eff_pt[k].SetName("trkEff_"+s_etaMin+"_"+s_etaMax);
1700
1701 addResoGraph(mg_trkmu_res_pt, &gr_trkmu_res_pt[k], leg_trkmu_res_pt, markerStyles.at(k), colors.at(k), s_eta);
1702 addResoGraph(mg_trkmu_eff_pt, &gr_trkmu_eff_pt[k], leg_trkmu_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
1703 }
1704
1705 // loop over pt
1706 for (k = 0; k < ptVals.size(); k++)
1707 {
1708 HistogramsCollectionVsEta(&plots_trkmu_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkmu", 0.0, 2.0);
1709 GetPtresVsEta<Track>(&plots_trkmu_res_eta[k], branchTrackMuon, branchParticleMuon, 13, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderMuon);
1710 gr_trkmu_res_eta[k] = EresGraphVsEta(&plots_trkmu_res_eta[k]);
1711
1712 h_trkmu_eff_eta = GetEffEta<Track>(branchTrackMuon, branchParticleMuon, "Muon", 13, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderMuon);
1713 gr_trkmu_eff_eta[k] = TGraphErrors(h_trkmu_eff_eta);
1714
1715 s_pt = Form("#mu^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k));
1716 if(ptVals.at(k) >= 1000.) s_pt = Form("#mu^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
1717
1718 addResoGraph(mg_trkmu_res_eta, &gr_trkmu_res_eta[k], leg_trkmu_res_eta, markerStyles.at(k), colors.at(k), s_pt );
1719 addResoGraph(mg_trkmu_eff_eta, &gr_trkmu_eff_eta[k], leg_trkmu_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
1720
1721 }
1722
1723 TCanvas *c_trkmu_res_pt = new TCanvas("","", 800, 600);
1724
1725 mg_trkmu_res_pt->Draw("APE");
1726 DrawAxis(mg_trkmu_res_pt, leg_trkmu_res_pt, ptMin, ptMax, 0.01, 100, "p_{T} [GeV]", "(track resolution in p_{T})/p_{T} (%)", true, true);
1727 leg_trkmu_res_pt->Draw();
1728 pave->Draw();
1729
1730 c_trkmu_res_pt->Print(pdfOutput,"pdf");
1731 c_trkmu_res_pt->Print(figPath+"img_trkmu_res_pt.pdf","pdf");
1732 c_trkmu_res_pt->Print(figPath+"img_trkmu_res_pt.png","png");
1733
1734 TCanvas *c_trkmu_res_eta = new TCanvas("","", 800, 600);
1735
1736 mg_trkmu_res_eta->Draw("APE");
1737 DrawAxis(mg_trkmu_res_eta, leg_trkmu_res_eta, etaMin, etaMax, 0.01, 100, " #eta ", "(track resolution in p_{T})/p_{T} (%)", false, true);
1738 leg_trkmu_res_eta->Draw();
1739 pave->Draw();
1740
1741 c_trkmu_res_eta->Print(pdfOutput,"pdf");
1742 c_trkmu_res_eta->Print(figPath+"img_trkmu_res_eta.pdf","pdf");
1743 c_trkmu_res_eta->Print(figPath+"img_trkmu_res_eta.png","png");
1744
1745 TCanvas *c_trkmu_eff_pt = new TCanvas("","", 800, 600);
1746
1747 mg_trkmu_eff_pt->Draw("APE");
1748 DrawAxis(mg_trkmu_eff_pt, leg_trkmu_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "tracking efficiency (%)", true, false);
1749 leg_trkmu_eff_pt->Draw();
1750 pave->Draw();
1751
1752 c_trkmu_eff_pt->Print(pdfOutput,"pdf");
1753 c_trkmu_eff_pt->Print(figPath+"img_trkmu_eff_pt.pdf","pdf");
1754 c_trkmu_eff_pt->Print(figPath+"img_trkmu_eff_pt.png","png");
1755
1756 TCanvas *c_trkmu_eff_eta = new TCanvas("","", 800, 600);
1757
1758 mg_trkmu_eff_eta->Draw("APE");
1759 DrawAxis(mg_trkmu_eff_eta, leg_trkmu_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "tracking efficiency (%)", false, false);
1760 leg_trkmu_eff_eta->Draw();
1761 pave->Draw();
1762
1763 c_trkmu_eff_eta->Print(pdfOutput,"pdf");
1764 c_trkmu_eff_eta->Print(figPath+"img_trkmu_eff_eta.pdf","pdf");
1765 c_trkmu_eff_eta->Print(figPath+"img_trkmu_eff_eta.png","png");
1766
1767
1768 //////////////////////
1769 // Ecal performance //
1770 //////////////////////
1771
1772
1773 TMultiGraph *mg_ecal_res_e = new TMultiGraph("","");
1774 TMultiGraph *mg_ecal_res_eta = new TMultiGraph("","");
1775
1776 TLegend *leg_ecal_res_e = new TLegend(0.55,0.64,0.90,0.90);
1777 TLegend *leg_ecal_res_eta = new TLegend(0.60,0.59,0.95,0.90);
1778
1779 TGraphErrors *gr_ecal_res_e = new TGraphErrors[n_etabins];
1780 TGraphErrors *gr_ecal_res_eta = new TGraphErrors[n_ptbins];
1781
1782 std::vector<resolPlot> *plots_ecal_res_e = new std::vector<resolPlot>[n_etabins];
1783 std::vector<resolPlot> *plots_ecal_res_eta = new std::vector<resolPlot>[n_ptbins];
1784
1785 // loop over eta bins
1786 for (k = 0; k < etaVals.size()-1; k++)
1787 {
1788 HistogramsCollection(&plots_ecal_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "ecal");
1789 GetEres<Tower>(&plots_ecal_res_e[k], branchTowerPhoton, branchParticlePhoton, 22, etaVals.at(k), etaVals.at(k+1), treeReaderPhoton);
1790 gr_ecal_res_e[k] = EresGraph(&plots_ecal_res_e[k]);
1791
1792 s_etaMin = Form("%.1f",etaVals.at(k));
1793 s_etaMax = Form("%.1f",etaVals.at(k+1));
1794
1795 s_eta = "#gamma , " + s_etaMin + " < | #eta | < "+s_etaMax;
1796
1797 gr_ecal_res_e[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax);
1798
1799 addResoGraph(mg_ecal_res_e, &gr_ecal_res_e[k], leg_ecal_res_e, markerStyles.at(k), colors.at(k), s_eta);
1800 }
1801
1802 // loop over pt
1803 for (k = 0; k < ptVals.size(); k++)
1804 {
1805 HistogramsCollectionVsEta(&plots_ecal_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "ecal", 0.0, 2.0);
1806 GetEresVsEta<Tower>(&plots_ecal_res_eta[k], branchTowerPhoton, branchParticlePhoton, 22, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPhoton);
1807 gr_ecal_res_eta[k] = EresGraphVsEta(&plots_ecal_res_eta[k]);
1808
1809 s_e = Form("#gamma , E = %.0f GeV",ptVals.at(k));
1810 if(ptVals.at(k) >= 1000.) s_e = Form("#gamma , E = %.0f TeV",ptVals.at(k)/1000.);
1811
1812 addResoGraph(mg_ecal_res_eta, &gr_ecal_res_eta[k], leg_ecal_res_eta, markerStyles.at(k), colors.at(k), s_e );
1813 }
1814
1815 TCanvas *c_ecal_res_e = new TCanvas("","", 800, 600);
1816
1817 mg_ecal_res_e->Draw("APE");
1818 // DrawAxis(mg_ecal_res_e, leg_ecal_res_e, ptMin, ptMax, 0.5, 100, "E [GeV]", "(ECAL resolution in E)/E (%)", true, true);
1819 DrawAxis(mg_ecal_res_e, leg_ecal_res_e, ptMin, ptMax, 0.0, 20, "E [GeV]", "(ECAL resolution in E)/E (%)", true, false);
1820 leg_ecal_res_e->Draw();
1821 pave->Draw();
1822
1823 c_ecal_res_e->Print(pdfOutput,"pdf");
1824 c_ecal_res_e->Print(figPath+"img_ecal_res_e.pdf","pdf");
1825 c_ecal_res_e->Print(figPath+"img_ecal_res_e.png","png");
1826
1827 TCanvas *c_ecal_res_eta = new TCanvas("","", 800, 600);
1828
1829 mg_ecal_res_eta->Draw("APE");
1830 //DrawAxis(mg_ecal_res_eta, leg_ecal_res_eta, etaMin, etaMax, 0.5, 100, " #eta ", "(ECAL resolution in E)/E (%)", false, true);
1831 DrawAxis(mg_ecal_res_eta, leg_ecal_res_eta, etaMin, etaMax, 0.0, 20, " #eta ", "(ECAL resolution in E)/E (%)", false, false);
1832 leg_ecal_res_eta->Draw();
1833 pave->Draw();
1834
1835 c_ecal_res_eta->Print(pdfOutput,"pdf");
1836 c_ecal_res_eta->Print(figPath+"img_ecal_res_eta.pdf","pdf");
1837 c_ecal_res_eta->Print(figPath+"img_ecal_res_eta.png","png");
1838
1839 //////////////////////
1840 // Hcal performance //
1841 //////////////////////
1842
1843
1844 TMultiGraph *mg_hcal_res_e = new TMultiGraph("","");
1845 TMultiGraph *mg_hcal_res_eta = new TMultiGraph("","");
1846
1847 TLegend *leg_hcal_res_e = new TLegend(0.55,0.64,0.90,0.90);
1848 TLegend *leg_hcal_res_eta = new TLegend(0.60,0.59,0.95,0.90);
1849
1850 TGraphErrors *gr_hcal_res_e = new TGraphErrors[n_etabins];
1851 TGraphErrors *gr_hcal_res_eta = new TGraphErrors[n_ptbins];
1852
1853 std::vector<resolPlot> *plots_hcal_res_e = new std::vector<resolPlot>[n_etabins];
1854 std::vector<resolPlot> *plots_hcal_res_eta = new std::vector<resolPlot>[n_ptbins];
1855
1856 // loop over eta bins
1857 for (k = 0; k < etaVals.size()-1; k++)
1858 {
1859 HistogramsCollection(&plots_hcal_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "hcal");
1860 GetEres<Tower>(&plots_hcal_res_e[k], branchTowerNeutralHadron, branchParticleNeutralHadron, 2112, etaVals.at(k), etaVals.at(k+1), treeReaderNeutralHadron);
1861
1862 gr_hcal_res_e[k] = EresGraph(&plots_hcal_res_e[k]);
1863
1864 s_etaMin = Form("%.1f",etaVals.at(k));
1865 s_etaMax = Form("%.1f",etaVals.at(k+1));
1866
1867 s_eta = "n , " + s_etaMin + " < | #eta | < "+s_etaMax;
1868
1869 gr_hcal_res_e[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax);
1870
1871 addResoGraph(mg_hcal_res_e, &gr_hcal_res_e[k], leg_hcal_res_e, markerStyles.at(k), colors.at(k), s_eta);
1872 }
1873
1874 // loop over pt
1875 for (k = 0; k < ptVals.size(); k++)
1876 {
1877 HistogramsCollectionVsEta(&plots_hcal_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "hcal", 0.0, 2.0);
1878 GetEresVsEta<Tower>(&plots_hcal_res_eta[k], branchTowerNeutralHadron, branchParticleNeutralHadron, 2112, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderNeutralHadron);
1879 gr_hcal_res_eta[k] = EresGraphVsEta(&plots_hcal_res_eta[k]);
1880
1881 s_e = Form("n , E = %.0f GeV",ptVals.at(k));
1882 if(ptVals.at(k) >= 1000.) s_e = Form("n , E = %.0f TeV",ptVals.at(k)/1000.);
1883
1884 addResoGraph(mg_hcal_res_eta, &gr_hcal_res_eta[k], leg_hcal_res_eta, markerStyles.at(k), colors.at(k), s_e );
1885 }
1886
1887
1888 TCanvas *c_hcal_res_e = new TCanvas("","", 800, 600);
1889
1890 mg_hcal_res_e->Draw("APE");
1891 //DrawAxis(mg_hcal_res_e, leg_hcal_res_e, ptMin, ptMax, 1, 100, "E [GeV]", "(HCAL resolution in E)/E (%)", true, true);
1892 DrawAxis(mg_hcal_res_e, leg_hcal_res_e, ptMin, ptMax, 0.0, 50, "E [GeV]", "(HCAL resolution in E)/E (%)", true, false);
1893 leg_hcal_res_e->Draw();
1894 pave->Draw();
1895
1896 c_hcal_res_e->Print(pdfOutput,"pdf");
1897 c_hcal_res_e->Print(figPath+"img_hcal_res_e.pdf","pdf");
1898 c_hcal_res_e->Print(figPath+"img_hcal_res_e.png","png");
1899
1900 TCanvas *c_hcal_res_eta = new TCanvas("","", 800, 600);
1901
1902 mg_hcal_res_eta->Draw("APE");
1903 //DrawAxis(mg_hcal_res_eta, leg_hcal_res_eta, etaMin, etaMax, 1, 100, " #eta ", "(HCAL resolution in E)/E (%)", false, true);
1904 DrawAxis(mg_hcal_res_eta, leg_hcal_res_eta, etaMin, etaMax, 0.0, 50, " #eta ", "(HCAL resolution in E)/E (%)", false, false);
1905 leg_hcal_res_eta->Draw();
1906 pave->Draw();
1907
1908 c_hcal_res_eta->Print(pdfOutput,"pdf");
1909 c_hcal_res_eta->Print(figPath+"img_hcal_res_eta.pdf","pdf");
1910 c_hcal_res_eta->Print(figPath+"img_hcal_res_eta.png","png");
1911
1912 ////////////////////
1913 // PF - electrons //
1914 ////////////////////
1915
1916 TMultiGraph *mg_pfele_res_e[n_etabins];
1917 TMultiGraph *mg_pfele_res_eta[n_ptbins];
1918
1919 TLegend *leg_pfele_res_e[n_etabins];
1920 TLegend *leg_pfele_res_eta[n_ptbins];
1921
1922 TGraphErrors *gr_pfele_res_e = new TGraphErrors[n_etabins];
1923 TGraphErrors *gr_pfele_res_eta = new TGraphErrors[n_ptbins];
1924 TGraphErrors *gr_trkele_res_e = new TGraphErrors[n_etabins];
1925 TGraphErrors *gr_trkele_res_eeta = new TGraphErrors[n_ptbins];
1926
1927 std::vector<resolPlot> *plots_pfele_res_e = new std::vector<resolPlot>[n_etabins];
1928 std::vector<resolPlot> *plots_pfele_res_eta = new std::vector<resolPlot>[n_ptbins];
1929 std::vector<resolPlot> *plots_trkele_res_e = new std::vector<resolPlot>[n_etabins];
1930 std::vector<resolPlot> *plots_trkele_res_eeta = new std::vector<resolPlot>[n_ptbins];
1931
1932 TCanvas *c_pfele_res_e[n_etabins];
1933 TCanvas *c_pfele_res_eta[n_ptbins];
1934
1935
1936 // loop over eta bins
1937 for (k = 0; k < etaVals.size()-1; k++)
1938 {
1939 mg_pfele_res_e[k] = new TMultiGraph("","");
1940 leg_pfele_res_e[k] = new TLegend(0.40,0.60,0.75,0.90);
1941
1942 HistogramsCollection(&plots_pfele_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfele");
1943 GetEres<Electron>(&plots_pfele_res_e[k], branchElectronPF, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);
1944 gr_pfele_res_e[k] = EresGraph(&plots_pfele_res_e[k]);
1945
1946 HistogramsCollection(&plots_trkele_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkele");
1947 GetEres<Track>(&plots_trkele_res_e[k], branchTrackElectron, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);
1948 gr_trkele_res_e[k] = EresGraph(&plots_trkele_res_e[k]);
1949
1950 s_etaMin = Form("%.1f",etaVals.at(k));
1951 s_etaMax = Form("%.1f",etaVals.at(k+1));
1952 s_eta = "e^{ #pm}, "+ s_etaMin + " < | #eta | < " + s_etaMax;
1953
1954 leg_pfele_res_e[k]->SetTextFont(132);
1955 leg_pfele_res_e[k]->SetHeader(s_eta);
1956
1957 addResoGraph(mg_pfele_res_e[k], &gr_ecal_res_e[k], leg_pfele_res_e[k], markerStyles.at(0), colors.at(0), "ECAL");
1958 addResoGraph(mg_pfele_res_e[k], &gr_trkele_res_e[k], leg_pfele_res_e[k], markerStyles.at(1), colors.at(1), "Track");
1959 addResoGraph(mg_pfele_res_e[k], &gr_pfele_res_e[k], leg_pfele_res_e[k], markerStyles.at(2), colors.at(2), "Particle-flow");
1960
1961 c_pfele_res_e[k] = new TCanvas("","", 800, 600);
1962
1963 mg_pfele_res_e[k]->Draw("APE");
1964 //DrawAxis(mg_pfele_res_e[k], leg_pfele_res_e[k], ptMin, ptMax, 0.1, 100, "E [GeV]", "(resolution in E)/E (%)", true, true);
1965 DrawAxis(mg_pfele_res_e[k], leg_pfele_res_e[k], ptMin, ptMax, 0.0, 20, "E [GeV]", "(resolution in E)/E (%)", true, false);
1966 leg_pfele_res_e[k]->Draw();
1967 pave->Draw();
1968
1969 TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_";
1970
1971 c_pfele_res_e[k]->Print(pdfOutput,"pdf");
1972 c_pfele_res_e[k]->Print(figPath+"img_pfele_res_"+s_etarange+"e.pdf","pdf");
1973 c_pfele_res_e[k]->Print(figPath+"img_pfele_res_"+s_etarange+"e.png","png");
1974
1975 }
1976
1977
1978 // loop over eta bins
1979 for (k = 0; k < ptVals.size(); k++)
1980 {
1981
1982 mg_pfele_res_eta[k] = new TMultiGraph("","");
1983 leg_pfele_res_eta[k] = new TLegend(0.40,0.60,0.75,0.90);
1984
1985 HistogramsCollectionVsEta(&plots_pfele_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "pfele", 0.0, 2.0);
1986 GetEresVsEta<Electron>(&plots_pfele_res_eta[k], branchElectronPF, branchParticleElectron, 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderElectron);
1987 gr_pfele_res_eta[k] = EresGraphVsEta(&plots_pfele_res_eta[k]);
1988
1989 HistogramsCollectionVsEta(&plots_trkele_res_eeta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkele", 0.0, 2.0);
1990 GetEresVsEta<Track>(&plots_trkele_res_eeta[k], branchTrackElectron, branchParticleElectron, 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderElectron);
1991 gr_trkele_res_eeta[k] = EresGraphVsEta(&plots_trkele_res_eeta[k]);
1992
1993 s_e = Form("e^{ #pm}, E = %.0f GeV",ptVals.at(k));
1994 if(ptVals.at(k) >= 1000.) s_e = Form("e^{ #pm}, E = %.0f TeV",ptVals.at(k)/1000.);
1995
1996
1997 leg_pfele_res_eta[k]->SetTextFont(132);
1998 leg_pfele_res_eta[k]->SetHeader(s_e);
1999
2000 addResoGraph(mg_pfele_res_eta[k], &gr_ecal_res_eta[k], leg_pfele_res_eta[k], markerStyles.at(0), colors.at(0), "ECAL");
2001 addResoGraph(mg_pfele_res_eta[k], &gr_trkele_res_eeta[k], leg_pfele_res_eta[k], markerStyles.at(1), colors.at(1), "Track");
2002 addResoGraph(mg_pfele_res_eta[k], &gr_pfele_res_eta[k], leg_pfele_res_eta[k], markerStyles.at(2), colors.at(2), "Particle-flow");
2003
2004 c_pfele_res_eta[k] = new TCanvas("","", 800, 600);
2005
2006 mg_pfele_res_eta[k]->Draw("APE");
2007 //DrawAxis(mg_pfele_res_eta[k], leg_pfele_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true);
2008 DrawAxis(mg_pfele_res_eta[k], leg_pfele_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false);
2009 leg_pfele_res_eta[k]->Draw();
2010 pave->Draw();
2011
2012 TString s_ptrange = Form("pt_%.0f_",ptVals.at(k));
2013
2014 c_pfele_res_eta[k]->Print(pdfOutput,"pdf");
2015 c_pfele_res_eta[k]->Print(figPath+"img_pfele_res_"+s_ptrange+"eta.pdf","pdf");
2016 c_pfele_res_eta[k]->Print(figPath+"img_pfele_res_"+s_ptrange+"eta.png","png");
2017
2018 }
2019
2020 /////////////////
2021 // PF - Pions //
2022 /////////////////
2023
2024 TMultiGraph *mg_pfpi_res_e[n_etabins];
2025 TMultiGraph *mg_pfpi_res_eta[n_ptbins];
2026
2027 TLegend *leg_pfpi_res_e[n_etabins];
2028 TLegend *leg_pfpi_res_eta[n_ptbins];
2029
2030 TGraphErrors *gr_pfpi_res_e = new TGraphErrors[n_etabins];
2031 TGraphErrors *gr_pfpi_res_eta = new TGraphErrors[n_ptbins];
2032
2033 TGraphErrors *gr_trkpi_res_e = new TGraphErrors[n_etabins];
2034 TGraphErrors *gr_trkpi_res_eeta = new TGraphErrors[n_ptbins];
2035
2036 std::vector<resolPlot> *plots_pfpi_res_e = new std::vector<resolPlot>[n_etabins];
2037 std::vector<resolPlot> *plots_pfpi_res_eta = new std::vector<resolPlot>[n_ptbins];
2038 std::vector<resolPlot> *plots_trkpi_res_e = new std::vector<resolPlot>[n_etabins];
2039 std::vector<resolPlot> *plots_trkpi_res_eeta = new std::vector<resolPlot>[n_ptbins];
2040
2041 TCanvas *c_pfpi_res_e[n_etabins];
2042 TCanvas *c_pfpi_res_eta[n_ptbins];
2043
2044
2045 // loop over eta bins
2046 for (k = 0; k < etaVals.size()-1; k++)
2047 {
2048 mg_pfpi_res_e[k] = new TMultiGraph("","");
2049 leg_pfpi_res_e[k] = new TLegend(0.40,0.60,0.75,0.90);
2050
2051 HistogramsCollection(&plots_pfpi_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfpi");
2052 GetEres<Track>(&plots_pfpi_res_e[k], branchPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k+1), treeReaderPion);
2053 gr_pfpi_res_e[k] = EresGraph(&plots_pfpi_res_e[k]);
2054
2055 HistogramsCollection(&plots_trkpi_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkpi");
2056 GetEres<Track>(&plots_trkpi_res_e[k], branchTrackPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k+1), treeReaderPion);
2057 gr_trkpi_res_e[k] = EresGraph(&plots_trkpi_res_e[k]);
2058
2059
2060 s_etaMin = Form("%.1f",etaVals.at(k));
2061 s_etaMax = Form("%.1f",etaVals.at(k+1));
2062 s_eta = "#pi^{ #pm}, "+ s_etaMin + " < | #eta | < " + s_etaMax;
2063
2064 leg_pfpi_res_e[k]->SetTextFont(132);
2065 leg_pfpi_res_e[k]->SetHeader(s_eta);
2066
2067 addResoGraph(mg_pfpi_res_e[k], &gr_hcal_res_e[k], leg_pfpi_res_e[k], markerStyles.at(0), colors.at(0), "HCAL");
2068 addResoGraph(mg_pfpi_res_e[k], &gr_trkpi_res_e[k], leg_pfpi_res_e[k], markerStyles.at(1), colors.at(1), "Track");
2069 addResoGraph(mg_pfpi_res_e[k], &gr_pfpi_res_e[k], leg_pfpi_res_e[k], markerStyles.at(2), colors.at(2), "Particle-flow");
2070
2071 c_pfpi_res_e[k] = new TCanvas("","", 800, 600);
2072
2073 mg_pfpi_res_e[k]->Draw("APE");
2074 //DrawAxis(mg_pfpi_res_e[k], leg_pfpi_res_e[k], ptMin, ptMax, 0.1, 100, "E [GeV]", "(resolution in E)/E (%)", true, true);
2075 DrawAxis(mg_pfpi_res_e[k], leg_pfpi_res_e[k], ptMin, ptMax, 0.1, 50, "E [GeV]", "(resolution in E)/E (%)", true, false);
2076 leg_pfpi_res_e[k]->Draw();
2077 pave->Draw();
2078
2079 TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_";
2080
2081 c_pfpi_res_e[k]->Print(pdfOutput,"pdf");
2082 c_pfpi_res_e[k]->Print(figPath+"img_pfpi_res_"+s_etarange+"e.pdf","pdf");
2083 c_pfpi_res_e[k]->Print(figPath+"img_pfpi_res_"+s_etarange+"e.png","png");
2084
2085 }
2086
2087
2088 // loop over eta bins
2089 for (k = 0; k < ptVals.size(); k++)
2090 {
2091
2092 mg_pfpi_res_eta[k] = new TMultiGraph("","");
2093 leg_pfpi_res_eta[k] = new TLegend(0.40,0.60,0.75,0.90);
2094
2095 HistogramsCollectionVsEta(&plots_pfpi_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "pfpi", 0.0, 2.0);
2096 GetEresVsEta<Track>(&plots_pfpi_res_eta[k], branchPion, branchParticlePion, 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPion);
2097 gr_pfpi_res_eta[k] = EresGraphVsEta(&plots_pfpi_res_eta[k]);
2098
2099 HistogramsCollectionVsEta(&plots_trkpi_res_eeta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkpi", 0.0, 2.0);
2100 GetEresVsEta<Track>(&plots_trkpi_res_eeta[k], branchPion, branchParticlePion, 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPion);
2101 gr_trkpi_res_eeta[k] = EresGraphVsEta(&plots_trkpi_res_eeta[k]);
2102
2103
2104 s_e = Form("#pi^{ #pm}, E = %.0f GeV",ptVals.at(k));
2105 if(ptVals.at(k) >= 1000.) s_e = Form("#pi^{ #pm}, E = %.0f TeV",ptVals.at(k)/1000.);
2106
2107 leg_pfpi_res_eta[k]->SetTextFont(132);
2108 leg_pfpi_res_eta[k]->SetHeader(s_e);
2109
2110 addResoGraph(mg_pfpi_res_eta[k], &gr_hcal_res_eta[k], leg_pfpi_res_eta[k], markerStyles.at(0), colors.at(0), "HCAL");
2111 addResoGraph(mg_pfpi_res_eta[k], &gr_trkpi_res_eeta[k], leg_pfpi_res_eta[k], markerStyles.at(1), colors.at(1), "Track");
2112 addResoGraph(mg_pfpi_res_eta[k], &gr_pfpi_res_eta[k], leg_pfpi_res_eta[k], markerStyles.at(2), colors.at(2), "Particle-flow");
2113
2114 c_pfpi_res_eta[k] = new TCanvas("","", 800, 600);
2115
2116 mg_pfpi_res_eta[k]->Draw("APE");
2117 //DrawAxis(mg_pfpi_res_eta[k], leg_pfpi_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true);
2118 DrawAxis(mg_pfpi_res_eta[k], leg_pfpi_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false);
2119 leg_pfpi_res_eta[k]->Draw();
2120 pave->Draw();
2121
2122 TString s_ptrange = Form("pt_%.0f_",ptVals.at(k));
2123
2124 c_pfpi_res_eta[k]->Print(pdfOutput,"pdf");
2125 c_pfpi_res_eta[k]->Print(figPath+"img_pfpi_res_"+s_ptrange+"eta.pdf","pdf");
2126 c_pfpi_res_eta[k]->Print(figPath+"img_pfpi_res_"+s_ptrange+"eta.png","png");
2127
2128 }
2129
2130
2131 /////////////////
2132 // PF - jets //
2133 /////////////////
2134
2135 TMultiGraph *mg_pfjet_res_e[n_etabins];
2136 TMultiGraph *mg_pfjet_res_eta[n_ptbins];
2137
2138 TLegend *leg_pfjet_res_e[n_etabins];
2139 TLegend *leg_pfjet_res_eta[n_ptbins];
2140
2141 TGraphErrors *gr_pfjet_res_e = new TGraphErrors[n_etabins];
2142 TGraphErrors *gr_pfjet_res_eta = new TGraphErrors[n_ptbins];
2143
2144 TGraphErrors *gr_cajet_res_e = new TGraphErrors[n_etabins];
2145 TGraphErrors *gr_cajet_res_eta = new TGraphErrors[n_ptbins];
2146
2147 std::vector<resolPlot> *plots_pfjet_res_e = new std::vector<resolPlot>[n_etabins];
2148 std::vector<resolPlot> *plots_pfjet_res_eta = new std::vector<resolPlot>[n_ptbins];
2149 std::vector<resolPlot> *plots_cajet_res_e = new std::vector<resolPlot>[n_etabins];
2150 std::vector<resolPlot> *plots_cajet_res_eta = new std::vector<resolPlot>[n_ptbins];
2151
2152 TCanvas *c_pfjet_res_e[n_etabins];
2153 TCanvas *c_pfjet_res_eta[n_ptbins];
2154
2155
2156 // loop over eta bins
2157 for (k = 0; k < etaVals.size()-1; k++)
2158 {
2159
2160 mg_pfjet_res_e[k] = new TMultiGraph("","");
2161 leg_pfjet_res_e[k] = new TLegend(0.40,0.70,0.90,0.90);
2162
2163 HistogramsCollection(&plots_pfjet_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfjet");
2164 HistogramsCollection(&plots_cajet_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "cajet");
2165
2166 GetJetsEres(&plots_pfjet_res_e[k], branchPFJet, branchGenJet, treeReaderJet, etaVals.at(k), etaVals.at(k+1));
2167 GetJetsEres(&plots_cajet_res_e[k], branchCaloJet, branchGenJet, treeReaderJet, etaVals.at(k), etaVals.at(k+1));
2168
2169 gr_pfjet_res_e[k] = EresGraph(&plots_pfjet_res_e[k]);
2170 gr_cajet_res_e[k] = EresGraph(&plots_cajet_res_e[k]);
2171
2172 s_etaMin = Form("%.1f",etaVals.at(k));
2173 s_etaMax = Form("%.1f",etaVals.at(k+1));
2174 s_eta = "anti-k_{T}, R = 0.4, "+ s_etaMin + " < | #eta | < " + s_etaMax;
2175
2176 leg_pfjet_res_e[k]->SetTextFont(132);
2177 leg_pfjet_res_e[k]->SetHeader(s_eta);
2178
2179 addResoGraph(mg_pfjet_res_e[k], &gr_cajet_res_e[k], leg_pfjet_res_e[k], markerStyles.at(0), colors.at(0), "Calorimeter Jets");
2180 addResoGraph(mg_pfjet_res_e[k], &gr_pfjet_res_e[k], leg_pfjet_res_e[k], markerStyles.at(1), colors.at(1), "Particle-flow Jets");
2181
2182 c_pfjet_res_e[k] = new TCanvas("","", 800, 600);
2183
2184 mg_pfjet_res_e[k]->Draw("APE");
2185 //DrawAxis(mg_pfjet_res_e[k], leg_pfjet_res_e[k], 10, ptMax, 0.5, 100, "E [GeV]", "(resolution in E)/E (%)", true, true);
2186 DrawAxis(mg_pfjet_res_e[k], leg_pfjet_res_e[k], 10, ptMax, 0.0, 30, "E [GeV]", "(resolution in E)/E (%)", true, false);
2187 leg_pfjet_res_e[k]->Draw();
2188 pave->Draw();
2189
2190 TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_";
2191
2192 c_pfjet_res_e[k]->Print(pdfOutput,"pdf");
2193 c_pfjet_res_e[k]->Print(figPath+"img_pfjet_res_"+s_etarange+"e.pdf","pdf");
2194 c_pfjet_res_e[k]->Print(figPath+"img_pfjet_res_"+s_etarange+"e.png","png");
2195
2196 }
2197
2198
2199 // loop over eta bins
2200 for (k = 0; k < ptVals.size(); k++)
2201 {
2202
2203 mg_pfjet_res_eta[k] = new TMultiGraph("","");
2204 leg_pfjet_res_eta[k] = new TLegend(0.30,0.70,0.85,0.90);
2205
2206 HistogramsCollectionVsEta(&plots_pfjet_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "pfjet", 0.0, 2.0);
2207 HistogramsCollectionVsEta(&plots_cajet_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "cajet", 0.0, 2.0);
2208
2209 GetJetsEresVsEta(&plots_pfjet_res_eta[k], branchPFJet, branchGenJet, treeReaderJet, 0.5*ptVals.at(k), 2.0*ptVals.at(k));
2210 GetJetsEresVsEta(&plots_cajet_res_eta[k], branchCaloJet, branchGenJet, treeReaderJet, 0.5*ptVals.at(k), 2.0*ptVals.at(k));
2211
2212 gr_pfjet_res_eta[k] = EresGraphVsEta(&plots_pfjet_res_eta[k]);
2213 gr_cajet_res_eta[k] = EresGraphVsEta(&plots_cajet_res_eta[k]);
2214
2215 s_e = Form("anti-k_{T}, R = 0.4, jets, E = %.0f GeV",ptVals.at(k));
2216 if(ptVals.at(k) >= 1000.) s_e = Form("anti-k_{T}, R = 0.4, E = %.0f TeV",ptVals.at(k)/1000.);
2217
2218 leg_pfjet_res_eta[k]->SetTextFont(132);
2219 leg_pfjet_res_eta[k]->SetHeader(s_e);
2220
2221 addResoGraph(mg_pfjet_res_eta[k], &gr_cajet_res_eta[k], leg_pfjet_res_eta[k], markerStyles.at(0), colors.at(0), "Calorimeter Jets");
2222 addResoGraph(mg_pfjet_res_eta[k], &gr_pfjet_res_eta[k], leg_pfjet_res_eta[k], markerStyles.at(1), colors.at(1), "Particle-flow Jets");
2223
2224 c_pfjet_res_eta[k] = new TCanvas("","", 800, 600);
2225
2226 mg_pfjet_res_eta[k]->Draw("APE");
2227 //DrawAxis(mg_pfjet_res_eta[k], leg_pfjet_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true);
2228 DrawAxis(mg_pfjet_res_eta[k], leg_pfjet_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false);
2229 leg_pfjet_res_eta[k]->Draw();
2230 pave->Draw();
2231
2232 TString s_ptrange = Form("pt_%.0f_",ptVals.at(k));
2233
2234 c_pfjet_res_eta[k]->Print(pdfOutput,"pdf");
2235 c_pfjet_res_eta[k]->Print(figPath+"img_pfjet_res_"+s_ptrange+"eta.pdf","pdf");
2236 c_pfjet_res_eta[k]->Print(figPath+"img_pfjet_res_"+s_ptrange+"eta.png","png");
2237
2238 }
2239
2240
2241 /////////////////////
2242 // PF Missing ET ///
2243 /////////////////////
2244
2245 TMultiGraph *mg_met_res_ht = new TMultiGraph("","");
2246 TLegend *leg_met_res_ht = new TLegend(0.60,0.22,0.90,0.42);
2247
2248 std::vector<resolPlot> plots_pfmet, plots_camet;
2249
2250 HistogramsCollection(&plots_pfmet, TMath::Log10(ptMin), TMath::Log10(ptMax), "pfMET", -500, 500);
2251 HistogramsCollection(&plots_camet, TMath::Log10(ptMin), TMath::Log10(ptMax), "caMET", -500, 500);
2252
2253 GetMetres(&plots_pfmet, branchGenScalarHT, branchMet, branchPFJet, treeReaderJet);
2254 GetMetres(&plots_camet, branchGenScalarHT, branchCaloMet, branchCaloJet, treeReaderJet);
2255
2256 TGraphErrors gr_pfmet_res_ht = MetResGraph(&plots_pfmet, true);
2257 TGraphErrors gr_camet_res_ht = MetResGraph(&plots_camet, true);
2258
2259 addResoGraph(mg_met_res_ht, &gr_camet_res_ht, leg_met_res_ht, markerStyles.at(0), colors.at(0), "Calorimeter E_{T}^{miss}");
2260 addResoGraph(mg_met_res_ht, &gr_pfmet_res_ht, leg_met_res_ht, markerStyles.at(1), colors.at(1), "Particle-flow E_{T}^{miss}");
2261
2262 TCanvas *c_met_res_ht = new TCanvas("","", 800, 600);
2263
2264 mg_met_res_ht->Draw("APE");
2265 DrawAxis(mg_met_res_ht, leg_met_res_ht, 10, 10000, 0.1, 1000, " #sum p_{T} [GeV]", "resolution in E_{x,y}^{miss} [GeV]", true, true);
2266
2267 leg_met_res_ht->Draw();
2268 pave->Draw();
2269 c_met_res_ht->Print(pdfOutput,"pdf");
2270 c_met_res_ht->Print(figPath+"img_met_res_ht.pdf","pdf");
2271 c_met_res_ht->Print(figPath+"img_met_res_ht.png","png");
2272
2273
2274 /////////////////////////////////////////
2275 // Electron Reconstruction Efficiency ///
2276 /////////////////////////////////////////
2277
2278 TMultiGraph *mg_recele_eff_pt = new TMultiGraph("","");
2279 TMultiGraph *mg_recele_eff_eta = new TMultiGraph("","");
2280
2281 TLegend *leg_recele_eff_pt = new TLegend(0.55,0.22,0.90,0.48);
2282 TLegend *leg_recele_eff_eta = new TLegend(0.55,0.22,0.90,0.48);
2283
2284 TGraphErrors *gr_recele_eff_pt = new TGraphErrors[n_etabins];
2285 TGraphErrors *gr_recele_eff_eta = new TGraphErrors[n_ptbins];
2286 TH1D* h_recele_eff_pt, *h_recele_eff_eta;
2287
2288 // loop over eta bins
2289 for (k = 0; k < etaVals.size()-1; k++)
2290 {
2291
2292 h_recele_eff_pt = GetEffPt<Electron>(branchElectron, branchParticleElectron, "Electron", 11, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);
2293 gr_recele_eff_pt[k] = TGraphErrors(h_recele_eff_pt);
2294
2295 s_etaMin = Form("%.1f",etaVals.at(k));
2296 s_etaMax = Form("%.1f",etaVals.at(k+1));
2297
2298 s_eta = "e^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax;
2299
2300 gr_recele_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2301
2302 addResoGraph(mg_recele_eff_pt, &gr_recele_eff_pt[k], leg_recele_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
2303 }
2304
2305 // loop over pt
2306 for (k = 0; k < ptVals.size(); k++)
2307 {
2308 h_recele_eff_eta = GetEffEta<Electron>(branchElectron, branchParticleElectron, "Electron", 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderElectron);
2309 gr_recele_eff_eta[k] = TGraphErrors(h_recele_eff_eta);
2310
2311 s_pt = Form("e^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k));
2312 if(ptVals.at(k) >= 1000.) s_pt = Form("e^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2313
2314 addResoGraph(mg_recele_eff_eta, &gr_recele_eff_eta[k], leg_recele_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
2315 }
2316
2317 TCanvas *c_recele_eff_pt = new TCanvas("","", 800, 600);
2318
2319 mg_recele_eff_pt->Draw("APE");
2320 DrawAxis(mg_recele_eff_pt, leg_recele_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false);
2321 leg_recele_eff_pt->Draw();
2322 pave->Draw();
2323
2324 c_recele_eff_pt->Print(pdfOutput,"pdf");
2325 c_recele_eff_pt->Print(figPath+"img_recele_eff_pt.pdf","pdf");
2326 c_recele_eff_pt->Print(figPath+"img_recele_eff_pt.png","png");
2327
2328 TCanvas *c_recele_eff_eta = new TCanvas("","", 800, 600);
2329
2330 mg_recele_eff_eta->Draw("APE");
2331 DrawAxis(mg_recele_eff_eta, leg_recele_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false);
2332 leg_recele_eff_eta->Draw();
2333 pave->Draw();
2334
2335 c_recele_eff_eta->Print(pdfOutput,"pdf");
2336 c_recele_eff_eta->Print(figPath+"img_recele_eff_eta.pdf","pdf");
2337 c_recele_eff_eta->Print(figPath+"img_recele_eff_eta.png","png");
2338
2339
2340 /////////////////////////////////////////
2341 // Muon Reconstruction Efficiency ///
2342 /////////////////////////////////////////
2343
2344 TMultiGraph *mg_recmu_eff_pt = new TMultiGraph("","");
2345 TMultiGraph *mg_recmu_eff_eta = new TMultiGraph("","");
2346
2347 TLegend *leg_recmu_eff_pt = new TLegend(0.55,0.22,0.90,0.48);
2348 TLegend *leg_recmu_eff_eta = new TLegend(0.55,0.22,0.90,0.48);
2349
2350 TGraphErrors *gr_recmu_eff_pt = new TGraphErrors[n_etabins];
2351 TGraphErrors *gr_recmu_eff_eta = new TGraphErrors[n_ptbins];
2352 TH1D* h_recmu_eff_pt, *h_recmu_eff_eta;
2353
2354 // loop over eta bins
2355 for (k = 0; k < etaVals.size()-1; k++)
2356 {
2357
2358 h_recmu_eff_pt = GetEffPt<Muon>(branchMuon, branchParticleMuon, "muon", 13, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderMuon);
2359 gr_recmu_eff_pt[k] = TGraphErrors(h_recmu_eff_pt);
2360
2361 s_etaMin = Form("%.1f",etaVals.at(k));
2362 s_etaMax = Form("%.1f",etaVals.at(k+1));
2363
2364 s_eta = "#mu^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax;
2365
2366 gr_recmu_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2367
2368 addResoGraph(mg_recmu_eff_pt, &gr_recmu_eff_pt[k], leg_recmu_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
2369 }
2370
2371 // loop over pt
2372 for (k = 0; k < ptVals.size(); k++)
2373 {
2374 h_recmu_eff_eta = GetEffEta<Muon>(branchMuon, branchParticleMuon, "muon", 13, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderMuon);
2375 gr_recmu_eff_eta[k] = TGraphErrors(h_recmu_eff_eta);
2376
2377 s_pt = Form("#mu^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k));
2378 if(ptVals.at(k) >= 1000.) s_pt = Form("#mu^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2379
2380 addResoGraph(mg_recmu_eff_eta, &gr_recmu_eff_eta[k], leg_recmu_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
2381 }
2382
2383 TCanvas *c_recmu_eff_pt = new TCanvas("","", 800, 600);
2384
2385 mg_recmu_eff_pt->Draw("APE");
2386 DrawAxis(mg_recmu_eff_pt, leg_recmu_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false);
2387 leg_recmu_eff_pt->Draw();
2388 pave->Draw();
2389
2390 c_recmu_eff_pt->Print(pdfOutput,"pdf");
2391 c_recmu_eff_pt->Print(figPath+"img_recmu_eff_pt.pdf","pdf");
2392 c_recmu_eff_pt->Print(figPath+"img_recmu_eff_pt.png","png");
2393
2394 TCanvas *c_recmu_eff_eta = new TCanvas("","", 800, 600);
2395
2396 mg_recmu_eff_eta->Draw("APE");
2397 DrawAxis(mg_recmu_eff_eta, leg_recmu_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false);
2398 leg_recmu_eff_eta->Draw();
2399 pave->Draw();
2400
2401 c_recmu_eff_eta->Print(pdfOutput,"pdf");
2402 c_recmu_eff_eta->Print(figPath+"img_recmu_eff_eta.pdf","pdf");
2403 c_recmu_eff_eta->Print(figPath+"img_recmu_eff_eta.png","png");
2404
2405
2406 /////////////////////////////////////////
2407 // Photon Reconstruction Efficiency ///
2408 /////////////////////////////////////////
2409
2410 TMultiGraph *mg_recpho_eff_pt = new TMultiGraph("","");
2411 TMultiGraph *mg_recpho_eff_eta = new TMultiGraph("","");
2412
2413 TLegend *leg_recpho_eff_pt = new TLegend(0.55,0.22,0.90,0.48);
2414 TLegend *leg_recpho_eff_eta = new TLegend(0.55,0.22,0.90,0.48);
2415
2416 TGraphErrors *gr_recpho_eff_pt = new TGraphErrors[n_etabins];
2417 TGraphErrors *gr_recpho_eff_eta = new TGraphErrors[n_ptbins];
2418 TH1D* h_recpho_eff_pt, *h_recpho_eff_eta;
2419
2420 // loop over eta bins
2421 for (k = 0; k < etaVals.size()-1; k++)
2422 {
2423
2424 h_recpho_eff_pt = GetEffPt<Photon>(branchPhoton, branchParticlePhoton, "Photon", 22, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderPhoton);
2425 gr_recpho_eff_pt[k] = TGraphErrors(h_recpho_eff_pt);
2426
2427 s_etaMin = Form("%.1f",etaVals.at(k));
2428 s_etaMax = Form("%.1f",etaVals.at(k+1));
2429
2430 s_eta = "#gamma , " + s_etaMin + " < | #eta | < "+s_etaMax;
2431
2432 gr_recpho_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2433
2434 addResoGraph(mg_recpho_eff_pt, &gr_recpho_eff_pt[k], leg_recpho_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
2435 }
2436
2437 // loop over pt
2438 for (k = 0; k < ptVals.size(); k++)
2439 {
2440 h_recpho_eff_eta = GetEffEta<Photon>(branchPhoton, branchParticlePhoton, "Photon", 22, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderPhoton);
2441 gr_recpho_eff_eta[k] = TGraphErrors(h_recpho_eff_eta);
2442
2443 s_pt = Form("#gamma , p_{T} = %.0f GeV",ptVals.at(k));
2444 if(ptVals.at(k) >= 1000.) s_pt = Form("#gamma , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2445
2446 addResoGraph(mg_recpho_eff_eta, &gr_recpho_eff_eta[k], leg_recpho_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
2447 }
2448
2449 TCanvas *c_recpho_eff_pt = new TCanvas("","", 800, 600);
2450
2451 mg_recpho_eff_pt->Draw("APE");
2452 DrawAxis(mg_recpho_eff_pt, leg_recpho_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false);
2453 leg_recpho_eff_pt->Draw();
2454 pave->Draw();
2455
2456 c_recpho_eff_pt->Print(pdfOutput,"pdf");
2457 c_recpho_eff_pt->Print(figPath+"img_recpho_eff_pt.pdf","pdf");
2458 c_recpho_eff_pt->Print(figPath+"img_recpho_eff_pt.png","png");
2459
2460 TCanvas *c_recpho_eff_eta = new TCanvas("","", 800, 600);
2461
2462 mg_recpho_eff_eta->Draw("APE");
2463 DrawAxis(mg_recpho_eff_eta, leg_recpho_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false);
2464 leg_recpho_eff_eta->Draw();
2465 pave->Draw();
2466
2467 c_recpho_eff_eta->Print(pdfOutput,"pdf");
2468 c_recpho_eff_eta->Print(figPath+"img_recpho_eff_eta.pdf","pdf");
2469 c_recpho_eff_eta->Print(figPath+"img_recpho_eff_eta.png","png");
2470
2471
2472 /////////////////////////////////////////
2473 // B-jets Efficiency/ mistag rates ///
2474 /////////////////////////////////////////
2475
2476 TMultiGraph *mg_recbjet_eff_pt = new TMultiGraph("","");
2477 TMultiGraph *mg_recbjet_eff_eta = new TMultiGraph("","");
2478
2479 TLegend *leg_recbjet_eff_pt = new TLegend(0.50,0.22,0.90,0.48);
2480 TLegend *leg_recbjet_eff_eta = new TLegend(0.50,0.22,0.90,0.48);
2481
2482 TGraphErrors *gr_recbjet_eff_pt = new TGraphErrors[n_etabins];
2483 TGraphErrors *gr_recbjet_eff_eta = new TGraphErrors[n_ptbins];
2484 TH1D* h_recbjet_eff_pt, *h_recbjet_eff_eta;
2485
2486 // loop over eta bins
2487 for (k = 0; k < etaVals.size()-1; k++)
2488 {
2489
2490 h_recbjet_eff_pt = GetEffPt<Jet>(branchPFBJet, branchParticleBJet, "BJet", 5, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderBJet);
2491 gr_recbjet_eff_pt[k] = TGraphErrors(h_recbjet_eff_pt);
2492
2493 s_etaMin = Form("%.1f",etaVals.at(k));
2494 s_etaMax = Form("%.1f",etaVals.at(k+1));
2495
2496 s_eta = "b-jet , " + s_etaMin + " < | #eta | < "+s_etaMax;
2497
2498 gr_recbjet_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2499
2500 addResoGraph(mg_recbjet_eff_pt, &gr_recbjet_eff_pt[k], leg_recbjet_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
2501 }
2502
2503 // loop over pt
2504 for (k = 0; k < ptVals.size(); k++)
2505 {
2506 h_recbjet_eff_eta = GetEffEta<Jet>(branchPFBJet, branchParticleBJet, "BJet", 5, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderBJet);
2507 gr_recbjet_eff_eta[k] = TGraphErrors(h_recbjet_eff_eta);
2508
2509 s_pt = Form("b-jet , p_{T} = %.0f GeV",ptVals.at(k));
2510 if(ptVals.at(k) >= 1000.) s_pt = Form("b-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2511
2512 addResoGraph(mg_recbjet_eff_eta, &gr_recbjet_eff_eta[k], leg_recbjet_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
2513 }
2514
2515 TCanvas *c_recbjet_eff_pt = new TCanvas("","", 800, 600);
2516
2517 mg_recbjet_eff_pt->Draw("APE");
2518 DrawAxis(mg_recbjet_eff_pt, leg_recbjet_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "b - tag efficiency (%)", true, false);
2519 leg_recbjet_eff_pt->Draw();
2520 pave->Draw();
2521
2522 c_recbjet_eff_pt->Print(pdfOutput,"pdf");
2523 c_recbjet_eff_pt->Print(figPath+"img_recbjet_eff_pt.pdf","pdf");
2524 c_recbjet_eff_pt->Print(figPath+"img_recbjet_eff_pt.png","png");
2525
2526 TCanvas *c_recbjet_eff_eta = new TCanvas("","", 800, 600);
2527
2528 mg_recbjet_eff_eta->Draw("APE");
2529 DrawAxis(mg_recbjet_eff_eta, leg_recbjet_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "b - tag efficiency (%)", false, false);
2530 leg_recbjet_eff_eta->Draw();
2531 pave->Draw();
2532
2533 c_recbjet_eff_eta->Print(pdfOutput,"pdf");
2534 c_recbjet_eff_eta->Print(figPath+"img_recbjet_eff_eta.pdf","pdf");
2535 c_recbjet_eff_eta->Print(figPath+"img_recbjet_eff_eta.png","png");
2536
2537 // ------ c - mistag ------
2538
2539 TMultiGraph *mg_recbjet_cmis_pt = new TMultiGraph("","");
2540 TMultiGraph *mg_recbjet_cmis_eta = new TMultiGraph("","");
2541
2542 TLegend *leg_recbjet_cmis_pt = new TLegend(0.50,0.64,0.90,0.90);
2543 TLegend *leg_recbjet_cmis_eta = new TLegend(0.50,0.64,0.90,0.90);
2544
2545 TGraphErrors *gr_recbjet_cmis_pt = new TGraphErrors[n_etabins];
2546 TGraphErrors *gr_recbjet_cmis_eta = new TGraphErrors[n_ptbins];
2547 TH1D* h_recbjet_cmis_pt, *h_recbjet_cmis_eta;
2548
2549 // loop over eta bins
2550 for (k = 0; k < etaVals.size()-1; k++)
2551 {
2552
2553 h_recbjet_cmis_pt = GetEffPt<Jet>(branchPFCJet, branchParticleCJet, "CJet", 4, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderCJet);
2554 gr_recbjet_cmis_pt[k] = TGraphErrors(h_recbjet_cmis_pt);
2555
2556 s_etaMin = Form("%.1f",etaVals.at(k));
2557 s_etaMax = Form("%.1f",etaVals.at(k+1));
2558
2559 s_eta = "c-jet , " + s_etaMin + " < | #eta | < "+s_etaMax;
2560
2561 gr_recbjet_cmis_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2562
2563 addResoGraph(mg_recbjet_cmis_pt, &gr_recbjet_cmis_pt[k], leg_recbjet_cmis_pt, markerStyles.at(k), colors.at(k), s_eta);
2564 }
2565
2566 // loop over pt
2567 for (k = 0; k < ptVals.size(); k++)
2568 {
2569 h_recbjet_cmis_eta = GetEffEta<Jet>(branchPFCJet, branchParticleCJet, "CJet", 4, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderCJet);
2570 gr_recbjet_cmis_eta[k] = TGraphErrors(h_recbjet_cmis_eta);
2571
2572 s_pt = Form("c-jet , p_{T} = %.0f GeV",ptVals.at(k));
2573 if(ptVals.at(k) >= 1000.) s_pt = Form("c-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2574
2575 addResoGraph(mg_recbjet_cmis_eta, &gr_recbjet_cmis_eta[k], leg_recbjet_cmis_eta, markerStyles.at(k), colors.at(k), s_pt );
2576 }
2577
2578 TCanvas *c_recbjet_cmis_pt = new TCanvas("","", 800, 600);
2579
2580 mg_recbjet_cmis_pt->Draw("APE");
2581 DrawAxis(mg_recbjet_cmis_pt, leg_recbjet_cmis_pt, ptMin, ptMax, 0.0, 20, "p_{T} [GeV]", "c - mistag rate (%)", true, false);
2582 leg_recbjet_cmis_pt->Draw();
2583 pave->Draw();
2584
2585 c_recbjet_cmis_pt->Print(pdfOutput,"pdf");
2586 c_recbjet_cmis_pt->Print(figPath+"img_recbjet_cmis_pt.pdf","pdf");
2587 c_recbjet_cmis_pt->Print(figPath+"img_recbjet_cmis_pt.png","png");
2588
2589 TCanvas *c_recbjet_cmis_eta = new TCanvas("","", 800, 600);
2590
2591 mg_recbjet_cmis_eta->Draw("APE");
2592 DrawAxis(mg_recbjet_cmis_eta, leg_recbjet_cmis_eta, etaMin, etaMax, 0.0, 20, " #eta ", "c - mistag rate (%)", false, false);
2593 leg_recbjet_cmis_eta->Draw();
2594 pave->Draw();
2595
2596 c_recbjet_cmis_eta->Print(pdfOutput,"pdf");
2597 c_recbjet_cmis_eta->Print(figPath+"img_recbjet_cmis_eta.pdf","pdf");
2598 c_recbjet_cmis_eta->Print(figPath+"img_recbjet_cmis_eta.png","png");
2599
2600 // ------ light - mistag ------
2601
2602 TMultiGraph *mg_recbjet_lmis_pt = new TMultiGraph("","");
2603 TMultiGraph *mg_recbjet_lmis_eta = new TMultiGraph("","");
2604
2605 TLegend *leg_recbjet_lmis_pt = new TLegend(0.50,0.64,0.90,0.90);
2606 TLegend *leg_recbjet_lmis_eta = new TLegend(0.50,0.64,0.90,0.90);
2607
2608 TGraphErrors *gr_recbjet_lmis_pt = new TGraphErrors[n_etabins];
2609 TGraphErrors *gr_recbjet_lmis_eta = new TGraphErrors[n_ptbins];
2610 TH1D* h_recbjet_lmis_pt, *h_recbjet_lmis_eta;
2611
2612 // loop over eta bins
2613 for (k = 0; k < etaVals.size()-1; k++)
2614 {
2615
2616 h_recbjet_lmis_pt = GetEffPt<Jet>(branchJet, branchParticleJet, "Jet", 1, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderJet);
2617 gr_recbjet_lmis_pt[k] = TGraphErrors(h_recbjet_lmis_pt);
2618
2619 s_etaMin = Form("%.1f",etaVals.at(k));
2620 s_etaMax = Form("%.1f",etaVals.at(k+1));
2621
2622 s_eta = "uds-jet , " + s_etaMin + " < | #eta | < "+s_etaMax;
2623
2624 gr_recbjet_lmis_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2625
2626 addResoGraph(mg_recbjet_lmis_pt, &gr_recbjet_lmis_pt[k], leg_recbjet_lmis_pt, markerStyles.at(k), colors.at(k), s_eta);
2627 }
2628
2629 // loop over pt
2630 for (k = 0; k < ptVals.size(); k++)
2631 {
2632 h_recbjet_lmis_eta = GetEffEta<Jet>(branchJet, branchParticleJet, "Jet", 1, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderJet);
2633 gr_recbjet_lmis_eta[k] = TGraphErrors(h_recbjet_lmis_eta);
2634
2635 s_pt = Form("uds-jet , p_{T} = %.0f GeV",ptVals.at(k));
2636 if(ptVals.at(k) >= 1000.) s_pt = Form("uds-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2637
2638 addResoGraph(mg_recbjet_lmis_eta, &gr_recbjet_lmis_eta[k], leg_recbjet_lmis_eta, markerStyles.at(k), colors.at(k), s_pt );
2639 }
2640
2641 TCanvas *c_recbjet_lmis_pt = new TCanvas("","", 800, 600);
2642
2643 mg_recbjet_lmis_pt->Draw("APE");
2644 DrawAxis(mg_recbjet_lmis_pt, leg_recbjet_lmis_pt, ptMin, ptMax, 0.0, 0.5, "p_{T} [GeV]", "light - mistag rate (%)", true, false);
2645 leg_recbjet_lmis_pt->Draw();
2646 pave->Draw();
2647
2648 c_recbjet_lmis_pt->Print(pdfOutput,"pdf");
2649 c_recbjet_lmis_pt->Print(figPath+"img_recbjet_lmis_pt.pdf","pdf");
2650 c_recbjet_lmis_pt->Print(figPath+"img_recbjet_lmis_pt.png","png");
2651
2652 TCanvas *c_recbjet_lmis_eta = new TCanvas("","", 800, 600);
2653
2654 mg_recbjet_lmis_eta->Draw("APE");
2655 DrawAxis(mg_recbjet_lmis_eta, leg_recbjet_lmis_eta, etaMin, etaMax, 0.0, 0.5, " #eta ", "light - mistag rate (%)", false, false);
2656 leg_recbjet_lmis_eta->Draw();
2657 pave->Draw();
2658
2659 c_recbjet_lmis_eta->Print(pdfOutput,"pdf");
2660 c_recbjet_lmis_eta->Print(figPath+"img_recbjet_lmis_eta.pdf","pdf");
2661 c_recbjet_lmis_eta->Print(figPath+"img_recbjet_lmis_eta.png","png");
2662
2663
2664 ///////////////////////////////////////////
2665 // tau-jets Efficiency/ mistag rates ///
2666 ///////////////////////////////////////////
2667
2668 TMultiGraph *mg_rectaujet_eff_pt = new TMultiGraph("","");
2669 TMultiGraph *mg_rectaujet_eff_eta = new TMultiGraph("","");
2670
2671 TLegend *leg_rectaujet_eff_pt = new TLegend(0.50,0.22,0.90,0.48);
2672 TLegend *leg_rectaujet_eff_eta = new TLegend(0.50,0.22,0.90,0.48);
2673
2674 TGraphErrors *gr_rectaujet_eff_pt = new TGraphErrors[n_etabins];
2675 TGraphErrors *gr_rectaujet_eff_eta = new TGraphErrors[n_ptbins];
2676 TH1D* h_rectaujet_eff_pt, *h_rectaujet_eff_eta;
2677
2678 // loop over eta bins
2679 for (k = 0; k < etaVals.size()-1; k++)
2680 {
2681
2682 h_rectaujet_eff_pt = GetTauEffPt<Jet>(branchPFTauJet, branchParticleTauJet, "TauJet", 15, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderTauJet);
2683 gr_rectaujet_eff_pt[k] = TGraphErrors(h_rectaujet_eff_pt);
2684
2685 s_etaMin = Form("%.1f",etaVals.at(k));
2686 s_etaMax = Form("%.1f",etaVals.at(k+1));
2687
2688 s_eta = "#tau-jet , " + s_etaMin + " < | #eta | < "+s_etaMax;
2689
2690 gr_rectaujet_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2691
2692 addResoGraph(mg_rectaujet_eff_pt, &gr_rectaujet_eff_pt[k], leg_rectaujet_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
2693 }
2694
2695 // loop over pt
2696 for (k = 0; k < ptVals.size(); k++)
2697 {
2698 h_rectaujet_eff_eta = GetTauEffEta<Jet>(branchPFTauJet, branchParticleTauJet, "TauJet", 15, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderTauJet);
2699 gr_rectaujet_eff_eta[k] = TGraphErrors(h_rectaujet_eff_eta);
2700
2701 s_pt = Form("#tau-jet , p_{T} = %.0f GeV",ptVals.at(k));
2702 if(ptVals.at(k) >= 1000.) s_pt = Form("#tau-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2703
2704 addResoGraph(mg_rectaujet_eff_eta, &gr_rectaujet_eff_eta[k], leg_rectaujet_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
2705 }
2706
2707
2708 TCanvas *c_rectaujet_eff_pt = new TCanvas("","", 800, 600);
2709
2710 mg_rectaujet_eff_pt->Draw("APE");
2711 DrawAxis(mg_rectaujet_eff_pt, leg_rectaujet_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "#tau - tag efficiency (%)", true, false);
2712 leg_rectaujet_eff_pt->Draw();
2713 pave->Draw();
2714
2715 c_rectaujet_eff_pt->Print(pdfOutput,"pdf");
2716 c_rectaujet_eff_pt->Print(figPath+"img_rectaujet_eff_pt.pdf","pdf");
2717 c_rectaujet_eff_pt->Print(figPath+"img_rectaujet_eff_pt.png","png");
2718
2719 TCanvas *c_rectaujet_eff_eta = new TCanvas("","", 800, 600);
2720
2721 mg_rectaujet_eff_eta->Draw("APE");
2722 DrawAxis(mg_rectaujet_eff_eta, leg_rectaujet_eff_eta, etaMin, etaMax, 0.0, 100., " #eta ", "#tau - tag efficiency (%)", false, false);
2723 leg_rectaujet_eff_eta->Draw();
2724 pave->Draw();
2725
2726 c_rectaujet_eff_eta->Print(pdfOutput,"pdf");
2727 c_rectaujet_eff_eta->Print(figPath+"img_rectaujet_eff_eta.pdf","pdf");
2728 c_rectaujet_eff_eta->Print(figPath+"img_rectaujet_eff_eta.png","png");
2729
2730
2731 //--------------- tau mistag rate ----------
2732
2733 TMultiGraph *mg_rectaujet_mis_pt = new TMultiGraph("","");
2734 TMultiGraph *mg_rectaujet_mis_eta = new TMultiGraph("","");
2735
2736 TLegend *leg_rectaujet_mis_pt = new TLegend(0.50,0.64,0.90,0.90);
2737 TLegend *leg_rectaujet_mis_eta = new TLegend(0.50,0.64,0.90,0.90);
2738
2739 TGraphErrors *gr_rectaujet_mis_pt = new TGraphErrors[n_etabins];
2740 TGraphErrors *gr_rectaujet_mis_eta = new TGraphErrors[n_ptbins];
2741 TH1D* h_rectaujet_mis_pt, *h_rectaujet_mis_eta;
2742
2743 // loop over eta bins
2744 for (k = 0; k < etaVals.size()-1; k++)
2745 {
2746
2747 h_rectaujet_mis_pt = GetTauEffPt<Jet>(branchJet, branchParticleJet, "TauJet", 1, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderJet);
2748 gr_rectaujet_mis_pt[k] = TGraphErrors(h_rectaujet_mis_pt);
2749
2750 s_etaMin = Form("%.1f",etaVals.at(k));
2751 s_etaMax = Form("%.1f",etaVals.at(k+1));
2752
2753 s_eta = "uds-jet , " + s_etaMin + " < | #eta | < "+s_etaMax;
2754
2755 gr_rectaujet_mis_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2756
2757 addResoGraph(mg_rectaujet_mis_pt, &gr_rectaujet_mis_pt[k], leg_rectaujet_mis_pt, markerStyles.at(k), colors.at(k), s_eta);
2758 }
2759
2760 // loop over pt
2761 for (k = 0; k < ptVals.size(); k++)
2762 {
2763 h_rectaujet_mis_eta = GetTauEffEta<Jet>(branchJet, branchParticleJet, "TauJet", 1, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderJet);
2764 gr_rectaujet_mis_eta[k] = TGraphErrors(h_rectaujet_mis_eta);
2765
2766 s_pt = Form("uds-jet , p_{T} = %.0f GeV",ptVals.at(k));
2767 if(ptVals.at(k) >= 1000.) s_pt = Form("uds-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2768
2769 addResoGraph(mg_rectaujet_mis_eta, &gr_rectaujet_mis_eta[k], leg_rectaujet_mis_eta, markerStyles.at(k), colors.at(k), s_pt );
2770 }
2771
2772 TCanvas *c_rectaujet_mis_pt = new TCanvas("","", 800, 600);
2773
2774 mg_rectaujet_mis_pt->Draw("APE");
2775 DrawAxis(mg_rectaujet_mis_pt, leg_rectaujet_mis_pt, ptMin, ptMax, 0.0, 5., "p_{T} [GeV]", "#tau - mistag(%)", true, false);
2776 leg_rectaujet_mis_pt->Draw();
2777 pave->Draw();
2778
2779 c_rectaujet_mis_pt->Print(pdfOutput,"pdf");
2780 c_rectaujet_mis_pt->Print(figPath+"img_rectaujet_mis_pt.pdf","pdf");
2781 c_rectaujet_mis_pt->Print(figPath+"img_rectaujet_mis_pt.png","png");
2782
2783 TCanvas *c_rectaujet_mis_eta = new TCanvas("","", 800, 600);
2784
2785 mg_rectaujet_mis_eta->Draw("APE");
2786 DrawAxis(mg_rectaujet_mis_eta, leg_rectaujet_mis_eta, etaMin, etaMax, 0.0, 5., " #eta ", "#tau - mistag (%)", false, false);
2787 leg_rectaujet_mis_eta->Draw();
2788 pave->Draw();
2789
2790 c_rectaujet_mis_eta->Print(pdfOutput+")","pdf");
2791 c_rectaujet_mis_eta->Print(figPath+"img_rectaujet_mis_eta.pdf","pdf");
2792 c_rectaujet_mis_eta->Print(figPath+"img_rectaujet_mis_eta.png","png");
2793
2794
2795// ---- store resolution histograms in the output (for leave efficiencies out) ---
2796
2797
2798 TFile *fout = new TFile(outputFile,"recreate");
2799
2800 for (int bin = 0; bin < Nbins; bin++)
2801 {
2802
2803 for (k = 0; k < etaVals.size()-1; k++)
2804 {
2805 plots_trkpi_res_pt[k].at(bin).resolHist->Write();
2806 plots_trkele_res_pt[k].at(bin).resolHist->Write();
2807 plots_trkmu_res_pt[k].at(bin).resolHist->Write();
2808 plots_ecal_res_e[k].at(bin).resolHist->Write();
2809 plots_hcal_res_e[k].at(bin).resolHist->Write();
2810 plots_pfele_res_e[k].at(bin).resolHist->Write();
2811 plots_pfpi_res_e[k].at(bin).resolHist->Write();
2812 plots_pfjet_res_e[k].at(bin).resolHist->Write();
2813 plots_cajet_res_e[k].at(bin).resolHist->Write();
2814
2815 }
2816
2817 for (k = 0; k < ptVals.size(); k++)
2818 {
2819 plots_trkpi_res_eta[k].at(bin).resolHist->Write();
2820 plots_trkele_res_eta[k].at(bin).resolHist->Write();
2821 plots_trkmu_res_eta[k].at(bin).resolHist->Write();
2822 plots_ecal_res_eta[k].at(bin).resolHist->Write();
2823 plots_hcal_res_eta[k].at(bin).resolHist->Write();
2824 plots_pfele_res_eta[k].at(bin).resolHist->Write();
2825 plots_pfpi_res_eta[k].at(bin).resolHist->Write();
2826 plots_pfjet_res_eta[k].at(bin).resolHist->Write();
2827 plots_cajet_res_eta[k].at(bin).resolHist->Write();
2828
2829 }
2830
2831 plots_pfmet.at(bin).resolHist->Write();
2832 plots_camet.at(bin).resolHist->Write();
2833
2834 }
2835
2836 fout->Write();
2837
2838
2839
2840
2841 cout << "** Exiting..." << endl;
2842
2843 delete treeReaderElectron;
2844 delete treeReaderMuon;
2845 delete treeReaderPhoton;
2846 delete treeReaderJet;
2847 delete treeReaderBJet;
2848 delete treeReaderTauJet;
2849 delete chainElectron;
2850 delete chainMuon;
2851 delete chainPhoton;
2852 delete chainJet;
2853 delete chainBJet;
2854 delete chainTauJet;
2855}
2856
2857//------------------------------------------------------------------------------
2858
2859int main(int argc, char *argv[])
2860{
2861 char *appName = "Validation";
2862
2863 if(argc != 12)
2864 {
2865 cout << " Usage: " << appName << " input_file_electron input_file_muon input_file_photon input_file_jet input_file_bjet input_file_taujet output_file" << endl;
2866 cout << " input_file_pion - input file in ROOT format ('Delphes' tree)," << endl;
2867 cout << " input_file_electron - input file in ROOT format ('Delphes' tree)," << endl;
2868 cout << " input_file_muon - input file in ROOT format ('Delphes' tree)," << endl;
2869 cout << " input_file_photon - input file in ROOT format ('Delphes' tree)," << endl;
2870 cout << " input_file_neutralhadron - input file in ROOT format ('Delphes' tree)," << endl;
2871 cout << " input_file_jet - input file in ROOT format ('Delphes' tree)," << endl;
2872 cout << " input_file_bjet - input file in ROOT format ('Delphes' tree)," << endl;
2873 cout << " input_file_cjet - input file in ROOT format ('Delphes' tree)," << endl;
2874 cout << " input_file_taujet - input file in ROOT format ('Delphes' tree)," << endl;
2875 cout << " output_file - output file in ROOT format" << endl;
2876 cout << " delphes version" << endl;
2877
2878 return 1;
2879 }
2880
2881 gROOT->SetBatch();
2882
2883 int appargc = 1;
2884 char *appargv[] = {appName};
2885 TApplication app(appName, &appargc, appargv);
2886
2887 Validation(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11]);
2888}
2889
2890
2891
Note: See TracBrowser for help on using the repository browser.