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