Fork me on GitHub

source: git/examples/Validation.cpp@ 44b481d

ImprovedOutputFile Timing dual_readout llp 3.4.0pre01
Last change on this file since 44b481d was cb159ed, checked in by Michele Selvaggi <michele.selvaggi@…>, 8 years ago

fixed tracks in pf plots vs e instead of pt

  • Property mode set to 100644
File size: 100.1 KB
RevLine 
[734b267]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>
[1408174]23#include <typeinfo>
[734b267]24
25#include "TROOT.h"
26#include "TSystem.h"
27#include "TApplication.h"
28
29#include "TString.h"
30
[1408174]31#include "TH1.h"
[734b267]32#include "TH2.h"
[1408174]33#include "TMath.h"
34#include "TStyle.h"
35#include "TGraph.h"
36#include "TCanvas.h"
[734b267]37#include "THStack.h"
38#include "TLegend.h"
39#include "TPaveText.h"
40#include "TClonesArray.h"
41#include "TLorentzVector.h"
[1408174]42#include "TGraphErrors.h"
43#include "TMultiGraph.h"
[734b267]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
[92237ca]57static const int Nbins = 50;
[1408174]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
[92237ca]82unsigned int k;
83
[1408174]84
85struct resolPlot
86{
[92237ca]87 TH1* resolHist;
[1408174]88 double ptmin;
89 double ptmax;
[92237ca]90 double etamin;
91 double etamax;
[1408174]92 double xmin;
93 double xmax;
94 TString obj;
95
96 resolPlot();
97 resolPlot(double ptdown, double ptup, TString object);
[92237ca]98 resolPlot(double etadown, double etaup, double ptdown, double ptup, TString object);
[1408174]99 void set(double ptdown, double ptup, TString object, double xmin = 0, double xmax = 2);
[92237ca]100 void set(double etadown, double etaup, double ptdown, double ptup, TString object, double xmin = 0, double xmax = 2);
[1408174]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
[92237ca]114resolPlot::resolPlot(double etadown, double etaup, double ptdown, double ptup, TString object)
115{
116 this->set(etadown, etaup, ptdown, ptup, object);
117}
118
[1408174]119void resolPlot::set(double ptdown, double ptup, TString object, double xmin, double xmax)
120{
121 ptmin = ptdown;
122 ptmax = ptup;
123 obj = object;
124
[92237ca]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);
[1408174]137}
138
[92237ca]139
140
[1408174]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
[92237ca]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
[1408174]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>
[92237ca]207TH1D* GetEffPt(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)
[1408174]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
[92237ca]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));
[1408174]227
[92237ca]228 histGenPt->SetDirectory(0);
229 histRecoPt->SetDirectory(0);
[1408174]230
[92237ca]231 BinLogX(histGenPt);
232 BinLogX(histRecoPt);
[1408174]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
[92237ca]249 pt = genMomentum.Pt();
250 eta = TMath::Abs(genMomentum.Eta());
251
[cb159ed]252
[92237ca]253 if(eta > etamax || eta < etamin ) continue;
[1408174]254
[cb159ed]255 //cout<<"b parton: "<<pt<<endl;
[92237ca]256 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax )
257 {
[1408174]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
[06a83b3]267
268
[1408174]269 // take the closest parton candidate
270 if(TMath::Abs(pdgID) == 5)
271 {
272 Jet *jet = (Jet *)recoObj;
[92237ca]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 }
[cb159ed]283
284 if(TMath::Abs(pdgID) == 1)
[92237ca]285 {
286 Jet *jet = (Jet *)recoObj;
[06a83b3]287 if( !(jet->BTag & (1 << 0)) ) continue;
[1408174]288 }
[92237ca]289
[1408174]290 if(TMath::Abs(pdgID) == 15)
291 {
292 Jet *jet = (Jet *)recoObj;
293 if(jet->TauTag != 1) continue;
294 }
[92237ca]295
296
[1408174]297 if(genMomentum.DeltaR(recoMomentum) < deltaR)
298 {
299 deltaR = genMomentum.DeltaR(recoMomentum);
300 bestRecoMomentum = recoMomentum;
301 }
302 }
[92237ca]303 histGenPt->Fill(pt);
[cb159ed]304 if(deltaR < 0.3 && bestRecoMomentum.Pt()> 0.20*pt ) { histRecoPt->Fill(pt);}
[1408174]305
[92237ca]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)
[1408174]368 {
[92237ca]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;
[1408174]374
[92237ca]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 }
[1408174]405 }
[92237ca]406
407 histGenEta->Fill(eta);
408 if(deltaR < 0.3) { histRecoEta->Fill(eta); }
409
[1408174]410 }
411 }
412 }
413
[92237ca]414 histRecoEta->Sumw2();
415 histGenEta->Sumw2();
[1408174]416
[92237ca]417 histRecoEta->Divide(histGenEta);
418 histRecoEta->Scale(100.);
[1408174]419
[92237ca]420 return histRecoEta;
421}
[1408174]422
423
424
425template<typename T>
[92237ca]426TH1D* GetTauEffPt(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)
[1408174]427{
428
[92237ca]429 cout << "** Computing Efficiency of reconstructing "<< branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;
430
431 Long64_t allEntries = treeReader->GetEntries();
[1408174]432
433 GenParticle *particle;
[92237ca]434 T *recoObj;
[1408174]435
[92237ca]436 TLorentzVector recoMomentum, genMomentum, bestRecoMomentum;
[1408174]437
438 Float_t deltaR;
439 Float_t pt, eta;
440 Long64_t entry;
441
[92237ca]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);
[1408174]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
[92237ca]459 // Loop over all generated particle in event
460 for(i = 0; i < branchParticle->GetEntriesFast(); ++i)
[1408174]461 {
[92237ca]462
463 particle = (GenParticle*) branchParticle->At(i);
464 genMomentum = particle->P4();
[1408174]465
466 deltaR = 999;
467
[92237ca]468 pt = genMomentum.Pt();
469 eta = TMath::Abs(genMomentum.Eta());
[1408174]470
[92237ca]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();
[1408174]480 // this is simply to avoid warnings from initial state particle
481 // having infite rapidity ...
[92237ca]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 }
[1408174]495
496 if(genMomentum.DeltaR(recoMomentum) < deltaR)
497 {
[92237ca]498 deltaR = genMomentum.DeltaR(recoMomentum);
499 bestRecoMomentum = recoMomentum;
[1408174]500 }
501 }
[92237ca]502
503 histGenPt->Fill(pt);
504 if(deltaR < 0.3) { histRecoPt->Fill(pt); }
505
[1408174]506 }
[92237ca]507 }
508 }
[1408174]509
[92237ca]510 histRecoPt->Sumw2();
511 histGenPt->Sumw2();
[1408174]512
[92237ca]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)
[1408174]570 {
[92237ca]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)
[1408174]584 {
[92237ca]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;
[1408174]593 }
594 }
[92237ca]595
596 histGenEta->Fill(eta);
597 if(deltaR < 0.3) { histRecoEta->Fill(eta); }
598
[1408174]599 }
600 }
601 }
[92237ca]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;
[1408174]611}
[32677fb]612
613
614template<typename T>
[92237ca]615void GetPtres(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t etaMin, Double_t etaMax, ExRootTreeReader *treeReader)
[32677fb]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 {
[92237ca]674 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > etaMin && eta < etaMax)
[32677fb]675 {
[92237ca]676 histos->at(bin).resolHist->Fill(recoMomentum.Pt()/bestGenMomentum.Pt());
[32677fb]677 }
678 }
679 }
680 }
681 }
682}
683
684
[92237ca]685template<typename T>
686void GetEres(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t etaMin, Double_t etaMax, ExRootTreeReader *treeReader)
[1408174]687{
688 Long64_t allEntries = treeReader->GetEntries();
689
[92237ca]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;
[1408174]906
907 Jet *jet, *genjet;
908
[92237ca]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
[85ad2b9]1270
[92237ca]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
[85ad2b9]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)
[92237ca]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");
[b4ec6ac]1333 TClonesArray *branchElectronPF = treeReaderElectron->UseBranch("ElectronPF");
[92237ca]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");
[13cb1b6]1352 TClonesArray *branchPFJet = treeReaderJet->UseBranch("PFJet");
[92237ca]1353 TClonesArray *branchCaloJet = treeReaderJet->UseBranch("CaloJet");
[06a83b3]1354 TClonesArray *branchJet = treeReaderJet->UseBranch("Jet");
[cb159ed]1355
[92237ca]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");
[13cb1b6]1366 TClonesArray *branchMet = treeReaderJet->UseBranch("PFMissingET");
[92237ca]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
[85ad2b9]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(kHAlignRight);
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
[92237ca]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
1459 TGraphErrors gr_trkpi_res_pt[n_etabins], gr_trkpi_eff_pt[n_etabins], gr_trkpi_res_eta[n_ptbins], gr_trkpi_eff_eta[n_ptbins];
1460 TH1D* h_trkpi_eff_pt, *h_trkpi_eff_eta;
1461
1462 std::vector<resolPlot> plots_trkpi_res_pt[n_etabins], plots_trkpi_res_eta[n_ptbins];
1463
1464 // loop over eta bins
1465 for (k = 0; k < etaVals.size()-1; k++)
1466 {
1467 HistogramsCollection(&plots_trkpi_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkpi");
1468 GetPtres<Track>(&plots_trkpi_res_pt[k], branchTrackPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k+1), treeReaderPion);
1469 gr_trkpi_res_pt[k] = EresGraph(&plots_trkpi_res_pt[k]);
1470
1471 h_trkpi_eff_pt = GetEffPt<Track>(branchTrackPion, branchParticlePion, "Pion", 211, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderPion);
1472 gr_trkpi_eff_pt[k] = TGraphErrors(h_trkpi_eff_pt);
1473
1474 s_etaMin = Form("%.1f",etaVals.at(k));
1475 s_etaMax = Form("%.1f",etaVals.at(k+1));
1476
1477 s_eta = "#pi^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax;
1478
1479 gr_trkpi_res_pt[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax);
1480 gr_trkpi_eff_pt[k].SetName("trkEff_"+s_etaMin+"_"+s_etaMax);
1481
1482 addResoGraph(mg_trkpi_res_pt, &gr_trkpi_res_pt[k], leg_trkpi_res_pt, markerStyles.at(k), colors.at(k), s_eta);
1483 addResoGraph(mg_trkpi_eff_pt, &gr_trkpi_eff_pt[k], leg_trkpi_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
1484 }
1485
1486 // loop over pt
1487 for (k = 0; k < ptVals.size(); k++)
1488 {
1489 HistogramsCollectionVsEta(&plots_trkpi_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkpi", 0.0, 2.0);
1490 GetPtresVsEta<Track>(&plots_trkpi_res_eta[k], branchTrackPion, branchParticlePion, 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPion);
1491 gr_trkpi_res_eta[k] = EresGraphVsEta(&plots_trkpi_res_eta[k]);
1492
1493 h_trkpi_eff_eta = GetEffEta<Track>(branchTrackPion, branchParticlePion, "Pion", 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderPion);
1494 gr_trkpi_eff_eta[k] = TGraphErrors(h_trkpi_eff_eta);
1495
1496 s_pt = Form("#pi^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k));
1497 if(ptVals.at(k) >= 1000.) s_pt = Form("#pi^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
1498
1499 addResoGraph(mg_trkpi_res_eta, &gr_trkpi_res_eta[k], leg_trkpi_res_eta, markerStyles.at(k), colors.at(k), s_pt );
1500 addResoGraph(mg_trkpi_eff_eta, &gr_trkpi_eff_eta[k], leg_trkpi_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
1501
1502 }
1503
1504 TCanvas *c_trkpi_res_pt = new TCanvas("","", 800, 600);
1505
1506 mg_trkpi_res_pt->Draw("APE");
1507 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);
1508 leg_trkpi_res_pt->Draw();
[85ad2b9]1509 pave->Draw();
[92237ca]1510
1511 c_trkpi_res_pt->Print(pdfOutput+"(","pdf");
1512 c_trkpi_res_pt->Print(figPath+"img_trkpi_res_pt.pdf","pdf");
1513 c_trkpi_res_pt->Print(figPath+"img_trkpi_res_pt.png","png");
1514
1515 TCanvas *c_trkpi_res_eta = new TCanvas("","", 800, 600);
1516
1517 mg_trkpi_res_eta->Draw("APE");
1518 DrawAxis(mg_trkpi_res_eta, leg_trkpi_res_eta, etaMin, etaMax, 0.01, 100, " #eta ", "(track resolution in p_{T})/p_{T} (%)", false, true);
1519 leg_trkpi_res_eta->Draw();
[85ad2b9]1520 pave->Draw();
[92237ca]1521
1522 c_trkpi_res_eta->Print(pdfOutput,"pdf");
1523 c_trkpi_res_eta->Print(figPath+"img_trkpi_res_eta.pdf","pdf");
1524 c_trkpi_res_eta->Print(figPath+"img_trkpi_res_eta.png","png");
1525
1526 TCanvas *c_trkpi_eff_pt = new TCanvas("","", 800, 600);
1527
1528 mg_trkpi_eff_pt->Draw("APE");
1529 DrawAxis(mg_trkpi_eff_pt, leg_trkpi_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "tracking efficiency (%)", true, false);
1530 leg_trkpi_eff_pt->Draw();
[85ad2b9]1531 pave->Draw();
[92237ca]1532
1533 c_trkpi_eff_pt->Print(pdfOutput,"pdf");
1534 c_trkpi_eff_pt->Print(figPath+"img_trkpi_eff_pt.pdf","pdf");
1535 c_trkpi_eff_pt->Print(figPath+"img_trkpi_eff_pt.png","png");
1536
1537 TCanvas *c_trkpi_eff_eta = new TCanvas("","", 800, 600);
1538
1539 mg_trkpi_eff_eta->Draw("APE");
1540 DrawAxis(mg_trkpi_eff_eta, leg_trkpi_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "tracking efficiency (%)", false, false);
1541 leg_trkpi_eff_eta->Draw();
[85ad2b9]1542 pave->Draw();
1543
[92237ca]1544
1545 c_trkpi_eff_eta->Print(pdfOutput,"pdf");
1546 c_trkpi_eff_eta->Print(figPath+"img_trkpi_eff_eta.pdf","pdf");
1547 c_trkpi_eff_eta->Print(figPath+"img_trkpi_eff_eta.png","png");
1548
1549 // --------- Electron Tracks --------- //
1550
1551 TMultiGraph *mg_trkele_res_pt = new TMultiGraph("","");
1552 TMultiGraph *mg_trkele_eff_pt = new TMultiGraph("","");
1553 TMultiGraph *mg_trkele_res_eta = new TMultiGraph("","");
1554 TMultiGraph *mg_trkele_eff_eta = new TMultiGraph("","");
1555
1556 TLegend *leg_trkele_res_pt = new TLegend(0.55,0.22,0.90,0.48);
1557 TLegend *leg_trkele_eff_pt = (TLegend*)leg_trkele_res_pt->Clone();
1558 TLegend *leg_trkele_res_eta = (TLegend*)leg_trkele_res_pt->Clone();
1559 TLegend *leg_trkele_eff_eta = (TLegend*)leg_trkele_res_eta->Clone();
1560
1561 TGraphErrors gr_trkele_res_pt[n_etabins], gr_trkele_eff_pt[n_etabins], gr_trkele_res_eta[n_ptbins], gr_trkele_eff_eta[n_ptbins];
1562 TH1D* h_trkele_eff_pt, *h_trkele_eff_eta;
1563
1564 std::vector<resolPlot> plots_trkele_res_pt[n_etabins], plots_trkele_res_eta[n_ptbins];
1565
1566 // loop over eta bins
1567 for (k = 0; k < etaVals.size()-1; k++)
1568 {
1569 HistogramsCollection(&plots_trkele_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkele");
1570 GetPtres<Track>(&plots_trkele_res_pt[k], branchTrackElectron, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);
1571 gr_trkele_res_pt[k] = EresGraph(&plots_trkele_res_pt[k]);
1572
1573 h_trkele_eff_pt = GetEffPt<Track>(branchTrackElectron, branchParticleElectron, "Electron", 11, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);
1574 gr_trkele_eff_pt[k] = TGraphErrors(h_trkele_eff_pt);
1575
1576 s_etaMin = Form("%.1f",etaVals.at(k));
1577 s_etaMax = Form("%.1f",etaVals.at(k+1));
1578
1579 s_eta = "e^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax;
1580
1581 gr_trkele_res_pt[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax);
1582 gr_trkele_eff_pt[k].SetName("trkEff_"+s_etaMin+"_"+s_etaMax);
1583
1584 addResoGraph(mg_trkele_res_pt, &gr_trkele_res_pt[k], leg_trkele_res_pt, markerStyles.at(k), colors.at(k), s_eta);
1585 addResoGraph(mg_trkele_eff_pt, &gr_trkele_eff_pt[k], leg_trkele_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
1586 }
1587
1588 // loop over pt
1589 for (k = 0; k < ptVals.size(); k++)
1590 {
1591 HistogramsCollectionVsEta(&plots_trkele_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkele", 0.0, 2.0);
1592 GetPtresVsEta<Track>(&plots_trkele_res_eta[k], branchTrackElectron, branchParticleElectron, 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderElectron);
1593 gr_trkele_res_eta[k] = EresGraphVsEta(&plots_trkele_res_eta[k]);
1594
1595 h_trkele_eff_eta = GetEffEta<Track>(branchTrackElectron, branchParticleElectron, "Electron", 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderElectron);
1596 gr_trkele_eff_eta[k] = TGraphErrors(h_trkele_eff_eta);
1597
1598 s_pt = Form("e^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k));
1599 if(ptVals.at(k) >= 1000.) s_pt = Form("e^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
1600
1601 addResoGraph(mg_trkele_res_eta, &gr_trkele_res_eta[k], leg_trkele_res_eta, markerStyles.at(k), colors.at(k), s_pt );
1602 addResoGraph(mg_trkele_eff_eta, &gr_trkele_eff_eta[k], leg_trkele_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
1603
1604 }
1605
1606 TCanvas *c_trkele_res_pt = new TCanvas("","", 800, 600);
1607
1608 mg_trkele_res_pt->Draw("APE");
1609 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);
1610 leg_trkele_res_pt->Draw();
[85ad2b9]1611 pave->Draw();
[92237ca]1612
1613 c_trkele_res_pt->Print(pdfOutput,"pdf");
1614 c_trkele_res_pt->Print(figPath+"img_trkele_res_pt.pdf","pdf");
1615 c_trkele_res_pt->Print(figPath+"img_trkele_res_pt.png","png");
1616
1617 TCanvas *c_trkele_res_eta = new TCanvas("","", 800, 600);
1618
1619 mg_trkele_res_eta->Draw("APE");
1620 DrawAxis(mg_trkele_res_eta, leg_trkele_res_eta, etaMin, etaMax, 0.01, 100, " #eta ", "(track resolution in p_{T})/p_{T} (%)", false, true);
1621 leg_trkele_res_eta->Draw();
[85ad2b9]1622 pave->Draw();
[92237ca]1623
1624 c_trkele_res_eta->Print(pdfOutput,"pdf");
1625 c_trkele_res_eta->Print(figPath+"img_trkele_res_eta.pdf","pdf");
1626 c_trkele_res_eta->Print(figPath+"img_trkele_res_eta.png","png");
1627
1628 TCanvas *c_trkele_eff_pt = new TCanvas("","", 800, 600);
1629
1630 mg_trkele_eff_pt->Draw("APE");
1631 DrawAxis(mg_trkele_eff_pt, leg_trkele_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "tracking efficiency (%)", true, false);
1632 leg_trkele_eff_pt->Draw();
[85ad2b9]1633 pave->Draw();
[92237ca]1634
1635 c_trkele_eff_pt->Print(pdfOutput,"pdf");
1636 c_trkele_eff_pt->Print(figPath+"img_trkele_eff_pt.pdf","pdf");
1637 c_trkele_eff_pt->Print(figPath+"img_trkele_eff_pt.png","png");
1638
1639 TCanvas *c_trkele_eff_eta = new TCanvas("","", 800, 600);
1640
1641 mg_trkele_eff_eta->Draw("APE");
1642 DrawAxis(mg_trkele_eff_eta, leg_trkele_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "tracking efficiency (%)", false, false);
1643 leg_trkele_eff_eta->Draw();
[85ad2b9]1644 pave->Draw();
[92237ca]1645
1646 c_trkele_eff_eta->Print(pdfOutput,"pdf");
1647 c_trkele_eff_eta->Print(figPath+"img_trkele_eff_eta.pdf","pdf");
1648 c_trkele_eff_eta->Print(figPath+"img_trkele_eff_eta.png","png");
1649
1650
1651 // --------- Muon Tracks --------- //
1652
1653 TMultiGraph *mg_trkmu_res_pt = new TMultiGraph("","");
1654 TMultiGraph *mg_trkmu_eff_pt = new TMultiGraph("","");
1655 TMultiGraph *mg_trkmu_res_eta = new TMultiGraph("","");
1656 TMultiGraph *mg_trkmu_eff_eta = new TMultiGraph("","");
1657
1658 TLegend *leg_trkmu_res_pt = new TLegend(0.55,0.22,0.90,0.48);
1659 TLegend *leg_trkmu_eff_pt = (TLegend*)leg_trkmu_res_pt->Clone();
1660
1661 TLegend *leg_trkmu_res_eta = (TLegend*)leg_trkmu_res_pt->Clone();
1662 TLegend *leg_trkmu_eff_eta = (TLegend*)leg_trkmu_res_eta->Clone();
1663
1664
1665 TGraphErrors gr_trkmu_res_pt[n_etabins], gr_trkmu_eff_pt[n_etabins], gr_trkmu_res_eta[n_ptbins], gr_trkmu_eff_eta[n_ptbins];
1666 TH1D* h_trkmu_eff_pt, *h_trkmu_eff_eta;
1667
1668 std::vector<resolPlot> plots_trkmu_res_pt[n_etabins], plots_trkmu_res_eta[n_ptbins];
1669
1670 // loop over eta bins
1671 for (k = 0; k < etaVals.size()-1; k++)
1672 {
1673 HistogramsCollection(&plots_trkmu_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkmu");
1674 GetPtres<Track>(&plots_trkmu_res_pt[k], branchTrackMuon, branchParticleMuon, 13, etaVals.at(k), etaVals.at(k+1), treeReaderMuon);
1675 gr_trkmu_res_pt[k] = EresGraph(&plots_trkmu_res_pt[k]);
1676
1677 h_trkmu_eff_pt = GetEffPt<Track>(branchTrackMuon, branchParticleMuon, "Muon", 13, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderMuon);
1678 gr_trkmu_eff_pt[k] = TGraphErrors(h_trkmu_eff_pt);
1679
1680 s_etaMin = Form("%.1f",etaVals.at(k));
1681 s_etaMax = Form("%.1f",etaVals.at(k+1));
1682
1683 s_eta = "#mu^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax;
1684
1685 gr_trkmu_res_pt[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax);
1686 gr_trkmu_eff_pt[k].SetName("trkEff_"+s_etaMin+"_"+s_etaMax);
1687
1688 addResoGraph(mg_trkmu_res_pt, &gr_trkmu_res_pt[k], leg_trkmu_res_pt, markerStyles.at(k), colors.at(k), s_eta);
1689 addResoGraph(mg_trkmu_eff_pt, &gr_trkmu_eff_pt[k], leg_trkmu_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
1690 }
1691
1692 // loop over pt
1693 for (k = 0; k < ptVals.size(); k++)
1694 {
1695 HistogramsCollectionVsEta(&plots_trkmu_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkmu", 0.0, 2.0);
1696 GetPtresVsEta<Track>(&plots_trkmu_res_eta[k], branchTrackMuon, branchParticleMuon, 13, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderMuon);
1697 gr_trkmu_res_eta[k] = EresGraphVsEta(&plots_trkmu_res_eta[k]);
1698
1699 h_trkmu_eff_eta = GetEffEta<Track>(branchTrackMuon, branchParticleMuon, "Muon", 13, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderMuon);
1700 gr_trkmu_eff_eta[k] = TGraphErrors(h_trkmu_eff_eta);
1701
1702 s_pt = Form("#mu^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k));
1703 if(ptVals.at(k) >= 1000.) s_pt = Form("#mu^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
1704
1705 addResoGraph(mg_trkmu_res_eta, &gr_trkmu_res_eta[k], leg_trkmu_res_eta, markerStyles.at(k), colors.at(k), s_pt );
1706 addResoGraph(mg_trkmu_eff_eta, &gr_trkmu_eff_eta[k], leg_trkmu_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
1707
1708 }
1709
1710 TCanvas *c_trkmu_res_pt = new TCanvas("","", 800, 600);
1711
1712 mg_trkmu_res_pt->Draw("APE");
1713 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);
1714 leg_trkmu_res_pt->Draw();
[85ad2b9]1715 pave->Draw();
[92237ca]1716
1717 c_trkmu_res_pt->Print(pdfOutput,"pdf");
1718 c_trkmu_res_pt->Print(figPath+"img_trkmu_res_pt.pdf","pdf");
1719 c_trkmu_res_pt->Print(figPath+"img_trkmu_res_pt.png","png");
1720
1721 TCanvas *c_trkmu_res_eta = new TCanvas("","", 800, 600);
1722
1723 mg_trkmu_res_eta->Draw("APE");
1724 DrawAxis(mg_trkmu_res_eta, leg_trkmu_res_eta, etaMin, etaMax, 0.01, 100, " #eta ", "(track resolution in p_{T})/p_{T} (%)", false, true);
1725 leg_trkmu_res_eta->Draw();
[85ad2b9]1726 pave->Draw();
[92237ca]1727
1728 c_trkmu_res_eta->Print(pdfOutput,"pdf");
1729 c_trkmu_res_eta->Print(figPath+"img_trkmu_res_eta.pdf","pdf");
1730 c_trkmu_res_eta->Print(figPath+"img_trkmu_res_eta.png","png");
1731
1732 TCanvas *c_trkmu_eff_pt = new TCanvas("","", 800, 600);
1733
1734 mg_trkmu_eff_pt->Draw("APE");
1735 DrawAxis(mg_trkmu_eff_pt, leg_trkmu_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "tracking efficiency (%)", true, false);
1736 leg_trkmu_eff_pt->Draw();
[85ad2b9]1737 pave->Draw();
[92237ca]1738
1739 c_trkmu_eff_pt->Print(pdfOutput,"pdf");
1740 c_trkmu_eff_pt->Print(figPath+"img_trkmu_eff_pt.pdf","pdf");
1741 c_trkmu_eff_pt->Print(figPath+"img_trkmu_eff_pt.png","png");
1742
1743 TCanvas *c_trkmu_eff_eta = new TCanvas("","", 800, 600);
1744
1745 mg_trkmu_eff_eta->Draw("APE");
1746 DrawAxis(mg_trkmu_eff_eta, leg_trkmu_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "tracking efficiency (%)", false, false);
1747 leg_trkmu_eff_eta->Draw();
[85ad2b9]1748 pave->Draw();
[92237ca]1749
1750 c_trkmu_eff_eta->Print(pdfOutput,"pdf");
1751 c_trkmu_eff_eta->Print(figPath+"img_trkmu_eff_eta.pdf","pdf");
1752 c_trkmu_eff_eta->Print(figPath+"img_trkmu_eff_eta.png","png");
1753
1754
1755 //////////////////////
1756 // Ecal performance //
1757 //////////////////////
1758
1759
1760 TMultiGraph *mg_ecal_res_e = new TMultiGraph("","");
1761 TMultiGraph *mg_ecal_res_eta = new TMultiGraph("","");
1762
1763 TLegend *leg_ecal_res_e = new TLegend(0.55,0.64,0.90,0.90);
1764 TLegend *leg_ecal_res_eta = new TLegend(0.60,0.59,0.95,0.90);
1765
1766 TGraphErrors gr_ecal_res_e[n_etabins], gr_ecal_res_eta[n_ptbins];
1767
1768 std::vector<resolPlot> plots_ecal_res_e[n_etabins], plots_ecal_res_eta[n_ptbins];
1769
1770 // loop over eta bins
1771 for (k = 0; k < etaVals.size()-1; k++)
1772 {
1773 HistogramsCollection(&plots_ecal_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "ecal");
1774 GetEres<Tower>(&plots_ecal_res_e[k], branchTowerPhoton, branchParticlePhoton, 22, etaVals.at(k), etaVals.at(k+1), treeReaderPhoton);
1775 gr_ecal_res_e[k] = EresGraph(&plots_ecal_res_e[k]);
1776
1777 s_etaMin = Form("%.1f",etaVals.at(k));
1778 s_etaMax = Form("%.1f",etaVals.at(k+1));
1779
1780 s_eta = "#gamma , " + s_etaMin + " < | #eta | < "+s_etaMax;
1781
1782 gr_ecal_res_e[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax);
1783
1784 addResoGraph(mg_ecal_res_e, &gr_ecal_res_e[k], leg_ecal_res_e, markerStyles.at(k), colors.at(k), s_eta);
1785 }
1786
1787 // loop over pt
1788 for (k = 0; k < ptVals.size(); k++)
1789 {
1790 HistogramsCollectionVsEta(&plots_ecal_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "ecal", 0.0, 2.0);
1791 GetEresVsEta<Tower>(&plots_ecal_res_eta[k], branchTowerPhoton, branchParticlePhoton, 22, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPhoton);
1792 gr_ecal_res_eta[k] = EresGraphVsEta(&plots_ecal_res_eta[k]);
1793
1794 s_e = Form("#gamma , E = %.0f GeV",ptVals.at(k));
1795 if(ptVals.at(k) >= 1000.) s_e = Form("#gamma , E = %.0f TeV",ptVals.at(k)/1000.);
1796
1797 addResoGraph(mg_ecal_res_eta, &gr_ecal_res_eta[k], leg_ecal_res_eta, markerStyles.at(k), colors.at(k), s_e );
1798 }
1799
1800 TCanvas *c_ecal_res_e = new TCanvas("","", 800, 600);
1801
1802 mg_ecal_res_e->Draw("APE");
1803 // DrawAxis(mg_ecal_res_e, leg_ecal_res_e, ptMin, ptMax, 0.5, 100, "E [GeV]", "(ECAL resolution in E)/E (%)", true, true);
1804 DrawAxis(mg_ecal_res_e, leg_ecal_res_e, ptMin, ptMax, 0.0, 20, "E [GeV]", "(ECAL resolution in E)/E (%)", true, false);
1805 leg_ecal_res_e->Draw();
[85ad2b9]1806 pave->Draw();
[92237ca]1807
1808 c_ecal_res_e->Print(pdfOutput,"pdf");
1809 c_ecal_res_e->Print(figPath+"img_ecal_res_e.pdf","pdf");
1810 c_ecal_res_e->Print(figPath+"img_ecal_res_e.png","png");
1811
1812 TCanvas *c_ecal_res_eta = new TCanvas("","", 800, 600);
1813
1814 mg_ecal_res_eta->Draw("APE");
1815 //DrawAxis(mg_ecal_res_eta, leg_ecal_res_eta, etaMin, etaMax, 0.5, 100, " #eta ", "(ECAL resolution in E)/E (%)", false, true);
1816 DrawAxis(mg_ecal_res_eta, leg_ecal_res_eta, etaMin, etaMax, 0.0, 20, " #eta ", "(ECAL resolution in E)/E (%)", false, false);
1817 leg_ecal_res_eta->Draw();
[85ad2b9]1818 pave->Draw();
[92237ca]1819
1820 c_ecal_res_eta->Print(pdfOutput,"pdf");
1821 c_ecal_res_eta->Print(figPath+"img_ecal_res_eta.pdf","pdf");
1822 c_ecal_res_eta->Print(figPath+"img_ecal_res_eta.png","png");
1823
1824 //////////////////////
1825 // Hcal performance //
1826 //////////////////////
1827
1828
1829 TMultiGraph *mg_hcal_res_e = new TMultiGraph("","");
1830 TMultiGraph *mg_hcal_res_eta = new TMultiGraph("","");
1831
1832 TLegend *leg_hcal_res_e = new TLegend(0.55,0.64,0.90,0.90);
1833 TLegend *leg_hcal_res_eta = new TLegend(0.60,0.59,0.95,0.90);
1834
1835 TGraphErrors gr_hcal_res_e[n_etabins], gr_hcal_res_eta[n_ptbins];
1836
1837 std::vector<resolPlot> plots_hcal_res_e[n_etabins], plots_hcal_res_eta[n_ptbins];
1838
1839 // loop over eta bins
1840 for (k = 0; k < etaVals.size()-1; k++)
1841 {
1842 HistogramsCollection(&plots_hcal_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "hcal");
1843 GetEres<Tower>(&plots_hcal_res_e[k], branchTowerNeutralHadron, branchParticleNeutralHadron, 2112, etaVals.at(k), etaVals.at(k+1), treeReaderNeutralHadron);
1844
1845 gr_hcal_res_e[k] = EresGraph(&plots_hcal_res_e[k]);
1846
1847 s_etaMin = Form("%.1f",etaVals.at(k));
1848 s_etaMax = Form("%.1f",etaVals.at(k+1));
1849
1850 s_eta = "n , " + s_etaMin + " < | #eta | < "+s_etaMax;
1851
1852 gr_hcal_res_e[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax);
1853
1854 addResoGraph(mg_hcal_res_e, &gr_hcal_res_e[k], leg_hcal_res_e, markerStyles.at(k), colors.at(k), s_eta);
1855 }
1856
1857 // loop over pt
1858 for (k = 0; k < ptVals.size(); k++)
1859 {
1860 HistogramsCollectionVsEta(&plots_hcal_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "hcal", 0.0, 2.0);
1861 GetEresVsEta<Tower>(&plots_hcal_res_eta[k], branchTowerNeutralHadron, branchParticleNeutralHadron, 2112, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderNeutralHadron);
1862 gr_hcal_res_eta[k] = EresGraphVsEta(&plots_hcal_res_eta[k]);
1863
1864 s_e = Form("n , E = %.0f GeV",ptVals.at(k));
1865 if(ptVals.at(k) >= 1000.) s_e = Form("n , E = %.0f TeV",ptVals.at(k)/1000.);
1866
1867 addResoGraph(mg_hcal_res_eta, &gr_hcal_res_eta[k], leg_hcal_res_eta, markerStyles.at(k), colors.at(k), s_e );
1868 }
1869
1870
1871 TCanvas *c_hcal_res_e = new TCanvas("","", 800, 600);
1872
1873 mg_hcal_res_e->Draw("APE");
1874 //DrawAxis(mg_hcal_res_e, leg_hcal_res_e, ptMin, ptMax, 1, 100, "E [GeV]", "(HCAL resolution in E)/E (%)", true, true);
1875 DrawAxis(mg_hcal_res_e, leg_hcal_res_e, ptMin, ptMax, 0.0, 50, "E [GeV]", "(HCAL resolution in E)/E (%)", true, false);
1876 leg_hcal_res_e->Draw();
[85ad2b9]1877 pave->Draw();
[92237ca]1878
1879 c_hcal_res_e->Print(pdfOutput,"pdf");
1880 c_hcal_res_e->Print(figPath+"img_hcal_res_e.pdf","pdf");
1881 c_hcal_res_e->Print(figPath+"img_hcal_res_e.png","png");
1882
1883 TCanvas *c_hcal_res_eta = new TCanvas("","", 800, 600);
1884
1885 mg_hcal_res_eta->Draw("APE");
1886 //DrawAxis(mg_hcal_res_eta, leg_hcal_res_eta, etaMin, etaMax, 1, 100, " #eta ", "(HCAL resolution in E)/E (%)", false, true);
1887 DrawAxis(mg_hcal_res_eta, leg_hcal_res_eta, etaMin, etaMax, 0.0, 50, " #eta ", "(HCAL resolution in E)/E (%)", false, false);
1888 leg_hcal_res_eta->Draw();
[85ad2b9]1889 pave->Draw();
[92237ca]1890
1891 c_hcal_res_eta->Print(pdfOutput,"pdf");
1892 c_hcal_res_eta->Print(figPath+"img_hcal_res_eta.pdf","pdf");
1893 c_hcal_res_eta->Print(figPath+"img_hcal_res_eta.png","png");
1894
1895 ////////////////////
1896 // PF - electrons //
1897 ////////////////////
1898
1899 TMultiGraph *mg_pfele_res_e[n_etabins];
1900 TMultiGraph *mg_pfele_res_eta[n_ptbins];
1901
1902 TLegend *leg_pfele_res_e[n_etabins];
1903 TLegend *leg_pfele_res_eta[n_ptbins];
1904
1905 TGraphErrors gr_pfele_res_e[n_etabins];
1906 TGraphErrors gr_pfele_res_eta[n_ptbins];
1907
[cb159ed]1908 TGraphErrors gr_trkele_res_e[n_etabins];
1909 TGraphErrors gr_trkele_res_eeta[n_ptbins];
1910
[92237ca]1911 std::vector<resolPlot> plots_pfele_res_e[n_etabins], plots_pfele_res_eta[n_ptbins];
[cb159ed]1912 std::vector<resolPlot> plots_trkele_res_e[n_etabins], plots_trkele_res_eeta[n_ptbins];
[92237ca]1913
1914 TCanvas *c_pfele_res_e[n_etabins];
1915 TCanvas *c_pfele_res_eta[n_ptbins];
1916
1917
1918 // loop over eta bins
1919 for (k = 0; k < etaVals.size()-1; k++)
1920 {
1921 mg_pfele_res_e[k] = new TMultiGraph("","");
1922 leg_pfele_res_e[k] = new TLegend(0.40,0.60,0.75,0.90);
1923
1924 HistogramsCollection(&plots_pfele_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfele");
[b4ec6ac]1925 GetEres<Electron>(&plots_pfele_res_e[k], branchElectronPF, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);
[92237ca]1926 gr_pfele_res_e[k] = EresGraph(&plots_pfele_res_e[k]);
1927
[cb159ed]1928 HistogramsCollection(&plots_trkele_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkele");
1929 GetEres<Track>(&plots_trkele_res_e[k], branchTrackElectron, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);
1930 gr_trkele_res_e[k] = EresGraph(&plots_trkele_res_e[k]);
1931
[92237ca]1932 s_etaMin = Form("%.1f",etaVals.at(k));
1933 s_etaMax = Form("%.1f",etaVals.at(k+1));
1934 s_eta = "e^{ #pm}, "+ s_etaMin + " < | #eta | < " + s_etaMax;
1935
1936 leg_pfele_res_e[k]->SetTextFont(132);
1937 leg_pfele_res_e[k]->SetHeader(s_eta);
1938
[b4ec6ac]1939 addResoGraph(mg_pfele_res_e[k], &gr_ecal_res_e[k], leg_pfele_res_e[k], markerStyles.at(0), colors.at(0), "ECAL");
[cb159ed]1940 addResoGraph(mg_pfele_res_e[k], &gr_trkele_res_e[k], leg_pfele_res_e[k], markerStyles.at(1), colors.at(1), "Track");
[b4ec6ac]1941 addResoGraph(mg_pfele_res_e[k], &gr_pfele_res_e[k], leg_pfele_res_e[k], markerStyles.at(2), colors.at(2), "Particle-flow");
[92237ca]1942
1943 c_pfele_res_e[k] = new TCanvas("","", 800, 600);
1944
1945 mg_pfele_res_e[k]->Draw("APE");
1946 //DrawAxis(mg_pfele_res_e[k], leg_pfele_res_e[k], ptMin, ptMax, 0.1, 100, "E [GeV]", "(resolution in E)/E (%)", true, true);
1947 DrawAxis(mg_pfele_res_e[k], leg_pfele_res_e[k], ptMin, ptMax, 0.0, 20, "E [GeV]", "(resolution in E)/E (%)", true, false);
1948 leg_pfele_res_e[k]->Draw();
[85ad2b9]1949 pave->Draw();
[92237ca]1950
1951 TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_";
1952
1953 c_pfele_res_e[k]->Print(pdfOutput,"pdf");
1954 c_pfele_res_e[k]->Print(figPath+"img_pfele_res_"+s_etarange+"e.pdf","pdf");
1955 c_pfele_res_e[k]->Print(figPath+"img_pfele_res_"+s_etarange+"e.png","png");
1956
1957 }
1958
1959
1960 // loop over eta bins
1961 for (k = 0; k < ptVals.size(); k++)
1962 {
1963
1964 mg_pfele_res_eta[k] = new TMultiGraph("","");
1965 leg_pfele_res_eta[k] = new TLegend(0.40,0.60,0.75,0.90);
1966
1967 HistogramsCollectionVsEta(&plots_pfele_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "pfele", 0.0, 2.0);
[b4ec6ac]1968 GetEresVsEta<Electron>(&plots_pfele_res_eta[k], branchElectronPF, branchParticleElectron, 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderElectron);
[92237ca]1969 gr_pfele_res_eta[k] = EresGraphVsEta(&plots_pfele_res_eta[k]);
1970
[cb159ed]1971 HistogramsCollectionVsEta(&plots_trkele_res_eeta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkele", 0.0, 2.0);
1972 GetEresVsEta<Track>(&plots_trkele_res_eeta[k], branchTrackElectron, branchParticleElectron, 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderElectron);
1973 gr_trkele_res_eeta[k] = EresGraphVsEta(&plots_trkele_res_eeta[k]);
1974
[92237ca]1975 s_e = Form("e^{ #pm}, E = %.0f GeV",ptVals.at(k));
1976 if(ptVals.at(k) >= 1000.) s_e = Form("e^{ #pm}, E = %.0f TeV",ptVals.at(k)/1000.);
1977
1978
1979 leg_pfele_res_eta[k]->SetTextFont(132);
1980 leg_pfele_res_eta[k]->SetHeader(s_e);
1981
[b4ec6ac]1982 addResoGraph(mg_pfele_res_eta[k], &gr_ecal_res_eta[k], leg_pfele_res_eta[k], markerStyles.at(0), colors.at(0), "ECAL");
[cb159ed]1983 addResoGraph(mg_pfele_res_eta[k], &gr_trkele_res_eeta[k], leg_pfele_res_eta[k], markerStyles.at(1), colors.at(1), "Track");
[b4ec6ac]1984 addResoGraph(mg_pfele_res_eta[k], &gr_pfele_res_eta[k], leg_pfele_res_eta[k], markerStyles.at(2), colors.at(2), "Particle-flow");
[92237ca]1985
1986 c_pfele_res_eta[k] = new TCanvas("","", 800, 600);
1987
1988 mg_pfele_res_eta[k]->Draw("APE");
1989 //DrawAxis(mg_pfele_res_eta[k], leg_pfele_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true);
1990 DrawAxis(mg_pfele_res_eta[k], leg_pfele_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false);
1991 leg_pfele_res_eta[k]->Draw();
[85ad2b9]1992 pave->Draw();
[92237ca]1993
1994 TString s_ptrange = Form("pt_%.0f_",ptVals.at(k));
1995
1996 c_pfele_res_eta[k]->Print(pdfOutput,"pdf");
1997 c_pfele_res_eta[k]->Print(figPath+"img_pfele_res_"+s_ptrange+"eta.pdf","pdf");
1998 c_pfele_res_eta[k]->Print(figPath+"img_pfele_res_"+s_ptrange+"eta.png","png");
1999
2000 }
2001
2002 /////////////////
2003 // PF - Pions //
2004 /////////////////
2005
2006 TMultiGraph *mg_pfpi_res_e[n_etabins];
2007 TMultiGraph *mg_pfpi_res_eta[n_ptbins];
2008
2009 TLegend *leg_pfpi_res_e[n_etabins];
2010 TLegend *leg_pfpi_res_eta[n_ptbins];
2011
2012 TGraphErrors gr_pfpi_res_e[n_etabins];
2013 TGraphErrors gr_pfpi_res_eta[n_ptbins];
2014
[cb159ed]2015 TGraphErrors gr_trkpi_res_e[n_etabins];
2016 TGraphErrors gr_trkpi_res_eeta[n_ptbins];
2017
[92237ca]2018 std::vector<resolPlot> plots_pfpi_res_e[n_etabins], plots_pfpi_res_eta[n_ptbins];
[cb159ed]2019 std::vector<resolPlot> plots_trkpi_res_e[n_etabins], plots_trkpi_res_eeta[n_ptbins];
[92237ca]2020
2021 TCanvas *c_pfpi_res_e[n_etabins];
2022 TCanvas *c_pfpi_res_eta[n_ptbins];
2023
2024
2025 // loop over eta bins
2026 for (k = 0; k < etaVals.size()-1; k++)
2027 {
2028 mg_pfpi_res_e[k] = new TMultiGraph("","");
2029 leg_pfpi_res_e[k] = new TLegend(0.40,0.60,0.75,0.90);
2030
2031 HistogramsCollection(&plots_pfpi_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfpi");
2032 GetEres<Track>(&plots_pfpi_res_e[k], branchPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k+1), treeReaderPion);
2033 gr_pfpi_res_e[k] = EresGraph(&plots_pfpi_res_e[k]);
2034
[cb159ed]2035 HistogramsCollection(&plots_trkpi_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkpi");
2036 GetEres<Track>(&plots_trkpi_res_e[k], branchTrackPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k+1), treeReaderPion);
2037 gr_trkpi_res_e[k] = EresGraph(&plots_trkpi_res_e[k]);
2038
2039
[92237ca]2040 s_etaMin = Form("%.1f",etaVals.at(k));
2041 s_etaMax = Form("%.1f",etaVals.at(k+1));
2042 s_eta = "#pi^{ #pm}, "+ s_etaMin + " < | #eta | < " + s_etaMax;
2043
2044 leg_pfpi_res_e[k]->SetTextFont(132);
2045 leg_pfpi_res_e[k]->SetHeader(s_eta);
2046
[b4ec6ac]2047 addResoGraph(mg_pfpi_res_e[k], &gr_hcal_res_e[k], leg_pfpi_res_e[k], markerStyles.at(0), colors.at(0), "HCAL");
[cb159ed]2048 addResoGraph(mg_pfpi_res_e[k], &gr_trkpi_res_e[k], leg_pfpi_res_e[k], markerStyles.at(1), colors.at(1), "Track");
[b4ec6ac]2049 addResoGraph(mg_pfpi_res_e[k], &gr_pfpi_res_e[k], leg_pfpi_res_e[k], markerStyles.at(2), colors.at(2), "Particle-flow");
[92237ca]2050
2051 c_pfpi_res_e[k] = new TCanvas("","", 800, 600);
2052
2053 mg_pfpi_res_e[k]->Draw("APE");
2054 //DrawAxis(mg_pfpi_res_e[k], leg_pfpi_res_e[k], ptMin, ptMax, 0.1, 100, "E [GeV]", "(resolution in E)/E (%)", true, true);
2055 DrawAxis(mg_pfpi_res_e[k], leg_pfpi_res_e[k], ptMin, ptMax, 0.1, 50, "E [GeV]", "(resolution in E)/E (%)", true, false);
2056 leg_pfpi_res_e[k]->Draw();
[85ad2b9]2057 pave->Draw();
[92237ca]2058
2059 TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_";
2060
2061 c_pfpi_res_e[k]->Print(pdfOutput,"pdf");
2062 c_pfpi_res_e[k]->Print(figPath+"img_pfpi_res_"+s_etarange+"e.pdf","pdf");
2063 c_pfpi_res_e[k]->Print(figPath+"img_pfpi_res_"+s_etarange+"e.png","png");
2064
2065 }
2066
2067
2068 // loop over eta bins
2069 for (k = 0; k < ptVals.size(); k++)
2070 {
2071
2072 mg_pfpi_res_eta[k] = new TMultiGraph("","");
2073 leg_pfpi_res_eta[k] = new TLegend(0.40,0.60,0.75,0.90);
2074
2075 HistogramsCollectionVsEta(&plots_pfpi_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "pfpi", 0.0, 2.0);
2076 GetEresVsEta<Track>(&plots_pfpi_res_eta[k], branchPion, branchParticlePion, 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPion);
2077 gr_pfpi_res_eta[k] = EresGraphVsEta(&plots_pfpi_res_eta[k]);
2078
[cb159ed]2079 HistogramsCollectionVsEta(&plots_trkpi_res_eeta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkpi", 0.0, 2.0);
2080 GetEresVsEta<Track>(&plots_trkpi_res_eeta[k], branchPion, branchParticlePion, 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPion);
2081 gr_trkpi_res_eeta[k] = EresGraphVsEta(&plots_trkpi_res_eeta[k]);
2082
2083
[92237ca]2084 s_e = Form("#pi^{ #pm}, E = %.0f GeV",ptVals.at(k));
2085 if(ptVals.at(k) >= 1000.) s_e = Form("#pi^{ #pm}, E = %.0f TeV",ptVals.at(k)/1000.);
2086
2087 leg_pfpi_res_eta[k]->SetTextFont(132);
2088 leg_pfpi_res_eta[k]->SetHeader(s_e);
2089
[b4ec6ac]2090 addResoGraph(mg_pfpi_res_eta[k], &gr_hcal_res_eta[k], leg_pfpi_res_eta[k], markerStyles.at(0), colors.at(0), "HCAL");
[cb159ed]2091 addResoGraph(mg_pfpi_res_eta[k], &gr_trkpi_res_eeta[k], leg_pfpi_res_eta[k], markerStyles.at(1), colors.at(1), "Track");
[b4ec6ac]2092 addResoGraph(mg_pfpi_res_eta[k], &gr_pfpi_res_eta[k], leg_pfpi_res_eta[k], markerStyles.at(2), colors.at(2), "Particle-flow");
[92237ca]2093
2094 c_pfpi_res_eta[k] = new TCanvas("","", 800, 600);
2095
2096 mg_pfpi_res_eta[k]->Draw("APE");
2097 //DrawAxis(mg_pfpi_res_eta[k], leg_pfpi_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true);
2098 DrawAxis(mg_pfpi_res_eta[k], leg_pfpi_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false);
2099 leg_pfpi_res_eta[k]->Draw();
[85ad2b9]2100 pave->Draw();
[92237ca]2101
2102 TString s_ptrange = Form("pt_%.0f_",ptVals.at(k));
2103
2104 c_pfpi_res_eta[k]->Print(pdfOutput,"pdf");
2105 c_pfpi_res_eta[k]->Print(figPath+"img_pfpi_res_"+s_ptrange+"eta.pdf","pdf");
2106 c_pfpi_res_eta[k]->Print(figPath+"img_pfpi_res_"+s_ptrange+"eta.png","png");
2107
2108 }
2109
2110
2111 /////////////////
2112 // PF - jets //
2113 /////////////////
2114
2115 TMultiGraph *mg_pfjet_res_e[n_etabins];
2116 TMultiGraph *mg_pfjet_res_eta[n_ptbins];
2117
2118 TLegend *leg_pfjet_res_e[n_etabins];
2119 TLegend *leg_pfjet_res_eta[n_ptbins];
2120
2121 TGraphErrors gr_pfjet_res_e[n_etabins];
2122 TGraphErrors gr_pfjet_res_eta[n_ptbins];
2123
2124 TGraphErrors gr_cajet_res_e[n_etabins];
2125 TGraphErrors gr_cajet_res_eta[n_ptbins];
2126
2127 std::vector<resolPlot> plots_pfjet_res_e[n_etabins], plots_pfjet_res_eta[n_ptbins];
2128 std::vector<resolPlot> plots_cajet_res_e[n_etabins], plots_cajet_res_eta[n_ptbins];
2129
2130 TCanvas *c_pfjet_res_e[n_etabins];
2131 TCanvas *c_pfjet_res_eta[n_ptbins];
2132
2133
2134 // loop over eta bins
2135 for (k = 0; k < etaVals.size()-1; k++)
2136 {
2137
2138 mg_pfjet_res_e[k] = new TMultiGraph("","");
[b4ec6ac]2139 leg_pfjet_res_e[k] = new TLegend(0.40,0.70,0.90,0.90);
[92237ca]2140
2141 HistogramsCollection(&plots_pfjet_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfjet");
2142 HistogramsCollection(&plots_cajet_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "cajet");
2143
2144 GetJetsEres(&plots_pfjet_res_e[k], branchPFJet, branchGenJet, treeReaderJet, etaVals.at(k), etaVals.at(k+1));
2145 GetJetsEres(&plots_cajet_res_e[k], branchCaloJet, branchGenJet, treeReaderJet, etaVals.at(k), etaVals.at(k+1));
2146
2147 gr_pfjet_res_e[k] = EresGraph(&plots_pfjet_res_e[k]);
2148 gr_cajet_res_e[k] = EresGraph(&plots_cajet_res_e[k]);
2149
2150 s_etaMin = Form("%.1f",etaVals.at(k));
2151 s_etaMax = Form("%.1f",etaVals.at(k+1));
[b4ec6ac]2152 s_eta = "anti-k_{T}, R = 0.4, "+ s_etaMin + " < | #eta | < " + s_etaMax;
[92237ca]2153
2154 leg_pfjet_res_e[k]->SetTextFont(132);
2155 leg_pfjet_res_e[k]->SetHeader(s_eta);
2156
[b4ec6ac]2157 addResoGraph(mg_pfjet_res_e[k], &gr_cajet_res_e[k], leg_pfjet_res_e[k], markerStyles.at(0), colors.at(0), "Calorimeter Jets");
2158 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");
[92237ca]2159
2160 c_pfjet_res_e[k] = new TCanvas("","", 800, 600);
2161
2162 mg_pfjet_res_e[k]->Draw("APE");
2163 //DrawAxis(mg_pfjet_res_e[k], leg_pfjet_res_e[k], 10, ptMax, 0.5, 100, "E [GeV]", "(resolution in E)/E (%)", true, true);
2164 DrawAxis(mg_pfjet_res_e[k], leg_pfjet_res_e[k], 10, ptMax, 0.0, 30, "E [GeV]", "(resolution in E)/E (%)", true, false);
2165 leg_pfjet_res_e[k]->Draw();
[85ad2b9]2166 pave->Draw();
[92237ca]2167
2168 TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_";
2169
2170 c_pfjet_res_e[k]->Print(pdfOutput,"pdf");
2171 c_pfjet_res_e[k]->Print(figPath+"img_pfjet_res_"+s_etarange+"e.pdf","pdf");
2172 c_pfjet_res_e[k]->Print(figPath+"img_pfjet_res_"+s_etarange+"e.png","png");
2173
2174 }
2175
2176
2177 // loop over eta bins
2178 for (k = 0; k < ptVals.size(); k++)
2179 {
2180
2181 mg_pfjet_res_eta[k] = new TMultiGraph("","");
[b4ec6ac]2182 leg_pfjet_res_eta[k] = new TLegend(0.30,0.70,0.85,0.90);
[92237ca]2183
2184 HistogramsCollectionVsEta(&plots_pfjet_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "pfjet", 0.0, 2.0);
2185 HistogramsCollectionVsEta(&plots_cajet_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "cajet", 0.0, 2.0);
2186
2187 GetJetsEresVsEta(&plots_pfjet_res_eta[k], branchPFJet, branchGenJet, treeReaderJet, 0.5*ptVals.at(k), 2.0*ptVals.at(k));
2188 GetJetsEresVsEta(&plots_cajet_res_eta[k], branchCaloJet, branchGenJet, treeReaderJet, 0.5*ptVals.at(k), 2.0*ptVals.at(k));
2189
2190 gr_pfjet_res_eta[k] = EresGraphVsEta(&plots_pfjet_res_eta[k]);
2191 gr_cajet_res_eta[k] = EresGraphVsEta(&plots_cajet_res_eta[k]);
2192
[b4ec6ac]2193 s_e = Form("anti-k_{T}, R = 0.4, jets, E = %.0f GeV",ptVals.at(k));
2194 if(ptVals.at(k) >= 1000.) s_e = Form("anti-k_{T}, R = 0.4, E = %.0f TeV",ptVals.at(k)/1000.);
[92237ca]2195
2196 leg_pfjet_res_eta[k]->SetTextFont(132);
2197 leg_pfjet_res_eta[k]->SetHeader(s_e);
2198
[b4ec6ac]2199 addResoGraph(mg_pfjet_res_eta[k], &gr_cajet_res_eta[k], leg_pfjet_res_eta[k], markerStyles.at(0), colors.at(0), "Calorimeter Jets");
2200 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");
[92237ca]2201
2202 c_pfjet_res_eta[k] = new TCanvas("","", 800, 600);
2203
2204 mg_pfjet_res_eta[k]->Draw("APE");
2205 //DrawAxis(mg_pfjet_res_eta[k], leg_pfjet_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true);
2206 DrawAxis(mg_pfjet_res_eta[k], leg_pfjet_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false);
2207 leg_pfjet_res_eta[k]->Draw();
[85ad2b9]2208 pave->Draw();
[92237ca]2209
2210 TString s_ptrange = Form("pt_%.0f_",ptVals.at(k));
2211
2212 c_pfjet_res_eta[k]->Print(pdfOutput,"pdf");
2213 c_pfjet_res_eta[k]->Print(figPath+"img_pfjet_res_"+s_ptrange+"eta.pdf","pdf");
2214 c_pfjet_res_eta[k]->Print(figPath+"img_pfjet_res_"+s_ptrange+"eta.png","png");
2215
2216 }
2217
2218
2219 /////////////////////
2220 // PF Missing ET ///
2221 /////////////////////
2222
2223 TMultiGraph *mg_met_res_ht = new TMultiGraph("","");
2224 TLegend *leg_met_res_ht = new TLegend(0.60,0.22,0.90,0.42);
2225
2226 std::vector<resolPlot> plots_pfmet, plots_camet;
2227
2228 HistogramsCollection(&plots_pfmet, TMath::Log10(ptMin), TMath::Log10(ptMax), "pfMET", -500, 500);
2229 HistogramsCollection(&plots_camet, TMath::Log10(ptMin), TMath::Log10(ptMax), "caMET", -500, 500);
2230
2231 GetMetres(&plots_pfmet, branchGenScalarHT, branchMet, branchPFJet, treeReaderJet);
2232 GetMetres(&plots_camet, branchGenScalarHT, branchCaloMet, branchCaloJet, treeReaderJet);
2233
2234 TGraphErrors gr_pfmet_res_ht = MetResGraph(&plots_pfmet, true);
2235 TGraphErrors gr_camet_res_ht = MetResGraph(&plots_camet, true);
2236
[b4ec6ac]2237 addResoGraph(mg_met_res_ht, &gr_camet_res_ht, leg_met_res_ht, markerStyles.at(0), colors.at(0), "Calorimeter E_{T}^{miss}");
2238 addResoGraph(mg_met_res_ht, &gr_pfmet_res_ht, leg_met_res_ht, markerStyles.at(1), colors.at(1), "Particle-flow E_{T}^{miss}");
[92237ca]2239
2240 TCanvas *c_met_res_ht = new TCanvas("","", 800, 600);
2241
2242 mg_met_res_ht->Draw("APE");
[b4ec6ac]2243 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);
[92237ca]2244
2245 leg_met_res_ht->Draw();
[85ad2b9]2246 pave->Draw();
[92237ca]2247 c_met_res_ht->Print(pdfOutput,"pdf");
2248 c_met_res_ht->Print(figPath+"img_met_res_ht.pdf","pdf");
2249 c_met_res_ht->Print(figPath+"img_met_res_ht.png","png");
2250
2251
2252 /////////////////////////////////////////
2253 // Electron Reconstruction Efficiency ///
2254 /////////////////////////////////////////
2255
2256 TMultiGraph *mg_recele_eff_pt = new TMultiGraph("","");
2257 TMultiGraph *mg_recele_eff_eta = new TMultiGraph("","");
2258
2259 TLegend *leg_recele_eff_pt = new TLegend(0.55,0.22,0.90,0.48);
2260 TLegend *leg_recele_eff_eta = new TLegend(0.55,0.22,0.90,0.48);
2261
2262 TGraphErrors gr_recele_eff_pt[n_etabins], gr_recele_eff_eta[n_ptbins];
2263 TH1D* h_recele_eff_pt, *h_recele_eff_eta;
2264
2265 // loop over eta bins
2266 for (k = 0; k < etaVals.size()-1; k++)
2267 {
2268
2269 h_recele_eff_pt = GetEffPt<Electron>(branchElectron, branchParticleElectron, "Electron", 11, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);
2270 gr_recele_eff_pt[k] = TGraphErrors(h_recele_eff_pt);
2271
2272 s_etaMin = Form("%.1f",etaVals.at(k));
2273 s_etaMax = Form("%.1f",etaVals.at(k+1));
2274
2275 s_eta = "e^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax;
2276
2277 gr_recele_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2278
2279 addResoGraph(mg_recele_eff_pt, &gr_recele_eff_pt[k], leg_recele_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
2280 }
2281
2282 // loop over pt
2283 for (k = 0; k < ptVals.size(); k++)
2284 {
2285 h_recele_eff_eta = GetEffEta<Electron>(branchElectron, branchParticleElectron, "Electron", 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderElectron);
2286 gr_recele_eff_eta[k] = TGraphErrors(h_recele_eff_eta);
2287
2288 s_pt = Form("e^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k));
2289 if(ptVals.at(k) >= 1000.) s_pt = Form("e^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2290
2291 addResoGraph(mg_recele_eff_eta, &gr_recele_eff_eta[k], leg_recele_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
2292 }
2293
2294 TCanvas *c_recele_eff_pt = new TCanvas("","", 800, 600);
2295
2296 mg_recele_eff_pt->Draw("APE");
2297 DrawAxis(mg_recele_eff_pt, leg_recele_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false);
2298 leg_recele_eff_pt->Draw();
[85ad2b9]2299 pave->Draw();
[92237ca]2300
2301 c_recele_eff_pt->Print(pdfOutput,"pdf");
2302 c_recele_eff_pt->Print(figPath+"img_recele_eff_pt.pdf","pdf");
2303 c_recele_eff_pt->Print(figPath+"img_recele_eff_pt.png","png");
2304
2305 TCanvas *c_recele_eff_eta = new TCanvas("","", 800, 600);
[1408174]2306
[92237ca]2307 mg_recele_eff_eta->Draw("APE");
2308 DrawAxis(mg_recele_eff_eta, leg_recele_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false);
2309 leg_recele_eff_eta->Draw();
[85ad2b9]2310 pave->Draw();
[1408174]2311
[92237ca]2312 c_recele_eff_eta->Print(pdfOutput,"pdf");
2313 c_recele_eff_eta->Print(figPath+"img_recele_eff_eta.pdf","pdf");
2314 c_recele_eff_eta->Print(figPath+"img_recele_eff_eta.png","png");
[1408174]2315
2316
[92237ca]2317 /////////////////////////////////////////
2318 // Muon Reconstruction Efficiency ///
2319 /////////////////////////////////////////
[1408174]2320
[92237ca]2321 TMultiGraph *mg_recmu_eff_pt = new TMultiGraph("","");
2322 TMultiGraph *mg_recmu_eff_eta = new TMultiGraph("","");
2323
2324 TLegend *leg_recmu_eff_pt = new TLegend(0.55,0.22,0.90,0.48);
2325 TLegend *leg_recmu_eff_eta = new TLegend(0.55,0.22,0.90,0.48);
2326
2327 TGraphErrors gr_recmu_eff_pt[n_etabins], gr_recmu_eff_eta[n_ptbins];
2328 TH1D* h_recmu_eff_pt, *h_recmu_eff_eta;
2329
2330 // loop over eta bins
2331 for (k = 0; k < etaVals.size()-1; k++)
[1408174]2332 {
2333
[92237ca]2334 h_recmu_eff_pt = GetEffPt<Muon>(branchMuon, branchParticleMuon, "muon", 13, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderMuon);
2335 gr_recmu_eff_pt[k] = TGraphErrors(h_recmu_eff_pt);
[1408174]2336
[92237ca]2337 s_etaMin = Form("%.1f",etaVals.at(k));
2338 s_etaMax = Form("%.1f",etaVals.at(k+1));
[1408174]2339
[92237ca]2340 s_eta = "#mu^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax;
[1408174]2341
[92237ca]2342 gr_recmu_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
[1408174]2343
[92237ca]2344 addResoGraph(mg_recmu_eff_pt, &gr_recmu_eff_pt[k], leg_recmu_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
2345 }
[1408174]2346
[92237ca]2347 // loop over pt
2348 for (k = 0; k < ptVals.size(); k++)
2349 {
2350 h_recmu_eff_eta = GetEffEta<Muon>(branchMuon, branchParticleMuon, "muon", 13, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderMuon);
2351 gr_recmu_eff_eta[k] = TGraphErrors(h_recmu_eff_eta);
[1408174]2352
[92237ca]2353 s_pt = Form("#mu^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k));
2354 if(ptVals.at(k) >= 1000.) s_pt = Form("#mu^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
[1408174]2355
[92237ca]2356 addResoGraph(mg_recmu_eff_eta, &gr_recmu_eff_eta[k], leg_recmu_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
[1408174]2357 }
2358
[92237ca]2359 TCanvas *c_recmu_eff_pt = new TCanvas("","", 800, 600);
[1408174]2360
[92237ca]2361 mg_recmu_eff_pt->Draw("APE");
2362 DrawAxis(mg_recmu_eff_pt, leg_recmu_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false);
2363 leg_recmu_eff_pt->Draw();
[85ad2b9]2364 pave->Draw();
[1408174]2365
[92237ca]2366 c_recmu_eff_pt->Print(pdfOutput,"pdf");
2367 c_recmu_eff_pt->Print(figPath+"img_recmu_eff_pt.pdf","pdf");
2368 c_recmu_eff_pt->Print(figPath+"img_recmu_eff_pt.png","png");
[1408174]2369
[92237ca]2370 TCanvas *c_recmu_eff_eta = new TCanvas("","", 800, 600);
[1408174]2371
[92237ca]2372 mg_recmu_eff_eta->Draw("APE");
2373 DrawAxis(mg_recmu_eff_eta, leg_recmu_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false);
2374 leg_recmu_eff_eta->Draw();
[85ad2b9]2375 pave->Draw();
[1408174]2376
[92237ca]2377 c_recmu_eff_eta->Print(pdfOutput,"pdf");
2378 c_recmu_eff_eta->Print(figPath+"img_recmu_eff_eta.pdf","pdf");
2379 c_recmu_eff_eta->Print(figPath+"img_recmu_eff_eta.png","png");
[1408174]2380
2381
[92237ca]2382 /////////////////////////////////////////
2383 // Photon Reconstruction Efficiency ///
2384 /////////////////////////////////////////
[1408174]2385
[92237ca]2386 TMultiGraph *mg_recpho_eff_pt = new TMultiGraph("","");
2387 TMultiGraph *mg_recpho_eff_eta = new TMultiGraph("","");
[1408174]2388
[92237ca]2389 TLegend *leg_recpho_eff_pt = new TLegend(0.55,0.22,0.90,0.48);
2390 TLegend *leg_recpho_eff_eta = new TLegend(0.55,0.22,0.90,0.48);
2391
2392 TGraphErrors gr_recpho_eff_pt[n_etabins], gr_recpho_eff_eta[n_ptbins];
2393 TH1D* h_recpho_eff_pt, *h_recpho_eff_eta;
2394
2395 // loop over eta bins
2396 for (k = 0; k < etaVals.size()-1; k++)
[1408174]2397 {
2398
[92237ca]2399 h_recpho_eff_pt = GetEffPt<Photon>(branchPhoton, branchParticlePhoton, "Photon", 22, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderPhoton);
2400 gr_recpho_eff_pt[k] = TGraphErrors(h_recpho_eff_pt);
[1408174]2401
[92237ca]2402 s_etaMin = Form("%.1f",etaVals.at(k));
2403 s_etaMax = Form("%.1f",etaVals.at(k+1));
[1408174]2404
[92237ca]2405 s_eta = "#gamma , " + s_etaMin + " < | #eta | < "+s_etaMax;
[1408174]2406
[92237ca]2407 gr_recpho_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2408
2409 addResoGraph(mg_recpho_eff_pt, &gr_recpho_eff_pt[k], leg_recpho_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
[1408174]2410 }
2411
[92237ca]2412 // loop over pt
2413 for (k = 0; k < ptVals.size(); k++)
2414 {
2415 h_recpho_eff_eta = GetEffEta<Photon>(branchPhoton, branchParticlePhoton, "Photon", 22, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderPhoton);
2416 gr_recpho_eff_eta[k] = TGraphErrors(h_recpho_eff_eta);
[1408174]2417
[92237ca]2418 s_pt = Form("#gamma , p_{T} = %.0f GeV",ptVals.at(k));
2419 if(ptVals.at(k) >= 1000.) s_pt = Form("#gamma , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
[1160e4f]2420
[92237ca]2421 addResoGraph(mg_recpho_eff_eta, &gr_recpho_eff_eta[k], leg_recpho_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
2422 }
[1160e4f]2423
[92237ca]2424 TCanvas *c_recpho_eff_pt = new TCanvas("","", 800, 600);
[1160e4f]2425
[92237ca]2426 mg_recpho_eff_pt->Draw("APE");
2427 DrawAxis(mg_recpho_eff_pt, leg_recpho_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false);
2428 leg_recpho_eff_pt->Draw();
[85ad2b9]2429 pave->Draw();
[1408174]2430
[92237ca]2431 c_recpho_eff_pt->Print(pdfOutput,"pdf");
2432 c_recpho_eff_pt->Print(figPath+"img_recpho_eff_pt.pdf","pdf");
2433 c_recpho_eff_pt->Print(figPath+"img_recpho_eff_pt.png","png");
[1408174]2434
[92237ca]2435 TCanvas *c_recpho_eff_eta = new TCanvas("","", 800, 600);
2436
2437 mg_recpho_eff_eta->Draw("APE");
2438 DrawAxis(mg_recpho_eff_eta, leg_recpho_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false);
2439 leg_recpho_eff_eta->Draw();
[85ad2b9]2440 pave->Draw();
[92237ca]2441
2442 c_recpho_eff_eta->Print(pdfOutput,"pdf");
2443 c_recpho_eff_eta->Print(figPath+"img_recpho_eff_eta.pdf","pdf");
2444 c_recpho_eff_eta->Print(figPath+"img_recpho_eff_eta.png","png");
2445
[cb159ed]2446
[92237ca]2447 /////////////////////////////////////////
2448 // B-jets Efficiency/ mistag rates ///
2449 /////////////////////////////////////////
2450
2451 TMultiGraph *mg_recbjet_eff_pt = new TMultiGraph("","");
2452 TMultiGraph *mg_recbjet_eff_eta = new TMultiGraph("","");
2453
2454 TLegend *leg_recbjet_eff_pt = new TLegend(0.50,0.22,0.90,0.48);
2455 TLegend *leg_recbjet_eff_eta = new TLegend(0.50,0.22,0.90,0.48);
2456
2457 TGraphErrors gr_recbjet_eff_pt[n_etabins], gr_recbjet_eff_eta[n_ptbins];
2458 TH1D* h_recbjet_eff_pt, *h_recbjet_eff_eta;
2459
2460 // loop over eta bins
2461 for (k = 0; k < etaVals.size()-1; k++)
[1408174]2462 {
[92237ca]2463
2464 h_recbjet_eff_pt = GetEffPt<Jet>(branchPFBJet, branchParticleBJet, "BJet", 5, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderBJet);
2465 gr_recbjet_eff_pt[k] = TGraphErrors(h_recbjet_eff_pt);
2466
2467 s_etaMin = Form("%.1f",etaVals.at(k));
2468 s_etaMax = Form("%.1f",etaVals.at(k+1));
2469
2470 s_eta = "b-jet , " + s_etaMin + " < | #eta | < "+s_etaMax;
2471
2472 gr_recbjet_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2473
2474 addResoGraph(mg_recbjet_eff_pt, &gr_recbjet_eff_pt[k], leg_recbjet_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
[1408174]2475 }
2476
[92237ca]2477 // loop over pt
2478 for (k = 0; k < ptVals.size(); k++)
[1408174]2479 {
[92237ca]2480 h_recbjet_eff_eta = GetEffEta<Jet>(branchPFBJet, branchParticleBJet, "BJet", 5, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderBJet);
2481 gr_recbjet_eff_eta[k] = TGraphErrors(h_recbjet_eff_eta);
2482
2483 s_pt = Form("b-jet , p_{T} = %.0f GeV",ptVals.at(k));
2484 if(ptVals.at(k) >= 1000.) s_pt = Form("b-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2485
2486 addResoGraph(mg_recbjet_eff_eta, &gr_recbjet_eff_eta[k], leg_recbjet_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
[1408174]2487 }
2488
[92237ca]2489 TCanvas *c_recbjet_eff_pt = new TCanvas("","", 800, 600);
[734b267]2490
[92237ca]2491 mg_recbjet_eff_pt->Draw("APE");
2492 DrawAxis(mg_recbjet_eff_pt, leg_recbjet_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "b - tag efficiency (%)", true, false);
2493 leg_recbjet_eff_pt->Draw();
[85ad2b9]2494 pave->Draw();
[1408174]2495
[92237ca]2496 c_recbjet_eff_pt->Print(pdfOutput,"pdf");
2497 c_recbjet_eff_pt->Print(figPath+"img_recbjet_eff_pt.pdf","pdf");
2498 c_recbjet_eff_pt->Print(figPath+"img_recbjet_eff_pt.png","png");
[1408174]2499
[92237ca]2500 TCanvas *c_recbjet_eff_eta = new TCanvas("","", 800, 600);
[1408174]2501
[92237ca]2502 mg_recbjet_eff_eta->Draw("APE");
2503 DrawAxis(mg_recbjet_eff_eta, leg_recbjet_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "b - tag efficiency (%)", false, false);
2504 leg_recbjet_eff_eta->Draw();
[85ad2b9]2505 pave->Draw();
[1408174]2506
[92237ca]2507 c_recbjet_eff_eta->Print(pdfOutput,"pdf");
2508 c_recbjet_eff_eta->Print(figPath+"img_recbjet_eff_eta.pdf","pdf");
2509 c_recbjet_eff_eta->Print(figPath+"img_recbjet_eff_eta.png","png");
[1408174]2510
[92237ca]2511 // ------ c - mistag ------
[1408174]2512
[92237ca]2513 TMultiGraph *mg_recbjet_cmis_pt = new TMultiGraph("","");
2514 TMultiGraph *mg_recbjet_cmis_eta = new TMultiGraph("","");
[1408174]2515
[92237ca]2516 TLegend *leg_recbjet_cmis_pt = new TLegend(0.50,0.64,0.90,0.90);
2517 TLegend *leg_recbjet_cmis_eta = new TLegend(0.50,0.64,0.90,0.90);
[1408174]2518
[92237ca]2519 TGraphErrors gr_recbjet_cmis_pt[n_etabins], gr_recbjet_cmis_eta[n_ptbins];
2520 TH1D* h_recbjet_cmis_pt, *h_recbjet_cmis_eta;
[1408174]2521
[92237ca]2522 // loop over eta bins
2523 for (k = 0; k < etaVals.size()-1; k++)
2524 {
[1408174]2525
[92237ca]2526 h_recbjet_cmis_pt = GetEffPt<Jet>(branchPFCJet, branchParticleCJet, "CJet", 4, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderCJet);
2527 gr_recbjet_cmis_pt[k] = TGraphErrors(h_recbjet_cmis_pt);
[1408174]2528
[92237ca]2529 s_etaMin = Form("%.1f",etaVals.at(k));
2530 s_etaMax = Form("%.1f",etaVals.at(k+1));
[1408174]2531
[92237ca]2532 s_eta = "c-jet , " + s_etaMin + " < | #eta | < "+s_etaMax;
[1408174]2533
[92237ca]2534 gr_recbjet_cmis_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
[1408174]2535
[92237ca]2536 addResoGraph(mg_recbjet_cmis_pt, &gr_recbjet_cmis_pt[k], leg_recbjet_cmis_pt, markerStyles.at(k), colors.at(k), s_eta);
2537 }
[1408174]2538
[92237ca]2539 // loop over pt
2540 for (k = 0; k < ptVals.size(); k++)
2541 {
2542 h_recbjet_cmis_eta = GetEffEta<Jet>(branchPFCJet, branchParticleCJet, "CJet", 4, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderCJet);
2543 gr_recbjet_cmis_eta[k] = TGraphErrors(h_recbjet_cmis_eta);
[1408174]2544
[92237ca]2545 s_pt = Form("c-jet , p_{T} = %.0f GeV",ptVals.at(k));
2546 if(ptVals.at(k) >= 1000.) s_pt = Form("c-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
[1408174]2547
[92237ca]2548 addResoGraph(mg_recbjet_cmis_eta, &gr_recbjet_cmis_eta[k], leg_recbjet_cmis_eta, markerStyles.at(k), colors.at(k), s_pt );
2549 }
[1408174]2550
[92237ca]2551 TCanvas *c_recbjet_cmis_pt = new TCanvas("","", 800, 600);
[1408174]2552
[92237ca]2553 mg_recbjet_cmis_pt->Draw("APE");
2554 DrawAxis(mg_recbjet_cmis_pt, leg_recbjet_cmis_pt, ptMin, ptMax, 0.0, 20, "p_{T} [GeV]", "c - mistag rate (%)", true, false);
2555 leg_recbjet_cmis_pt->Draw();
[85ad2b9]2556 pave->Draw();
[1408174]2557
[92237ca]2558 c_recbjet_cmis_pt->Print(pdfOutput,"pdf");
2559 c_recbjet_cmis_pt->Print(figPath+"img_recbjet_cmis_pt.pdf","pdf");
2560 c_recbjet_cmis_pt->Print(figPath+"img_recbjet_cmis_pt.png","png");
[1408174]2561
[92237ca]2562 TCanvas *c_recbjet_cmis_eta = new TCanvas("","", 800, 600);
[1408174]2563
[92237ca]2564 mg_recbjet_cmis_eta->Draw("APE");
2565 DrawAxis(mg_recbjet_cmis_eta, leg_recbjet_cmis_eta, etaMin, etaMax, 0.0, 20, " #eta ", "c - mistag rate (%)", false, false);
2566 leg_recbjet_cmis_eta->Draw();
[85ad2b9]2567 pave->Draw();
[1408174]2568
[92237ca]2569 c_recbjet_cmis_eta->Print(pdfOutput,"pdf");
2570 c_recbjet_cmis_eta->Print(figPath+"img_recbjet_cmis_eta.pdf","pdf");
2571 c_recbjet_cmis_eta->Print(figPath+"img_recbjet_cmis_eta.png","png");
[1408174]2572
[92237ca]2573 // ------ light - mistag ------
[1408174]2574
[92237ca]2575 TMultiGraph *mg_recbjet_lmis_pt = new TMultiGraph("","");
2576 TMultiGraph *mg_recbjet_lmis_eta = new TMultiGraph("","");
[1408174]2577
[92237ca]2578 TLegend *leg_recbjet_lmis_pt = new TLegend(0.50,0.64,0.90,0.90);
2579 TLegend *leg_recbjet_lmis_eta = new TLegend(0.50,0.64,0.90,0.90);
[1408174]2580
[92237ca]2581 TGraphErrors gr_recbjet_lmis_pt[n_etabins], gr_recbjet_lmis_eta[n_ptbins];
2582 TH1D* h_recbjet_lmis_pt, *h_recbjet_lmis_eta;
[1408174]2583
[92237ca]2584 // loop over eta bins
2585 for (k = 0; k < etaVals.size()-1; k++)
2586 {
[cb159ed]2587
[06a83b3]2588 h_recbjet_lmis_pt = GetEffPt<Jet>(branchJet, branchParticleJet, "Jet", 1, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderJet);
[92237ca]2589 gr_recbjet_lmis_pt[k] = TGraphErrors(h_recbjet_lmis_pt);
[1408174]2590
[92237ca]2591 s_etaMin = Form("%.1f",etaVals.at(k));
2592 s_etaMax = Form("%.1f",etaVals.at(k+1));
[1408174]2593
[92237ca]2594 s_eta = "uds-jet , " + s_etaMin + " < | #eta | < "+s_etaMax;
[1408174]2595
[92237ca]2596 gr_recbjet_lmis_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
[1408174]2597
[92237ca]2598 addResoGraph(mg_recbjet_lmis_pt, &gr_recbjet_lmis_pt[k], leg_recbjet_lmis_pt, markerStyles.at(k), colors.at(k), s_eta);
2599 }
[1408174]2600
[92237ca]2601 // loop over pt
2602 for (k = 0; k < ptVals.size(); k++)
2603 {
[06a83b3]2604 h_recbjet_lmis_eta = GetEffEta<Jet>(branchJet, branchParticleJet, "Jet", 1, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderJet);
[92237ca]2605 gr_recbjet_lmis_eta[k] = TGraphErrors(h_recbjet_lmis_eta);
2606
2607 s_pt = Form("uds-jet , p_{T} = %.0f GeV",ptVals.at(k));
2608 if(ptVals.at(k) >= 1000.) s_pt = Form("uds-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2609
2610 addResoGraph(mg_recbjet_lmis_eta, &gr_recbjet_lmis_eta[k], leg_recbjet_lmis_eta, markerStyles.at(k), colors.at(k), s_pt );
2611 }
2612
2613 TCanvas *c_recbjet_lmis_pt = new TCanvas("","", 800, 600);
2614
2615 mg_recbjet_lmis_pt->Draw("APE");
[cb159ed]2616 DrawAxis(mg_recbjet_lmis_pt, leg_recbjet_lmis_pt, ptMin, ptMax, 0.0, 0.5, "p_{T} [GeV]", "light - mistag rate (%)", true, false);
[92237ca]2617 leg_recbjet_lmis_pt->Draw();
[85ad2b9]2618 pave->Draw();
[92237ca]2619
2620 c_recbjet_lmis_pt->Print(pdfOutput,"pdf");
2621 c_recbjet_lmis_pt->Print(figPath+"img_recbjet_lmis_pt.pdf","pdf");
2622 c_recbjet_lmis_pt->Print(figPath+"img_recbjet_lmis_pt.png","png");
2623
2624 TCanvas *c_recbjet_lmis_eta = new TCanvas("","", 800, 600);
2625
2626 mg_recbjet_lmis_eta->Draw("APE");
[cb159ed]2627 DrawAxis(mg_recbjet_lmis_eta, leg_recbjet_lmis_eta, etaMin, etaMax, 0.0, 0.5, " #eta ", "light - mistag rate (%)", false, false);
[92237ca]2628 leg_recbjet_lmis_eta->Draw();
[85ad2b9]2629 pave->Draw();
[92237ca]2630
2631 c_recbjet_lmis_eta->Print(pdfOutput,"pdf");
2632 c_recbjet_lmis_eta->Print(figPath+"img_recbjet_lmis_eta.pdf","pdf");
2633 c_recbjet_lmis_eta->Print(figPath+"img_recbjet_lmis_eta.png","png");
2634
2635
2636 ///////////////////////////////////////////
2637 // tau-jets Efficiency/ mistag rates ///
2638 ///////////////////////////////////////////
2639
2640 TMultiGraph *mg_rectaujet_eff_pt = new TMultiGraph("","");
2641 TMultiGraph *mg_rectaujet_eff_eta = new TMultiGraph("","");
[fa068d3]2642
[92237ca]2643 TLegend *leg_rectaujet_eff_pt = new TLegend(0.50,0.22,0.90,0.48);
2644 TLegend *leg_rectaujet_eff_eta = new TLegend(0.50,0.22,0.90,0.48);
[1408174]2645
[92237ca]2646 TGraphErrors gr_rectaujet_eff_pt[n_etabins], gr_rectaujet_eff_eta[n_ptbins];
2647 TH1D* h_rectaujet_eff_pt, *h_rectaujet_eff_eta;
[1408174]2648
[92237ca]2649 // loop over eta bins
2650 for (k = 0; k < etaVals.size()-1; k++)
2651 {
2652
2653 h_rectaujet_eff_pt = GetTauEffPt<Jet>(branchPFTauJet, branchParticleTauJet, "TauJet", 15, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderTauJet);
2654 gr_rectaujet_eff_pt[k] = TGraphErrors(h_rectaujet_eff_pt);
2655
2656 s_etaMin = Form("%.1f",etaVals.at(k));
2657 s_etaMax = Form("%.1f",etaVals.at(k+1));
2658
2659 s_eta = "#tau-jet , " + s_etaMin + " < | #eta | < "+s_etaMax;
2660
2661 gr_rectaujet_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
2662
2663 addResoGraph(mg_rectaujet_eff_pt, &gr_rectaujet_eff_pt[k], leg_rectaujet_eff_pt, markerStyles.at(k), colors.at(k), s_eta);
2664 }
2665
2666 // loop over pt
2667 for (k = 0; k < ptVals.size(); k++)
2668 {
2669 h_rectaujet_eff_eta = GetTauEffEta<Jet>(branchPFTauJet, branchParticleTauJet, "TauJet", 15, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderTauJet);
2670 gr_rectaujet_eff_eta[k] = TGraphErrors(h_rectaujet_eff_eta);
2671
2672 s_pt = Form("#tau-jet , p_{T} = %.0f GeV",ptVals.at(k));
2673 if(ptVals.at(k) >= 1000.) s_pt = Form("#tau-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
2674
2675 addResoGraph(mg_rectaujet_eff_eta, &gr_rectaujet_eff_eta[k], leg_rectaujet_eff_eta, markerStyles.at(k), colors.at(k), s_pt );
2676 }
2677
2678
2679 TCanvas *c_rectaujet_eff_pt = new TCanvas("","", 800, 600);
2680
2681 mg_rectaujet_eff_pt->Draw("APE");
2682 DrawAxis(mg_rectaujet_eff_pt, leg_rectaujet_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "#tau - tag efficiency (%)", true, false);
2683 leg_rectaujet_eff_pt->Draw();
[85ad2b9]2684 pave->Draw();
[92237ca]2685
2686 c_rectaujet_eff_pt->Print(pdfOutput,"pdf");
2687 c_rectaujet_eff_pt->Print(figPath+"img_rectaujet_eff_pt.pdf","pdf");
2688 c_rectaujet_eff_pt->Print(figPath+"img_rectaujet_eff_pt.png","png");
[1408174]2689
[92237ca]2690 TCanvas *c_rectaujet_eff_eta = new TCanvas("","", 800, 600);
[1408174]2691
[92237ca]2692 mg_rectaujet_eff_eta->Draw("APE");
[f3be533]2693 DrawAxis(mg_rectaujet_eff_eta, leg_rectaujet_eff_eta, etaMin, etaMax, 0.0, 100., " #eta ", "#tau - tag efficiency (%)", false, false);
[92237ca]2694 leg_rectaujet_eff_eta->Draw();
[85ad2b9]2695 pave->Draw();
[1408174]2696
[92237ca]2697 c_rectaujet_eff_eta->Print(pdfOutput,"pdf");
2698 c_rectaujet_eff_eta->Print(figPath+"img_rectaujet_eff_eta.pdf","pdf");
2699 c_rectaujet_eff_eta->Print(figPath+"img_rectaujet_eff_eta.png","png");
[1408174]2700
2701
[92237ca]2702 //--------------- tau mistag rate ----------
[1408174]2703
[92237ca]2704 TMultiGraph *mg_rectaujet_mis_pt = new TMultiGraph("","");
2705 TMultiGraph *mg_rectaujet_mis_eta = new TMultiGraph("","");
[1408174]2706
[92237ca]2707 TLegend *leg_rectaujet_mis_pt = new TLegend(0.50,0.64,0.90,0.90);
2708 TLegend *leg_rectaujet_mis_eta = new TLegend(0.50,0.64,0.90,0.90);
[1408174]2709
[92237ca]2710 TGraphErrors gr_rectaujet_mis_pt[n_etabins], gr_rectaujet_mis_eta[n_ptbins];
2711 TH1D* h_rectaujet_mis_pt, *h_rectaujet_mis_eta;
[1408174]2712
[92237ca]2713 // loop over eta bins
2714 for (k = 0; k < etaVals.size()-1; k++)
2715 {
[1408174]2716
[06a83b3]2717 h_rectaujet_mis_pt = GetTauEffPt<Jet>(branchJet, branchParticleJet, "TauJet", 1, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderJet);
[92237ca]2718 gr_rectaujet_mis_pt[k] = TGraphErrors(h_rectaujet_mis_pt);
[1408174]2719
[92237ca]2720 s_etaMin = Form("%.1f",etaVals.at(k));
2721 s_etaMax = Form("%.1f",etaVals.at(k+1));
[1408174]2722
[92237ca]2723 s_eta = "uds-jet , " + s_etaMin + " < | #eta | < "+s_etaMax;
[1408174]2724
[92237ca]2725 gr_rectaujet_mis_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax);
[1408174]2726
[92237ca]2727 addResoGraph(mg_rectaujet_mis_pt, &gr_rectaujet_mis_pt[k], leg_rectaujet_mis_pt, markerStyles.at(k), colors.at(k), s_eta);
2728 }
[1408174]2729
[92237ca]2730 // loop over pt
2731 for (k = 0; k < ptVals.size(); k++)
2732 {
[06a83b3]2733 h_rectaujet_mis_eta = GetTauEffEta<Jet>(branchJet, branchParticleJet, "TauJet", 1, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderJet);
[92237ca]2734 gr_rectaujet_mis_eta[k] = TGraphErrors(h_rectaujet_mis_eta);
[1408174]2735
[92237ca]2736 s_pt = Form("uds-jet , p_{T} = %.0f GeV",ptVals.at(k));
2737 if(ptVals.at(k) >= 1000.) s_pt = Form("uds-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.);
[1408174]2738
[92237ca]2739 addResoGraph(mg_rectaujet_mis_eta, &gr_rectaujet_mis_eta[k], leg_rectaujet_mis_eta, markerStyles.at(k), colors.at(k), s_pt );
2740 }
[1408174]2741
[92237ca]2742 TCanvas *c_rectaujet_mis_pt = new TCanvas("","", 800, 600);
[1408174]2743
[92237ca]2744 mg_rectaujet_mis_pt->Draw("APE");
[cb159ed]2745 DrawAxis(mg_rectaujet_mis_pt, leg_rectaujet_mis_pt, ptMin, ptMax, 0.0, 5., "p_{T} [GeV]", "#tau - mistag(%)", true, false);
[92237ca]2746 leg_rectaujet_mis_pt->Draw();
[85ad2b9]2747 pave->Draw();
[1408174]2748
[92237ca]2749 c_rectaujet_mis_pt->Print(pdfOutput,"pdf");
2750 c_rectaujet_mis_pt->Print(figPath+"img_rectaujet_mis_pt.pdf","pdf");
2751 c_rectaujet_mis_pt->Print(figPath+"img_rectaujet_mis_pt.png","png");
[1408174]2752
[92237ca]2753 TCanvas *c_rectaujet_mis_eta = new TCanvas("","", 800, 600);
[1408174]2754
[92237ca]2755 mg_rectaujet_mis_eta->Draw("APE");
2756 DrawAxis(mg_rectaujet_mis_eta, leg_rectaujet_mis_eta, etaMin, etaMax, 0.0, 5., " #eta ", "#tau - mistag (%)", false, false);
2757 leg_rectaujet_mis_eta->Draw();
[85ad2b9]2758 pave->Draw();
[1408174]2759
[92237ca]2760 c_rectaujet_mis_eta->Print(pdfOutput+")","pdf");
2761 c_rectaujet_mis_eta->Print(figPath+"img_rectaujet_mis_eta.pdf","pdf");
2762 c_rectaujet_mis_eta->Print(figPath+"img_rectaujet_mis_eta.png","png");
[1408174]2763
2764
[92237ca]2765// ---- store resolution histograms in the output (for leave efficiencies out) ---
[1408174]2766
2767
2768 TFile *fout = new TFile(outputFile,"recreate");
2769
2770 for (int bin = 0; bin < Nbins; bin++)
2771 {
2772
[92237ca]2773 for (k = 0; k < etaVals.size()-1; k++)
2774 {
2775 plots_trkpi_res_pt[k].at(bin).resolHist->Write();
2776 plots_trkele_res_pt[k].at(bin).resolHist->Write();
[cb159ed]2777 plots_trkmu_res_pt[k].at(bin).resolHist->Write();
[92237ca]2778 plots_ecal_res_e[k].at(bin).resolHist->Write();
2779 plots_hcal_res_e[k].at(bin).resolHist->Write();
2780 plots_pfele_res_e[k].at(bin).resolHist->Write();
2781 plots_pfpi_res_e[k].at(bin).resolHist->Write();
2782 plots_pfjet_res_e[k].at(bin).resolHist->Write();
2783 plots_cajet_res_e[k].at(bin).resolHist->Write();
[1408174]2784
[92237ca]2785 }
2786
2787 for (k = 0; k < ptVals.size(); k++)
2788 {
2789 plots_trkpi_res_eta[k].at(bin).resolHist->Write();
2790 plots_trkele_res_eta[k].at(bin).resolHist->Write();
2791 plots_trkmu_res_eta[k].at(bin).resolHist->Write();
2792 plots_ecal_res_eta[k].at(bin).resolHist->Write();
2793 plots_hcal_res_eta[k].at(bin).resolHist->Write();
2794 plots_pfele_res_eta[k].at(bin).resolHist->Write();
2795 plots_pfpi_res_eta[k].at(bin).resolHist->Write();
2796 plots_pfjet_res_eta[k].at(bin).resolHist->Write();
2797 plots_cajet_res_eta[k].at(bin).resolHist->Write();
[32677fb]2798
[92237ca]2799 }
[1408174]2800
[92237ca]2801 plots_pfmet.at(bin).resolHist->Write();
2802 plots_camet.at(bin).resolHist->Write();
[1408174]2803
2804 }
2805
2806 fout->Write();
2807
[cb159ed]2808
2809
2810
[1408174]2811 cout << "** Exiting..." << endl;
2812
2813 delete treeReaderElectron;
2814 delete treeReaderMuon;
2815 delete treeReaderPhoton;
2816 delete treeReaderJet;
2817 delete treeReaderBJet;
2818 delete treeReaderTauJet;
2819 delete chainElectron;
2820 delete chainMuon;
2821 delete chainPhoton;
2822 delete chainJet;
2823 delete chainBJet;
2824 delete chainTauJet;
2825}
[734b267]2826
2827//------------------------------------------------------------------------------
2828
2829int main(int argc, char *argv[])
2830{
2831 char *appName = "Validation";
2832
[85ad2b9]2833 if(argc != 12)
[734b267]2834 {
[1408174]2835 cout << " Usage: " << appName << " input_file_electron input_file_muon input_file_photon input_file_jet input_file_bjet input_file_taujet output_file" << endl;
[92237ca]2836 cout << " input_file_pion - input file in ROOT format ('Delphes' tree)," << endl;
[1408174]2837 cout << " input_file_electron - input file in ROOT format ('Delphes' tree)," << endl;
2838 cout << " input_file_muon - input file in ROOT format ('Delphes' tree)," << endl;
2839 cout << " input_file_photon - input file in ROOT format ('Delphes' tree)," << endl;
[92237ca]2840 cout << " input_file_neutralhadron - input file in ROOT format ('Delphes' tree)," << endl;
[1408174]2841 cout << " input_file_jet - input file in ROOT format ('Delphes' tree)," << endl;
2842 cout << " input_file_bjet - input file in ROOT format ('Delphes' tree)," << endl;
[92237ca]2843 cout << " input_file_cjet - input file in ROOT format ('Delphes' tree)," << endl;
[1408174]2844 cout << " input_file_taujet - input file in ROOT format ('Delphes' tree)," << endl;
[734b267]2845 cout << " output_file - output file in ROOT format" << endl;
[85ad2b9]2846 cout << " delphes version" << endl;
2847
[734b267]2848 return 1;
2849 }
2850
2851 gROOT->SetBatch();
2852
2853 int appargc = 1;
2854 char *appargv[] = {appName};
2855 TApplication app(appName, &appargc, appargv);
2856
[85ad2b9]2857 Validation(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11]);
[734b267]2858}
2859
2860
[92237ca]2861
Note: See TracBrowser for help on using the repository browser.