#include "MCResultComparator.h" void MCResultComparator::CompareMCResults() { // Output File // std::string OutputFileName; struct stat DirInfo; if ((InputRootFile.find(".")==0) || (InputRootFile.find_last_of("/")!=string::npos) || (InputRootFile.find("~")==0)) { std::size_t FileNameBeginning = InputRootFile.find_last_of("/"); std::size_t FileNameEnd = InputRootFile.find(".root"); DirectoryName = InputRootFile.substr(FileNameBeginning+1,FileNameEnd-FileNameBeginning-1); } else { stringstream InputRootFilestream(InputRootFile); getline(InputRootFilestream, DirectoryName, '.'); } if ((SInputRootFile.find(".")==0) || (SInputRootFile.find_last_of("/")!=string::npos) || (SInputRootFile.find("~")==0)) { std::size_t SFileNameBeginning = SInputRootFile.find_last_of("/"); std::size_t SFileNameEnd = SInputRootFile.find(".root"); SDirectoryName = SInputRootFile.substr(SFileNameBeginning+1,SFileNameEnd-SFileNameBeginning-1); } else { stringstream SInputRootFilestream(SInputRootFile); getline(SInputRootFilestream, SDirectoryName, '.'); } string FinalDirectoryName = DirectoryName+"_COMPAREDTO_"+SDirectoryName; if (stat(FinalDirectoryName.c_str(), &DirInfo)!=0) mkdir(FinalDirectoryName.c_str(),0777); OutputFileName = FinalDirectoryName+"/"+FinalDirectoryName+".root"; OutputRootF = new TFile(OutputFileName.c_str(), "RECREATE"); // Histograms // Note: For JPsitoElectronMuon, the Muon is the first lepton and the Electron is the second lepton TH1D* h_TruthJPsi_Mass = new TH1D("Truth_JPsi_Mass (Centrally Generated MC Sample)", "Truth_JPsi_Mass (Centrally Generated MC Sample)", 100, 3.096, 3.099); // 30KeV/Bin TH1D* h_TruthJPsi_Pt = new TH1D("Truth_JPsi_Pt (Centrally Generated MC Sample)", "Truth_JPsi_Pt (Centrally Generated MC Sample)", 100, 0, 100); // 1GeV/Bin TH1D* h_TruthJPsi_Eta = new TH1D("Truth_JPsi_Eta (Centrally Generated MC Sample)", "Truth_JPsi_Eta (Centrally Generated MC Sample)", 90, -15, 15); TH1D* h_TruthLepton1_Pt = new TH1D("Truth_Lepton1_Pt (Centrally Generated MC Sample)", "Truth_Lepton1_Pt (Centrally Generated MC Sample)", 100, 0, 100); // 1GeV/Bin TH1D* h_TruthLepton2_Pt = new TH1D("Truth_Lepton2_Pt (Centrally Generated MC Sample)", "Truth_Lepton2_Pt (Centrally Generated MC Sample)", 100, 0, 100); // 1GeV/Bin TH1D* h_TruthLepton1_Eta = new TH1D("Truth_Lepton1_Eta (Centrally Generated MC Sample)", "Truth_Lepton1_Eta (Centrally Generated MC Sample)", 90, -15, 15); TH1D* h_TruthLepton2_Eta = new TH1D("Truth_Lepton2_Eta (Centrally Generated MC Sample)", "Truth_Lepton2_Eta (Centrally Generated MC Sample)", 90, -15, 15); TH1D* h_STruthJPsi_Mass = new TH1D("Truth_JPsi_Mass (Private MC Sample)", "Truth_JPsi_Mass (Private MC Sample)", 100, 3.096, 3.099); // 30KeV/Bin TH1D* h_STruthJPsi_Pt = new TH1D("Truth_JPsi_Pt (Private MC Sample)", "Truth_JPsi_Pt (Private MC Sample)", 100, 0, 100); // 1GeV/Bin TH1D* h_STruthJPsi_Eta = new TH1D("Truth_JPsi_Eta (Private MC Sample)", "Truth_JPsi_Eta (Private MC Sample)", 90, -15, 15); TH1D* h_STruthLepton1_Pt = new TH1D("Truth_Lepton1_Pt (Private MC Sample)", "Truth_Lepton1_Pt (Private MC Sample)", 100, 0, 100); // 1GeV/Bin TH1D* h_STruthLepton2_Pt = new TH1D("Truth_Lepton2_Pt (Private MC Sample)", "Truth_Lepton2_Pt (Private MC Sample)", 100, 0, 100); // 1GeV/Bin TH1D* h_STruthLepton1_Eta = new TH1D("Truth_Lepton1_Eta (Private MC Sample)", "Truth_Lepton1_Eta (Private MC Sample)", 90, -15, 15); TH1D* h_STruthLepton2_Eta = new TH1D("Truth_Lepton2_Eta (Private MC Sample)", "Truth_Lepton2_Eta (Private MC Sample)", 90, -15, 15); // First MC Sample // int AllMCEntries = InMCTree->GetEntries(); int EmptyEvents = 0; std::cout << endl; std::cout << "Number of Entries (Centrally Generated MC Sample) = " << AllMCEntries << endl; for(int i=0; iGetEntry(i); if (In_Truth_JPsi_Mass->empty()) EmptyEvents++; if (!In_Truth_JPsi_Mass->empty()) { h_TruthJPsi_Mass->Fill(In_Truth_JPsi_Mass->at(0)); h_TruthJPsi_Pt->Fill(In_Truth_JPsi_Pt->at(0)); h_TruthJPsi_Eta->Fill(In_Truth_JPsi_Eta->at(0)); h_TruthLepton1_Pt->Fill(In_Truth_JPsiLepton1_Pt->at(0)); h_TruthLepton1_Eta->Fill(In_Truth_JPsiLepton1_Eta->at(0)); h_TruthLepton2_Pt->Fill(In_Truth_JPsiLepton2_Pt->at(0)); h_TruthLepton2_Eta->Fill(In_Truth_JPsiLepton2_Eta->at(0)); } } // <---<< End of "Main Loop" std::cout << endl; std::cout << "Number of Empty Events (Centrally Generated MC Sample) = " << EmptyEvents << endl; // Second MC Sample // int AllSMCEntries = SInMCTree->GetEntries(); int SEmptyEvents = 0; std::cout << endl; std::cout << "Number of Entries (Private MC Sample) = " << AllSMCEntries << endl; for(int i=0; iGetEntry(i); if (SIn_Truth_JPsi_Mass->empty()) SEmptyEvents++; if (!SIn_Truth_JPsi_Mass->empty()) { h_STruthJPsi_Mass->Fill(SIn_Truth_JPsi_Mass->at(0)); h_STruthJPsi_Pt->Fill(SIn_Truth_JPsi_Pt->at(0)); h_STruthJPsi_Eta->Fill(SIn_Truth_JPsi_Eta->at(0)); h_STruthLepton1_Pt->Fill(SIn_Truth_JPsiLepton1_Pt->at(0)); h_STruthLepton1_Eta->Fill(SIn_Truth_JPsiLepton1_Eta->at(0)); h_STruthLepton2_Pt->Fill(SIn_Truth_JPsiLepton2_Pt->at(0)); h_STruthLepton2_Eta->Fill(SIn_Truth_JPsiLepton2_Eta->at(0)); } } // <---<< End of "Main Loop" std::cout << endl; std::cout << "Number of Empty Events (Private MC Sample) = " << SEmptyEvents << endl; double NormalizationFactor = (double)AllMCEntries/(double)AllSMCEntries; std::cout << endl; std::cout << "Nornalization Factor = " << NormalizationFactor << endl; // Creating Canvases // double WW = 1200; double WH = 900; gROOT->SetBatch(kTRUE); // <---<< To prevent canvases from opening //gStyle->SetPalette(109); //kCool // <---<< This setting cannot be set for each plot individually! Choose one for all plots. gStyle->SetPalette(60); //kBlueRedYellow //gStyle->SetPalette(89); //kMint TH1D* h_OFTruthJPsi_Pt = new TH1D("Truth_JPsi_Pt (Centrally Generated MC Sample-OF)", "Truth_JPsi_Pt (Centrally Generated MC Sample-OF)", 51, 0, 51); // 1GeV/Bin TH1D* h_OFTruthLepton1_Pt = new TH1D("Truth_Lepton1_Pt (Centrally Generated MC Sample-OF)", "Truth_Lepton1_Pt (Centrally Generated MC Sample-OF)", 41, 0, 41); // 1GeV/Bin TH1D* h_OFTruthLepton2_Pt = new TH1D("Truth_Lepton2_Pt (Centrally Generated MC Sample-OF)", "Truth_Lepton2_Pt (Centrally Generated MC Sample-OF)", 21, 0, 21); // 1GeV/Bin TH1D* h_OFSTruthJPsi_Pt = new TH1D("Truth_JPsi_Pt (Private MC Sample-OF)", "Truth_JPsi_Pt (Private MC Sample-OF)", 51, 0, 51); // 1GeV/Bin TH1D* h_OFSTruthLepton1_Pt = new TH1D("Truth_Lepton1_Pt (Private MC Sample-OF)", "Truth_Lepton1_Pt (Private MC Sample-OF)", 41, 0, 41); // 1GeV/Bin TH1D* h_OFSTruthLepton2_Pt = new TH1D("Truth_Lepton2_Pt (Private MC Sample-OF)", "Truth_Lepton2_Pt (Private MC Sample-OF)", 21, 0, 21); // 1GeV/Bin int Container[6] = {0}; for (int l=1; l<=100; l++) { if (l<=50) { h_OFTruthJPsi_Pt->SetBinContent(l,h_TruthJPsi_Pt->GetBinContent(l)); h_OFSTruthJPsi_Pt->SetBinContent(l,h_STruthJPsi_Pt->GetBinContent(l)); } else { Container[0]+=h_TruthJPsi_Pt->GetBinContent(l); Container[1]+=h_STruthJPsi_Pt->GetBinContent(l); } if (l<=40) { h_OFTruthLepton1_Pt->SetBinContent(l,h_TruthLepton1_Pt->GetBinContent(l)); h_OFSTruthLepton1_Pt->SetBinContent(l,h_STruthLepton1_Pt->GetBinContent(l)); } else { Container[2]+=h_TruthLepton1_Pt->GetBinContent(l); Container[3]+=h_STruthLepton1_Pt->GetBinContent(l); } if (l<=20) { h_OFTruthLepton2_Pt->SetBinContent(l,h_TruthLepton2_Pt->GetBinContent(l)); h_OFSTruthLepton2_Pt->SetBinContent(l,h_STruthLepton2_Pt->GetBinContent(l)); } else { Container[4]+=h_TruthLepton2_Pt->GetBinContent(l); Container[5]+=h_STruthLepton2_Pt->GetBinContent(l); } } h_OFTruthJPsi_Pt->SetBinContent(51,Container[0]); h_OFTruthLepton1_Pt->SetBinContent(41,Container[2]); h_OFTruthLepton2_Pt->SetBinContent(21,Container[4]); h_OFSTruthJPsi_Pt->SetBinContent(51,Container[1]); h_OFSTruthLepton1_Pt->SetBinContent(41,Container[3]); h_OFSTruthLepton2_Pt->SetBinContent(21,Container[5]); h_OFTruthJPsi_Pt->SetEntries(h_TruthJPsi_Pt->GetEntries()); h_OFTruthLepton1_Pt->SetEntries(h_TruthLepton1_Pt->GetEntries()); h_OFTruthLepton2_Pt->SetEntries(h_TruthLepton2_Pt->GetEntries()); h_OFSTruthJPsi_Pt->SetEntries(h_STruthJPsi_Pt->GetEntries()); h_OFSTruthLepton1_Pt->SetEntries(h_STruthLepton1_Pt->GetEntries()); h_OFSTruthLepton2_Pt->SetEntries(h_STruthLepton2_Pt->GetEntries()); TH1D* h_NSTruthJPsi_Mass = new TH1D("Truth_JPsi_Mass (Private MC Sample-NOF)", "Truth_JPsi_Mass (Private MC Sample-NOF)", 100, 3.096, 3.099); // 30KeV/Bin TH1D* h_NOFSTruthJPsi_Pt = new TH1D("Truth_JPsi_Pt (Private MC Sample-NOF)", "Truth_JPsi_Pt (Private MC Sample-NOF)", 51, 0, 51); // 1GeV/Bin TH1D* h_NOFSTruthLepton1_Pt = new TH1D("Truth_Lepton1_Pt (Private MC Sample-NOF)", "Truth_Lepton1_Pt (Private MC Sample-NOF)", 41, 0, 41); TH1D* h_NOFSTruthLepton2_Pt = new TH1D("Truth_Lepton2_Pt (Private MC Sample-NOF)", "Truth_Lepton2_Pt (Private MC Sample-NOF)", 21, 0, 21); // J/Psi Mass // for (int l=0; l<(int)h_STruthJPsi_Mass->GetNbinsX(); l++) h_NSTruthJPsi_Mass->SetBinContent(l+1,(NormalizationFactor*(double)h_STruthJPsi_Mass->GetBinContent(l+1))); h_NSTruthJPsi_Mass->SetEntries(h_NSTruthJPsi_Mass->Integral()); TCanvas* JPsiMass_canv = new TCanvas("J/Psi Mass","J/Psi Mass"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); h_TruthJPsi_Mass->SetMarkerStyle(34); h_TruthJPsi_Mass->SetTitle("J/Psi Mass (Comparison between two MC samples)"); h_TruthJPsi_Mass->GetXaxis()->SetTitle("J/Psi Mass (GeV)"); h_TruthJPsi_Mass->GetXaxis()->SetRangeUser(3.096,3.099); h_TruthJPsi_Mass->GetXaxis()->SetNdivisions(9); h_TruthJPsi_Mass->SetFillStyle(3001); h_TruthJPsi_Mass->SetFillColor(kRed); h_TruthJPsi_Mass->Draw(); h_STruthJPsi_Mass->SetFillStyle(3001); h_STruthJPsi_Mass->SetFillColor(kGreen); h_STruthJPsi_Mass->Draw("sames"); TLegend* l_JPsiMass = new TLegend(0.73,0.67,0.88,0.87); l_JPsiMass->SetTextSize(0.015); l_JPsiMass->SetHeader("MC Samples","C"); l_JPsiMass->AddEntry(h_TruthJPsi_Mass,"Centrally Generated MC Sample","f"); l_JPsiMass->AddEntry(h_STruthJPsi_Mass,"Private MC Sample","f"); l_JPsiMass->Draw(); gPad->Update(); JPsiMass_canv->SetWindowSize(WW, WH); JPsiMass_canv->Write(); TCanvas* NJPsiMass_canv = new TCanvas("J/Psi Mass (Normalized)","J/Psi Mass"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); h_TruthJPsi_Mass->SetStats(kFALSE); h_TruthJPsi_Mass->SetMarkerStyle(34); h_TruthJPsi_Mass->SetTitle("J/Psi Mass (Comparison between two MC samples)"); h_TruthJPsi_Mass->GetXaxis()->SetTitle("J/Psi Mass (GeV)"); h_TruthJPsi_Mass->GetXaxis()->SetRangeUser(3.096,3.099); h_TruthJPsi_Mass->GetXaxis()->SetNdivisions(9); h_TruthJPsi_Mass->SetFillStyle(3001); h_TruthJPsi_Mass->SetFillColor(kRed); h_TruthJPsi_Mass->Draw(); h_NSTruthJPsi_Mass->SetStats(kFALSE); h_NSTruthJPsi_Mass->SetFillStyle(3001); h_NSTruthJPsi_Mass->SetMarkerStyle(34); h_NSTruthJPsi_Mass->SetFillColor(kGreen); h_NSTruthJPsi_Mass->Draw("sames"); TLegend* l_NJPsiMass = new TLegend(0.73,0.67,0.88,0.87); l_NJPsiMass->SetTextSize(0.015); l_NJPsiMass->SetHeader("MC Samples","C"); l_NJPsiMass->AddEntry(h_TruthJPsi_Mass,"Centrally Generated MC Sample","f"); l_NJPsiMass->AddEntry(h_NSTruthJPsi_Mass,"Private MC Sample (Normalized)","f"); l_NJPsiMass->Draw(); gPad->Update(); NJPsiMass_canv->SetWindowSize(WW, WH); NJPsiMass_canv->Write(); TCanvas* rp_JPsiMass_canv = new TCanvas("Ratio Plot for J/Psi Mass","Ratio Plot for J/Psi Mass"); TRatioPlot* rp_JPsiMass = new TRatioPlot(h_NSTruthJPsi_Mass,h_TruthJPsi_Mass); gStyle->SetOptStat(0); rp_JPsiMass->Draw(); rp_JPsiMass->GetLowYaxis()->SetNdivisions(505); rp_JPsiMass_canv->SetWindowSize(WW, WH); rp_JPsiMass_canv->Write(); /* const int nMJPsi = 100; double XMJPsi[nMJPsi] = {0.}; double YMJPsi[nMJPsi] = {0.}; double MinMassRatio = 10000.; double MaxMassRatio = 0.; for (int l=0; l<(int)h_STruthJPsi_Mass->GetNbinsX(); l++) { if (h_TruthJPsi_Mass->GetBinContent(l+1)!=0.) { XMJPsi[l] = h_NSTruthJPsi_Mass->GetXaxis()->GetBinCenter(l+1); YMJPsi[l] = (double)h_NSTruthJPsi_Mass->GetBinContent(l+1)/(double)h_TruthJPsi_Mass->GetBinContent(l+1); if (YMJPsi[l]MaxMassRatio) MaxMassRatio = YMJPsi[l]; } } TGraph* g_MJPsi = new TGraph(nMJPsi,XMJPsi,YMJPsi); TCanvas* JPsiMassRatio_canv = new TCanvas("Ratio Graph for J/Psi Mass","Ratio Graph for J/Psi Mass"); gPad->SetGrid(); g_MJPsi->GetXaxis()->SetLimits(3.096,3.099); g_MJPsi->GetHistogram()->SetMaximum(MaxMassRatio+0.05); g_MJPsi->GetHistogram()->SetMinimum(MinMassRatio-0.05); g_MJPsi->SetMarkerStyle(47); g_MJPsi->SetMarkerColor(40); g_MJPsi->SetMarkerSize(1.5); g_MJPsi->SetTitle("Ratio Graph for J/Psi Mass (Private/Centrally Generated)"); g_MJPsi->Draw("AP"); gPad->Update(); JPsiMassRatio_canv->SetWindowSize(WW, WH); JPsiMassRatio_canv->Write(); */ // J/Psi Pt // for (int l=0; l<(int)h_OFSTruthJPsi_Pt->GetNbinsX(); l++) h_NOFSTruthJPsi_Pt->SetBinContent(l+1,(NormalizationFactor*(double)h_OFSTruthJPsi_Pt->GetBinContent(l+1))); h_NOFSTruthJPsi_Pt->SetEntries(h_NOFSTruthJPsi_Pt->Integral()); TCanvas* JPsiPt_canv = new TCanvas("J/Psi Pt","J/Psi Pt"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); //h_TruthJPsi_Pt->SetStats(kFALSE); h_TruthJPsi_Pt->SetMarkerStyle(34); h_TruthJPsi_Pt->SetTitle("J/Psi Pt (Comparison between two MC samples)"); h_TruthJPsi_Pt->GetXaxis()->SetTitle("J/Psi Pt (GeV)"); h_TruthJPsi_Pt->GetXaxis()->SetRangeUser(0,100); h_TruthJPsi_Pt->GetXaxis()->SetNdivisions(10); h_TruthJPsi_Pt->SetFillStyle(3001); h_TruthJPsi_Pt->SetFillColor(kRed); h_TruthJPsi_Pt->Draw(); //h_STruthJPsi_Pt->SetStats(kFALSE); h_STruthJPsi_Pt->SetFillStyle(3001); h_STruthJPsi_Pt->SetFillColor(kGreen); h_STruthJPsi_Pt->Draw("sames"); TLegend* l_JPsiPt = new TLegend(0.73,0.67,0.88,0.87); l_JPsiPt->SetTextSize(0.015); l_JPsiPt->SetHeader("MC Samples","C"); l_JPsiPt->AddEntry(h_TruthJPsi_Pt,"Centrally Generated MC Sample","f"); l_JPsiPt->AddEntry(h_STruthJPsi_Pt,"Private MC Sample","f"); l_JPsiPt->Draw(); gPad->Update(); JPsiPt_canv->SetWindowSize(WW, WH); JPsiPt_canv->Write(); TCanvas* OFJPsiPt_canv = new TCanvas("J/Psi Pt (Overflow)","J/Psi Pt"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); //gStyle->SetOptStat("neMRo"); //h_OFTruthJPsi_Pt->SetStats(kFALSE); h_OFTruthJPsi_Pt->SetMarkerStyle(34); h_OFTruthJPsi_Pt->SetTitle("J/Psi Pt (Comparison between two MC samples)"); h_OFTruthJPsi_Pt->GetXaxis()->SetTitle("J/Psi Pt (GeV)"); h_OFTruthJPsi_Pt->GetXaxis()->SetRangeUser(0,51); h_OFTruthJPsi_Pt->GetXaxis()->SetNdivisions(5); h_OFTruthJPsi_Pt->GetYaxis()->SetRangeUser(0.5,(2*h_OFTruthJPsi_Pt->GetMaximum())); h_OFTruthJPsi_Pt->SetFillStyle(3001); h_OFTruthJPsi_Pt->SetFillColor(kRed); h_OFTruthJPsi_Pt->Draw(); //h_OFSTruthJPsi_Pt->SetStats(kFALSE); h_OFSTruthJPsi_Pt->SetFillStyle(3001); h_OFSTruthJPsi_Pt->SetFillColor(kGreen); h_OFSTruthJPsi_Pt->Draw("sames"); TLegend* l_OFJPsiPt = new TLegend(0.73,0.67,0.88,0.87); l_OFJPsiPt->SetTextSize(0.015); l_OFJPsiPt->SetHeader("MC Samples","C"); l_OFJPsiPt->AddEntry(h_OFTruthJPsi_Pt,"Centrally Generated MC Sample","f"); l_OFJPsiPt->AddEntry(h_OFSTruthJPsi_Pt,"Private MC Sample","f"); l_OFJPsiPt->Draw(); gPad->Update(); OFJPsiPt_canv->SetWindowSize(WW, WH); OFJPsiPt_canv->Write(); TCanvas* NJPsiPt_canv = new TCanvas("J/Psi Pt (Normalized)","J/Psi Pt"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); h_OFTruthJPsi_Pt->SetStats(kFALSE); h_OFTruthJPsi_Pt->SetMarkerStyle(34); h_OFTruthJPsi_Pt->SetTitle("J/Psi Pt (Comparison between two MC samples)"); h_OFTruthJPsi_Pt->GetXaxis()->SetTitle("J/Psi Pt (GeV)"); h_OFTruthJPsi_Pt->GetXaxis()->SetRangeUser(0,51); h_OFTruthJPsi_Pt->GetXaxis()->SetNdivisions(5); h_OFTruthJPsi_Pt->GetYaxis()->SetRangeUser(0.5,(2*h_OFTruthJPsi_Pt->GetMaximum())); h_OFTruthJPsi_Pt->SetFillStyle(3001); h_OFTruthJPsi_Pt->SetFillColor(kRed); h_OFTruthJPsi_Pt->Draw(); h_NOFSTruthJPsi_Pt->SetStats(kFALSE); h_NOFSTruthJPsi_Pt->SetFillStyle(3001); h_NOFSTruthJPsi_Pt->SetFillColor(kGreen); h_NOFSTruthJPsi_Pt->Draw("sames"); TLegend* l_NJPsiPt = new TLegend(0.73,0.67,0.88,0.87); l_NJPsiPt->SetTextSize(0.015); l_NJPsiPt->SetHeader("MC Samples","C"); l_NJPsiPt->AddEntry(h_OFTruthJPsi_Pt,"Centrally Generated MC Sample","f"); l_NJPsiPt->AddEntry(h_NOFSTruthJPsi_Pt,"Private MC Sample (Normalized)","f"); l_NJPsiPt->Draw(); gPad->Update(); NJPsiPt_canv->SetWindowSize(WW, WH); NJPsiPt_canv->Write(); TCanvas* rp_JPsiPt_canv = new TCanvas("Ratio Plot for J/Psi Pt","Ratio Plot for J/Psi Pt"); TRatioPlot* rp_JPsiPt = new TRatioPlot(h_NOFSTruthJPsi_Pt,h_OFTruthJPsi_Pt); gStyle->SetOptStat(0); rp_JPsiPt->Draw(); rp_JPsiPt->GetLowYaxis()->SetNdivisions(505); rp_JPsiPt_canv->SetWindowSize(WW, WH); rp_JPsiPt_canv->Write(); /* const int nPtJPsi = 51; double XPtJPsi[nPtJPsi] = {0.}; double YPtJPsi[nPtJPsi] = {0.}; double MinPtRatio = 10000.; double MaxPtRatio = 0.; for (int l=0; l<(int)h_OFSTruthJPsi_Pt->GetNbinsX(); l++) { if (h_OFTruthJPsi_Pt->GetBinContent(l+1)!=0.) { XPtJPsi[l] = h_NOFSTruthJPsi_Pt->GetXaxis()->GetBinCenter(l+1); YPtJPsi[l] = (double)h_NOFSTruthJPsi_Pt->GetBinContent(l+1)/(double)h_OFTruthJPsi_Pt->GetBinContent(l+1); if (YPtJPsi[l]MaxPtRatio) MaxPtRatio = YPtJPsi[l]; } } TGraph* g_PtJPsi = new TGraph(nPtJPsi,XPtJPsi,YPtJPsi); TCanvas* JPsiPtRatio_canv = new TCanvas("Ratio Graph for J/Psi Pt","Ratio Graph for J/Psi Pt"); gPad->SetGrid(); g_PtJPsi->GetXaxis()->SetLimits(0,51); g_PtJPsi->GetHistogram()->SetMaximum(MaxPtRatio+0.05); g_PtJPsi->GetHistogram()->SetMinimum(MinPtRatio-0.05); g_PtJPsi->SetMarkerStyle(47); g_PtJPsi->SetMarkerColor(40); g_PtJPsi->SetMarkerSize(1.5); g_PtJPsi->SetTitle("Ratio Graph for J/Psi Pt (Private/Centrally Generated)"); g_PtJPsi->Draw("AP"); gPad->Update(); JPsiPtRatio_canv->SetWindowSize(WW, WH); JPsiPtRatio_canv->Write(); */ // J/Psi Eta // TCanvas* JPsiEta_canv = new TCanvas("J/Psi Eta","J/Psi Eta"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); h_TruthJPsi_Eta->SetStats(kFALSE); h_TruthJPsi_Eta->SetMarkerStyle(34); h_TruthJPsi_Eta->SetTitle("J/Psi Eta (Comparison between two MC samples)"); h_TruthJPsi_Eta->GetXaxis()->SetTitle("J/Psi Eta"); h_TruthJPsi_Eta->GetXaxis()->SetRangeUser(-15,15); h_TruthJPsi_Eta->GetXaxis()->SetNdivisions(15); h_TruthJPsi_Eta->SetFillStyle(3001); h_TruthJPsi_Eta->SetFillColor(kRed); h_TruthJPsi_Eta->Draw(); h_STruthJPsi_Eta->SetStats(kFALSE); h_STruthJPsi_Eta->SetFillStyle(3001); h_STruthJPsi_Eta->SetFillColor(kGreen); h_STruthJPsi_Eta->Draw("sames"); TLegend* l_JPsiEta = new TLegend(0.73,0.67,0.88,0.87); l_JPsiEta->SetTextSize(0.015); l_JPsiEta->SetHeader("MC Samples","C"); l_JPsiEta->AddEntry(h_TruthJPsi_Eta,"Centrally Generated MC Sample","f"); l_JPsiEta->AddEntry(h_STruthJPsi_Eta,"Private MC Sample","f"); l_JPsiEta->Draw(); gPad->Update(); JPsiEta_canv->SetWindowSize(WW, WH); JPsiEta_canv->Write(); // Lepton1 Pt // for (int l=0; l<(int)h_OFSTruthLepton1_Pt->GetNbinsX(); l++) h_NOFSTruthLepton1_Pt->SetBinContent(l+1,(NormalizationFactor*(double)h_OFSTruthLepton1_Pt->GetBinContent(l+1))); h_NOFSTruthLepton1_Pt->SetEntries(h_NOFSTruthLepton1_Pt->Integral()); TCanvas* Lepton1Pt_canv = new TCanvas("First Lepton Pt","First Lepton Pt"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); //h_TruthLepton1_Pt->SetStats(kFALSE); h_TruthLepton1_Pt->SetMarkerStyle(34); h_TruthLepton1_Pt->SetTitle("First Lepton Pt (Comparison between two MC samples)"); h_TruthLepton1_Pt->GetXaxis()->SetTitle("Lepton Pt (GeV)"); h_TruthLepton1_Pt->GetXaxis()->SetRangeUser(0,100); h_TruthLepton1_Pt->GetXaxis()->SetNdivisions(10); h_TruthLepton1_Pt->SetFillStyle(3001); h_TruthLepton1_Pt->SetFillColor(kRed); h_TruthLepton1_Pt->Draw(); //h_STruthLepton1_Pt->SetStats(kFALSE); h_STruthLepton1_Pt->SetFillStyle(3001); h_STruthLepton1_Pt->SetFillColor(kGreen); h_STruthLepton1_Pt->Draw("sames"); TLegend* l_Lepton1Pt = new TLegend(0.73,0.67,0.88,0.87); l_Lepton1Pt->SetTextSize(0.015); l_Lepton1Pt->SetHeader("MC Samples","C"); l_Lepton1Pt->AddEntry(h_TruthLepton1_Pt,"Centrally Generated MC Sample","f"); l_Lepton1Pt->AddEntry(h_STruthLepton1_Pt,"Private MC Sample","f"); l_Lepton1Pt->Draw(); gPad->Update(); Lepton1Pt_canv->SetWindowSize(WW, WH); Lepton1Pt_canv->Write(); TCanvas* OFLepton1Pt_canv = new TCanvas("First Lepton Pt (Overflow)","First Lepton Pt"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); //gStyle->SetOptStat("neMRo"); //h_OFTruthLepton1_Pt->SetStats(kFALSE); h_OFTruthLepton1_Pt->SetMarkerStyle(34); h_OFTruthLepton1_Pt->SetTitle("First Lepton Pt (Comparison between two MC samples)"); h_OFTruthLepton1_Pt->GetXaxis()->SetTitle("Lepton Pt (GeV)"); h_OFTruthLepton1_Pt->GetXaxis()->SetRangeUser(0,41); h_OFTruthLepton1_Pt->GetXaxis()->SetNdivisions(8); h_OFTruthLepton1_Pt->GetYaxis()->SetRangeUser(0.5,(2*h_OFTruthLepton1_Pt->GetMaximum())); h_OFTruthLepton1_Pt->SetFillStyle(3001); h_OFTruthLepton1_Pt->SetFillColor(kRed); h_OFTruthLepton1_Pt->Draw(); //h_OFSTruthLepton1_Pt->SetStats(kFALSE); h_OFSTruthLepton1_Pt->SetFillStyle(3001); h_OFSTruthLepton1_Pt->SetFillColor(kGreen); h_OFSTruthLepton1_Pt->Draw("sames"); TLegend* l_OFLepton1Pt = new TLegend(0.73,0.67,0.88,0.87); l_OFLepton1Pt->SetTextSize(0.015); l_OFLepton1Pt->SetHeader("MC Samples","C"); l_OFLepton1Pt->AddEntry(h_OFTruthLepton1_Pt,"Centrally Generated MC Sample","f"); l_OFLepton1Pt->AddEntry(h_OFSTruthLepton1_Pt,"Private MC Sample","f"); l_OFLepton1Pt->Draw(); gPad->Update(); OFLepton1Pt_canv->SetWindowSize(WW, WH); OFLepton1Pt_canv->Write(); TCanvas* NLepton1Pt_canv = new TCanvas("Lepton1 Pt (Normalized)","Lepton1 Pt"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); h_OFTruthLepton1_Pt->SetStats(kFALSE); h_OFTruthLepton1_Pt->SetMarkerStyle(34); h_OFTruthLepton1_Pt->SetTitle("First Lepton Pt (Comparison between two MC samples)"); h_OFTruthLepton1_Pt->GetXaxis()->SetTitle("First Lepton Pt (GeV)"); h_OFTruthLepton1_Pt->GetXaxis()->SetRangeUser(0,41); h_OFTruthLepton1_Pt->GetXaxis()->SetNdivisions(8); h_OFTruthLepton1_Pt->GetYaxis()->SetRangeUser(0.5,(2*h_OFTruthLepton1_Pt->GetMaximum())); h_OFTruthLepton1_Pt->SetFillStyle(3001); h_OFTruthLepton1_Pt->SetFillColor(kRed); h_OFTruthLepton1_Pt->Draw(); h_NOFSTruthLepton1_Pt->SetStats(kFALSE); h_NOFSTruthLepton1_Pt->SetFillStyle(3001); h_NOFSTruthLepton1_Pt->SetFillColor(kGreen); h_NOFSTruthLepton1_Pt->Draw("sames"); TLegend* l_NLepton1Pt = new TLegend(0.73,0.67,0.88,0.87); l_NLepton1Pt->SetTextSize(0.015); l_NLepton1Pt->SetHeader("MC Samples","C"); l_NLepton1Pt->AddEntry(h_OFTruthLepton1_Pt,"Centrally Generated MC Sample","f"); l_NLepton1Pt->AddEntry(h_NOFSTruthLepton1_Pt,"Private MC Sample (Normalized)","f"); l_NLepton1Pt->Draw(); gPad->Update(); NLepton1Pt_canv->SetWindowSize(WW, WH); NLepton1Pt_canv->Write(); TCanvas* rp_L1Pt_canv = new TCanvas("Ratio Plot for First Lepton Pt","Ratio Plot for First Lepton Pt"); TRatioPlot* rp_L1Pt = new TRatioPlot(h_NOFSTruthLepton1_Pt,h_OFTruthLepton1_Pt); gStyle->SetOptStat(0); rp_L1Pt->Draw(); rp_L1Pt->GetLowYaxis()->SetNdivisions(505); rp_L1Pt_canv->SetWindowSize(WW, WH); rp_L1Pt_canv->Write(); /* const int nPtL1 = 41; double XPtL1[nPtL1] = {0.}; double YPtL1[nPtL1] = {0.}; double MinPt1Ratio = 10000.; double MaxPt1Ratio = 0.; for (int l=0; l<(int)h_OFSTruthLepton1_Pt->GetNbinsX(); l++) { if (h_OFTruthLepton1_Pt->GetBinContent(l+1)!=0.) { XPtL1[l] = h_NOFSTruthLepton1_Pt->GetXaxis()->GetBinCenter(l+1); YPtL1[l] = (double)h_NOFSTruthLepton1_Pt->GetBinContent(l+1)/(double)h_OFTruthLepton1_Pt->GetBinContent(l+1); if (YPtL1[l]MaxPt1Ratio) MaxPt1Ratio = YPtL1[l]; } } TGraph* g_PtL1 = new TGraph(nPtL1,XPtL1,YPtL1); TCanvas* L1PtRatio_canv = new TCanvas("Ratio Graph for First Lepton Pt","Ratio Graph for First Lepton Pt"); gPad->SetGrid(); g_PtL1->GetXaxis()->SetLimits(0,41); g_PtL1->GetHistogram()->SetMaximum(MaxPt1Ratio+0.05); g_PtL1->GetHistogram()->SetMinimum(MinPt1Ratio-0.05); g_PtL1->SetMarkerStyle(47); g_PtL1->SetMarkerColor(40); g_PtL1->SetMarkerSize(1.5); g_PtL1->SetTitle("Ratio Graph for First Lepton Pt (Private/Centrally Generated)"); g_PtL1->Draw("AP"); gPad->Update(); L1PtRatio_canv->SetWindowSize(WW, WH); L1PtRatio_canv->Write(); */ // Lepton2 Pt // for (int l=0; l<(int)h_OFSTruthLepton2_Pt->GetNbinsX(); l++) h_NOFSTruthLepton2_Pt->SetBinContent(l+1,(NormalizationFactor*(double)h_OFSTruthLepton2_Pt->GetBinContent(l+1))); h_NOFSTruthLepton2_Pt->SetEntries(h_NOFSTruthLepton2_Pt->Integral()); TCanvas* Lepton2Pt_canv = new TCanvas("Second Lepton Pt","Second Lepton Pt"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); //h_TruthLepton2_Pt->SetStats(kFALSE); h_TruthLepton2_Pt->SetMarkerStyle(34); h_TruthLepton2_Pt->SetTitle("Second Lepton Pt (Comparison between two MC samples)"); h_TruthLepton2_Pt->GetXaxis()->SetTitle("Lepton Pt (GeV)"); h_TruthLepton2_Pt->GetXaxis()->SetRangeUser(0,100); h_TruthLepton2_Pt->GetXaxis()->SetNdivisions(10); h_TruthLepton2_Pt->SetFillStyle(3001); h_TruthLepton2_Pt->SetFillColor(kRed); h_TruthLepton2_Pt->Draw(); h_STruthLepton2_Pt->SetFillStyle(3001); h_STruthLepton2_Pt->SetFillColor(kGreen); h_STruthLepton2_Pt->Draw("sames"); TLegend* l_Lepton2Pt = new TLegend(0.73,0.67,0.88,0.87); l_Lepton2Pt->SetTextSize(0.015); l_Lepton2Pt->SetHeader("MC Samples","C"); l_Lepton2Pt->AddEntry(h_TruthLepton2_Pt,"Centrally Generated MC Sample","f"); l_Lepton2Pt->AddEntry(h_STruthLepton2_Pt,"Private MC Sample","f"); l_Lepton2Pt->Draw(); gPad->Update(); Lepton2Pt_canv->SetWindowSize(WW, WH); Lepton2Pt_canv->Write(); TCanvas* OFLepton2Pt_canv = new TCanvas("Second Lepton Pt (Overflow)","Second Lepton Pt"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); //gStyle->SetOptStat("neMRo"); //h_OFTruthLepton2_Pt->SetStats(kFALSE); h_OFTruthLepton2_Pt->SetMarkerStyle(34); h_OFTruthLepton2_Pt->SetTitle("Second Lepton Pt (Comparison between two MC samples)"); h_OFTruthLepton2_Pt->GetXaxis()->SetTitle("Lepton Pt (GeV)"); h_OFTruthLepton2_Pt->GetXaxis()->SetRangeUser(0,21); h_OFTruthLepton2_Pt->GetXaxis()->SetNdivisions(8); h_OFTruthLepton2_Pt->GetYaxis()->SetRangeUser(0.5,(2*h_OFTruthLepton2_Pt->GetMaximum())); h_OFTruthLepton2_Pt->SetFillStyle(3001); h_OFTruthLepton2_Pt->SetFillColor(kRed); h_OFTruthLepton2_Pt->Draw(); //h_OFSTruthLepton2_Pt->SetStats(kFALSE); h_OFSTruthLepton2_Pt->SetFillStyle(3001); h_OFSTruthLepton2_Pt->SetFillColor(kGreen); h_OFSTruthLepton2_Pt->Draw("sames"); TLegend* l_OFLepton2Pt = new TLegend(0.73,0.67,0.88,0.87); l_OFLepton2Pt->SetTextSize(0.015); l_OFLepton2Pt->SetHeader("MC Samples","C"); l_OFLepton2Pt->AddEntry(h_OFTruthLepton2_Pt,"Centrally Generated MC Sample","f"); l_OFLepton2Pt->AddEntry(h_OFSTruthLepton2_Pt,"Private MC Sample","f"); l_OFLepton2Pt->Draw(); gPad->Update(); OFLepton2Pt_canv->SetWindowSize(WW, WH); OFLepton2Pt_canv->Write(); TCanvas* NLepton2Pt_canv = new TCanvas("Lepton2 Pt (Normalized)","Lepton2 Pt"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); h_OFTruthLepton2_Pt->SetStats(kFALSE); h_OFTruthLepton2_Pt->SetMarkerStyle(34); h_OFTruthLepton2_Pt->SetTitle("Second Lepton Pt (Comparison between two MC samples)"); h_OFTruthLepton2_Pt->GetXaxis()->SetTitle("Second Lepton Pt (GeV)"); h_OFTruthLepton2_Pt->GetXaxis()->SetRangeUser(0,21); h_OFTruthLepton2_Pt->GetXaxis()->SetNdivisions(8); h_OFTruthLepton2_Pt->GetYaxis()->SetRangeUser(0.5,(2*h_OFTruthLepton2_Pt->GetMaximum())); h_OFTruthLepton2_Pt->SetFillStyle(3001); h_OFTruthLepton2_Pt->SetFillColor(kRed); h_OFTruthLepton2_Pt->Draw(); h_NOFSTruthLepton2_Pt->SetStats(kFALSE); h_NOFSTruthLepton2_Pt->SetFillStyle(3001); h_NOFSTruthLepton2_Pt->SetFillColor(kGreen); h_NOFSTruthLepton2_Pt->Draw("sames"); TLegend* l_NLepton2Pt = new TLegend(0.73,0.67,0.88,0.87); l_NLepton2Pt->SetTextSize(0.015); l_NLepton2Pt->SetHeader("MC Samples","C"); l_NLepton2Pt->AddEntry(h_OFTruthLepton2_Pt,"Centrally Generated MC Sample","f"); l_NLepton2Pt->AddEntry(h_NOFSTruthLepton2_Pt,"Private MC Sample (Normalized)","f"); l_NLepton2Pt->Draw(); gPad->Update(); NLepton2Pt_canv->SetWindowSize(WW, WH); NLepton2Pt_canv->Write(); TCanvas* rp_L2Pt_canv = new TCanvas("Ratio Plot for Second Lepton Pt","Ratio Plot for Second Lepton Pt"); TRatioPlot* rp_L2Pt = new TRatioPlot(h_NOFSTruthLepton2_Pt,h_OFTruthLepton2_Pt); gStyle->SetOptStat(0); rp_L2Pt->Draw(); rp_L2Pt->GetLowYaxis()->SetNdivisions(505); rp_L2Pt_canv->SetWindowSize(WW, WH); rp_L2Pt_canv->Write(); /* const int nPtL2 = 21; double XPtL2[nPtL2] = {0.}; double YPtL2[nPtL2] = {0.}; double MinPt2Ratio = 10000.; double MaxPt2Ratio = 0.; for (int l=0; l<(int)h_OFSTruthLepton2_Pt->GetNbinsX(); l++) { if (h_OFTruthLepton2_Pt->GetBinContent(l+1)!=0.) { XPtL2[l] = h_NOFSTruthLepton2_Pt->GetXaxis()->GetBinCenter(l+1); YPtL2[l] = (double)h_NOFSTruthLepton2_Pt->GetBinContent(l+1)/(double)h_OFTruthLepton2_Pt->GetBinContent(l+1); if (YPtL2[l]MaxPt2Ratio) MaxPt2Ratio = YPtL2[l]; } } TGraph* g_PtL2 = new TGraph(nPtL2,XPtL2,YPtL2); TCanvas* L2PtRatio_canv = new TCanvas("Ratio Graph for Second Lepton Pt","Ratio Graph for Second Lepton Pt"); gPad->SetGrid(); g_PtL2->GetXaxis()->SetLimits(0,21); g_PtL2->GetHistogram()->SetMaximum(MaxPt2Ratio+0.05); g_PtL2->GetHistogram()->SetMinimum(MinPt2Ratio-0.05); g_PtL2->SetMarkerStyle(47); g_PtL2->SetMarkerColor(40); g_PtL2->SetMarkerSize(1.5); g_PtL2->SetTitle("Ratio Graph for Second Lepton Pt (Private/Centrally Generated)"); g_PtL2->Draw("AP"); gPad->Update(); L2PtRatio_canv->SetWindowSize(WW, WH); L2PtRatio_canv->Write(); */ // Lepton1 Eta // TCanvas* TruthLepton1Eta_canv = new TCanvas("First Lepton Eta","First Lepton Eta"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); //h_TruthLepton1_Eta->SetStats(kFALSE); h_TruthLepton1_Eta->SetMarkerStyle(34); h_TruthLepton1_Eta->SetTitle("First Lepton Eta (Comparison between two MC samples)"); h_TruthLepton1_Eta->GetXaxis()->SetTitle("Eta"); h_TruthLepton1_Eta->GetXaxis()->SetRangeUser(-15, 15); h_TruthLepton1_Eta->GetXaxis()->SetNdivisions(15); h_TruthLepton1_Eta->SetFillStyle(3001); h_TruthLepton1_Eta->SetFillColor(kRed); h_TruthLepton1_Eta->Draw(); //h_STruthLepton1_Eta->SetStats(kFALSE); h_STruthLepton1_Eta->SetFillStyle(3001); h_STruthLepton1_Eta->SetFillColor(kGreen); h_STruthLepton1_Eta->Draw("sames"); TLegend* l_TruthLepton1Eta = new TLegend(0.73,0.67,0.88,0.87); l_TruthLepton1Eta->SetTextSize(0.015); l_TruthLepton1Eta->SetHeader("MC Samples","C"); l_TruthLepton1Eta->AddEntry(h_TruthLepton1_Eta,"Centrally Generated MC Sample","f"); l_TruthLepton1Eta->AddEntry(h_STruthLepton1_Eta,"Private MC Sample","f"); l_TruthLepton1Eta->Draw(); gPad->Update(); TruthLepton1Eta_canv->SetWindowSize(WW, WH); TruthLepton1Eta_canv->Write(); // Lepton2 Eta // TCanvas* TruthLepton2Eta_canv = new TCanvas("Second Lepton Eta","Second Lepton Eta"); gPad->SetLogy(); gPad->SetGridx(); gPad->SetGridy(); //h_TruthLepton2_Eta->SetStats(kFALSE); h_TruthLepton2_Eta->SetMarkerStyle(34); h_TruthLepton2_Eta->SetTitle("Second Lepton Eta (Comparison between two MC samples)"); h_TruthLepton2_Eta->GetXaxis()->SetTitle("Eta"); h_TruthLepton2_Eta->GetXaxis()->SetRangeUser(-15, 15); h_TruthLepton2_Eta->GetXaxis()->SetNdivisions(15); h_TruthLepton2_Eta->SetFillStyle(3001); h_TruthLepton2_Eta->SetFillColor(kRed); h_TruthLepton2_Eta->Draw(); //h_STruthLepton2_Eta->SetStats(kFALSE); h_STruthLepton2_Eta->SetFillStyle(3001); h_STruthLepton2_Eta->SetFillColor(kGreen); h_STruthLepton2_Eta->Draw("sames"); TLegend* l_TruthLepton2Eta = new TLegend(0.73,0.67,0.88,0.87); l_TruthLepton2Eta->SetTextSize(0.015); l_TruthLepton2Eta->SetHeader("MC Samples","C"); l_TruthLepton2Eta->AddEntry(h_TruthLepton2_Eta,"Centrally Generated MC Sample","f"); l_TruthLepton2Eta->AddEntry(h_STruthLepton2_Eta,"Private MC Sample","f"); l_TruthLepton2Eta->Draw(); gPad->Update(); TruthLepton2Eta_canv->SetWindowSize(WW, WH); TruthLepton2Eta_canv->Write(); //OutputRootF->Write(); OutputRootF->Close(); std::cout << endl; }