Changeset fe3908f in git for examples/Validation.C
- Timestamp:
- Jun 27, 2016, 4:40:50 PM (8 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- a3a556c
- Parents:
- 734b267
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/Validation.C
r734b267 rfe3908f 57 57 double ptrangemin = 10; 58 58 double ptrangemax = 10000; 59 static const int Nbins = 10;59 static const int Nbins = 20; 60 60 61 61 int objStyle = 1; … … 101 101 obj = object; 102 102 103 cenResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", 500, - 0.4, 0.4);103 cenResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", 500, -1, 1); 104 104 fwdResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_fwd", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_fwd", 500, 0.4, 0.4); 105 105 … … 317 317 Long64_t allEntries = treeReader->GetEntries(); 318 318 319 cout << "** Computing resolution of " << branchJet->GetName() << " induced by " << branchGenJet->GetName() << endl;319 cout << "** Computing resolution of " << branchJet->GetName() << " induced by " << branchGenJet->GetName() << endl; 320 320 321 321 Jet *jet, *genjet; … … 338 338 339 339 // Loop over all reconstructed jets in event 340 for(i = 0; i < branchJet->GetEntriesFast(); ++i)340 for(i = 0; i < TMath::Min(2,branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i) 341 341 { 342 342 … … 347 347 348 348 // Loop over all hard partons in event 349 for(j = 0; j < branchGenJet->GetEntriesFast(); ++j)349 for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j) 350 350 { 351 351 genjet = (Jet*) branchGenJet->At(j); … … 365 365 } 366 366 367 if(deltaR < 0. 1)367 if(deltaR < 0.3) 368 368 { 369 369 pt = genJetMomentum.Pt(); … … 372 372 for (bin = 0; bin < Nbins; bin++) 373 373 { 374 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > 0.0 && eta < 0.5)374 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > 0.0 && eta < 2.5) 375 375 { 376 376 histos->at(bin).cenResolHist->Fill((bestGenJetMomentum.E()-jetMomentum.E())/bestGenJetMomentum.E()); … … 389 389 delete f1; 390 390 return make_pair (sig, sigErr); 391 //return make_pair (hist->GetRMS(), hist->GetRMSError()); 391 392 } 392 393 … … 395 396 { 396 397 Int_t bin; 397 TGraphErrors gr = TGraphErrors(Nbins); 398 Int_t count = 0; 399 TGraphErrors gr = TGraphErrors(Nbins/2); 398 400 Double_t sig = 0; 399 401 Double_t sigErr = 0; … … 406 408 std::cout << " entries : " << histos->at(bin).cenResolHist->GetEntries() << std::endl; 407 409 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).cenResolHist); 408 gr.SetPoint(bin,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first); 409 gr.SetPointError(bin,0, sigvalues.second); 410 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first); 411 gr.SetPointError(count,0, sigvalues.second); 412 count++; 410 413 } 411 414 /* … … 516 519 gPad->SetBottomMargin(0.2); 517 520 gPad->SetLeftMargin(0.2); 521 gPad->Modified(); 522 gPad->Update(); 518 523 519 524 } … … 653 658 C_el2->SaveAs(elRes+".eps"); 654 659 660 gDirectory->cd(0); 655 661 656 662 /* … … 802 808 TGraphErrors gr_pfjets = EresGraph(&plots_pfjets, true); 803 809 gr_pfjets.SetName("pfJet"); 810 811 812 // PFJets Energy Resolution 813 std::vector<resolPlot> plots_calojets; 814 HistogramsCollection(&plots_calojets, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "CaloJet"); 815 GetJetsEres( &plots_calojets, branchCaloJet, branchGenJet, treeReader); 816 TGraphErrors gr_calojets = EresGraph(&plots_calojets, true); 817 gr_calojets.SetName("caloJet"); 818 819 820 TString jetRes = "jetERes"; 821 TCanvas *C_jet = new TCanvas(jetRes,jetRes, 1000, 500); 822 TMultiGraph *mg_jet = new TMultiGraph(jetRes,jetRes); 823 TLegend *leg_jet = new TLegend(0.52,0.7,0.9,0.9); 824 825 addGraph(mg_jet, &gr_calojets, leg_jet, 3); 826 addGraph(mg_jet, &gr_pfjets, leg_jet, 1); 827 828 mg_jet->Draw("ACX"); 829 leg_jet->Draw(); 830 831 DrawAxis(mg_jet, leg_jet, 0.25); 832 833 C_jet->SaveAs(jetRes+".eps"); 804 834 805 835 … … 820 850 { 821 851 plots_pfjets.at(bin).cenResolHist->Write(); 852 plots_calojets.at(bin).cenResolHist->Write(); 822 853 plots_el.at(bin).cenResolHist->Write(); 823 854 plots_eltrack.at(bin).cenResolHist->Write(); … … 848 879 C_el1->Write(); 849 880 C_el2->Write(); 881 C_jet->Write(); 850 882 /* 851 883 C_mu->Write(); … … 853 885 */ 854 886 gr_pfjets.Write(); 855 //gr_calojets.Write();887 gr_calojets.Write(); 856 888 857 889 fout->Write();
Note:
See TracChangeset
for help on using the changeset viewer.