void phimetphimu2b3() { //=========Macro generated from canvas: b3/phimetphimu2b3/b3/phimetphimu2b3 //========= (Tue Nov 24 14:24:06 2015) by ROOT version6.02/05 TCanvas *b3/phimetphimu2b3 = new TCanvas("b3/phimetphimu2b3", "b3/phimetphimu2b3",380,402,700,700); b3/phimetphimu2b3->Range(0,0,1,1); b3/phimetphimu2b3->SetFillColor(0); b3/phimetphimu2b3->SetBorderMode(0); b3/phimetphimu2b3->SetBorderSize(2); b3/phimetphimu2b3->SetLogy(); b3/phimetphimu2b3->SetFrameBorderMode(0); b3/phimetphimu2b3->SetFrameBorderMode(0); THStack *b3/phimetphimu2b3 = new THStack(); b3/phimetphimu2b3->SetName("b3/phimetphimu2b3"); b3/phimetphimu2b3->SetTitle("b3/phimetphimu2b3"); TH1F *b3/phimetphimu2b3_stack_20 = new TH1F("b3/phimetphimu2b3_stack_20","b3/phimetphimu2b3",20,-3.141593,3.141593); b3/phimetphimu2b3_stack_20->SetMinimum(-0); b3/phimetphimu2b3_stack_20->SetMaximum(-nan); b3/phimetphimu2b3_stack_20->SetDirectory(0); b3/phimetphimu2b3_stack_20->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); b3/phimetphimu2b3_stack_20->SetLineColor(ci); b3/phimetphimu2b3_stack_20->GetXaxis()->SetTitle("b3/phimetphimu2b3"); b3/phimetphimu2b3_stack_20->GetXaxis()->SetLabelFont(42); b3/phimetphimu2b3_stack_20->GetXaxis()->SetLabelSize(0.035); b3/phimetphimu2b3_stack_20->GetXaxis()->SetTitleSize(0.035); b3/phimetphimu2b3_stack_20->GetXaxis()->SetTitleFont(42); b3/phimetphimu2b3_stack_20->GetYaxis()->SetTitle("Events/pb"); b3/phimetphimu2b3_stack_20->GetYaxis()->SetLabelFont(42); b3/phimetphimu2b3_stack_20->GetYaxis()->SetLabelSize(0.035); b3/phimetphimu2b3_stack_20->GetYaxis()->SetTitleSize(0.035); b3/phimetphimu2b3_stack_20->GetYaxis()->SetTitleFont(42); b3/phimetphimu2b3_stack_20->GetZaxis()->SetLabelFont(42); b3/phimetphimu2b3_stack_20->GetZaxis()->SetLabelSize(0.035); b3/phimetphimu2b3_stack_20->GetZaxis()->SetTitleSize(0.035); b3/phimetphimu2b3_stack_20->GetZaxis()->SetTitleFont(42); b3/phimetphimu2b3->SetHistogram(b3/phimetphimu2b3_stack_20); TH1D *phimetphimu2b396 = new TH1D("phimetphimu2b396"," #Delta_{#phi}[#mu2,MET]",20,-3.141593,3.141593); ci = TColor::GetColor("#00cc00"); phimetphimu2b396->SetFillColor(ci); ci = TColor::GetColor("#00cc00"); phimetphimu2b396->SetLineColor(ci); ci = TColor::GetColor("#00cc00"); phimetphimu2b396->SetMarkerColor(ci); phimetphimu2b396->SetMarkerStyle(22); phimetphimu2b396->GetXaxis()->SetTitle("phimetphimu2b3"); phimetphimu2b396->GetXaxis()->SetLabelFont(42); phimetphimu2b396->GetXaxis()->SetLabelSize(0.035); phimetphimu2b396->GetXaxis()->SetTitleSize(0.035); phimetphimu2b396->GetXaxis()->SetTitleFont(42); phimetphimu2b396->GetYaxis()->SetTitle("Events/pb"); phimetphimu2b396->GetYaxis()->SetLabelFont(42); phimetphimu2b396->GetYaxis()->SetLabelSize(0.035); phimetphimu2b396->GetYaxis()->SetTitleSize(0.035); phimetphimu2b396->GetYaxis()->SetTitleFont(42); phimetphimu2b396->GetZaxis()->SetLabelFont(42); phimetphimu2b396->GetZaxis()->SetLabelSize(0.035); phimetphimu2b396->GetZaxis()->SetTitleSize(0.035); phimetphimu2b396->GetZaxis()->SetTitleFont(42); b3/phimetphimu2b3->Add(phimetphimu2b3,""); TH1D *phimetphimu2b397 = new TH1D("phimetphimu2b397"," #Delta_{#phi}[#mu2,MET]",20,-3.141593,3.141593); ci = TColor::GetColor("#00ffff"); phimetphimu2b397->SetFillColor(ci); ci = TColor::GetColor("#00ffff"); phimetphimu2b397->SetLineColor(ci); ci = TColor::GetColor("#00ffff"); phimetphimu2b397->SetMarkerColor(ci); phimetphimu2b397->SetMarkerStyle(20); phimetphimu2b397->GetXaxis()->SetTitle("phimetphimu2b3"); phimetphimu2b397->GetXaxis()->SetLabelFont(42); phimetphimu2b397->GetXaxis()->SetLabelSize(0.035); phimetphimu2b397->GetXaxis()->SetTitleSize(0.035); phimetphimu2b397->GetXaxis()->SetTitleFont(42); phimetphimu2b397->GetYaxis()->SetTitle("Events/pb"); phimetphimu2b397->GetYaxis()->SetLabelFont(42); phimetphimu2b397->GetYaxis()->SetLabelSize(0.035); phimetphimu2b397->GetYaxis()->SetTitleSize(0.035); phimetphimu2b397->GetYaxis()->SetTitleFont(42); phimetphimu2b397->GetZaxis()->SetLabelFont(42); phimetphimu2b397->GetZaxis()->SetLabelSize(0.035); phimetphimu2b397->GetZaxis()->SetTitleSize(0.035); phimetphimu2b397->GetZaxis()->SetTitleFont(42); b3/phimetphimu2b3->Add(phimetphimu2b3,""); TH1D *phimetphimu2b398 = new TH1D("phimetphimu2b398"," #Delta_{#phi}[#mu2,MET]",20,-3.141593,3.141593); ci = TColor::GetColor("#ffcc00"); phimetphimu2b398->SetFillColor(ci); ci = TColor::GetColor("#ffcc00"); phimetphimu2b398->SetLineColor(ci); ci = TColor::GetColor("#ffcc00"); phimetphimu2b398->SetMarkerColor(ci); phimetphimu2b398->SetMarkerStyle(21); phimetphimu2b398->GetXaxis()->SetTitle("phimetphimu2b3"); phimetphimu2b398->GetXaxis()->SetLabelFont(42); phimetphimu2b398->GetXaxis()->SetLabelSize(0.035); phimetphimu2b398->GetXaxis()->SetTitleSize(0.035); phimetphimu2b398->GetXaxis()->SetTitleFont(42); phimetphimu2b398->GetYaxis()->SetTitle("Events/pb"); phimetphimu2b398->GetYaxis()->SetLabelFont(42); phimetphimu2b398->GetYaxis()->SetLabelSize(0.035); phimetphimu2b398->GetYaxis()->SetTitleSize(0.035); phimetphimu2b398->GetYaxis()->SetTitleFont(42); phimetphimu2b398->GetZaxis()->SetLabelFont(42); phimetphimu2b398->GetZaxis()->SetLabelSize(0.035); phimetphimu2b398->GetZaxis()->SetTitleSize(0.035); phimetphimu2b398->GetZaxis()->SetTitleFont(42); b3/phimetphimu2b3->Add(phimetphimu2b3,""); TH1D *phimetphimu2b399 = new TH1D("phimetphimu2b399"," #Delta_{#phi}[#mu2,MET]",20,-3.141593,3.141593); ci = TColor::GetColor("#ff0000"); phimetphimu2b399->SetFillColor(ci); ci = TColor::GetColor("#ff0000"); phimetphimu2b399->SetLineColor(ci); ci = TColor::GetColor("#ff0000"); phimetphimu2b399->SetMarkerColor(ci); phimetphimu2b399->SetMarkerStyle(20); phimetphimu2b399->GetXaxis()->SetTitle("phimetphimu2b3"); phimetphimu2b399->GetXaxis()->SetLabelFont(42); phimetphimu2b399->GetXaxis()->SetLabelSize(0.035); phimetphimu2b399->GetXaxis()->SetTitleSize(0.035); phimetphimu2b399->GetXaxis()->SetTitleFont(42); phimetphimu2b399->GetYaxis()->SetTitle("Events/pb"); phimetphimu2b399->GetYaxis()->SetLabelFont(42); phimetphimu2b399->GetYaxis()->SetLabelSize(0.035); phimetphimu2b399->GetYaxis()->SetTitleSize(0.035); phimetphimu2b399->GetYaxis()->SetTitleFont(42); phimetphimu2b399->GetZaxis()->SetLabelFont(42); phimetphimu2b399->GetZaxis()->SetLabelSize(0.035); phimetphimu2b399->GetZaxis()->SetTitleSize(0.035); phimetphimu2b399->GetZaxis()->SetTitleFont(42); b3/phimetphimu2b3->Add(phimetphimu2b3,""); TH1D *phimetphimu2b3100 = new TH1D("phimetphimu2b3100"," #Delta_{#phi}[#mu2,MET]",20,-3.141593,3.141593); ci = TColor::GetColor("#0000ff"); phimetphimu2b3100->SetFillColor(ci); ci = TColor::GetColor("#0000ff"); phimetphimu2b3100->SetLineColor(ci); ci = TColor::GetColor("#0000ff"); phimetphimu2b3100->SetMarkerColor(ci); phimetphimu2b3100->SetMarkerStyle(21); phimetphimu2b3100->GetXaxis()->SetTitle("phimetphimu2b3"); phimetphimu2b3100->GetXaxis()->SetLabelFont(42); phimetphimu2b3100->GetXaxis()->SetLabelSize(0.035); phimetphimu2b3100->GetXaxis()->SetTitleSize(0.035); phimetphimu2b3100->GetXaxis()->SetTitleFont(42); phimetphimu2b3100->GetYaxis()->SetTitle("Events/pb"); phimetphimu2b3100->GetYaxis()->SetLabelFont(42); phimetphimu2b3100->GetYaxis()->SetLabelSize(0.035); phimetphimu2b3100->GetYaxis()->SetTitleSize(0.035); phimetphimu2b3100->GetYaxis()->SetTitleFont(42); phimetphimu2b3100->GetZaxis()->SetLabelFont(42); phimetphimu2b3100->GetZaxis()->SetLabelSize(0.035); phimetphimu2b3100->GetZaxis()->SetTitleSize(0.035); phimetphimu2b3100->GetZaxis()->SetTitleFont(42); b3/phimetphimu2b3->Add(phimetphimu2b3,""); b3/phimetphimu2b3->Draw("nostack"); TLegend *leg = new TLegend(0.54023,0.639881,0.938218,0.924107,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextSize(0.034965); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("phimetphimu2b3","b3/phimetphimu2b3_QCD_b3/","lp"); ci = TColor::GetColor("#00cc00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#00cc00"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(22); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("phimetphimu2b3","b3/phimetphimu2b3_WJetsToLNu_b3/","lp"); ci = TColor::GetColor("#00ffff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#00ffff"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("phimetphimu2b3","b3/phimetphimu2b3_ZJetsToNuNu_b3/","lp"); ci = TColor::GetColor("#ffcc00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#ffcc00"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("phimetphimu2b3","b3/phimetphimu2b3_signal_b3/","lp"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#ff0000"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("phimetphimu2b3","b3/phimetphimu2b3_ttbar_b3/","lp"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#0000ff"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); b3/phimetphimu2b3->Modified(); b3/phimetphimu2b3->cd(); b3/phimetphimu2b3->SetSelected(b3/phimetphimu2b3); }
void metDistribution(const Int_t signalRegion_flag = 1) { // if signalRegion_flag == 1 (default), will do met distribution in the monojet signal region, else it will do the control region gROOT->SetStyle("Plain"); // to have white legend (on my pc it's already white, but in tier2 it appears grey) gStyle->SetFillColor(10); string plotDirectoryPath = "/cmshome/ciprianim/CMSSW721/pdfsFromAnalysis/plots/monojet/met_distribution/"; //string plotDirectoryPath = "./"; string plotFileExtension = ".pdf"; string suffix = "_mumu"; TH1D* hmet = NULL; vector<TH1D*> hMCmetNoLep; vector<string> sampleName; vector<string> MC_TexLabel; setSampleName(signalRegion_flag, sampleName, MC_TexLabel); Int_t nFiles = (Int_t)sampleName.size(); vector<Int_t> histColor; setHistColor(histColor, nFiles); string filenameBase; string canvasName; if (signalRegion_flag == 1) { filenameBase = "monojet_SR_spring15_25ns_"; canvasName = "metDistribution_monojetSR"; } else { filenameBase = "zmumujets_CS_spring15_25ns_"; canvasName = "metDistribution_zjetsCS" + suffix; } string filenameExtension = ".root"; vector<string> MCfileName; for (Int_t i = 0; i < nFiles; i++){ MCfileName.push_back(filenameBase + sampleName[i] + filenameExtension); } for(Int_t i = 0; i < nFiles; i++) { cout<<"fileName : "<<MCfileName[i]<<endl; TFile* f = TFile::Open(MCfileName[i].c_str(),"READ"); if (!f || !f->IsOpen()) { cout<<"*******************************"<<endl; cout<<"Error opening file \""<<MCfileName[i]<<"\".\nApplication will be terminated."<<endl; cout<<"*******************************"<<endl; exit(EXIT_FAILURE); } //cout << "check 1 " << endl; hmet = (TH1D*)f->Get("HYieldsMetBin"); if (!hmet) { cout << "Error: histogram not found in file ' " << MCfileName[i] << "'. End of programme." << endl; exit(EXIT_FAILURE); } hMCmetNoLep.push_back( (TH1D*)hmet->Clone() ); } THStack* hstack_metNoLep = new THStack("hstack_metNoLep",""); for (Int_t j = 0; j < nFiles; j++) { for (Int_t i = 1; i <= hMCmetNoLep[j]->GetNbinsX(); i++) { hMCmetNoLep[j]->SetBinError(i,sqrt(hMCmetNoLep[j]->GetBinContent(i))); } hMCmetNoLep[j]->SetFillColor(histColor[j]); hstack_metNoLep->Add(hMCmetNoLep[j]); } // now here we go with the canvas // TH1D * ratioplot = NULL; // will use it for the ratio plots // TPad *subpad_1 = NULL; // will use it to access specific subpad in canvas // TPad *subpad_2 = NULL; TCanvas *c = new TCanvas(canvasName.c_str(),"met distribution"); c->SetLogy(); TLegend *leg = new TLegend(0.6,0.55,0.89,0.89); // subpad_1 = new TPad("pad_1","",0.0,0.28,1.0,1.0); // //subpad_1->SetBottomMargin(0); // subpad_2 = new TPad("pad_2","",0.0,0.0,1.0,0.32); // subpad_2->SetGridy(); // //subpad_2->SetTopMargin(0); // subpad_2->SetBottomMargin(0.3); // subpad_1->Draw(); // subpad_2->Draw(); //subpad_1->cd(); hstack_metNoLep->Draw("HIST"); //hstack_metNoLep->SetMinimum(0.3); //hstack_metNoLep->SetMaximum(4000.0); TH1D* stackCopy = (TH1D*)(((TH1D*)hstack_metNoLep->GetStack()->Last())->DrawCopy("E2 SAME")); stackCopy->SetFillColor(kBlack); stackCopy->SetFillStyle(3017); hstack_metNoLep->GetXaxis()->SetTitle("#slash{E}_{T} [GeV]"); hstack_metNoLep->GetXaxis()->SetTitleSize(0.06); hstack_metNoLep->GetXaxis()->SetTitleOffset(0.6); hstack_metNoLep->GetYaxis()->SetTitle("events"); hstack_metNoLep->GetYaxis()->SetTitleSize(0.06); hstack_metNoLep->GetYaxis()->SetTitleOffset(0.8); hstack_metNoLep->GetYaxis()->CenterTitle(); for (Int_t j = (nFiles-1); j >= 0; j--) { leg->AddEntry(hMCmetNoLep[j],Form("%s",MC_TexLabel[j].c_str()),"lf"); } gStyle->SetStatStyle(0); leg->Draw(); leg->SetMargin(0.3); leg->SetBorderSize(0); // subpad_2->cd(); // ratioplot = new TH1D(*hratio); // ratioplot->Divide(hBRratioOverAxe); // ratioplot->SetStats(0); // ratioplot->GetXaxis()->SetLabelSize(0.10); // ratioplot->GetXaxis()->SetTitle("#slash{E}_{T} [GeV]"); // ratioplot->GetXaxis()->SetTitleSize(0.15); // ratioplot->GetXaxis()->SetTitleOffset(0.8); // ratioplot->GetYaxis()->SetLabelSize(0.10); // ratioplot->GetYaxis()->SetTitle("ratio"); // ratioplot->GetYaxis()->SetTitleSize(0.15); // ratioplot->GetYaxis()->SetTitleOffset(0.3); // ratioplot->GetYaxis()->CenterTitle(); // ratioplot->GetYaxis()->SetRangeUser(0.5,1.5); // ratioplot->GetYaxis()->SetNdivisions(011); // ratioplot->DrawCopy("HE"); // ratioplot->SetMarkerStyle(8); //medium dot c->SaveAs( (plotDirectoryPath + c->GetName() + plotFileExtension).c_str() ); }
void macro_MakeFRClosureTest() { // parameters ////////////////////////////////////////////////////////////// // luminosity of data const float lumi = 10445; string inputFilePrefix = "invMassHistos"; // lumi and .root will be added //string inputFilePrefix = "test"; // plot data? const bool plotData = true; //const bool plotData = false; // which closure tests should be plotted? bool plotClosureTest[4]; plotClosureTest[0] = true; // no corrections plotClosureTest[1] = true; // GSF electrons not passing HEEP plotClosureTest[2] = true; // all above + HEEP-GSF corrected with DY contribuion plotClosureTest[3] = true; // all above + GSF-GSF corrected with W+jet and gamma+jet contribution // which histograms should be plotted? bool plotHisto[4]; plotHisto[0] = true; // EB-EB + EB-EE plotHisto[1] = true; // EB-EB plotHisto[2] = true; // EB-EE plotHisto[3] = true; // EE-EE int font = 42; //////////////////////////////////////////////////////////////////////////// const double yAxisMin = 0.001; // const int rebin = 10; float massMin = 50; float massMax = 2050; int nBins = 2000; vector<pair<float, float> > binning; // VARIABLE BINNING // binning.push_back(make_pair(100, 1)); // binning.push_back(make_pair(500, 10)); // binning.push_back(make_pair(massMax, 50)); // CONSTANT BINNING binning.push_back(make_pair(massMax, 10)); vector<float> bins; bins.push_back(massMin); for (vector<pair<float,float> >::iterator it = binning.begin(); it < binning.end(); ++it) { while (bins.back() < it->first) bins.push_back(bins.back() + it->second); } if (bins.back() < massMax) bins.push_back(massMax); nBins = bins.size() - 1; Double_t binArray[nBins + 1]; for (int i = 0; i <= nBins; ++i) binArray[i] = (Double_t)bins.at(i); stringstream sStream; sStream << "Photon_Run2012A-13Jul2012_06Aug2012+DoublePhotonHighPt_Run2012B-13Jul2012+DoublePhotonHighPt_Run2012C-PromptReco-v1+v2_Cert_190456-202016_8TeV_PromptReco_gct1_35_" << lumi << "pb-1"; //sStream << lumi << "pb-1"; TString folderDataHisto = sStream.str().c_str(); // select histograms dynamically depending on state of correction ////////// vector<TString> folderHeepGsfHisto; folderHeepGsfHisto.push_back(sStream.str().c_str()); folderHeepGsfHisto.push_back(sStream.str().c_str()); folderHeepGsfHisto.push_back("combinations"); folderHeepGsfHisto.push_back("combinations"); vector<TString> folderGsfGsfHisto; folderGsfGsfHisto.push_back(sStream.str().c_str()); folderGsfGsfHisto.push_back(sStream.str().c_str()); folderGsfGsfHisto.push_back(sStream.str().c_str()); folderGsfGsfHisto.push_back("combinations"); vector<TString> heepGsfHisto; heepGsfHisto.push_back("histoHeepGsfMassFR"); heepGsfHisto.push_back("histoHeepGsfMassNoHeepFR"); heepGsfHisto.push_back("histoHeepGsfCorr"); heepGsfHisto.push_back("histoHeepGsfCorr"); vector<TString> gsfGsfHisto; gsfGsfHisto.push_back("histoGsfGsfMassFR"); gsfGsfHisto.push_back("histoGsfGsfMassNoHeepFR"); gsfGsfHisto.push_back("histoGsfGsfMassNoHeepFR"); gsfGsfHisto.push_back("histoGsfGsfCorr"); //////////////////////////////////////////////////////////////////////////// vector<TString> canvasName; canvasName.push_back("closureFR"); canvasName.push_back("closureFRNoHeep"); canvasName.push_back("closureFRCorrDY"); canvasName.push_back("closureFRCorrFull"); vector<TString> canvasTitle; canvasTitle.push_back("Fake rate closure test uncorrected"); canvasTitle.push_back("Fake rate closure test GSF (non HEEP)"); canvasTitle.push_back("Fake rate closure test DY corrected"); canvasTitle.push_back("Fake rate closure test fully corrected"); vector<TString> legendHeepGsf; legendHeepGsf.push_back("HEEP-GSF uncorrected"); legendHeepGsf.push_back("HEEP-GSF(non HEEP)"); legendHeepGsf.push_back("HEEP-GSF DY corrected"); legendHeepGsf.push_back("HEEP-GSF DY corrected"); vector<TString> legendGsfGsf; legendGsfGsf.push_back("GSF-GSF uncorrected"); legendGsfGsf.push_back("GSF-GSF (non HEEP)"); legendGsfGsf.push_back("GSF-GSF (non HEEP)"); legendGsfGsf.push_back("GSF-GSF W+jet + \\gamma+jet corrected"); vector<TString> acroSuffix; acroSuffix.push_back(""); acroSuffix.push_back("BB"); acroSuffix.push_back("BE"); acroSuffix.push_back("EE"); vector<TString> suffix; suffix.push_back(""); suffix.push_back(" EB-EB"); suffix.push_back(" EB-EE"); suffix.push_back(" EE-EE"); sStream.str(""); sStream << inputFilePrefix << lumi << "pb-1.root"; TFile input(sStream.str().c_str(), "read"); input.cd(); cout << endl << "Input file: " << sStream.str() << endl; // to keep the histogram when the file is closed TH1::AddDirectory(kFALSE); TH1::SetDefaultSumw2(kTRUE); for (unsigned int j = 0; j < 4; ++j) { if (!plotClosureTest[j]) continue; for (unsigned int p = 0; p < 4; ++p) { if (!plotHisto[p]) continue; TCanvas *c0 = new TCanvas(canvasName[j] + acroSuffix[p], canvasTitle[j] + suffix[p], 100, 100, 800, 600); c0->cd(); c0->SetBorderMode(0); c0->SetFrameBorderMode(0); c0->SetFillColor(0); c0->SetFrameFillColor(0); c0->SetLogy(); gStyle->SetTitleFont(font); gStyle->SetLabelFont(font); gStyle->SetOptStat(0); gStyle->SetPadTickX(1); gStyle->SetPadTickY(1); // get the histograms input.cd(folderGsfGsfHisto[j]); TH1F *histoGsfGsf = (TH1F *)gDirectory->Get(gsfGsfHisto[j] + acroSuffix[p]); input.cd(folderHeepGsfHisto[j]); TH1F *histoHeepGsf = (TH1F *)gDirectory->Get(heepGsfHisto[j] + acroSuffix[p]); input.cd(folderDataHisto); TH1F *histoData = (TH1F *)gDirectory->Get("histoHeepHeepMass" + acroSuffix[p]); TH1F *histoGsfGsfRebinned = (TH1F *)histoGsfGsf->Rebin(nBins, gsfGsfHisto[j] + "Rebinned" + acroSuffix[p], binArray); TH1F *histoHeepGsfRebinned = (TH1F *)histoHeepGsf->Rebin(nBins, heepGsfHisto[j] + "Rebinned" + acroSuffix[p], binArray); TH1F *histoDataRebinned = (TH1F *)histoData->Rebin(nBins, "histoHeepHeepMassRebinned" + acroSuffix[p], binArray); histoGsfGsfRebinned->SetLineColor(4); histoGsfGsfRebinned->SetMarkerColor(4); histoGsfGsfRebinned->SetMarkerStyle(20); histoGsfGsfRebinned->SetTitleFont(font); histoHeepGsfRebinned->SetLineColor(2); histoHeepGsfRebinned->SetMarkerColor(2); histoHeepGsfRebinned->SetMarkerStyle(21); histoHeepGsfRebinned->SetTitleFont(font); histoHeepGsfRebinned->GetYaxis()->SetTitleFont(font); histoHeepGsfRebinned->GetYaxis()->SetLabelFont(font); histoHeepGsfRebinned->GetXaxis()->SetLabelFont(font); histoDataRebinned->SetLineColor(1); histoDataRebinned->SetMarkerColor(1); histoDataRebinned->SetMarkerStyle(20); histoDataRebinned->SetTitleFont(font); histoDataRebinned->GetYaxis()->SetTitleFont(font); histoDataRebinned->GetYaxis()->SetLabelFont(font); histoDataRebinned->GetXaxis()->SetLabelFont(font); sStream.str(""); if (binning.size() > 1) sStream << "# of events / bin"; else sStream << "# of events / " << binning.begin()->second << "GeV"; if (plotData) { histoDataRebinned->SetMinimum(yAxisMin); histoDataRebinned->SetTitle(canvasTitle[j] + suffix[p]); histoDataRebinned->GetYaxis()->SetTitle(sStream.str().c_str()); histoDataRebinned->Draw(); histoHeepGsfRebinned->Draw("sames"); } else { histoHeepGsfRebinned->SetTitle(canvasTitle[j] + suffix[p]); histoHeepGsfRebinned->GetYaxis()->SetTitle(sStream.str().c_str()); histoHeepGsfRebinned->Draw(); } histoGsfGsfRebinned->Draw("sames"); sStream.str(""); sStream << "#sqrt{s} = 8TeV, #int L dt = " << lumi << "pb^{-1}"; TPaveLabel *label0 = new TPaveLabel(0.6, 0.79, 0.9, 0.89, sStream.str().c_str(), "brNDC"); label0->SetFillColor(0); label0->SetFillStyle(0); label0->SetBorderSize(0); label0->SetTextSize(0.30); label0->SetTextFont(font); label0->Draw("sames"); TPaveLabel *label1 = new TPaveLabel(0.7, 0.89, 0.91, 0.98, "CMS preliminary", "brNDC"); label1->SetFillColor(0); label1->SetFillStyle(0); label1->SetBorderSize(0); label1->SetTextSize(0.40); label1->SetTextFont(font); label1->Draw("sames"); TLegend *legend = new TLegend(0.38, 0.6, 0.53, 0.9); if (!plotData) legend->SetY2(0.8); legend->SetTextSize(0.03); legend->SetTextFont(font); legend->SetBorderSize(0); legend->SetFillStyle(0); if (plotData) legend->AddEntry(histoDataRebinned, "Data", "lep"); legend->AddEntry(histoHeepGsfRebinned, legendHeepGsf[j], "lep"); legend->AddEntry(histoGsfGsfRebinned, legendGsfGsf[j], "lep"); legend->Draw("sames"); } // end loop over eta ranges } // end loop over corrections input.Close(); }
int postprocessingSysError(){ cout<<endl<<endl<<endl<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Postproccess all systematic uncertainties! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl<<endl; gErrorIgnoreLevel = 1001; const TString method = "RMS99"; const TString type = "PFCHS"; const int nEta =4; double eta_bins[5] = {0., 0.5, 1.1, 1.7, 2.3}; // For looking at different systematic uncertainties independently const bool QCD = true; const bool JEC = true; const bool flavor = true; const bool PU = true; const bool MC = true; TString etaString, filename; TString rootFiles, AuxString; TString JetType = "PFCHS"; TString Method = "RMS99"; double *ratioEtaBinnedX = new double[nEta]; double *ratioEtaBinnedY = new double[nEta]; double *ratioEtaBinnedEX = new double[nEta]; double *ratioEtaBinnedEY = new double[nEta]; double *ratioEtaBinnedQCDUpY = new double[nEta]; double *ratioEtaBinnedQCDDownY = new double[nEta]; TF1 *QCDuncertainty; if(QCD){ rootFiles = (TString) "scripts/plotsQCD/FinalErrorsQCD_" + type + (TString) "_" + method + (TString) ".root"; TFile *_file = TFile::Open(rootFiles); _file->GetObject("function",QCDuncertainty); } for(int eta = 0; eta < nEta; eta++){ //cout<< endl<<endl<<endl<<eta+1<<". eta Bin!!"<<endl; // Read the MC and data results rootFiles = (TString) "root_files_FINAL_data/Resolution_for_" + (long) (eta+1) + (TString) "_eta_bin_" + JetType + (TString) "_data_" + Method + (TString) ".root"; TGraphErrors* JERData = readTGraphErrors(rootFiles,"Graph;1","Graph"); rootFiles = (TString) "root_files_FINAL_mc/Resolution_for_" + (long) (eta+1) + (TString) "_eta_bin_" + JetType + (TString) "_mc_" + Method + (TString) ".root"; TGraphErrors* JERMC = readTGraphErrors(rootFiles,"Graph","Graph"); if(eta+1 == 1) etaString = Form("JER for |#eta| < %4.1f",etaBins[eta+1]); else etaString = Form("JER for %4.1f <|#eta|< %4.1f",etaBins[eta+1],etaBins[eta+2]); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // 1.) Calculate the ratio w/o systematic Uncertainties int nData = JERData->GetN(); double *dataX = JERData->GetX(); double *dataY = JERData->GetY(); double *dataEX = JERData->GetEX(); double *dataEY = JERData->GetEY(); double *mcX = new double[nData]; double *mcY = new double[nData]; double *mcEX = new double[nData]; double *mcEY = new double[nData]; double *ratioX = new double[nData]; double *ratioY = new double[nData]; double *ratioEX = new double[nData]; double *ratioEY = new double[nData]; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Initialize some stuff for QCD uncertainty double *ratioQCDUpY = new double[nData]; double *ratioQCDDownY = new double[nData]; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% int idx = 0; for(int i=0; i<nData; i++){ JERMC -> GetPoint(idx,mcX[i],mcY[i]); mcEX[i] = JERMC -> GetErrorX(idx); mcEY[i] = JERMC -> GetErrorY(idx); idx += 1; if(TMath::Abs(dataX[i]/mcX[i] - 1.) > 0.1){ i -= 1; continue; } ratioX[i] = 1./2.*(dataX[i] + mcX[i]); ratioY[i] = dataY[i]/mcY[i]; ratioEX[i] = 1./2.*TMath::Sqrt(TMath::Power(dataEX[i],2)+TMath::Power(mcEX[i],2)); ratioEY[i] = TMath::Sqrt(TMath::Power((1./mcY[i]),2)*TMath::Power(dataEY[i],2)+TMath::Power((dataY[i]/(TMath::Power(mcY[i],2))),2)*TMath::Power(mcEY[i],2)); if(QCD){ // For QCD ratioQCDUpY[i] = ratioY[i]*(1. + QCDuncertainty->Eval(ratioX[i])); ratioQCDDownY[i] = ratioY[i]*(1. - QCDuncertainty->Eval(ratioX[i])); //cout<<"QCDuncertainty->Eval(ratioX[i]) = "<<QCDuncertainty->Eval(ratioX[i])<<endl; } } TGraphErrors *Ratio = new TGraphErrors(nData,ratioX,ratioY,ratioEX,ratioEY); // For QCD TGraphErrors *QCDUp = new TGraphErrors(nData,ratioX,ratioQCDUpY,ratioEX,ratioEY); TGraphErrors *QCDDown = new TGraphErrors(nData,ratioX,ratioQCDDownY,ratioEX,ratioEY); if(eta+1 == 1 ) AuxString = Form("Ratio between Data and MC for |#eta| < %4.1f",etaBins[eta+1]); else AuxString = Form("Ratio between Data and MC for %4.1f <|#eta|<%4.1f",etaBins[eta+1],etaBins[eta+2]); Ratio -> SetTitle(AuxString); Ratio -> GetXaxis() -> SetTitle("Photon pT"); Ratio -> GetXaxis() -> SetTitleOffset(1.1); Ratio -> GetYaxis() -> SetTitle("Ratio of JER (DATA/MC)"); Ratio -> GetYaxis() -> SetTitleOffset(1.2); Ratio -> GetXaxis() -> SetLimits(0,600); TF1* f1 = new TF1("name","pol0",0,600); Ratio -> Fit("name","QR"); TF1* fitQCDUp = new TF1("fitQCDUp","pol0",0,600); TF1* fitQCDDown = new TF1("fitQCDDown","pol0",0,600); if(QCD){ // For QCD QCDUp -> Fit("fitQCDUp","QR"); QCDDown -> Fit("fitQCDDown","QR"); } TLegend *legend = 0; legend = new TLegend(0.55,0.8,0.9,0.9); legend -> SetFillColor(0); legend -> SetHeader(Form(" %4.3f #pm %4.3f", f1 -> GetParameter(0), f1->GetParError(0))); TCanvas *c11 = new TCanvas("c11",AuxString,200,10,500,500); c11 -> cd(); Ratio -> SetMinimum(0.5); Ratio -> SetMaximum(2.0); Ratio -> Draw("AP"); legend -> Draw("same"); TLatex* info = new TLatex(); info-> SetNDC(); info->SetTextSize(0.045); info->DrawLatex(0.22,0.84,Form("#splitline{#chi^{2} = %4.2f}{dof = %i}",f1 -> GetChisquare(),f1 -> GetNDF())); filename = (TString) "plots/Ratio_Resolution_for_" + (long) (eta+1) + (TString) "_eta_bin_" + type + (TString) "_data_comparison_" + method + (TString) ".pdf"; c11 -> SaveAs(filename); delete c11; ratioEtaBinnedX[eta] = (eta_bins[eta+1] + eta_bins[eta])/2.; ratioEtaBinnedY[eta] = f1 -> GetParameter(0); ratioEtaBinnedEX[0]=0.25; ratioEtaBinnedEX[1]=0.3; ratioEtaBinnedEX[2]=0.3; ratioEtaBinnedEX[3]=0.3; ratioEtaBinnedEY[eta] = f1->GetParError(0); if(QCD){ ratioEtaBinnedQCDUpY[eta] = fitQCDUp -> GetParameter(0); ratioEtaBinnedQCDDownY[eta]= fitQCDDown -> GetParameter(0); // Some additional stuff for QCD uncertainty TCanvas *plotsQCD = new TCanvas("plotsQCD","plotsQCD",200,10,500,500); plotsQCD -> cd(); Ratio -> SetMarkerColor(1); Ratio -> SetLineColor(1); Ratio -> SetMarkerStyle(20); Ratio -> GetFunction("name")->SetLineColor(1); QCDUp -> SetMarkerColor(3); QCDDown -> SetMarkerColor(3); QCDUp -> SetLineColor(3); QCDDown -> SetLineColor(3); QCDUp -> SetMarkerStyle(20); QCDDown -> SetMarkerStyle(20); QCDUp -> SetMarkerSize(0.8); QCDDown -> SetMarkerSize(0.8); QCDUp -> GetFunction("fitQCDUp")->SetLineColor(3); QCDDown -> GetFunction("fitQCDDown")->SetLineColor(3); Ratio -> Draw("AP"); QCDUp -> Draw("sameP"); QCDDown -> Draw("sameP"); delete legend; legend = new TLegend(0.4,0.8,0.9,0.9); legend -> SetFillColor(0); legend -> SetTextSize(0.045); legend -> AddEntry(Ratio,"Central Value","l"); legend -> AddEntry(QCDUp,Form("Upward variation: + %4.3f",abs(ratioEtaBinnedQCDUpY[eta]/ratioEtaBinnedY[eta]-1.)),"l"); legend -> AddEntry(QCDDown,Form("Downward variation: - %4.3f",abs(ratioEtaBinnedQCDDownY[eta]/ratioEtaBinnedY[eta]-1.)),"l"); legend -> Draw("same"); filename = (TString) "plots/plotsQCD_for_" + (long) (eta+1) + (TString) "_bin_" + type + (TString) "_" + method + (TString) ".pdf"; plotsQCD -> SaveAs(filename); delete plotsQCD; } } TGraphErrors* ratioEtaBinned = new TGraphErrors(nEta,ratioEtaBinnedX,ratioEtaBinnedY,ratioEtaBinnedEX,ratioEtaBinnedEY); filename = (TString) "plots/RatioEtaBinned_" + type + (TString) "_" + method + (TString) ".root"; TFile *f = new TFile(filename,"RECREATE"); f -> WriteTObject(ratioEtaBinned,"Graph"); f->Close(); delete f; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // 1.) Calculate sys Error from QCD contamination //cout<<endl; double deltaRatioUpQCD[nEta] = {0.}; double deltaRatioDownQCD[nEta] = {0.}; if(QCD){ for(int eta = 0; eta<nEta; eta++){ deltaRatioUpQCD[eta] = abs(ratioEtaBinnedQCDUpY[eta]/ratioEtaBinnedY[eta]-1.); deltaRatioDownQCD[eta] = abs(ratioEtaBinnedQCDDownY[eta]/ratioEtaBinnedY[eta]-1.); //cout<<"ratioEtaBinnedQCDDownY[eta]"<<ratioEtaBinnedQCDDownY[eta]<<endl; //cout<<"ratioEtaBinnedY[eta]"<<ratioEtaBinnedY[eta]<<endl; //cout<<"deltaRatioUpQCD["<<eta<<"] = "<<deltaRatioUpQCD[eta]<<endl; //cout<<"deltaRatioDownQCD["<<eta<<"] = "<<deltaRatioDownQCD[eta]<<endl; } } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // 2.) Calculate sys Error from JEC uncertainty (percentage change of MC result) //cout<<endl; double deltaRatioUpJEC[nEta] = {0.}; double deltaRatioDownJEC[nEta] = {0.}; if(JEC){ rootFiles = (TString) "scripts/plotsJEC/FinalEtaBinnedErrorsJECUp_" + type + (TString) "_" + method + (TString) ".root"; TGraphErrors *JECuncertaintyUp = readTGraphErrors(rootFiles,"graph","Graph"); double *sysRelJECUp = JECuncertaintyUp -> GetY(); rootFiles = (TString) "scripts/plotsJEC/FinalEtaBinnedErrorsJECLow_" + type + (TString) "_" + method + (TString) ".root"; TGraphErrors *JECuncertaintyLow = readTGraphErrors(rootFiles,"graph","Graph"); double *sysRelJECLow = JECuncertaintyLow -> GetY(); for(int eta = 0; eta<nEta; eta++){ deltaRatioUpJEC[eta] = sysRelJECUp[eta]; deltaRatioDownJEC[eta] = sysRelJECLow[eta]; //cout<<"deltaRatioUpJEC["<<eta<<"] = "<<deltaRatioUpJEC[eta]<<endl; //cout<<"deltaRatioDownJEC["<<eta<<"] = "<<deltaRatioDownJEC[eta]<<endl; } } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // 3.) Calculate sys Error from Flavor uncertainty (percentage change of MC result) //cout<<endl; // Multiply on mc (as symmetric Error) // ratioUp = 1/(1 - delta) * ratio // ratioLow = 1/(1 + delta) * ratio double deltaRatioUpFlavor[nEta] = {0.}; double deltaRatioDownFlavor[nEta] = {0.}; if(flavor){ rootFiles = (TString) "scripts/plotsFlavor/FinalEtaBinnedErrorsFlavorUp_" + type + (TString) "_" + method + (TString) ".root"; TGraphErrors *FlavoruncertaintyUp = readTGraphErrors(rootFiles,"graph","Graph"); double *sysRelFlavorUp = FlavoruncertaintyUp -> GetY(); rootFiles = (TString) "scripts/plotsFlavor/FinalEtaBinnedErrorsFlavorLow_" + type + (TString) "_" + method + (TString) ".root"; TGraphErrors *FlavoruncertaintyLow = readTGraphErrors(rootFiles,"graph","Graph"); double *sysRelFlavorLow = FlavoruncertaintyLow -> GetY(); for(int eta = 0; eta<nEta; eta++){ deltaRatioUpFlavor[eta] = sysRelFlavorUp[eta]; deltaRatioDownFlavor[eta] = sysRelFlavorLow[eta]; //cout<<"deltaRatioUpFlavor["<<eta<<"] = "<<deltaRatioUpFlavor[eta]<<endl; //cout<<"deltaRatioDownFlavor["<<eta<<"] = "<<deltaRatioDownFlavor[eta]<<endl; } } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // 4.) Calculate sys Error from PU uncertainty (percentage change of MC result) //cout<<endl; double deltaRatioUpPU[nEta] = {0.}; double deltaRatioDownPU[nEta] = {0.}; if(PU){ rootFiles = (TString) "scripts/plotsPU/FinalEtaBinnedErrorsPUUp_" + type + (TString) "_" + method + (TString) ".root"; TGraphErrors *PUuncertaintyUp = readTGraphErrors(rootFiles,"graph","Graph"); double *sysRelPUUp = PUuncertaintyUp -> GetY(); rootFiles = (TString) "scripts/plotsPU/FinalEtaBinnedErrorsPULow_" + type + (TString) "_" + method + (TString) ".root"; TGraphErrors *PUuncertaintyLow = readTGraphErrors(rootFiles,"graph","Graph"); double *sysRelPULow = PUuncertaintyLow -> GetY(); // Multiply on mc (as symmetric Error) // ratioUp = 1/(1 - delta) * ratio // ratioUp = 1/(1 + delta) * ratio for(int eta = 0; eta<nEta; eta++){ deltaRatioUpPU[eta] = sysRelPUUp[eta]; deltaRatioDownPU[eta] = sysRelPULow[eta]; //cout<<"deltaRatioUpPU["<<eta<<"] = "<<deltaRatioUpPU[eta]<<endl; //cout<<"deltaRatioDownPU["<<eta<<"] = "<<deltaRatioDownPU[eta]<<endl; } } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // 5.) Calculate sys Error from Out-of Cone showering simulation (percentage change of full ratio result) //cout<<endl; double deltaRatioUpMC[nEta] = {0.}; double deltaRatioDownMC[nEta] = {0.}; if(MC){ rootFiles = (TString) "scripts/plotsMC/FinalErrorsMC_" + type + (TString) "_" + method + (TString) ".root"; TGraphErrors *MCuncertainty = readTGraphErrors(rootFiles,"graph","Graph"); double *sysRelMC = MCuncertainty -> GetY(); // Percentage change is only in one direction, to take this into account keep deltaRatioDownMC = 0 for(int eta = 0; eta<nEta; eta++){ deltaRatioUpMC[eta] = sysRelMC[eta]; deltaRatioDownMC[eta] = sysRelMC[eta]; //cout<<"deltaRatioUpMC["<<eta<<"] = "<<deltaRatioUpMC[eta]<<endl; //cout<<"deltaRatioDownMC["<<eta<<"] = "<<deltaRatioDownMC[eta]<<endl; } } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Take all systematic Uncertainties together and plot //cout<<endl; double *deltaTotalSysUp = new double[nEta]; double *deltaTotalSysDown = new double[nEta]; double *DeltaTotalSysUp = new double[nEta]; double *DeltaTotalSysDown = new double[nEta]; double *DeltaTotalDown = new double[nEta]; double *DeltaTotalUp = new double[nEta]; for(int eta = 0; eta<nEta; eta++){ // Add all systematic Uncertainties in quadrature (delta is relative Uncertainty) deltaTotalSysUp[eta] = sqrt(TMath::Power(deltaRatioUpJEC[eta],2) + TMath::Power(deltaRatioUpFlavor[eta],2) + TMath::Power(deltaRatioUpPU[eta],2) + TMath::Power(deltaRatioUpMC[eta],2) + TMath::Power(deltaRatioUpQCD[eta],2)); deltaTotalSysDown[eta] = sqrt(TMath::Power(deltaRatioDownJEC[eta],2) + TMath::Power(deltaRatioDownFlavor[eta],2) + TMath::Power(deltaRatioDownPU[eta],2) + TMath::Power(deltaRatioDownMC[eta],2) + TMath::Power(deltaRatioDownQCD[eta],2)); // Calculation of the absolute Uncertainty with Delta = ratio * delta DeltaTotalSysUp[eta] = deltaTotalSysUp[eta] * ratioEtaBinnedY[eta]; DeltaTotalSysDown[eta] = deltaTotalSysDown[eta] * ratioEtaBinnedY[eta]; // Calculate Systematic plus staistical Uncertainty DeltaTotalUp[eta] = sqrt(pow(DeltaTotalSysUp[eta],2) + pow(ratioEtaBinnedEY[eta],2)); DeltaTotalDown[eta] = sqrt(pow(DeltaTotalSysDown[eta],2) + pow(ratioEtaBinnedEY[eta],2)); cout<<endl<<"relative: deltaTotalSysUp["<<eta<<"] = "<<fixed<<setprecision(3)<<deltaTotalSysUp[eta]<<endl; cout<<"relative: deltaTotalSysDown["<<eta<<"] = "<<deltaTotalSysDown[eta]<<endl; cout<<endl<<"absolute: DeltaTotalSysUp["<<eta<<"] = "<<DeltaTotalSysUp[eta]<<endl; cout<<"absolute: DeltaTotalSysDown["<<eta<<"] = "<<DeltaTotalSysDown[eta]<<endl; } double ex[nEta] ={0.25,0.3,0.3,0.3}; TGraphAsymmErrors* ratioEtaBinnedSys = new TGraphAsymmErrors(nEta,ratioEtaBinnedX,ratioEtaBinnedY,ex,ex,DeltaTotalSysDown,DeltaTotalSysUp); double *TotalSysUp = new double[nEta]; double *TotalSysDown = new double[nEta]; for(int i=0; i<nEta; i++){ TotalSysUp[i] = ratioEtaBinnedY[i]+DeltaTotalSysUp[i]; TotalSysDown[i] = ratioEtaBinnedY[i]-DeltaTotalSysDown[i]; } TGraph* ratioSysBorderUp = new TGraph(nEta, ratioEtaBinnedX, TotalSysUp); TGraph* ratioSysBorderDown = new TGraph(nEta, ratioEtaBinnedX, TotalSysDown); TGraph* ratioRelativeErrorsUp = new TGraph(nEta,ratioEtaBinnedX,deltaTotalSysUp); TGraph* ratioRelativeErrorsDown = new TGraph(nEta,ratioEtaBinnedX,deltaTotalSysDown); TGraphErrors* ratioEtaBinnedStat = new TGraphErrors(nEta,ratioEtaBinnedX,ratioEtaBinnedY,ratioEtaBinnedEX,ratioEtaBinnedEY); TGraphAsymmErrors* ratioEtaBinnedStatPlusSys = new TGraphAsymmErrors(nEta,ratioEtaBinnedX,ratioEtaBinnedY,ex,ex,DeltaTotalDown,DeltaTotalUp); TCanvas *cFinal = new TCanvas("cFinal","cFinal",200,10,500,500); cFinal -> cd(); ratioEtaBinnedSys -> GetYaxis() -> SetTitle("Data/MC ratio for JER"); ratioEtaBinnedSys -> GetXaxis() -> SetTitle("|#eta|"); if(PU && flavor && JEC && MC && QCD) etaString = "All sys. Uncertainties"; else if(PU && !flavor && !JEC && !MC && !QCD) etaString = "Only PU uncert."; else if(!PU && flavor && !JEC && !MC && !QCD) etaString = "Only flavor uncert."; else if(!PU && !flavor && JEC && !MC && !QCD) etaString = "Only JEC uncert."; else if(!PU && !flavor && !JEC && MC && !QCD) etaString = "Only Out-of-Cone sim. uncert."; else if(!PU && !flavor && !JEC && MC && !QCD) etaString = "Only Out-of-Cone sim. uncert."; else if(!PU && !flavor && !JEC && !MC && QCD) etaString = "Only QCD uncert."; else if(PU && flavor && JEC && !MC && QCD) etaString = "All besides MC uncertainty."; else etaString = "Strange set of systematic uncertainties."; cout<<endl<<etaString<<endl<<endl; ratioEtaBinnedSys -> SetMarkerStyle(20); ratioEtaBinnedSys -> SetMarkerSize(1.4); ratioEtaBinnedSys -> SetFillColor(kGray); ratioEtaBinnedSys -> SetFillStyle(3001); ratioEtaBinnedSys -> SetLineColor(kGray); ratioEtaBinnedSys -> SetMinimum(0.8); ratioEtaBinnedSys -> SetMaximum(1.5); ratioEtaBinnedSys -> GetXaxis() -> SetLimits(0., 2.3); ratioEtaBinnedSys -> GetXaxis() -> SetNdivisions(6,6,0, "X"); ratioEtaBinnedSys -> DrawClone("Ae3p"); //ratioEtaBinnedSys -> SetPointError(0, 0., 0., 0., 0.); //ratioEtaBinnedSys -> SetPointError(1, 0., 0., 0., 0.); //ratioEtaBinnedSys -> SetPointError(2, 0., 0., 0., 0.); //ratioEtaBinnedSys -> SetPointError(3, 0., 0., 0., 0.); //ratioEtaBinnedSys -> SetPointError(4, 0., 0., 0., 0.); ratioEtaBinnedStat -> SetMarkerStyle(20); ratioEtaBinnedStat -> SetMarkerSize(1.4); ratioEtaBinnedStat -> SetFillColor(kGray); ratioEtaBinnedStat -> SetFillStyle(3001); ratioEtaBinnedStat -> SetLineColor(1); ratioEtaBinnedStat -> Draw("psame"); TLatex *infoFinal = new TLatex(); infoFinal -> SetTextFont(132); infoFinal -> SetNDC(); infoFinal -> SetTextSize(0.045); infoFinal -> DrawLatex(0.2,0.8,etaString); filename = (TString) "plots/FinalErrorPlot_" + type + (TString) "_" + method + (TString) ".pdf"; cFinal -> Print(filename,"pdf"); filename = (TString) "plots/FinalErrorPlot_" + type + (TString) "_" + method + (TString) ".pdf"; cFinal -> SaveAs(filename,"pdf"); delete cFinal; filename = (TString) "plots/FinalRelativeErrorsUp_" + type + (TString) "_" + method + (TString) ".root"; f = new TFile(filename,"RECREATE"); f -> WriteTObject(ratioRelativeErrorsUp,"graph"); f->Close(); delete f; filename = (TString) "plots/FinalRelativeErrorsLow_" + type + (TString) "_" + method + (TString) ".root"; f = new TFile(filename,"RECREATE"); f -> WriteTObject(ratioRelativeErrorsDown,"graph"); f->Close(); delete f; ofstream RelativeErrors; RelativeErrors.open("plots/Errors.txt"); RelativeErrors<<"Relative Errors: "<<endl; for(int i=0; i<nEta; i++){ RelativeErrors<<i+1<<". Eta bin: "<<"-"<<fixed<<setprecision(3)<<(deltaTotalSysDown[i]*100)<<"% / +"<<(deltaTotalSysUp[i]*100)<<"%"<<endl; } RelativeErrors<<endl<<"Absolute Errors: "<<endl; for(int i=0; i<nEta; i++){ RelativeErrors<<i+1<<". Eta bin: "<<"-"<<(DeltaTotalSysDown[i])<<" / +"<<(DeltaTotalSysUp[i])<<endl; } RelativeErrors<<endl<<endl<<"Relative Errors JEC: "<<endl; for(int i=0; i<nEta; i++){ RelativeErrors<<i+1<<". Eta bin: "<<"-"<<(deltaRatioDownJEC[i]*100)<<"% / +"<<(deltaRatioUpJEC[i]*100)<<"%"<<endl; } RelativeErrors<<endl<<endl<<"Relative Errors Flavor: "<<endl; for(int i=0; i<nEta; i++){ RelativeErrors<<i+1<<". Eta bin: "<<"-"<<(deltaRatioDownFlavor[i]*100)<<"% / +"<<(deltaRatioUpFlavor[i]*100)<<"%"<<endl; } RelativeErrors<<endl<<endl<<"Relative Errors Out-of-Cone showering simulation: "<<endl; for(int i=0; i<nEta; i++){ RelativeErrors<<i+1<<". Eta bin: "<<"-"<<(deltaRatioDownMC[i]*100)<<"% / +"<<(deltaRatioUpMC[i]*100)<<"%"<<endl; } RelativeErrors<<endl<<endl<<"Relative Errors QCD: "<<endl; for(int i=0; i<nEta; i++){ RelativeErrors<<i+1<<". Eta bin: "<<"-"<<(deltaRatioDownQCD[i]*100)<<"% / +"<<(deltaRatioUpQCD[i]*100)<<"%"<<endl; } RelativeErrors<<endl<<endl<<"Relative Errors PU reweighing: "<<endl; for(int i=0; i<nEta; i++){ RelativeErrors<<i+1<<". Eta bin: "<<"-"<<(deltaRatioDownPU[i]*100)<<"% / +"<<(deltaRatioUpPU[i]*100)<<"%"<<endl; } RelativeErrors<<endl<<endl<<"Central values and statistical Uncertainty: "<<endl; for(int i=0; i<nEta; i++){ RelativeErrors<<i+1<<". Eta bin: "<<"-"<<(ratioEtaBinnedY[i])<<" +/- "<<ratioEtaBinnedEY[i]<<endl; } RelativeErrors.close(); // Write directly full latex table with systematic and statistical unceratinty ofstream latexTable; latexTable.open("plots/latexTable.txt"); latexTable<<"\\renewcommand{\\arraystretch}{2.0}"<<endl; latexTable<<"\\begin{center}"<<endl; latexTable<<"\\begin{tabular}{ | c | c c c| }"<<endl; latexTable<<"$|\\eta^{\\text{Jet}}|$ & Ratio & stat. & sys. \\\\\\hline"<<endl; for(int z=0;z<nEta;z++){ latexTable<<"$"<<fixed<<setprecision(1)<<etaBins[z]<<" - "<<etaBins[z+1]<<"$ &"<<fixed<<setprecision(3)<<ratioEtaBinnedY[z]<<" & $\\pm "<<ratioEtaBinnedEY[z]<<"$ & $^{+"<<DeltaTotalSysUp[z]<<"}_{-"<<DeltaTotalSysDown[z]<<"}$ \\\\"<<endl; } latexTable<<"\\hline"<<endl; latexTable<<"\\end{tabular}"<<endl; latexTable<<"\\end{center}"<<endl<<endl<<endl<<endl<<endl; latexTable<<"\\begin{center}"<<endl; latexTable<<"\\begin{tabular}{ l| c | c | c | c |}"<<endl; latexTable<<"\\multicolumn{1}{c}{} & \\multicolumn{4}{c}{$|\\eta^{\\text{Jet}}|$}\\\\\\hline"<<endl<<fixed<<setprecision(1); for(int z=0;z<nEta;z++) latexTable<<"& \\textbf{"<<etaBins[z]<<" - "<<etaBins[z+1]<<"}"; latexTable<<"\\\\\\hline"<<endl; latexTable<<"\\multirow{2}{*}{\\textbf{Multijet contamination}}"; for(int z=0;z<nEta;z++) latexTable<<"& $+"<<deltaRatioUpQCD[z]*100<<" \\% $ "; latexTable<<"\\\\"<<endl; for(int z=0;z<nEta;z++) latexTable<<"& $-"<<deltaRatioDownQCD[z]*100<<" \\% $ "; latexTable<<"\\\\\\hline"<<endl; latexTable<<"\\multirow{2}{*}{\\textbf{Flavor uncertainty}}"; for(int z=0;z<nEta;z++) latexTable<<"& $+"<<deltaRatioUpFlavor[z]*100<<" \\% $ "; latexTable<<"\\\\"<<endl; for(int z=0;z<nEta;z++) latexTable<<"& $"<<deltaRatioDownFlavor[z]*100<<" \\% $ "; latexTable<<"\\\\\\hline"<<endl; latexTable<<"\\multirow{2}{*}{\\textbf{JEC uncertainty}}"; for(int z=0;z<nEta;z++) latexTable<<"& $+"<<deltaRatioUpJEC[z]*100<<" \\% $ "; latexTable<<"\\\\"<<endl; for(int z=0;z<nEta;z++) latexTable<<"& $"<<deltaRatioDownJEC[z]*100<<" \\% $ "; latexTable<<"\\\\\\hline"<<endl; latexTable<<"\\multirow{2}{*}{\\textbf{Out-of-Cone showering simulation}}"; for(int z=0;z<nEta;z++) latexTable<<"& $+"<<deltaRatioUpMC[z]*100<<" \\% $ "; latexTable<<"\\\\"<<endl; for(int z=0;z<nEta;z++) latexTable<<"& $-"<<deltaRatioDownMC[z]*100<<" \\% $ "; latexTable<<"\\\\\\hline"<<endl; latexTable<<"\\multirow{2}{*}{\\textbf{PU uncertainty}}"; for(int z=0;z<nEta;z++) latexTable<<"& $+"<<deltaRatioUpPU[z]*100<<" \\% $ "; latexTable<<"\\\\"<<endl; for(int z=0;z<nEta;z++) latexTable<<"& $"<<deltaRatioDownPU[z]*100<<" \\% $ "; latexTable<<"\\\\\\hline\\hline"<<endl; latexTable<<"\\multirow{2}{*}{\\textbf{Total}}"; for(int z=0;z<nEta;z++) latexTable<<"& $+"<<deltaTotalSysUp[z]*100<<" \\% $ "; latexTable<<"\\\\"<<endl; for(int z=0;z<nEta;z++) latexTable<<"& $-"<<deltaTotalSysDown[z]*100<<" \\% $ "; latexTable<<"\\\\\\hline"<<endl; latexTable<<"\\end{tabular}"<<endl; latexTable<<"\\end{center}"<<endl; latexTable.close(); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Comparison to 2011 Data cout<<endl; gROOT->LoadMacro("tdrstyle_mod14.C"); setTDRStyle(); gROOT->LoadMacro("CMS_lumi.C"); writeExtraText = true; // if extra text extraText = "Preliminary"; // default extra text is "Preliminary" lumi_8TeV = "19.7 fb^{-1}"; // default is "19.7 fb^{-1}" lumi_7TeV = "4.9 fb^{-1}"; // default is "5.1 fb^{-1}" int iPeriod = 2; // 1=7TeV, 2=8TeV, 3=7+8TeV, 7=7+8+13TeV gStyle->SetHatchesLineWidth(1); gStyle->SetHatchesSpacing(2.2); //----------------------------------------------------- TCanvas *cFinal2 = new TCanvas("cFinal2","cFinal2",200,10,1000,1000); cFinal2 -> cd(); double x_2011[4]; x_2011[0]=0.25; x_2011[1]=0.80; x_2011[2]=1.40; x_2011[3]=2.00; double y_2011[4]; y_2011[0]=1.052; y_2011[1]=1.057; y_2011[2]=1.096; y_2011[3]=1.134; double yErrStat_2011[4]; yErrStat_2011[0]=0.012; yErrStat_2011[1]=0.012; yErrStat_2011[2]=0.017; yErrStat_2011[3]=0.035; double yErrSysHigh_2011[4]; yErrSysHigh_2011[0]=0.062; yErrSysHigh_2011[1]=0.056; yErrSysHigh_2011[2]=0.063; yErrSysHigh_2011[3]=0.087; double yErrSysLow_2011[4]; yErrSysLow_2011[0]=0.061; yErrSysLow_2011[1]=0.055; yErrSysLow_2011[2]=0.062; yErrSysLow_2011[3]=0.085; double xErrLow_2011[4]; xErrLow_2011[0]=0.25; xErrLow_2011[1]=0.3; xErrLow_2011[2]=0.3; xErrLow_2011[3]=0.3; double xErrHigh_2011[4]; xErrHigh_2011[0]=0.25; xErrHigh_2011[1]=0.3; xErrHigh_2011[2]=0.3; xErrHigh_2011[3]=0.3; double yErrTotalHigh_2011[4]; double yErrTotalLow_2011[4]; for(int i=0; i<4; i++){ yErrTotalHigh_2011[i]=sqrt(pow(yErrStat_2011[i],2) + pow(yErrSysHigh_2011[i],2)); yErrTotalLow_2011[i]=sqrt(pow(yErrStat_2011[i],2) + pow(yErrSysLow_2011[i],2)); } TGraphAsymmErrors *Res_2011_stat = new TGraphAsymmErrors(4,x_2011,y_2011,xErrLow_2011,xErrHigh_2011,yErrStat_2011,yErrStat_2011); Res_2011_stat->SetName("Res_2011_stat"); TGraphAsymmErrors *Res_2011_sys = new TGraphAsymmErrors(4,x_2011,y_2011,xErrLow_2011,xErrHigh_2011,yErrSysLow_2011,yErrSysHigh_2011); Res_2011_sys->SetName("Res_2011_sys"); TGraphAsymmErrors *Res_2011_total = new TGraphAsymmErrors(4,x_2011,y_2011,xErrLow_2011,xErrHigh_2011,yErrTotalLow_2011,yErrTotalHigh_2011); Res_2011_sys->SetName("Res_2011_total"); //----------------------------------------------------- ratioEtaBinnedStatPlusSys -> GetXaxis() -> SetTitle("|#eta|"); ratioEtaBinnedStatPlusSys -> GetXaxis() -> SetRangeUser(0., 2.3); ratioEtaBinnedStatPlusSys -> GetYaxis() -> SetTitle("Data/MC ratio for JER"); ratioEtaBinnedSys -> GetXaxis() -> SetTitle("|#eta|"); ratioEtaBinnedSys -> GetXaxis() -> SetRangeUser(0., 2.3); ratioEtaBinnedSys -> GetYaxis() -> SetTitle("Data/MC ratio for JER"); ratioEtaBinnedStat -> GetXaxis() -> SetTitle("|#eta|"); ratioEtaBinnedStat -> GetXaxis() -> SetRangeUser(0., 2.3); ratioEtaBinnedStat -> GetYaxis() -> SetTitle("Data/MC ratio for JER"); ratioEtaBinnedStat -> GetYaxis() -> SetRangeUser(0.8, 1.6); Res_2011_stat -> GetXaxis() -> SetTitle("|#eta|"); Res_2011_stat -> GetXaxis() -> SetLimits(0., 2.3); Res_2011_stat -> GetXaxis() -> SetNdivisions(505, "X"); Res_2011_stat -> GetYaxis() -> SetTitle("Data/MC ratio for JER"); Res_2011_sys -> GetXaxis() -> SetTitle("|#eta|"); Res_2011_sys -> GetXaxis() -> SetLimits(0., 2.3); Res_2011_sys -> GetXaxis() -> SetNdivisions(505, "X"); Res_2011_sys -> GetYaxis() -> SetTitle("Data/MC ratio for JER"); Res_2011_total -> GetXaxis() -> SetTitle("|#eta|"); Res_2011_total -> GetXaxis() -> SetLimits(0., 2.3); Res_2011_total -> GetXaxis() -> SetNdivisions(505, "X"); Res_2011_total -> GetYaxis() -> SetTitle("Data/MC ratio for JER"); Res_2011_total -> GetYaxis() -> SetRangeUser(0.8, 1.5); ratioEtaBinnedStatPlusSys -> SetMarkerStyle(20); ratioEtaBinnedStatPlusSys -> SetMarkerSize(2.0); ratioEtaBinnedStatPlusSys -> SetLineColor(kPink-8); ratioEtaBinnedStatPlusSys -> SetLineWidth(2); ratioEtaBinnedStatPlusSys -> SetMarkerColor(kPink-8); ratioEtaBinnedStatPlusSys -> SetFillColor(kPink-8); ratioEtaBinnedStatPlusSys -> SetName("statPlusSys_2012"); ratioEtaBinnedStat -> SetMarkerStyle(20); ratioEtaBinnedStat -> SetMarkerSize(2.0); ratioEtaBinnedStat -> SetLineColor(kPink-8); ratioEtaBinnedStat -> SetLineWidth(2); ratioEtaBinnedStat -> SetMarkerColor(kPink-8); ratioEtaBinnedStat -> SetFillColor(kPink-8); ratioEtaBinnedStat -> SetName("Stat_2012"); ratioEtaBinnedStatPlusSys -> SetFillStyle(3244); ratioEtaBinnedStat -> SetFillStyle(3144); Res_2011_stat->SetMarkerStyle(24); Res_2011_stat->SetMarkerSize(2.0); Res_2011_stat->SetLineColor(kGray+2); Res_2011_stat->SetLineWidth(2); Res_2011_stat->SetLineWidth(2); Res_2011_stat->SetFillStyle(1001); Res_2011_total->SetMarkerStyle(24); Res_2011_total->SetMarkerSize(2.0); Res_2011_total->SetLineColor(1); Res_2011_total->SetLineWidth(2); Res_2011_total->SetFillColor(kGray); Res_2011_total->SetFillStyle(1001); Res_2011_total->SetLineColor(kGray+2); Res_2011_total->Draw("a2"); Res_2011_stat->Draw("esame"); ratioEtaBinnedStatPlusSys -> Draw("2same"); Res_2011_stat->Draw("pXsame"); Res_2011_stat->SetMarkerSize(1.9); Res_2011_stat->Draw("pXsame"); Res_2011_stat->SetMarkerSize(1.7); Res_2011_stat->Draw("pXsame"); ratioEtaBinnedStatPlusSys -> Draw("pXsame"); ratioEtaBinnedStat -> Draw("esame"); TLegend *leg = new TLegend(0.18, 0.60, 0.55, 0.75); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetFillStyle(0); leg->SetTextFont(42); leg->SetTextSize(0.045); leg->AddEntry(Res_2011_total,"5/fb (7 TeV)", "pfl"); leg->AddEntry(ratioEtaBinnedStatPlusSys,"20/fb (8 TeV)", "pfl"); leg->Draw("same"); TLatex *info = new TLatex(); info->SetNDC(); info->DrawLatex(0.67,0.83,"Anti-k_{T} R=0.5"); info->DrawLatex(0.67,0.77,"PF+CHS"); CMS_lumi( cFinal2, iPeriod, 11 ); cFinal2->Print("plots/resultsComparisonFINAL.pdf","pdf"); cFinal2->SaveAs("plots/resultsComparisonFINAL.C"); return 0; }
void DeltaPhi(double pt1_cutIN,double pt2_cutIN,double MET_cutIN, double DPHI_cutIN){ cout<<"#### DeltaPhi(MET,H) #####"<<endl; gStyle->SetPadTickY(1); gStyle->SetPadTickX(1); TLegend* leg = new TLegend(0.13,0.6,0.67,0.87); leg->SetNColumns(2); leg->SetBorderSize(0); leg->SetFillStyle(0); TLegend* leg_norm = new TLegend(0.20,0.5,0.74,0.87); leg_norm->SetNColumns(2); leg_norm->SetBorderSize(0); leg_norm->SetFillStyle(0); TCanvas *c1 = new TCanvas("c1","",500,600); TPad *mainPad = new TPad("mainPad","",0,0.3,1,1); TPad *smallPad = new TPad("smallPad","",0,0.05,1,0.3); mainPad->SetBottomMargin(0.015); smallPad->SetTopMargin(0.05); smallPad->SetBottomMargin(0.25); c1->cd(); mainPad->Draw(); mainPad->cd(); TCut mggmax = "mgg<180"; TCut mggmin = "mgg>100"; TCut mggblind = "((mgg<115)||(mgg>135))"; TCut eveto1 = "eleveto1 == 1"; TCut eveto2 = "eleveto2 == 1"; TCut eveto = eveto1 && eveto2; TCut genmatch = "((genmatch1==1 && genmatch2==0)||(genmatch1==0 && genmatch2==1)||(genmatch1==0 && genmatch2==0))"; TCut metF = "((metF_GV==1) && (metF_HBHENoise==1) && (metF_HBHENoiseIso==1) && (metF_CSC==1) && (metF_eeBadSC==1))"; TCut pt1cut = Form("pt1/mgg>%lf",pt1_cutIN); TCut pt2cut = Form("pt2/mgg>%lf",pt2_cutIN); TCut METcutD = Form("t1pfmetCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,1)>%lf",MET_cutIN); TCut METcut = Form("t1pfmetCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0)>%lf",MET_cutIN); TCut DPHIcut = Form("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>%lf",DPHI_cutIN); TCut DPHIcutD = Form("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,1))>%lf",DPHI_cutIN); TFile *data = TFile::Open("./25ns_2246inv_v3/DoubleEG.root","READ"); TFile *sig1 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP600.root","READ"); TFile *sig2 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP800.root","READ"); TFile *sig3 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1000.root","READ"); TFile *sig4 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1200.root","READ"); TFile *sig5 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1400.root","READ"); TFile *sig6 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1700.root","READ"); TFile *sig7 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP2500.root","READ"); TFile *bkg1 = TFile::Open("./25ns_2246inv_v3/DiPhoton.root","READ"); TFile *bkg2 = TFile::Open("./25ns_2246inv_v3/DYJetsToLL.root","READ"); TFile *bkg3 = TFile::Open("./25ns_2246inv_v3/GJets.root","READ"); TFile *bkg4 = TFile::Open("./25ns_2246inv_v3/GluGluHToGG.root","READ"); TFile *bkg5 = TFile::Open("./25ns_2246inv_v3/QCD.root","READ"); TFile *bkg6 = TFile::Open("./25ns_2246inv_v3/VH.root","READ"); TFile *bkg7 = TFile::Open("./25ns_2246inv_v3/ttHJetToGG.root","READ"); TFile *bkg8 = TFile::Open("./25ns_2246inv_v3/VBFHToGG.root","READ"); TFile *bkg9 = TFile::Open("./25ns_2246inv_v3/TGJets.root","READ"); TFile *bkg10 = TFile::Open("./25ns_2246inv_v3/TTGJets.root","READ"); TFile *bkg11 = TFile::Open("./25ns_2246inv_v3/WGToLNuG.root","READ"); TFile *bkg12 = TFile::Open("./25ns_2246inv_v3/ZGTo2LG.root","READ"); cout<<"check1"<<endl; TTree *tree_data = (TTree*) data->Get("DiPhotonTree"); TTree *tree_sig1 = (TTree*) sig1->Get("DiPhotonTree"); TTree *tree_sig2 = (TTree*) sig2->Get("DiPhotonTree"); TTree *tree_sig3 = (TTree*) sig3->Get("DiPhotonTree"); TTree *tree_sig4 = (TTree*) sig4->Get("DiPhotonTree"); TTree *tree_sig5 = (TTree*) sig5->Get("DiPhotonTree"); TTree *tree_sig6 = (TTree*) sig6->Get("DiPhotonTree"); TTree *tree_sig7 = (TTree*) sig7->Get("DiPhotonTree"); TTree *tree_bkg1 = (TTree*) bkg1->Get("DiPhotonTree"); TTree *tree_bkg2 = (TTree*) bkg2->Get("DiPhotonTree"); TTree *tree_bkg3 = (TTree*) bkg3->Get("DiPhotonTree"); TTree *tree_bkg4 = (TTree*) bkg4->Get("DiPhotonTree"); TTree *tree_bkg5 = (TTree*) bkg5->Get("DiPhotonTree"); TTree *tree_bkg6 = (TTree*) bkg6->Get("DiPhotonTree"); TTree *tree_bkg7 = (TTree*) bkg7->Get("DiPhotonTree"); TTree *tree_bkg8 = (TTree*) bkg8->Get("DiPhotonTree"); TTree *tree_bkg9 = (TTree*) bkg9->Get("DiPhotonTree"); TTree *tree_bkg10= (TTree*) bkg10->Get("DiPhotonTree"); TTree *tree_bkg11 = (TTree*) bkg11->Get("DiPhotonTree"); TTree *tree_bkg12 = (TTree*) bkg12->Get("DiPhotonTree"); cout<<"check2"<<endl; tree_data->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,1))>>hdata(15,0,3.5)",(mggmax && mggmin && metF && eveto && pt1cut && pt2cut && METcutD&& DPHIcutD)); TH1F *hdata =(TH1F*)gPad->GetPrimitive("hdata"); hdata->SetMarkerColor(kBlack); hdata->SetMarkerStyle(20); hdata->SetLineColor(kBlack); tree_sig1->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h1(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h1 =(TH1F*)gPad->GetPrimitive("h1"); tree_sig2->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h2(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h2 =(TH1F*)gPad->GetPrimitive("h2"); tree_sig3->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h3(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h3 =(TH1F*)gPad->GetPrimitive("h3"); tree_sig4->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h4(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h4 =(TH1F*)gPad->GetPrimitive("h4"); tree_sig5->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h5(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h5 =(TH1F*)gPad->GetPrimitive("h5"); tree_sig6->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h6(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h6 =(TH1F*)gPad->GetPrimitive("h6"); tree_sig7->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h7(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h7 =(TH1F*)gPad->GetPrimitive("h7"); tree_bkg1->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg1(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *hbkg1 =(TH1F*)gPad->GetPrimitive("hbkg1"); tree_bkg2->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg2(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *hbkg2 =(TH1F*)gPad->GetPrimitive("hbkg2"); tree_bkg3->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg3(15,0,3.5)","weight"*(mggmax && mggmin && eveto && genmatch && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *hbkg3 =(TH1F*)gPad->GetPrimitive("hbkg3"); tree_bkg4->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg4(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg4 =(TH1F*)gPad->GetPrimitive("hbkg4"); tree_bkg5->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg5(15,0,3.5)","weight"*(mggmax && mggmin && eveto && genmatch && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *hbkg5 =(TH1F*)gPad->GetPrimitive("hbkg5"); tree_bkg6->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg6(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg6 =(TH1F*)gPad->GetPrimitive("hbkg6"); tree_bkg7->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg7(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg7 =(TH1F*)gPad->GetPrimitive("hbkg7"); tree_bkg8->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg8(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg8 =(TH1F*)gPad->GetPrimitive("hbkg8"); tree_bkg9->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg9(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg9 =(TH1F*)gPad->GetPrimitive("hbkg9"); tree_bkg10->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg10(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg10 =(TH1F*)gPad->GetPrimitive("hbkg10"); tree_bkg11->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg11(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg11 =(TH1F*)gPad->GetPrimitive("hbkg11"); tree_bkg12->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg12(15,0,3.5)","weight*(weight>0.)"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg12 =(TH1F*)gPad->GetPrimitive("hbkg12"); cout<<"check3"<<endl; /* h1->Scale(0.00009338); h2->Scale(0.00010348); h3->Scale(0.00008394); h4->Scale(0.00006352); h5->Scale(0.00004712); h6->Scale(0.00003020); h7->Scale(0.00000972); */ h1->SetLineColor(kRed+3); h2->SetLineColor(kRed+1); h3->SetLineColor(kRed); h4->SetLineColor(kPink+2); h5->SetLineColor(kPink+4); //only for 15ns samples h6->SetLineColor(kPink+7); //only for 15ns samples h7->SetLineColor(kMagenta+2); //only for 15ns samples h1->SetLineWidth(2); h2->SetLineWidth(2); h3->SetLineWidth(2); h4->SetLineWidth(2); h5->SetLineWidth(2); //only for 15ns samples h6->SetLineWidth(2); //only for 15ns samples h7->SetLineWidth(2); //only for 15ns samples THStack *hs=new THStack("hs",""); hbkg7->SetFillColor(kGreen+2); hbkg6->SetFillColor(kGreen); hbkg8->SetFillColor(kYellow); hbkg4->SetFillColor(kOrange); hbkg9->SetFillColor(kOrange+7); hbkg10->SetFillColor(kOrange+4); hbkg11->SetFillColor(kCyan); hbkg12->SetFillColor(kCyan+1); hbkg5->SetFillColor(kBlue+2); hbkg2->SetFillColor(kBlue); hbkg3->SetFillColor(kMagenta-2); hbkg1->SetFillColor(kViolet); hbkg1->SetLineColor(kBlack); hbkg2->SetLineColor(kBlack); hbkg3->SetLineColor(kBlack); hbkg4->SetLineColor(kBlack); hbkg5->SetLineColor(kBlack); hbkg6->SetLineColor(kBlack); hbkg7->SetLineColor(kBlack); hbkg8->SetLineColor(kBlack); hbkg9->SetLineColor(kBlack); hbkg10->SetLineColor(kBlack); hbkg11->SetLineColor(kBlack); hbkg12->SetLineColor(kBlack); hs->Add(hbkg7); hs->Add(hbkg6); hs->Add(hbkg8); hs->Add(hbkg4); hs->Add(hbkg9); hs->Add(hbkg10); hs->Add(hbkg11); hs->Add(hbkg12); hs->Add(hbkg2); hs->Add(hbkg5); hs->Add(hbkg3); hs->Add(hbkg1); cout<<"check4"<<endl; TH1F *hsum = (TH1F*)hbkg1->Clone("hsum"); hsum->Add(hbkg2); hsum->Add(hbkg3); hsum->Add(hbkg4); hsum->Add(hbkg9); hsum->Add(hbkg10); hsum->Add(hbkg11); hsum->Add(hbkg12); hsum->Add(hbkg5); hsum->Add(hbkg6); hsum->Add(hbkg7); hsum->Add(hbkg8); hdata->SetMaximum(5000); // hs->SetMinimum(0.0001); hdata->SetTitle(""); hdata->Draw("e1"); hsum->SetMarkerStyle(1); hsum->SetFillColor(kGray+3); hsum->SetFillStyle(3002); hs->Draw("same hist"); hsum->Draw("same e2"); h2->Draw("same hist"); h3->Draw("same hist"); h4->Draw("same hist"); h1->Draw("same hist"); h5->Draw("same hist"); //only for 15ns samples h6->Draw("same hist"); //only for 15ns samples h7->Draw("same hist"); //only for 15ns samples hdata->Draw("same e1"); hdata->GetXaxis()->SetLabelOffset(999); hdata->GetYaxis()->SetTitle("Events/0.4"); hdata->GetYaxis()->SetTitleOffset(1.6); hdata->GetYaxis()->SetTitle("Events/0.23 GeV"); gPad->Modified(); /*leg->AddEntry(h1,"m_{#chi} = 1 GeV","l"); leg->AddEntry(h2,"m_{#chi} = 10 GeV","l"); leg->AddEntry(h3,"m_{#chi} = 100 GeV","l"); leg->AddEntry(h4,"m_{#chi} = 1000 GeV","l");*/ leg->AddEntry(hdata,"Data","elp"); // leg->AddEntry(h1,"m_{Z'} = 600 GeV","l"); leg->AddEntry(hbkg1,"#gamma #gamma","f"); // leg->AddEntry(h2,"m_{Z'} = 800 GeV","l"); leg->AddEntry(hbkg2,"Drell Yann","f"); // leg->AddEntry(h3,"m_{Z'} = 1000 GeV","l"); leg->AddEntry(hbkg3,"#gamma + Jets","f"); // leg->AddEntry(h4,"m_{Z'} = 1200 GeV","l"); leg->AddEntry(hbkg5,"QCD","f"); // leg->AddEntry(h5,"m_{Z'} = 1400 GeV","l"); //only for 15ns samples leg->AddEntry(hbkg4,"ggH","f"); // leg->AddEntry(h6,"m_{Z'} = 1700 GeV","l"); //only for 15ns samples leg->AddEntry(hbkg6,"VH","f"); // leg->AddEntry(h7,"m_{Z'} = 2500 GeV","l"); //only for 25ns samples leg->AddEntry(hbkg7,"ttH","f"); leg->AddEntry(hbkg8,"VBF H","f"); leg->AddEntry(hbkg9,"t + #gamma + Jets","f"); leg->AddEntry(hbkg10,"tt + #gamma +Jets","f"); leg->AddEntry(hbkg11,"#gamma+W","f"); leg->AddEntry(hbkg12,"#gamma+Z","f"); leg->AddEntry(hsum,"Bkg uncertainty","f"); leg->Draw("same"); cout<<"check5"<<endl; gStyle->SetOptStat(0); c1->cd(); smallPad->Draw(); smallPad->cd(); TGraphErrors *gr = new TGraphErrors(0); double integralData=hdata->Integral(); double integralBKG=hsum->Integral(); double error, ratio; for(int w=1; w<15; w++){ if((hdata->GetBinContent(w)!=0) && (hsum->GetBinContent(w)!=0)){ gr->SetPoint(w, hdata->GetBinCenter(w),(hdata->GetBinContent(w))/(hsum->GetBinContent(w))); ratio= (hdata->GetBinContent(w))/(hsum->GetBinContent(w)); error= (hdata->GetBinContent(w)*sqrt(hsum->GetBinContent(w))/(hsum->GetBinContent(w)*hsum->GetBinContent(w)) + sqrt(hdata->GetBinContent(w))/hsum->GetBinContent(w)); std::cout<<"VALUE: "<<ratio<<" ERROR: "<<error<<std::endl; gr->SetPointError(w, hdata->GetBinWidth(w)/2,error); }else{ gr->SetPoint(w, hdata->GetBinCenter(w),10); } } gStyle->SetPadTickY(1); gStyle->SetPadTickX(1); gr->GetHistogram()->SetMaximum(2); gr->GetHistogram()->SetMinimum(0.1); gStyle->SetTextSize(14); gROOT->ForceStyle(); gr->GetXaxis()->SetLabelFont(43); gr->GetXaxis()->SetLabelSize(15); gr->GetYaxis()->SetLabelFont(43); gr->GetYaxis()->SetLabelSize(15); gr->GetXaxis()->SetLimits(0,3.5); gPad->SetGrid(); gStyle->SetStripDecimals(kTRUE); gr->SetMarkerStyle(20); gr->SetMarkerSize(0.7); gr->Draw("AZP"); gr->GetXaxis()->SetTitle("|#Delta#phi(#gamma#gamma,E^{miss}_{T})|"); gr->GetXaxis()->SetTitleSize(0.1); gr->GetYaxis()->SetTitleSize(0.1); gr->GetYaxis()->SetNdivisions(505); gr->GetXaxis()->SetTitleOffset(1); gr->GetYaxis()->SetTitle("Data/MC"); gr->GetYaxis()->SetTitleOffset(0.4); gr->SetTitle(""); smallPad->Update(); TF1* line = new TF1("line","1",0,3.5); line->SetLineColor(kRed); line->SetLineWidth(2); line->Draw("L same"); gr->Draw("ZP SAME"); TCanvas *c2 = new TCanvas("c2","",500,500); tree_sig1->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h1_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h1_norm =(TH1F*)gPad->GetPrimitive("h1_norm"); tree_sig2->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h2_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h2_norm =(TH1F*)gPad->GetPrimitive("h2_norm"); tree_sig3->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h3_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h3_norm =(TH1F*)gPad->GetPrimitive("h3_norm"); tree_sig4->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h4_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h4_norm =(TH1F*)gPad->GetPrimitive("h4_norm"); tree_sig5->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h5_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h5_norm =(TH1F*)gPad->GetPrimitive("h5_norm"); tree_sig6->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h6_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h6_norm =(TH1F*)gPad->GetPrimitive("h6_norm"); tree_sig7->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h7_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *h7_norm =(TH1F*)gPad->GetPrimitive("h7_norm"); tree_bkg1->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg1_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *hbkg1_norm =(TH1F*)gPad->GetPrimitive("hbkg1_norm"); tree_bkg2->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg2_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *hbkg2_norm =(TH1F*)gPad->GetPrimitive("hbkg2_norm"); tree_bkg3->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg3_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && genmatch && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *hbkg3_norm =(TH1F*)gPad->GetPrimitive("hbkg3_norm"); tree_bkg4->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg4_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg4_norm =(TH1F*)gPad->GetPrimitive("hbkg4_norm"); tree_bkg5->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg5_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && genmatch && pt1cut && pt2cut && METcut&& DPHIcut)); TH1F *hbkg5_norm =(TH1F*)gPad->GetPrimitive("hbkg5_norm"); tree_bkg6->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg6_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg6_norm =(TH1F*)gPad->GetPrimitive("hbkg6_norm"); tree_bkg7->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg7_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg7_norm =(TH1F*)gPad->GetPrimitive("hbkg7_norm"); tree_bkg8->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg8_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg8_norm =(TH1F*)gPad->GetPrimitive("hbkg8_norm"); tree_bkg9->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg9_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg9_norm =(TH1F*)gPad->GetPrimitive("hbkg9_norm"); tree_bkg10->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg10_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg10_norm =(TH1F*)gPad->GetPrimitive("hbkg10_norm"); tree_bkg11->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg11_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg11_norm =(TH1F*)gPad->GetPrimitive("hbkg11_norm"); tree_bkg12->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg12_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut)); //weight also on BR = 0.002 if using 50ns samples TH1F *hbkg12_norm =(TH1F*)gPad->GetPrimitive("hbkg12_norm"); for(int i = 0; i<26;i++){ if(hbkg1_norm->GetBinContent(i) < 0.) hbkg1_norm->SetBinContent(i,0.); if(hbkg2_norm->GetBinContent(i) < 0.) hbkg2_norm->SetBinContent(i,0.); if(hbkg3_norm->GetBinContent(i) < 0.) hbkg3_norm->SetBinContent(i,0.); if(hbkg4_norm->GetBinContent(i) < 0.) hbkg4_norm->SetBinContent(i,0.); if(hbkg5_norm->GetBinContent(i) < 0.) hbkg5_norm->SetBinContent(i,0.); if(hbkg6_norm->GetBinContent(i) < 0.) hbkg6_norm->SetBinContent(i,0.); if(hbkg7_norm->GetBinContent(i) < 0.) hbkg7_norm->SetBinContent(i,0.); if(hbkg8_norm->GetBinContent(i) < 0.) hbkg8_norm->SetBinContent(i,0.); if(hbkg9_norm->GetBinContent(i) < 0.) hbkg9_norm->SetBinContent(i,0.); if(hbkg10_norm->GetBinContent(i) < 0.) hbkg10_norm->SetBinContent(i,0.); if(hbkg11_norm->GetBinContent(i) < 0.) hbkg11_norm->SetBinContent(i,0.); if(hbkg12_norm->GetBinContent(i) < 0.) hbkg12_norm->SetBinContent(i,0.); } double norm = 1./h1_norm->Integral(); h1_norm->Scale(norm); norm = 1./h2_norm->Integral(); h2_norm->Scale(norm); norm = 1./h3_norm->Integral(); h3_norm->Scale(norm); norm = 1./h4_norm->Integral(); h4_norm->Scale(norm); norm = 1./h5_norm->Integral(); //only for 50ns samples h5_norm->Scale(norm); //only for 50ns samples norm = 1./h6_norm->Integral(); //only for 50ns samples h6_norm->Scale(norm); //only for 50ns samples norm = 1./h7_norm->Integral(); //only for 50ns samples h7_norm->Scale(norm); //only for 50ns samples norm = 1./hbkg1_norm->Integral(); hbkg1_norm->Scale(norm); norm = 1./hbkg2_norm->Integral(); hbkg2_norm->Scale(norm); norm = 1./hbkg3_norm->Integral(); hbkg3_norm->Scale(norm); norm = 1./hbkg4_norm->Integral(); hbkg4_norm->Scale(norm); norm = 1./hbkg5_norm->Integral(); hbkg5_norm->Scale(norm); norm = 1./hbkg6_norm->Integral(); hbkg6_norm->Scale(norm); norm = 1./hbkg7_norm->Integral(); hbkg7_norm->Scale(norm); norm = 1./hbkg8_norm->Integral(); hbkg8_norm->Scale(norm); norm = 1./hbkg9_norm->Integral(); hbkg9_norm->Scale(norm); norm = 1./hbkg10_norm->Integral(); hbkg10_norm->Scale(norm); norm = 1./hbkg11_norm->Integral(); hbkg11_norm->Scale(norm); norm = 1./hbkg12_norm->Integral(); hbkg12_norm->Scale(norm); h1_norm->SetLineColor(kRed+3); h2_norm->SetLineColor(kRed+1); h3_norm->SetLineColor(kRed); h4_norm->SetLineColor(kPink+2); h5_norm->SetLineColor(kPink+4); //only for 25ns samples h6_norm->SetLineColor(kPink+7); //only for 25ns samples h7_norm->SetLineColor(kMagenta+2); //only for 25ns samples h1_norm->SetLineWidth(2); h2_norm->SetLineWidth(2); h3_norm->SetLineWidth(2); h4_norm->SetLineWidth(2); h5_norm->SetLineWidth(2); //only for 25ns samples h6_norm->SetLineWidth(2); //only for 25ns samples h7_norm->SetLineWidth(2); //only for 25ns samples hbkg7_norm->SetLineColor(kGreen+2); hbkg6_norm->SetLineColor(kGreen); hbkg8_norm->SetLineColor(kYellow); hbkg4_norm->SetLineColor(kOrange); hbkg9_norm->SetLineColor(kOrange+7); hbkg10_norm->SetLineColor(kOrange+4); hbkg11_norm->SetLineColor(kCyan); hbkg12_norm->SetLineColor(kCyan+1); hbkg5_norm->SetLineColor(kBlue+3); hbkg2_norm->SetLineColor(kBlue); hbkg3_norm->SetLineColor(kMagenta-2); hbkg1_norm->SetLineColor(kViolet); hbkg1_norm->SetFillStyle(0); hbkg2_norm->SetFillStyle(0); hbkg3_norm->SetFillStyle(0); hbkg4_norm->SetFillStyle(0); hbkg5_norm->SetFillStyle(0); hbkg6_norm->SetFillStyle(0); hbkg7_norm->SetFillStyle(0); hbkg8_norm->SetFillStyle(0); hbkg9_norm->SetFillStyle(0); hbkg10_norm->SetFillStyle(0); hbkg11_norm->SetFillStyle(0); hbkg12_norm->SetFillStyle(0); h1_norm->SetTitle(""); h1_norm->SetMaximum(1); h1_norm->SetMinimum(0.001); h1_norm->Draw("HIST"); hbkg1_norm->Draw("same HIST"); hbkg2_norm->Draw("same HIST"); hbkg3_norm->Draw("same HIST"); hbkg5_norm->Draw("same HIST"); hbkg4_norm->Draw("same HIST"); hbkg6_norm->Draw("same HIST"); hbkg7_norm->Draw("same HIST"); hbkg8_norm->Draw("same HIST"); hbkg9_norm->Draw("same HIST"); hbkg10_norm->Draw("same HIST"); hbkg11_norm->Draw("same HIST"); hbkg12_norm->Draw("same HIST"); h1_norm->Draw("same hist"); h2_norm->Draw("same hist"); h3_norm->Draw("same hist"); h4_norm->Draw("same hist"); h5_norm->Draw("same hist"); h6_norm->Draw("same hist"); h7_norm->Draw("same hist"); h1_norm->GetXaxis()->SetTitle("|#Delta#phi(#gamma#gamma,E_{T}^{miss})|"); h1_norm->GetYaxis()->SetTitle("Normalized events"); h1_norm->GetYaxis()->SetTitleOffset(1.2); gPad->Modified(); gStyle->SetOptStat(0); //int iPos =0; // CMS_lumi(p1,true,iPos,true); // CMS_lumi(p2,true,iPos,true); leg_norm->AddEntry(h1_norm,"m_{Z'} = 600 GeV","l"); leg_norm->AddEntry(hbkg1_norm,"#gamma #gamma","l"); leg_norm->AddEntry(h2_norm,"m_{Z'} = 800 GeV","l"); leg_norm->AddEntry(hbkg2_norm,"Drell Yann","l"); leg_norm->AddEntry(h3_norm,"m_{Z'} = 1000 GeV","l"); leg_norm->AddEntry(hbkg3_norm,"#gamma + Jets","l"); leg_norm->AddEntry(h4_norm,"m_{Z'} = 1200 GeV","l"); leg_norm->AddEntry(hbkg5_norm,"QCD","l"); leg_norm->AddEntry(h5_norm,"m_{Z'} = 1400 GeV","l"); //only for 25ns samples leg_norm->AddEntry(hbkg4_norm,"ggH","l"); leg_norm->AddEntry(h6_norm,"m_{Z'} = 1700 GeV","l"); //only for 25ns samples leg_norm->AddEntry(hbkg6_norm,"VH","l"); leg_norm->AddEntry(h7_norm,"m_{Z'} = 2500 GeV","l"); //only for 25ns samples leg_norm->AddEntry(hbkg7_norm,"ttH","l"); leg_norm->AddEntry(hbkg8_norm,"VBF H","l"); leg_norm->AddEntry(hbkg9_norm,"t + #gamma + Jets","l"); leg_norm->AddEntry(hbkg10_norm,"tt + #gamma +Jets","l"); leg_norm->AddEntry(hbkg11_norm,"#gamma+W","l"); leg_norm->AddEntry(hbkg12_norm,"#gamma+Z","l"); leg_norm->Draw("same"); if(pt1_cutIN==0. && pt2_cutIN == 0. && MET_cutIN == 0.){ c1->SaveAs("./25ns_2246inv_v3/plots/kinematics/DeltaPhi_H_MET_MET0.png"); c1->SaveAs("./25ns_2246inv_v3/plots/kinematics/DeltaPhi_H_MET_MET0.pdf"); c2->SaveAs("./25ns_2246inv_v3/plots/kinematics/DeltaPhi_H_MET_MET0_norm.png"); c2->SaveAs("./25ns_2246inv_v3/plots/kinematics/DeltaPhi_H_MET_MET0_norm.pdf"); } }
TEfficiency* CalcEfficHadrons(const char* fileName, Bool_t makeDraw=kFALSE) { // open the input file TFile *file = new TFile(fileName); // ******************************************** // parameters to check before running the macro // ******************************************** const Int_t NHISTS = 4; // Check the number of histograms for different particle species const Int_t NOUTPUTS = 3; const Int_t NHISTOUT[NOUTPUTS] = {1,1,1}; const Int_t IHISTOUT[NOUTPUTS][NHISTS] = {{0,-1,-1,-1},{1,-1,-1,-1},{2,-1,-1,-1}}; const Float_t CUT_RES = 0.02; Int_t style[NOUTPUTS] = {20,21,22}; Int_t color[NOUTPUTS] = {1,2,4}; const Int_t fgNumOfPtBins = 111; // Check the number of eta bins in the histograms const Int_t fgNumOfEtaBins = 16; // Check the number of E bins in the histograms const Int_t fgNumOfRBins = 45; Double_t fgPtAxis[117]= {0.0,0.01,0.02,0.03,0.04, 0.05, 0.06,0.07,0.08,0.09, 0.10,0.11, .12,0.13, .14,0.15, .16,0.17, .18,0.19, 0.2, .22, .24, .26, .28, 0.30, 0.32, .34, .36, .38, 0.40, .42, .44, .46, .48, 0.5, .52, .54, .56, .58, 0.60, 0.62, .64, .66, .68, 0.70, .72, .74, .76, .78, .80, .82, .84, .86, .88, 0.90, 0.92, .94, .96, .98, 1.00,1.05, 1.1,1.15, 1.2, 1.25, 1.3,1.35,1.40,1.45, 1.50, 1.55, 1.6,1.65, 1.7, 1.75, 1.8,1.85, 1.9,1.95, 2.0, 2.2, 2.4, 2.6, 2.8, 3.00, 3.20, 3.4, 3.6, 3.8, 4.00, 4.2, 4.4, 4.6, 4.8, 5.0, 5.5, 6.0, 6.5, 7.0, 7.50, 8.00, 8.5, 9.0, 9.5, 10.0,12.0,14.0,16.0,18.0, 20.0,25.0,30.0,35.0,40.0, 45.0, 50.0}; // declare histograms and graphs TH2F *histNum[NHISTS]; TH2F *histDen[NHISTS]; TGraphErrors *graph[NOUTPUTS]; TH1D* projYNum; TEfficiency *effic[NOUTPUTS]; char efficName[50]; // retrieve the input list of histogram. Check the TList name in the input file. TList *list = (TList*) file->Get("out1"); // retrieve the histograms in the list. Check the name of the histograms histNum[0] = (TH2F*)list->FindObject("fHistPionRec_ResPt_EmcalMC"); histNum[1] = (TH2F*)list->FindObject("fHistKaonRec_ResPt_EmcalMC"); histNum[2] = (TH2F*)list->FindObject("fHistProtonRec_ResPt_EmcalMC"); histNum[3] = (TH2F*)list->FindObject("fHistMuonRec_ResPt_EmcalMC"); // retrieve the histograms in the list. Check the name of the histograms histDen[0] = (TH2F*)list->FindObject("fHistPionAcc_EtaPt_EmcalMC"); histDen[1] = (TH2F*)list->FindObject("fHistKaonAcc_EtaPt_EmcalMC"); histDen[2] = (TH2F*)list->FindObject("fHistProtonAcc_EtaPt_EmcalMC"); histDen[3] = (TH2F*)list->FindObject("fHistMuonAcc_EtaPt_EmcalMC"); // ******************************************** Float_t x[fgNumOfPtBins]={0}, ex[fgNumOfPtBins]={0}; Float_t y[fgNumOfPtBins]={0}, ey[fgNumOfPtBins]={0}; Float_t num=0, den=0; //Int_t num=0, den=0; Float_t Res=0; // loop over different desired outputs for (int iOut=0; iOut<NOUTPUTS; iOut++) { sprintf(efficName,"effic_%d",iOut); effic[iOut] = new TEfficiency(efficName,efficName,fgNumOfPtBins,fgPtAxis); // loop over E bins for (int ix=0; ix<fgNumOfPtBins; ix++) { // initialize ET variables for a new particle species x[ix]=histNum[0]->GetXaxis()->GetBinCenter(ix+1); y[ix]=0; ex[ix]=0; ey[ix]=0; num = 0; den = 0; // loop over eta bins for (int iy=0; iy<fgNumOfEtaBins; iy++) { for (int iHist=0; iHist<NHISTOUT[iOut]; iHist++) { den += histDen[IHISTOUT[iOut][iHist]]->GetBinContent(ix+1,iy+1); // sum over all E bins in order to get total ET } } // loop over residual bins for (int iHist=0; iHist<NHISTOUT[iOut]; iHist++) { projYNum = histNum[IHISTOUT[iOut][iHist]]->ProjectionY(); for (int iy=0; iy<fgNumOfRBins; iy++) { Res = projYNum->GetBinCenter(iy+1); if (Res<CUT_RES) num += histNum[IHISTOUT[iOut][iHist]]->GetBinContent(ix+1,iy+1); // sum over all E bins in order to get total ET } } if ((num>0) && (den>0)) { effic[iOut]->SetTotalEvents(ix,den); effic[iOut]->SetPassedEvents(ix,num); y[ix] = num/den; ey[ix] = y[ix]*sqrt(1/num+1/den); //ey[ix] = ((num+1)*(num+2))/((den+2)*(den+3))-((num+1)*(num+1))/((den+2)*(den+2)); } else { y[ix] = 0; ey[ix] = 0; } } // end of loop over E bins graph[iOut] = new TGraphErrors(fgNumOfPtBins,x,y,ex,ey); // graphic of ET(>E_cut)/ET(total) for a given particle species and E cut } // end of loop over different outputs // Draw the plot if (makeDraw) { gStyle->SetOptTitle(0); gStyle->SetOptStat(0); gStyle->SetOptFit(0); TCanvas *c = new TCanvas("c","c",500,400); //c->SetTopMargin(0.04); //c->SetRightMargin(0.04); //c->SetLeftMargin(0.181452); //c->SetBottomMargin(0.134409); c->SetBorderSize(0); c->SetFillColor(0); c->SetBorderMode(0); c->SetFrameFillColor(0); c->SetFrameBorderMode(0); /* for (int i=0; i<NOUTPUTS; i++) { graph[i]->SetMarkerStyle(style[i]); graph[i]->SetMarkerColor(color[i]); graph[i]->SetLineColor(color[i]); graph[i]->SetFillColor(0); if (i == 0) { graph[i]->GetXaxis()->SetTitle("E (GeV)"); graph[i]->GetYaxis()->SetTitle("effic"); graph[i]->SetMaximum(1.0); graph[i]->SetMinimum(0.0); graph[i]->Draw("AP"); } else graph[i]->Draw("P"); } */ for (int i=0; i<NOUTPUTS; i++) { effic[i]->SetMarkerStyle(style[i]); effic[i]->SetMarkerColor(color[i]); effic[i]->SetLineColor(color[i]); effic[i]->SetFillColor(0); effic[i]->SetTitle("efficiency; p_{T} (GeV/c); #epsilon"); if (i == 0) { effic[i]->Draw(); } else effic[i]->Draw("Psame"); } TLegend *leg = new TLegend(0.65,0.2,0.95,0.5); leg->AddEntry(effic[0],"pions"); leg->AddEntry(effic[1],"kaons"); leg->AddEntry(effic[2],"protons"); //leg->AddEntry(effic[3],"muons"); leg->SetFillStyle(0); leg->SetFillColor(0); leg->SetBorderSize(0); leg->SetTextSize(0.03); leg->Draw(); } return effic[0]; }
void para_12TeV_2Lep_plots_All() { //=========Macro generated from canvas: c1/Parameter1 //========= (Sun Nov 22 20:05:00 2015) by ROOT version6.02/12 TCanvas *c1 = new TCanvas("c1", "Parameter1",0,22,1000,600); gStyle->SetOptStat(0); c1->Range(-4.375,-0.2745458,39.375,2.490986); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetGridx(); c1->SetGridy(); c1->SetFrameBorderMode(0); c1->SetFrameBorderMode(0); TH1F *NuisanceParameterFreed2 = new TH1F("NuisanceParameterFreed2","Mu",35,0,35); NuisanceParameterFreed2->SetMinimum(0.00200744); NuisanceParameterFreed2->SetMaximum(2.214433); NuisanceParameterFreed2->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); NuisanceParameterFreed2->SetLineColor(ci); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(1,"MUONS_MS"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(2,"Luminosity"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(3,"XS_Zb"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(4,"FT_EFF_Eigen_C_2"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(5,"MUON_EFF_TrigStatUncertainty"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(6,"FT_EFF_Eigen_C_3"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(7,"FT_EFF_Eigen_B_0"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(8,"MUON_EFF_SYS"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(9,"MUON_EFF_STAT"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(10,"FT_EFF_Eigen_Light_3"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(11,"FT_EFF_Eigen_Light_4"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(12,"global"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(13,"MUONS_SCALE"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(14,"MUON_ISO_STAT"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_C_0"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(16,"EL_EFF_Iso_TotalCorrUncertainty"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(17,"FT_EFF_Eigen_B_1"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(18,"XS_diboson"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(19,"XS_st"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(20,"MUON_EFF_TrigSystUncertainty"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(21,"EG_RESOLUTION_ALL"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(22,"FT_EFF_Eigen_B_2"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(23,"MUONS_ID"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(24,"EL_EFF_Reco_TotalCorrUncertainty"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(25,"EG_SCALE_ALL"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(26,"FT_EFF_extrapolation"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(27,"FT_EFF_Eigen_Light_1"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_2"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(29,"FT_EFF_Eigen_C_1"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(30,"MUON_ISO_SYS"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(31,"FT_EFF_Eigen_Light_0"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(32,"EL_EFF_ID_TotalCorrUncertainty"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(33,"XS_Zl"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(34,"XS_Zc"); NuisanceParameterFreed2->GetXaxis()->SetBinLabel(35,"XS_ttbar"); NuisanceParameterFreed2->GetXaxis()->SetLabelFont(42); NuisanceParameterFreed2->GetXaxis()->SetLabelSize(0.035); NuisanceParameterFreed2->GetXaxis()->SetTitleSize(0.035); NuisanceParameterFreed2->GetXaxis()->SetTitleFont(42); NuisanceParameterFreed2->GetYaxis()->SetTitle("#mu_{best}"); NuisanceParameterFreed2->GetYaxis()->SetLabelFont(42); NuisanceParameterFreed2->GetYaxis()->SetLabelSize(0.035); NuisanceParameterFreed2->GetYaxis()->SetTitleSize(0.035); NuisanceParameterFreed2->GetYaxis()->SetTitleFont(42); NuisanceParameterFreed2->GetZaxis()->SetLabelFont(42); NuisanceParameterFreed2->GetZaxis()->SetLabelSize(0.035); NuisanceParameterFreed2->GetZaxis()->SetTitleSize(0.035); NuisanceParameterFreed2->GetZaxis()->SetTitleFont(42); NuisanceParameterFreed2->Draw("hist"); Double_t _fx1002[37] = { 0, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, 24.5, 25.5, 26.5, 27.5, 28.5, 29.5, 30.5, 31.5, 32.5, 33.5, 34.5, 0 }; Double_t _fy1002[37] = { 0, 0.00200744, 2.065197, 2.090439, 2.097085, 2.102307, 2.102459, 2.103994, 2.109032, 2.110826, 2.110827, 2.110944, 2.111107, 2.111297, 2.111303, 2.111389, 2.11147, 2.1115, 2.112008, 2.112152, 2.112174, 2.112884, 2.113456, 2.113847, 2.114265, 2.114548, 2.11588, 2.116422, 2.117402, 2.123061, 2.129504, 2.131184, 2.133743, 2.13776, 2.138737, 2.214433, 0 }; Double_t _fex1002[37] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Double_t _fey1002[37] = { 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }; TGraphErrors *gre = new TGraphErrors(37,_fx1002,_fy1002,_fex1002,_fey1002); gre->SetName(""); gre->SetTitle(""); gre->SetFillColor(1); gre->SetMarkerStyle(20); gre->SetMarkerSize(1.2); TH1F *Graph_Graph1002 = new TH1F("Graph_Graph1002","",100,0,37.95); Graph_Graph1002->SetMinimum(-12.22144); Graph_Graph1002->SetMaximum(14.43588); Graph_Graph1002->SetDirectory(0); Graph_Graph1002->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1002->SetLineColor(ci); Graph_Graph1002->GetXaxis()->SetLabelFont(42); Graph_Graph1002->GetXaxis()->SetLabelSize(0.035); Graph_Graph1002->GetXaxis()->SetTitleSize(0.035); Graph_Graph1002->GetXaxis()->SetTitleFont(42); Graph_Graph1002->GetYaxis()->SetLabelFont(42); Graph_Graph1002->GetYaxis()->SetLabelSize(0.035); Graph_Graph1002->GetYaxis()->SetTitleSize(0.035); Graph_Graph1002->GetYaxis()->SetTitleFont(42); Graph_Graph1002->GetZaxis()->SetLabelFont(42); Graph_Graph1002->GetZaxis()->SetLabelSize(0.035); Graph_Graph1002->GetZaxis()->SetTitleSize(0.035); Graph_Graph1002->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1002); gre->Draw("p"); TLegend *leg = new TLegend(0.1,0.4,0.4,0.95,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(72); leg->SetTextSize(0.015); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(0); TLegendEntry *entry=leg->AddEntry("","global","P"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(20); entry->SetMarkerSize(1.2); entry->SetTextFont(72); leg->Draw(); TPaveText *pt = new TPaveText(0.4694177,0.94,0.5305823,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); TText *AText = pt->AddText("Mu"); pt->Draw(); c1->Modified(); c1->cd(); c1->SetSelected(c1); }
//================================================ void SignalShape(const int savePlot = 1) { const int icent = 0; const int nfiles = 2; const char *filename[nfiles] = {"Pico.Run13.pp500.jpsi.pt1.5.pt1.0.yield.root","Pico.Run13.pp500.jpsi.VtxCut.pt1.5.pt1.0.yield.root"}; const TString legName[nfiles] = {"W/o vtx cut","W/ vtx cut"}; const char *saveTitle = "Run13_VtxCut"; TFile *file[nfiles]; TH1F *hInvMass[nfiles][nPtBins]; TH1F *hMean[nfiles]; TH1F *hSigma[nfiles]; TH1F *hYield[nfiles]; for(int i=0; i<nfiles; i++) { file[i] = TFile::Open(Form("Rootfiles/%s",filename[i]),"read"); hMean[i] = (TH1F*)file[i]->Get(Form("Jpsi_FitMean_cent%s",cent_Title[icent])); hMean[i]->SetName(Form("%s_%d",hMean[i]->GetName(),i)); hSigma[i] = (TH1F*)file[i]->Get(Form("Jpsi_FitSigma_cent%s",cent_Title[icent])); hSigma[i]->SetName(Form("%s_%d",hSigma[i]->GetName(),i)); hYield[i] = (TH1F*)file[i]->Get(Form("Jpsi_BinCountYield_cent%s",cent_Title[icent])); hYield[i]->SetName(Form("%s_%d",hYield[i]->GetName(),i)); for(int ipt=0; ipt<nPtBins; ipt++) { hInvMass[i][ipt] = (TH1F*)file[i]->Get(Form("Jpsi_Signal_cent%s_pt%s_save",cent_Title[icent],pt_Name[ipt])); hInvMass[i][ipt]->SetName(Form("%s_%d",hInvMass[i][ipt]->GetName(),i)); } } // invariant mass distribution TCanvas *c = new TCanvas("InvMass","InvMass",1200,700); c->Divide(nPtBins/2+nPtBins%2,2); TLegend *leg = new TLegend(0.6,0.65,0.85,0.85); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextSize(0.05); for(int ipt=0; ipt<nPtBins; ipt++) { c->cd(ipt+1); SetPadMargin(gPad,0.13, 0.13, 0.03, 0.1); for(int i=0; i<nfiles; i++) { int bin = hInvMass[i][ipt]->FindFixBin(3.09); hInvMass[i][ipt]->Scale(1./hInvMass[i][ipt]->GetBinContent(bin)); hInvMass[i][ipt]->SetMaximum(1.5); hInvMass[i][ipt]->SetMarkerStyle(21+i*4); hInvMass[i][ipt]->SetMarkerColor(color[i]); hInvMass[i][ipt]->SetLineColor(color[i]); hInvMass[i][ipt]->SetYTitle("a.u."); ScaleHistoTitle(hInvMass[i][ipt],0.05,1,0.035,0.05,1.4,0.035,62); if(i==0) hInvMass[i][ipt]->Draw(); else hInvMass[i][ipt]->Draw("sames"); if(ipt==0) leg->AddEntry(hInvMass[i][ipt],legName[i].Data(),"PL"); } TPaveText *t1 = GetTitleText(Form("%1.0f < p_{T,#mu#mu} < %1.0f GeV/c",ptBins_low[ipt],ptBins_high[ipt]),0.06); t1->Draw(); } c->cd(1); leg->Draw(); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_InvMass_cent%s.pdf",run_type,saveTitle,cent_Title[icent])); // mean & sigma TList *list = new TList; for(int i=0; i<nfiles; i++) { hMean[i]->SetMarkerStyle(21+i*4); hMean[i]->SetMarkerColor(color[i]); hMean[i]->SetLineColor(color[i]); list->Add(hMean[i]); } c = drawHistos(list,"mean","Mean of J/#Psi mass peak",false,0,10,false,2.5,3.5,false,true,legName,true,"",0.5,0.7,0.3,0.5,true,0.04,0.04,false,1,false,false); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_JpsiMean_cent%s.pdf",run_type,saveTitle,cent_Title[icent])); list->Clear(); for(int i=0; i<nfiles; i++) { hSigma[i]->SetMarkerStyle(21+i*4); hSigma[i]->SetMarkerColor(color[i]); hSigma[i]->SetLineColor(color[i]); list->Add(hSigma[i]); } c = drawHistos(list,"sigma","Width of J/#Psi mass peak",false,0,10,false,2.5,3.5,false,true,legName,true,"",0.55,0.75,0.2,0.4,true,0.04,0.04,false,1,false,false); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_JpsiSigma_cent%s.pdf",run_type,saveTitle,cent_Title[icent])); list->Clear(); for(int i=0; i<nfiles; i++) { hYield[i]->Scale(1./hYield[i]->Integral()); hYield[i]->SetMarkerStyle(21+i*4); hYield[i]->SetMarkerColor(color[i]); hYield[i]->SetLineColor(color[i]); list->Add(hYield[i]); } c = drawHistos(list,"yield","Raw distribution of J/#Psi signal;p_{T} (GeV/c);Prob.",false,0,10,true,0,0.4,false,true,legName,true,"",0.55,0.75,0.6,0.8,true,0.04,0.04,false,1,false,false); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_RawCounts_cent%s.pdf",run_type,saveTitle,cent_Title[icent])); }
//================================================ void All(const int compCount = 1, const int compEff = 1, const int compRef = 1, const int savePlot = 1) { const char* dataType[2] = {"New","Old"}; // Jpsi efficiency vs. pT const int nPtBins = nPtBins_pt; const double* ptBins_low = ptBins_low_pt; const double* ptBins_high = ptBins_high_pt; const char** ptName = pt_Name_pt; const int nCentBins = nCentBins_pt; const int* centBins_low = centBins_low_pt; const int* centBins_high = centBins_high_pt; const char** cent_Name = cent_Name_pt; const char** cent_Title = cent_Title_pt; const int kNCent = nCentBins_npart[0]; const int nbins = nPtBins -1; double xbins[nbins+1]; for(int i=0; i<nbins; i++) xbins[i] = ptBins_low[i+1]; xbins[nbins] = ptBins_high[nbins]; TList *list = new TList; if(compCount) { TFile *fSig[2]; fSig[0] = TFile::Open(Form("Rootfiles/%s.JpsiYield.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read"); fSig[1] = TFile::Open(Form("Rootfiles/old.%s.JpsiYield.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read"); TH1F *hJpsiCounts[2][7]; TCanvas *c = new TCanvas("comp_JpsiCounts", "comp_JpsiCounts", 1100, 500); c->Divide(4,2); TLegend *leg = new TLegend(0.3,0.3,0.6,0.6); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextFont(62); leg->SetTextSize(0.08); for(int k=0; k<7; k++) { for(int j=0; j<2; j++) { if(k<5) hJpsiCounts[j][k] = (TH1F*)fSig[j]->Get(Form("Jpsi_FitYield_cent%s_weight",cent_Title[k])); else hJpsiCounts[j][k] = (TH1F*)fSig[j]->Get(Form("Jpsi_FitYield_pt%s_weight",pt_Name_npart[k-5])); hJpsiCounts[j][k]->SetName(Form("%s_%d",hJpsiCounts[j][k]->GetName(),j)); hJpsiCounts[j][k]->SetMarkerStyle(21+j*4); hJpsiCounts[j][k]->SetMarkerColor(j+1); hJpsiCounts[j][k]->SetLineColor(j+1); c->cd(k+1); gPad->SetLogy(); if(k==2 || k==3) hJpsiCounts[j][k]->GetXaxis()->SetRangeUser(0.5,10); if(k==4) hJpsiCounts[j][k]->GetXaxis()->SetRangeUser(0.5,6); hJpsiCounts[j][k]->SetTitle(";;Counts"); if(k<5) hJpsiCounts[j][k]->SetXTitle("p_{T} [GeV/c]"); if(j==0) hJpsiCounts[j][k]->Draw(); else hJpsiCounts[j][k]->Draw("sames"); if(k==0) leg->AddEntry(hJpsiCounts[j][k], dataType[j], "P"); } if(k<5) TPaveText *t1 = GetTitleText(Form("%s: %s%%",run_type,cent_Name[k]),0.06); else TPaveText *t1 = GetTitleText(Form("%s: %s",run_type,pt_Title_npart[k-5]),0.06); t1->Draw(); } c->cd(8); leg->Draw(); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_JpsiCounts.pdf",run_type)); } if(compEff) { const char *trkEffType[6] = {"MC","Tpc","MtdMth","MuonPid","MtdTrig","TrigUnit"}; TFile *fEff[2]; fEff[0] = TFile::Open(Form("Rootfiles/%s.EmbJpsiEff.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read"); fEff[1] = TFile::Open(Form("Rootfiles/old.%s.EmbJpsiEff.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read"); const int nHistos = 6; TH1F *hJpsiPt[2][nHistos][nCentBins]; TH1F *hJpsiPtEffs[2][nHistos][nCentBins]; for(int j=0; j<2; j++) { for(int i=0; i<nHistos; i++) { for(int k=0; k<nCentBins; k++) { hJpsiPt[j][i][k] = (TH1F*)fEff[j]->Get(Form("hJpsiPt_%s_cent%s",trkEffType[i],cent_Title[k])); hJpsiPt[j][i][k]->SetName(Form("%s_file%d",hJpsiPt[j][i][k]->GetName(),j)); hJpsiPt[j][i][k]->Rebin(4); int index = i-1; if(i==0) index = 0; hJpsiPtEffs[j][i][k] = DivideTH1ForEff(hJpsiPt[j][i][k],hJpsiPt[j][index][k],Form("hJpsiPtEff_%s_cent%s_file%d",trkEffType[i],cent_Title[k],j)); } } } // various efficiency const int kcent = 0; for(int i=1; i<nHistos; i++) { hJpsiPtEffs[0][i][kcent]->Divide(hJpsiPtEffs[1][i][kcent]); list->Add(hJpsiPtEffs[0][i][kcent]); } TString legName2[5] = {"TPC tracking + p_{T,#mu} cut","MTD acceptance & response","Muon PID","MTD triggering","Trigger unit"}; c = drawHistos(list,"JpsiEff_AllEffs",Form("%s: efficiencies for J/#psi ;p_{T} (GeV/c);New/Old",run_type),true,0,15,true,0.8,1.2,false,kTRUE,legName2,true,Form("%s%%",cent_Name[kcent]),0.2,0.4,0.63,0.88,kTRUE,0.04,0.035); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_JpsiEff_AllTypes.pdf",run_type)); list->Clear(); } if(compRef) { TFile *fpp[2]; fpp[0] = TFile::Open(Form("Rootfiles/Paper.%s.Jpsi.root",run_type),"read"); fpp[1] = TFile::Open(Form("Rootfiles/Comb2.Paper.%s.Jpsi.root",run_type),"read"); TGraphAsymmErrors *hppJpsiVsPt[2]; TGraphAsymmErrors *hppJpsiVsCent[2]; double x, y, x1, y1; for(int j=0; j<2; j++) { hppJpsiVsPt[j] = (TGraphAsymmErrors*)fpp[j]->Get("hpp200JpsiVsPtFinalSys"); hppJpsiVsPt[j]->SetName(Form("%s_%d",hppJpsiVsPt[j]->GetName(),j)); hppJpsiVsPt[j]->SetMarkerStyle(21+j*4); hppJpsiVsPt[j]->SetMarkerColor(j+1); hppJpsiVsPt[j]->SetLineColor(j+1); offset_x(hppJpsiVsPt[j], 0.1*j); hppJpsiVsCent[j] = (TGraphAsymmErrors*)fpp[j]->Get("hpp200JpsiVsCentFinalSys"); hppJpsiVsCent[j]->SetName(Form("%s_%d",hppJpsiVsCent[j]->GetName(),j)); hppJpsiVsCent[j]->SetMarkerStyle(21+j*4); hppJpsiVsCent[j]->SetMarkerColor(j+1); hppJpsiVsCent[j]->SetLineColor(j+1); offset_x(hppJpsiVsCent[j], 0.1*j); } for(int j=0; j<2; j++) { for(int ipoint=0; ipoint<hppJpsiVsPt[j]->GetN(); ipoint++) { hppJpsiVsPt[1]->GetPoint(ipoint, x, y); hppJpsiVsPt[j]->GetPoint(ipoint, x1, y1); hppJpsiVsPt[j]->SetPoint(ipoint, x1, y1/y); hppJpsiVsPt[j]->SetPointError(ipoint, hppJpsiVsPt[j]->GetErrorXlow(ipoint), hppJpsiVsPt[j]->GetErrorXhigh(ipoint), hppJpsiVsPt[j]->GetErrorYlow(ipoint)/y, hppJpsiVsPt[j]->GetErrorYhigh(ipoint)/y); } for(int ipoint=0; ipoint<hppJpsiVsCent[j]->GetN(); ipoint++) { hppJpsiVsCent[1]->GetPoint(ipoint, x, y); hppJpsiVsCent[j]->GetPoint(ipoint, x1, y1); hppJpsiVsCent[j]->SetPoint(ipoint, x1, y1/y); hppJpsiVsCent[j]->SetPointError(ipoint, hppJpsiVsCent[j]->GetErrorXlow(ipoint), hppJpsiVsCent[j]->GetErrorXhigh(ipoint), hppJpsiVsCent[j]->GetErrorYlow(ipoint)/y, hppJpsiVsCent[j]->GetErrorYhigh(ipoint)/y); } } hppJpsiVsPt[1]->GetYaxis()->SetRangeUser(0.5,1.5); c = drawGraph(hppJpsiVsPt[1],"Ratio of pp reference;p_{T} [GeV/c];Ratio"); hppJpsiVsPt[0]->Draw("samesPEZ"); TLegend *leg = new TLegend(0.6,0.7,0.8,0.85); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextFont(62); leg->SetTextSize(0.035); leg->AddEntry(hppJpsiVsPt[0], "(STAR+PHENIX)/STAR", "P"); leg->AddEntry(hppJpsiVsPt[1], "STAR/STAR", "P"); leg->Draw(); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_ppRefVsPt.pdf",run_type)); hppJpsiVsCent[1]->GetXaxis()->SetRangeUser(-0.5,6.5); hppJpsiVsCent[1]->GetYaxis()->SetRangeUser(0.5,1.5); c = drawGraph(hppJpsiVsCent[1],"Ratio of pp reference;;Ratio"); hppJpsiVsCent[0]->Draw("samesPEZ"); leg->Draw(); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_ppRefVsCent.pdf",run_type)); } }
int DrawInvMassBkgMain(TTree* tree, int leptonId, double Pt_low , double Pt_upp ,int nptbins , TString select, TString effcut , double cut, TString option){ TString _path= "/Users/GLP/Dropbox/Physique/Master_Thesis/plots_root/ZBkgInvM/"; setTDRStyle(); //Some variables Long64_t n = tree->GetEntries(); int nbins = 200; double Dpt = (Pt_upp-Pt_low)/nptbins; ///////////////////////// //Name of the output file ///////////////////////// //particle string TString pname; if(abs(leptonId) == 11){pname = "e";} if(abs(leptonId) == 13){pname = "mu";} //selection string TString _sel; if(select == "tight"){_sel = "tight";} else if(select == "loose"){_sel = "loose";} else if(select == ""){_sel = "";} else{cout<<"ERROR: wrong selection !";return 1;} //cut string TString _effcut; if(effcut == "tight"){_effcut = "tight";} else if(effcut == ""){_effcut = "";} else if(effcut == "loose"){_effcut = "loose";} else if(effcut == "reliso3"){_effcut = Form("reliso3_%0.3lf",cut);} else if(effcut == "reliso4"){_effcut = Form("reliso4_%0.3lf",cut);} else if(effcut == "chiso3"){_effcut = Form("chiso3_%0.3lf",cut);} else if(effcut == "chiso4"){_effcut = Form("chiso4_%0.3lf",cut);} else if(effcut == "dxy"){_effcut = Form("dxy_%0.3lf",cut);} else if(effcut == "dz"){_effcut = Form("dz_%0.3lf",cut);} else{cout<<"ERROR: wrong numerator name !";return 1;} TString _fname = "InvM4"; if(option.Contains("matching")){_fname += "_Matched";} TString _ptrange; _ptrange = Form("Pt%0.f_Pt%0.f",Pt_low,Pt_upp); _fname += "_"+_ptrange; _fname += "_"+_effcut+"_for_"+_sel+"_"+pname; TFile* file_out = new TFile(_path+_fname+".root","recreate"); //Histograms //Barrel TH1D** histo_M_DYJets_bkg_loweta = new TH1D*[nptbins+1]; TH1D** histo_M_DYJets_loweta = new TH1D*[nptbins+1]; TH1D** histo_M_bkg_loweta = new TH1D*[nptbins+1]; TH1D** histo_M_WJets_loweta = new TH1D*[nptbins+1]; TH1D** histo_M_DYJets_bkg_fail_loweta = new TH1D*[nptbins+1]; TH1D** histo_M_DYJets_fail_loweta = new TH1D*[nptbins+1]; TH1D** histo_M_bkg_fail_loweta = new TH1D*[nptbins+1]; TH1D** histo_M_WJets_fail_loweta = new TH1D*[nptbins+1]; //Endcape TH1D** histo_M_DYJets_bkg_higheta = new TH1D*[nptbins+1]; TH1D** histo_M_DYJets_higheta = new TH1D*[nptbins+1]; TH1D** histo_M_bkg_higheta = new TH1D*[nptbins+1]; TH1D** histo_M_WJets_higheta = new TH1D*[nptbins+1]; TH1D** histo_M_DYJets_bkg_fail_higheta = new TH1D*[nptbins+1]; TH1D** histo_M_DYJets_fail_higheta = new TH1D*[nptbins+1]; TH1D** histo_M_bkg_fail_higheta = new TH1D*[nptbins+1]; TH1D** histo_M_WJets_fail_higheta = new TH1D*[nptbins+1]; for(int _i = 0; _i < nptbins+1; ++_i){ double Pt1; double Pt2; if(_i*Dpt+Pt_low < Pt_upp){Pt1 = _i*Dpt+Pt_low; Pt2 = (_i+1)*Dpt;} else if (_i*Dpt+Pt_low >= Pt_upp){Pt1 = _i*Dpt+Pt_low; Pt2 = 10000;} //Barrel histo_M_DYJets_bkg_loweta[_i] = new TH1D("histo_M_DYJets_bkg_loweta","M",nbins,0,250); histo_M_DYJets_loweta[_i] = new TH1D("histo_M_DYJets_loweta","M",nbins,0,250); histo_M_bkg_loweta[_i] = new TH1D("histo_M_bkg_loweta","M",nbins,0,250); histo_M_WJets_loweta[_i] = new TH1D("histo_M_WYJets_loweta","M",nbins,0,250); histo_M_DYJets_bkg_fail_loweta[_i] = new TH1D("histo_M_DYJets_bkg_fail_loweta","M",nbins,0,250); histo_M_DYJets_fail_loweta[_i] = new TH1D("histo_M_DYJets_fail_loweta","M",nbins,0,250); histo_M_bkg_fail_loweta[_i] = new TH1D("histo_M_bkg_fail_loweta","M",nbins,0,250); histo_M_WJets_fail_loweta[_i] = new TH1D("histo_M_WJets_fail_loweta","M",nbins,0,250); //Endcape histo_M_DYJets_bkg_higheta[_i] = new TH1D("histo_M_DYJets_bkg_higheta","M",nbins,0,250); histo_M_DYJets_higheta[_i] = new TH1D("histo_M_DYJets_higheta","M",nbins,0,250); histo_M_bkg_higheta[_i] = new TH1D("histo_M_bkg_higheta","M",nbins,0,250); histo_M_WJets_higheta[_i] = new TH1D("histo_M_WYJets_higheta","M",nbins,0,250); histo_M_DYJets_bkg_fail_higheta[_i] = new TH1D("histo_M_DYJets_bkg_fail_higheta","M",nbins,0,250); histo_M_DYJets_fail_higheta[_i] = new TH1D("histo_M_DYJets_fail_higheta","M",nbins,0,250); histo_M_bkg_fail_higheta[_i] = new TH1D("histo_M_bkg_fail_higheta","M",nbins,0,250); histo_M_WJets_fail_higheta[_i] = new TH1D("histo_M_WJets_fail_higheta","M",nbins,0,250); } //Event variables ////Generated Int_t evt_id; Float_t scale; //not loose Int_t On; Int_t Oid[200]; Float_t Opt[200]; Float_t Om[200]; Float_t Oeta[200]; Float_t Ophi[200]; Int_t Oq[200]; Int_t Otight[200]; Int_t Oloose[200]; Float_t Oiso3[200]; Float_t Oiso4[200]; Float_t Ochiso3[200]; Float_t Ochiso4[200]; Float_t Odxy[200]; Float_t Odz[200]; //loose Int_t Gn; Int_t matched[200]; Int_t Gid[200]; Float_t Gpt[200]; Float_t Gm[200]; Float_t Geta[200]; Float_t Gphi[200]; Int_t Gq[200]; Int_t Gtight[200]; Int_t Gloose[200]; Float_t Giso3[200]; Float_t Giso4[200]; Float_t Gchiso3[200]; Float_t Gchiso4[200]; Float_t Gdxy[200]; Float_t Gdz[200]; //Assigne branches tree->SetBranchAddress("evt_scale1fb", &scale); tree->SetBranchAddress("evt_id", &evt_id); //not loose tree->SetBranchAddress("nLepOther",&On); tree->SetBranchAddress("LepOther_pdgId",&Oid); tree->SetBranchAddress("LepOther_pt",&Opt); tree->SetBranchAddress("LepOther_mass",&Om); tree->SetBranchAddress("LepOther_eta",&Oeta); tree->SetBranchAddress("LepOther_phi",&Ophi); tree->SetBranchAddress("LepOther_charge",&Oq); tree->SetBranchAddress("LepOther_tightId",&Otight); tree->SetBranchAddress("LepOther_looseIdSusy",Oloose); tree->SetBranchAddress("LepOther_relIso03",&Oiso3); tree->SetBranchAddress("LepOther_relIso04",&Oiso4); tree->SetBranchAddress("LepOther_chargedHadRelIso03",&Ochiso3); tree->SetBranchAddress("LepOther_chargedHadRelIso04",&Ochiso4); tree->SetBranchAddress("LepOther_dxy",&Odxy); tree->SetBranchAddress("LepOther_dz",&Odz); //Loose tree->SetBranchAddress("nLepGood",&Gn); tree->SetBranchAddress("LepGood_matched",&matched); tree->SetBranchAddress("LepGood_pdgId",&Gid); tree->SetBranchAddress("LepGood_pt",&Gpt); tree->SetBranchAddress("LepGood_mass",&Gm); tree->SetBranchAddress("LepGood_eta",&Geta); tree->SetBranchAddress("LepGood_phi",&Gphi); tree->SetBranchAddress("LepGood_charge",&Gq); tree->SetBranchAddress("LepGood_tightId",&Gtight); tree->SetBranchAddress("LepGood_looseIdSusy",&Gloose); tree->SetBranchAddress("LepGood_relIso03",&Giso3); tree->SetBranchAddress("LepGood_relIso04",&Giso4); tree->SetBranchAddress("LepGood_chargedHadRelIso03",&Gchiso3); tree->SetBranchAddress("LepGood_chargedHadRelIso04",&Gchiso4); tree->SetBranchAddress("LepGood_dxy",&Gdxy); tree->SetBranchAddress("LepGood_dz",&Gdz); //Start loop over all events for (int k = 0; k < n; ++k) { //Definitions to use T&P int tag[2]; int prob[2]; tag[0] = 9999; tag[1] = 9999; prob[0] = 9999; prob[1] = 9999; tree->GetEntry(k); //looseId leptons if(select != "loose"){ for (int i = 0; i < On; ++i) { //define selections using bools bool reliso3((effcut != "reliso3")||((effcut == "reliso3")&&(Oiso3[i] < cut ))); bool reliso4((effcut != "reliso4")||((effcut == "reliso4")&&(Oiso4[i] < cut ))); bool chiso3((effcut != "chiso3")||((effcut == "chiso3")&&(Ochiso3[i] < cut ))); bool chiso4((effcut != "chiso4")||((effcut == "chiso4")&&(Ochiso4[i] < cut ))); bool dxy((effcut != "dxy")||((effcut == "dxy")&&(abs(Odxy[i])< cut ))); bool dz((effcut != "dz")||((effcut == "dz")&&(abs(Odz[i])< cut ))); bool tight((effcut != "tight")||((effcut == "tight")&&(Otight[i] == 1))); //Store the values from both the loose and tight in the same variable //Prob selection cut if(abs(Oid[i]) == leptonId){ if((select != "tight")||((select == "tight")&&(Otight[i] == 1))){ if((!option.Contains("matching"))||((option.Contains("matching"))&&(matched[i] == 1))){ //Prob1 if(prob[0] == 9999){prob[0] = i;} //Prob2 if((prob[0] != 9999)&&(prob[0] != i)&&(prob[1] == 9999)){prob[1] = i;} //Selection cut for Tag only if(reliso3 && reliso4 && chiso3 && chiso4 && dxy && dz && tight){ if(prob[0] == i){tag[0] = i; } if(prob[1] == i){tag[1] = i; } } } } } } //loop over all the rec particles to find the isolation //We requiere one tag at least while((tag[0] != 9999)||(tag[1] != 9999)){ int l1; int l2; if(tag[0] != 9999){l1 = prob[1]; l2 = tag[0]; tag[0] = 9999;} else if(tag[1] != 9999){l1 = prob[0]; l2 = tag[1]; tag[1] = 9999;} double M = InvMass(Opt[l1],Oeta[l1],Ophi[l1],Om[l1],Opt[l2],Oeta[l2],Ophi[l2],Om[l2]); if(l1 != 9999){ for(int ii = 0; ii < nptbins+1; ++ii){ //Add all the signal to the Z double Pt1 = 0; double Pt2 = 0; if(ii*Dpt+Pt_low < Pt_upp){Pt1 = ii*Dpt+Pt_low; Pt2 = (ii+1)*Dpt+Pt_low;} else if (ii*Dpt+Pt_low >= Pt_upp){Pt1 = ii*Dpt+Pt_low; Pt2 = 10000;} if((Opt[l1] > Pt1)&&(Opt[l1]< Pt2)){ bool reliso3((effcut != "reliso3")||((effcut == "reliso3")&&(Oiso3[l1] < cut ))); bool reliso4((effcut != "reliso4")||((effcut == "reliso4")&&(Oiso4[l1] < cut ))); bool chiso3((effcut != "chiso3")||((effcut == "chiso3")&&(Ochiso3[l1] < cut ))); bool chiso4((effcut != "chiso4")||((effcut == "chiso4")&&(Ochiso4[l1] < cut ))); bool dxy((effcut != "dxy")||((effcut == "dxy")&&(abs(Odxy[l1])< cut ))); bool dz((effcut != "dz")||((effcut == "dz")&&(abs(Odz[l1])< cut ))); bool tight((effcut != "tight")||((effcut == "tight")&&(Otight[l1] == 1))); //Efficiency cut if(reliso3 && reliso4 && chiso3 && chiso4 && dxy && dz && tight){ if(abs(Oeta[l1]) < 1.2){histo_M_DYJets_bkg_loweta[ii]->Fill(M,scale);} if(abs(Oeta[l1]) >= 1.2){histo_M_DYJets_bkg_higheta[ii]->Fill(M,scale);} if ((evt_id == 500)||(evt_id == 502)||(evt_id == 503)||(evt_id == 504)||(evt_id == 505)||(evt_id == 300)){ if(abs(Oeta[l1]) < 1.2){histo_M_bkg_loweta[ii]->Fill(M,scale);} if(abs(Oeta[l1]) >= 1.2){histo_M_bkg_higheta[ii]->Fill(M,scale);} //Just the Wjets bkg if ((evt_id == 500)||(evt_id == 502)||(evt_id == 503)||(evt_id == 504)||(evt_id == 505)){ if(abs(Oeta[l1]) < 1.2){histo_M_WJets_loweta[ii]->Fill(M,scale);} if(abs(Oeta[l1]) >= 1.2){histo_M_WJets_higheta[ii]->Fill(M,scale);} } }else if((evt_id == 702)||(evt_id == 703)||(evt_id == 704)||(evt_id == 705)||(evt_id == 701)){ if(abs(Oeta[l1]) < 1.2){histo_M_DYJets_loweta[ii]->Fill(M,scale);} if(abs(Oeta[l1]) >= 1.2){histo_M_DYJets_higheta[ii]->Fill(M,scale);} } } reliso3 = ((effcut != "reliso3")||((effcut == "reliso3")&&(Oiso3[l1] >= cut ))); reliso4 = ((effcut != "reliso4")||((effcut == "reliso4")&&(Oiso4[l1] >= cut ))); chiso3 = ((effcut != "chiso3")||((effcut == "chiso3")&&(Ochiso3[l1] >= cut ))); chiso4 = ((effcut != "chiso4")||((effcut == "chiso4")&&(Ochiso4[l1] >= cut ))); dxy = ((effcut != "dxy")||((effcut == "dxy")&&(abs(Odxy[l1]) >= cut ))); dz = ((effcut != "dz")||((effcut == "dz")&&(abs(Odz[l1]) >= cut ))); tight = ((effcut != "tight")||((effcut == "tight")&&(Otight[l1] != 1))); if(reliso3 && reliso4 && chiso3 && chiso4 && dxy && dz && tight){ if(abs(Oeta[l1]) < 1.2)histo_M_DYJets_bkg_fail_loweta[ii]->Fill(M,scale); if(abs(Oeta[l1]) >= 1.2)histo_M_DYJets_bkg_fail_higheta[ii]->Fill(M,scale); if ((evt_id == 500)||(evt_id == 502)||(evt_id == 503)||(evt_id == 504)||(evt_id == 505)||(evt_id == 300)){ if(abs(Oeta[l1]) < 1.2)histo_M_bkg_fail_loweta[ii]->Fill(M,scale); if(abs(Oeta[l1]) >= 1.2)histo_M_bkg_fail_higheta[ii]->Fill(M,scale); if ((evt_id == 500)||(evt_id == 502)||(evt_id == 503)||(evt_id == 504)||(evt_id == 505)){ if(abs(Oeta[l1]) < 1.2)histo_M_WJets_fail_loweta[ii]->Fill(M,scale); if(abs(Oeta[l1]) >= 1.2)histo_M_WJets_fail_higheta[ii]->Fill(M,scale); } }else if((evt_id == 702)||(evt_id == 703)||(evt_id == 704)||(evt_id == 705)||(evt_id == 701)){ if(abs(Oeta[l1]) < 1.2)histo_M_DYJets_fail_loweta[ii]->Fill(M,scale); if(abs(Oeta[l1]) >= 1.2)histo_M_DYJets_fail_higheta[ii]->Fill(M,scale); } } } } } } } //Tightid leptons for (int i = 0; i < Gn; ++i) { //define selections using bools bool reliso3((effcut != "reliso3")||((effcut == "reliso3")&&(Giso3[i] < cut ))); bool reliso4((effcut != "reliso4")||((effcut == "reliso4")&&(Giso4[i] < cut ))); bool chiso3((effcut != "chiso3")||((effcut == "chiso3")&&(Gchiso3[i] < cut ))); bool chiso4((effcut != "chiso4")||((effcut == "chiso4")&&(Gchiso4[i] < cut ))); bool dxy((effcut != "dxy")||((effcut == "dxy")&&(abs(Gdxy[i])< cut ))); bool dz((effcut != "dz")||((effcut == "dz")&&(abs(Gdz[i])< cut ))); bool tight((effcut != "tight")||((effcut == "tight")&&(Gtight[i] == 1))); //Store the values from both the loose and tight in the same variable //Prob selection cut if(abs(Gid[i]) == leptonId){ if((select != "tight")||((select == "tight")&&(Gtight[i] == 1))){ if((!option.Contains("matching"))||((option.Contains("matching"))&&(matched[i] == 1))){ //Prob1 if(prob[0] == 9999){prob[0] = i;} //Prob2 if((prob[0] != 9999)&&(prob[0] != i)&&(prob[1] == 9999)){prob[1] = i;} //Selection cut for Tag only if(reliso3 && reliso4 && chiso3 && chiso4 && dxy && dz && tight){ if(prob[0] == i){tag[0] = i; } if(prob[1] == i){tag[1] = i; } } } } } } //loop over all the rec particles to find the isolation //We requiere one tag at least while((tag[0] != 9999)||(tag[1] != 9999)){ int l1; int l2; if(tag[0] != 9999){l1 = prob[1]; l2 = tag[0]; tag[0] = 9999;} else if(tag[1] != 9999){l1 = prob[0]; l2 = tag[1]; tag[1] = 9999;} double M = InvMass(Gpt[l1],Geta[l1],Gphi[l1],Gm[l1],Gpt[l2],Geta[l2],Gphi[l2],Gm[l2]); if(l1 != 9999){ for(int ii = 0; ii < nptbins+1; ++ii){ //Add all the signal to the Z double Pt1 = 0; double Pt2 = 0; if(ii*Dpt+Pt_low < Pt_upp){Pt1 = ii*Dpt+Pt_low; Pt2 = (ii+1)*Dpt+Pt_low;} else if (ii*Dpt+Pt_low >= Pt_upp){Pt1 = ii*Dpt+Pt_low; Pt2 = 10000;} if((Gpt[l1] > Pt1)&&(Gpt[l1]< Pt2)){ bool reliso3((effcut != "reliso3")||((effcut == "reliso3")&&(Giso3[l1] < cut ))); bool reliso4((effcut != "reliso4")||((effcut == "reliso4")&&(Giso4[l1] < cut ))); bool chiso3((effcut != "chiso3")||((effcut == "chiso3")&&(Gchiso3[l1] < cut ))); bool chiso4((effcut != "chiso4")||((effcut == "chiso4")&&(Gchiso4[l1] < cut ))); bool dxy((effcut != "dxy")||((effcut == "dxy")&&(abs(Gdxy[l1])< cut ))); bool dz((effcut != "dz")||((effcut == "dz")&&(abs(Gdz[l1])< cut ))); bool tight((effcut != "tight")||((effcut == "tight")&&(Gtight[l1] == 1))); //Efficiency cut if(reliso3 && reliso4 && chiso3 && chiso4 && dxy && dz && tight){ if(abs(Geta[l1]) < 1.2){histo_M_DYJets_bkg_loweta[ii]->Fill(M,scale);} if(abs(Geta[l1]) >= 1.2){histo_M_DYJets_bkg_higheta[ii]->Fill(M,scale);} if ((evt_id == 500)||(evt_id == 502)||(evt_id == 503)||(evt_id == 504)||(evt_id == 505)||(evt_id == 300)){ if(abs(Geta[l1]) < 1.2){histo_M_bkg_loweta[ii]->Fill(M,scale);} if(abs(Geta[l1]) >= 1.2){histo_M_bkg_higheta[ii]->Fill(M,scale);} //Just the Wjets bkg if ((evt_id == 500)||(evt_id == 502)||(evt_id == 503)||(evt_id == 504)||(evt_id == 505)){ if(abs(Geta[l1]) < 1.2){histo_M_WJets_loweta[ii]->Fill(M,scale);} if(abs(Geta[l1]) >= 1.2){histo_M_WJets_higheta[ii]->Fill(M,scale);} } }else if((evt_id == 702)||(evt_id == 703)||(evt_id == 704)||(evt_id == 705)||(evt_id == 701)){ if(abs(Geta[l1]) < 1.2){histo_M_DYJets_loweta[ii]->Fill(M,scale);} if(abs(Geta[l1]) >= 1.2){histo_M_DYJets_higheta[ii]->Fill(M,scale);} } } reliso3 = ((effcut != "reliso3")||((effcut == "reliso3")&&(Giso3[l1] >= cut ))); reliso4 = ((effcut != "reliso4")||((effcut == "reliso4")&&(Giso4[l1] >= cut ))); chiso3 = ((effcut != "chiso3")||((effcut == "chiso3")&&(Gchiso3[l1] >= cut ))); chiso4 = ((effcut != "chiso4")||((effcut == "chiso4")&&(Gchiso4[l1] >= cut ))); dxy = ((effcut != "dxy")||((effcut == "dxy")&&(abs(Gdxy[l1]) >= cut ))); dz = ((effcut != "dz")||((effcut == "dz")&&(abs(Gdz[l1]) >= cut ))); tight = ((effcut != "tight")||((effcut == "tight")&&(Gtight[l1] != 1))); if(reliso3 && reliso4 && chiso3 && chiso4 && dxy && dz && tight){ if(abs(Geta[l1]) < 1.2)histo_M_DYJets_bkg_fail_loweta[ii]->Fill(M,scale); if(abs(Geta[l1]) >= 1.2)histo_M_DYJets_bkg_fail_higheta[ii]->Fill(M,scale); if ((evt_id == 500)||(evt_id == 502)||(evt_id == 503)||(evt_id == 504)||(evt_id == 505)||(evt_id == 300)){ if(abs(Geta[l1]) < 1.2)histo_M_bkg_fail_loweta[ii]->Fill(M,scale); if(abs(Geta[l1]) >= 1.2)histo_M_bkg_fail_higheta[ii]->Fill(M,scale); if ((evt_id == 500)||(evt_id == 502)||(evt_id == 503)||(evt_id == 504)||(evt_id == 505)){ if(abs(Geta[l1]) < 1.2)histo_M_WJets_fail_loweta[ii]->Fill(M,scale); if(abs(Geta[l1]) >= 1.2)histo_M_WJets_fail_higheta[ii]->Fill(M,scale); } }else if((evt_id == 702)||(evt_id == 703)||(evt_id == 704)||(evt_id == 705)||(evt_id == 701)){ if(abs(Geta[l1]) < 1.2)histo_M_DYJets_fail_loweta[ii]->Fill(M,scale); if(abs(Geta[l1]) >= 1.2)histo_M_DYJets_fail_higheta[ii]->Fill(M,scale); } } } } } } } for(int i = 0; i < nptbins+1; ++i){ //Plot the canvas double Pt1; double Pt2; if(i*Dpt+Pt_low < Pt_upp){Pt1 = i*Dpt+Pt_low; Pt2 = (i+1)*Dpt+Pt_low;} else if (i*Dpt+Pt_low >= Pt_upp){Pt1 = i*Dpt+Pt_low; Pt2 = 10000;} TCanvas* c1 = new TCanvas("c1","c1"); c1->Divide(1,2); TCanvas* c2 = new TCanvas("c2","c2"); c2->Divide(1,2); TCanvas* c3 = new TCanvas("c3","c3"); c3->Divide(1,2); TCanvas* c4 = new TCanvas("c4","c4"); c4->Divide(1,2); //Zbkg pass eta<1.2 c1->cd(1); histo_M_DYJets_bkg_loweta[i]->Draw(); TString _title; _title = Form(", %0.f #leq P_{t} #leq %0.f",Pt1,Pt2); if(Pt2==10000)_title = Form(", %0.f #leq P_{t}",Pt1); TString _stitle = (TString)"Invariant mass for "+pname+_title+", #||{#eta}<1.2, "+effcut+" pass"; TString _stitlefail = (TString)"Invariant mass for "+pname+_title+", #||{#eta}<1.2, "+effcut+" fail"; TString _stitle2 = (TString)"Invariant mass for "+pname+_title+", #||{#eta}>1.2, "+effcut+" pass"; TString _stitle2fail = (TString)"Invariant mass for "+pname+_title+", #||{#eta}>1.2, "+effcut+" fail"; histo_M_DYJets_bkg_loweta[i]->SetTitle(_stitle); histo_M_DYJets_bkg_loweta[i]->GetXaxis()->SetTitle("m [GeV]"); histo_M_DYJets_bkg_loweta[i]->SetLineWidth(2); histo_M_DYJets_bkg_loweta[i]->SetLineColor(4); histo_M_DYJets_bkg_loweta[i]->SetMarkerColor(4); histo_M_bkg_loweta[i]->Draw("same"); histo_M_bkg_loweta[i]->SetLineWidth(2); histo_M_bkg_loweta[i]->SetMarkerColor(2); histo_M_bkg_loweta[i]->SetLineColor(2); histo_M_WJets_loweta[i]->Draw("same"); histo_M_WJets_loweta[i]->SetLineWidth(3); histo_M_WJets_loweta[i]->SetLineColor(3); histo_M_WJets_loweta[i]->SetMarkerColor(3); TLegend* leg = new TLegend(0.6, 0.7,0.89,0.89); leg->AddEntry(histo_M_DYJets_bkg_loweta[i], "Z + bkg"); leg->SetTextFont(43); leg->SetTextSize(25); leg->AddEntry(histo_M_bkg_loweta[i], "TTJets + WJets"); leg->AddEntry(histo_M_WJets_loweta[i], "WJets"); leg->SetBorderSize(0); leg->Draw(); //Zbkg fail eta<1.2 c1->cd(2); histo_M_DYJets_bkg_fail_loweta[i]->Draw(); histo_M_DYJets_bkg_fail_loweta[i]->SetTitle(_stitlefail); histo_M_DYJets_bkg_fail_loweta[i]->GetXaxis()->SetTitle("m [GeV]"); histo_M_DYJets_bkg_fail_loweta[i]->SetLineWidth(2); histo_M_DYJets_bkg_fail_loweta[i]->SetLineColor(4); histo_M_DYJets_bkg_fail_loweta[i]->SetMarkerColor(4); histo_M_bkg_fail_loweta[i]->Draw("same"); histo_M_bkg_fail_loweta[i]->SetLineWidth(2); histo_M_bkg_fail_loweta[i]->SetMarkerColor(2); histo_M_bkg_fail_loweta[i]->SetLineColor(2); histo_M_WJets_fail_loweta[i]->Draw("same"); histo_M_WJets_fail_loweta[i]->SetLineWidth(3); histo_M_WJets_fail_loweta[i]->SetLineColor(3); histo_M_WJets_fail_loweta[i]->SetMarkerColor(3); //Z pass eta<1.2 c2->cd(1); histo_M_DYJets_loweta[i]->Draw(); histo_M_DYJets_loweta[i]->SetTitle(_stitle); histo_M_DYJets_loweta[i]->GetXaxis()->SetTitle("m [GeV]"); histo_M_DYJets_loweta[i]->SetLineWidth(2); histo_M_DYJets_loweta[i]->SetLineColor(4); histo_M_DYJets_loweta[i]->SetMarkerColor(4); histo_M_bkg_loweta[i]->Draw("same"); histo_M_bkg_loweta[i]->SetLineWidth(2); histo_M_bkg_loweta[i]->SetMarkerColor(2); histo_M_bkg_loweta[i]->SetLineColor(2); TLegend* leg2 = new TLegend(0.6, 0.7,0.89,0.89); leg2->SetTextFont(43); leg2->SetTextSize(25); leg2->AddEntry(histo_M_DYJets_loweta[i], "Z"); leg2->AddEntry(histo_M_bkg_loweta[i], "TTJets + WJets"); leg2->SetBorderSize(0); leg2->Draw(); //Z fail eta<1.2 c2->cd(2); histo_M_DYJets_fail_loweta[i]->Draw(); histo_M_DYJets_fail_loweta[i]->SetTitle(_stitlefail); histo_M_DYJets_fail_loweta[i]->GetXaxis()->SetTitle("m [GeV]"); histo_M_DYJets_fail_loweta[i]->SetLineWidth(2); histo_M_DYJets_fail_loweta[i]->SetLineColor(4); histo_M_DYJets_fail_loweta[i]->SetMarkerColor(4); histo_M_bkg_fail_loweta[i]->Draw("same"); histo_M_bkg_fail_loweta[i]->SetLineWidth(2); histo_M_bkg_fail_loweta[i]->SetMarkerColor(2); histo_M_bkg_fail_loweta[i]->SetLineColor(2); //Zbkg pass eta>1.2 c3->cd(1); histo_M_DYJets_bkg_higheta[i]->Draw(); histo_M_DYJets_bkg_higheta[i]->SetTitle(_stitle2); histo_M_DYJets_bkg_higheta[i]->GetXaxis()->SetTitle("m [GeV]"); histo_M_DYJets_bkg_higheta[i]->SetLineWidth(2); histo_M_DYJets_bkg_higheta[i]->SetLineColor(4); histo_M_DYJets_bkg_higheta[i]->SetMarkerColor(4); histo_M_bkg_higheta[i]->Draw("same"); histo_M_bkg_higheta[i]->SetLineWidth(2); histo_M_bkg_higheta[i]->SetMarkerColor(2); histo_M_bkg_higheta[i]->SetLineColor(2); histo_M_WJets_higheta[i]->Draw("same"); histo_M_WJets_higheta[i]->SetLineWidth(3); histo_M_WJets_higheta[i]->SetLineColor(3); histo_M_WJets_higheta[i]->SetMarkerColor(3); leg->Draw(); //Zbkg fail eta>1.2 c3->cd(2); histo_M_DYJets_bkg_fail_higheta[i]->Draw(); histo_M_DYJets_bkg_fail_higheta[i]->SetTitle(_stitle2fail); histo_M_DYJets_bkg_fail_higheta[i]->SetLineWidth(2); histo_M_DYJets_bkg_fail_higheta[i]->SetLineColor(4); histo_M_DYJets_bkg_fail_higheta[i]->SetMarkerColor(4); histo_M_bkg_fail_higheta[i]->Draw("same"); histo_M_bkg_fail_higheta[i]->SetLineWidth(2); histo_M_bkg_fail_higheta[i]->SetMarkerColor(2); histo_M_bkg_fail_higheta[i]->SetLineColor(2); histo_M_WJets_fail_higheta[i]->Draw("same"); histo_M_WJets_fail_higheta[i]->SetLineWidth(3); histo_M_WJets_fail_higheta[i]->SetLineColor(3); histo_M_WJets_fail_higheta[i]->SetMarkerColor(3); //Z pass eta >1.2 TCanvas* c7 = new TCanvas("c7","c7"); c4->cd(1); histo_M_DYJets_higheta[i]->Draw(); histo_M_DYJets_higheta[i]->SetTitle(_stitle2); histo_M_DYJets_higheta[i]->SetLineWidth(2); histo_M_DYJets_higheta[i]->SetLineColor(4); histo_M_DYJets_higheta[i]->SetMarkerColor(4); histo_M_bkg_higheta[i]->Draw("same"); histo_M_bkg_higheta[i]->SetLineWidth(2); histo_M_bkg_higheta[i]->SetMarkerColor(2); histo_M_bkg_higheta[i]->SetLineColor(2); leg2->Draw(); //Z fail eta >1.2 c4->cd(2); histo_M_DYJets_fail_higheta[i]->Draw(); histo_M_DYJets_fail_higheta[i]->SetTitle(_stitle2fail); histo_M_DYJets_fail_higheta[i]->SetLineWidth(2); histo_M_DYJets_fail_higheta[i]->SetLineColor(4); histo_M_DYJets_fail_higheta[i]->SetMarkerColor(4); histo_M_bkg_fail_higheta[i]->Draw("same"); histo_M_bkg_fail_higheta[i]->SetLineWidth(2); histo_M_bkg_fail_higheta[i]->SetMarkerColor(2); histo_M_bkg_fail_higheta[i]->SetLineColor(2); c1->Write(Form("Zbkg_Pt%0.f_Pt%0.f_eta<1.2",Pt1,Pt2)); c2->Write(Form("Z_Pt%0.f_Pt%0.f_eta<1.2",Pt1,Pt2)); c3->Write(Form("Zbkg_Pt%0.f_Pt%0.f_eta>1.2",Pt1,Pt2)); c4->Write(Form("Z_Pt%0.f_Pt%0.f_eta>1.2",Pt1,Pt2)); mkdir(_path+_fname+"_PDF/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); TString _cname = Form(_path+_fname+"_PDF/InvM4_Pt%0.f_Pt%0.f",Pt1,Pt2); _cname += "_"+_effcut+"_"+pname; TString _c1name = _cname+ "_Zbkg_bkg_eta<1.2.pdf"; TString _c2name = _cname+ "_Z_bkg_eta<1.2.pdf"; TString _c3name = _cname+ "_Zbkg_bkg_eta>1.2.pdf"; TString _c4name = _cname+ "_Z_bkg_eta>1.2.pdf"; c1->SaveAs(_c1name); c2->SaveAs(_c2name); c3->SaveAs(_c3name); c4->SaveAs(_c4name); histo_M_DYJets_bkg_loweta[i]->Write(Form("histo_M_DYJets_bkg_loweta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_DYJets_loweta[i]->Write(Form("histo_M_DYJets_loweta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_bkg_loweta[i]->Write(Form("histo_M_bkg_loweta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_WJets_loweta[i]->Write(Form("histo_M_WJets_loweta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_DYJets_bkg_fail_loweta[i]->Write(Form("histo_M_DYJets_bkg_fail_loweta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_DYJets_fail_loweta[i]->Write(Form("histo_M_DYJets_fail_loweta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_bkg_fail_loweta[i]->Write(Form("histo_M_bkg_fail_loweta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_WJets_fail_loweta[i]->Write(Form("histo_M_WJets_fail_loweta_Pt%0.f_Pt%0.f",Pt1,Pt2)); //Endcape histo_M_DYJets_bkg_higheta[i]->Write(Form("histo_M_DYJets_bkg_higheta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_DYJets_higheta[i]->Write(Form("histo_M_DYJets_higheta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_bkg_higheta[i]->Write(Form("histo_M_bkg_higheta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_WJets_higheta[i]->Write(Form("histo_M_WJets_higheta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_DYJets_bkg_fail_higheta[i]->Write(Form("histo_M_DYJets_bkg_fail_higheta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_DYJets_fail_higheta[i]->Write(Form("histo_M_DYJets_fail_higheta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_bkg_fail_higheta[i]->Write(Form("histo_M_bkg_fail_higheta_Pt%0.f_Pt%0.f",Pt1,Pt2)); histo_M_WJets_fail_higheta[i]->Write(Form("histo_M_WJets_fail_higheta_Pt%0.f_Pt%0.f",Pt1,Pt2)); } file_out->Close(); return 0; }
void JER_FCCee_vs_CLIC_conformal_Zuds100_myCLIC() { //=========Macro generated from canvas: c1/A Simple Graph Example //========= (Thu May 17 12:00:25 2018) by ROOT version6.08/00 TCanvas *c1 = new TCanvas("c1", "A Simple Graph Example",2,51,800,700); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); c1->SetHighLightColor(2); c1->Range(-0.2266667,1.283784,1.106667,8.040541); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetTickx(1); c1->SetTicky(1); c1->SetPhi(150); c1->SetLeftMargin(0.17); c1->SetRightMargin(0.08); c1->SetTopMargin(0.08); c1->SetBottomMargin(0.18); c1->SetFrameLineWidth(2); c1->SetFrameBorderMode(0); c1->SetFrameLineWidth(2); c1->SetFrameBorderMode(0); Double_t xAxis11[14] = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.925, 0.95, 0.975, 1}; TH1F *ResVsCosTheta__11 = new TH1F("ResVsCosTheta__11","RMS_{90}(E_{j}) / Mean_{90}(E_{j}) vs |cos(#theta)|",13, xAxis11); ResVsCosTheta__11->SetBinContent(1,4.720301); ResVsCosTheta__11->SetBinContent(2,4.735073); ResVsCosTheta__11->SetBinContent(3,4.429979); ResVsCosTheta__11->SetBinContent(4,4.161036); ResVsCosTheta__11->SetBinContent(5,4.56193); ResVsCosTheta__11->SetBinContent(6,4.619762); ResVsCosTheta__11->SetBinContent(7,4.61053); ResVsCosTheta__11->SetBinContent(8,4.636955); ResVsCosTheta__11->SetBinContent(9,4.862062); ResVsCosTheta__11->SetBinContent(10,4.842597); ResVsCosTheta__11->SetBinContent(11,6.005219); ResVsCosTheta__11->SetBinContent(12,8.532589); ResVsCosTheta__11->SetBinContent(13,20.53576); ResVsCosTheta__11->SetBinError(1,0.1808823); ResVsCosTheta__11->SetBinError(2,0.1746558); ResVsCosTheta__11->SetBinError(3,0.1531225); ResVsCosTheta__11->SetBinError(4,0.1448687); ResVsCosTheta__11->SetBinError(5,0.1546639); ResVsCosTheta__11->SetBinError(6,0.1508406); ResVsCosTheta__11->SetBinError(7,0.1406199); ResVsCosTheta__11->SetBinError(8,0.1358532); ResVsCosTheta__11->SetBinError(9,0.1328214); ResVsCosTheta__11->SetBinError(10,0.2715593); ResVsCosTheta__11->SetBinError(11,0.3160641); ResVsCosTheta__11->SetBinError(12,0.438869); ResVsCosTheta__11->SetBinError(13,1.057646); ResVsCosTheta__11->SetMinimum(2.5); ResVsCosTheta__11->SetMaximum(7.5); ResVsCosTheta__11->SetEntries(13); ResVsCosTheta__11->SetStats(0); ResVsCosTheta__11->SetLineWidth(2); ResVsCosTheta__11->SetMarkerStyle(24); ResVsCosTheta__11->SetMarkerSize(1.2); ResVsCosTheta__11->GetXaxis()->SetTitle("|cos(#theta)|"); ResVsCosTheta__11->GetXaxis()->SetNdivisions(506); ResVsCosTheta__11->GetXaxis()->SetLabelFont(42); ResVsCosTheta__11->GetXaxis()->SetLabelOffset(0.015); ResVsCosTheta__11->GetXaxis()->SetLabelSize(0.06); ResVsCosTheta__11->GetXaxis()->SetTitleSize(0.07); ResVsCosTheta__11->GetXaxis()->SetTitleFont(42); ResVsCosTheta__11->GetYaxis()->SetTitle("RMS_{90}(E_{j}) / Mean_{90}(E_{j}) [%]"); ResVsCosTheta__11->GetYaxis()->SetNdivisions(506); ResVsCosTheta__11->GetYaxis()->SetLabelFont(42); ResVsCosTheta__11->GetYaxis()->SetLabelOffset(0.015); ResVsCosTheta__11->GetYaxis()->SetLabelSize(0.06); ResVsCosTheta__11->GetYaxis()->SetTitleSize(0.07); ResVsCosTheta__11->GetYaxis()->SetTitleOffset(0.95); ResVsCosTheta__11->GetYaxis()->SetTitleFont(42); ResVsCosTheta__11->GetZaxis()->SetLabelFont(42); ResVsCosTheta__11->GetZaxis()->SetLabelOffset(0.015); ResVsCosTheta__11->GetZaxis()->SetLabelSize(0.06); ResVsCosTheta__11->GetZaxis()->SetTitleSize(0.07); ResVsCosTheta__11->GetZaxis()->SetTitleOffset(1.2); ResVsCosTheta__11->GetZaxis()->SetTitleFont(42); ResVsCosTheta__11->Draw(""); Double_t xAxis12[14] = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.925, 0.95, 0.975, 1}; TH1F *ResVsCosTheta__12 = new TH1F("ResVsCosTheta__12","RMS_{90}(E_{j}) / Mean_{90}(E_{j}) vs |cos(#theta)|",13, xAxis12); ResVsCosTheta__12->SetBinContent(1,4.40504); ResVsCosTheta__12->SetBinContent(2,4.35462); ResVsCosTheta__12->SetBinContent(3,4.454359); ResVsCosTheta__12->SetBinContent(4,4.18309); ResVsCosTheta__12->SetBinContent(5,4.366775); ResVsCosTheta__12->SetBinContent(6,4.006863); ResVsCosTheta__12->SetBinContent(7,4.36426); ResVsCosTheta__12->SetBinContent(8,4.475314); ResVsCosTheta__12->SetBinContent(9,4.870826); ResVsCosTheta__12->SetBinContent(10,5.268826); ResVsCosTheta__12->SetBinContent(11,6.97412); ResVsCosTheta__12->SetBinContent(12,10.08); ResVsCosTheta__12->SetBinContent(13,21.51662); ResVsCosTheta__12->SetBinError(1,0.1701815); ResVsCosTheta__12->SetBinError(2,0.1620622); ResVsCosTheta__12->SetBinError(3,0.154987); ResVsCosTheta__12->SetBinError(4,0.1468882); ResVsCosTheta__12->SetBinError(5,0.1491662); ResVsCosTheta__12->SetBinError(6,0.1323183); ResVsCosTheta__12->SetBinError(7,0.1341105); ResVsCosTheta__12->SetBinError(8,0.1320847); ResVsCosTheta__12->SetBinError(9,0.1342177); ResVsCosTheta__12->SetBinError(10,0.2959268); ResVsCosTheta__12->SetBinError(11,0.3691096); ResVsCosTheta__12->SetBinError(12,0.5212247); ResVsCosTheta__12->SetBinError(13,1.109635); ResVsCosTheta__12->SetMinimum(0); ResVsCosTheta__12->SetMaximum(10); ResVsCosTheta__12->SetEntries(13); ResVsCosTheta__12->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#ff6666"); ResVsCosTheta__12->SetLineColor(ci); ResVsCosTheta__12->SetLineWidth(2); ci = TColor::GetColor("#ff6666"); ResVsCosTheta__12->SetMarkerColor(ci); ResVsCosTheta__12->SetMarkerStyle(25); ResVsCosTheta__12->SetMarkerSize(1.2); ResVsCosTheta__12->GetXaxis()->SetTitle("|cos(#theta)|"); ResVsCosTheta__12->GetXaxis()->SetNdivisions(506); ResVsCosTheta__12->GetXaxis()->SetLabelFont(42); ResVsCosTheta__12->GetXaxis()->SetLabelOffset(0.015); ResVsCosTheta__12->GetXaxis()->SetLabelSize(0.06); ResVsCosTheta__12->GetXaxis()->SetTitleSize(0.07); ResVsCosTheta__12->GetXaxis()->SetTitleFont(42); ResVsCosTheta__12->GetYaxis()->SetTitle("RMS_{90}(E_{j}) / Mean_{90}(E_{j}) [%]"); ResVsCosTheta__12->GetYaxis()->SetNdivisions(506); ResVsCosTheta__12->GetYaxis()->SetLabelFont(42); ResVsCosTheta__12->GetYaxis()->SetLabelOffset(0.015); ResVsCosTheta__12->GetYaxis()->SetLabelSize(0.06); ResVsCosTheta__12->GetYaxis()->SetTitleSize(0.07); ResVsCosTheta__12->GetYaxis()->SetTitleOffset(0.95); ResVsCosTheta__12->GetYaxis()->SetTitleFont(42); ResVsCosTheta__12->GetZaxis()->SetLabelFont(42); ResVsCosTheta__12->GetZaxis()->SetLabelOffset(0.015); ResVsCosTheta__12->GetZaxis()->SetLabelSize(0.06); ResVsCosTheta__12->GetZaxis()->SetTitleSize(0.07); ResVsCosTheta__12->GetZaxis()->SetTitleOffset(1.2); ResVsCosTheta__12->GetZaxis()->SetTitleFont(42); ResVsCosTheta__12->Draw("same"); TLegend *leg = new TLegend(0.2,0.7,0.58,0.9,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(62); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(2); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("ResVsCosTheta","FCCee","lp"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(2); entry->SetMarkerColor(1); entry->SetMarkerStyle(24); entry->SetMarkerSize(1.2); entry->SetTextFont(62); entry=leg->AddEntry("ResVsCosTheta","CLIC","lp"); ci = TColor::GetColor("#ff6666"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(2); ci = TColor::GetColor("#ff6666"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(25); entry->SetMarkerSize(1.2); entry->SetTextFont(62); leg->Draw(); c1->Modified(); c1->cd(); c1->SetSelected(c1); }
void plotgvsr(){ int xbin=0; //xbin<1 int xpt=0; int xtheta=0; //xtheta<5 TFile *f = TFile::Open("mergedV_Sum.root"); TFile *fProd = TFile::Open("mergedV_Prod.root"); TVectorD *vecDr = f->Get(Form("D_%d/r",xbin)); TVectorD *vecDg2 = f->Get(Form("D_%d/D_%d/D_%d/G2",xbin,xpt,xtheta)); TVectorD *vecDsigma2 = f->Get(Form("D_%d/D_%d/sigma2",xbin,xpt)); TVectorD *vecDV = f->Get(Form("D_%d/D_%d/V",xbin,xpt)); TVectorD *vecDavgmult = f->Get(Form("D_%d/avgmult",xbin)); TVectorD *vecDr_ = fProd->Get(Form("D_%d/r",xbin)); TVectorD *vecDg2_ = fProd->Get(Form("D_%d/D_%d/D_%d/G2",xbin,xpt,xtheta)); TVectorD *vecDsigma2_ = fProd->Get(Form("D_%d/D_%d/sigma2",xbin,xpt)); TVectorD *vecDV_ = fProd->Get(Form("D_%d/D_%d/V",xbin,xpt)); TVectorD *vecDavgmult_ = fProd->Get(Form("D_%d/avgmult",xbin)); double *r = vecDr->GetMatrixArray(); double *g2 = vecDg2->GetMatrixArray(); double *sigma2 = vecDsigma2->GetMatrixArray(); double *V = vecDV->GetMatrixArray(); double *avgmult = vecDavgmult->GetMatrixArray(); double *r_ = vecDr_->GetMatrixArray(); double *g2_ = vecDg2_->GetMatrixArray(); double *sigma2_ = vecDsigma2_->GetMatrixArray(); double *V_ = vecDV_->GetMatrixArray(); double *avgmult_ = vecDavgmult_->GetMatrixArray(); TCanvas *c1 = new TCanvas; c1->SetLogy(); TGraph *gr=new TGraph(nstepr,r,g2); TGraph *grProd=new TGraph(nstepr,r_,g2_); gr->GetXaxis()->SetTitle("r"); gr->GetYaxis()->SetTitle("|G^{#theta}(ir)|"); gr->GetXaxis()->SetRangeUser(0.1,0.4); gr->GetYaxis()->SetRangeUser(1e-8,2); gr->SetTitle(""); gr->SetMarkerSize(1); gr->SetMarkerColor(1); grProd->SetMarkerColor(4); gr->SetMarkerStyle(20); grProd->SetMarkerStyle(29); gr->Draw("AP"); grProd->Draw("Psame"); TLatex *t= new TLatex(); t->SetNDC(); if(xtheta==0) t->DrawLatex(0.2,0.8,Form("%d < mult <%d, theta = %d", trkbin[xbin+1],trkbin[xbin],xtheta)); else t->DrawLatex(0.2,0.8,Form("%d < mult <%d, theta = #frac{%d}{%d}#pi", trkbin[xbin+1],trkbin[xbin],xtheta,ntheta*nn)); double inV2 = 5.81474986447428899e-02; TF1 *gcl = new TF1("gcl","TMath::Power(exp(-[0]*x*x/4)*TMath::BesselJ0([1]*x),2)",0,1); TF1 *gclProd = new TF1("gclProd","TMath::Power(exp(-[0]*x*x/4)*TMath::BesselJ0([1]*x),2)",0,1); //gcl->SetParameters(sigma2[xtheta],V[xtheta]*sigma2[xtheta]); //gcl->SetParameters(300,0.065*300); cout<<sigma2[xtheta]<<"\t"<<V[xtheta]<<"\t"<<avgmult[xbin]<<endl; gcl->SetParameters(sigma2[xtheta]+V[xtheta]*V[xtheta]*avgmult[xbin]*avgmult[xbin]-inV2*inV2*avgmult[xbin]*avgmult[xbin],inV2*avgmult[xbin]); gclProd->SetParameters(sigma2_[xtheta]+V_[xtheta]*V_[xtheta]*avgmult_[xbin]*avgmult_[xbin]-inV2*inV2*avgmult_[xbin]*avgmult_[xbin],inV2*avgmult_[xbin]); gcl->SetLineColor(2); gclProd->SetLineColor(3); TLegend *leg = new TLegend(0.6,0.45,0.8,0.65); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextSize(0.04); leg->AddEntry(gr,"LYZ Sum Analysis result","P"); leg->AddEntry(grProd,"LYZ Prod Analysis result","P"); leg->AddEntry(gcl,"theoretical prediction","L"); leg->Draw("same"); gcl->Draw("same"); c1->Print("gvsr.png"); f->Close(); }
void TrackClusterDistanceCut_Zuds91_totalRecoEnergy() { //=========Macro generated from canvas: c1/A Simple Graph Example //========= (Mon Mar 5 13:11:08 2018) by ROOT version6.08/00 TCanvas *c1 = new TCanvas("c1", "A Simple Graph Example",2,51,800,700); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); c1->SetHighLightColor(2); c1->Range(-27.2,-290.1405,132.8,1321.751); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetTickx(1); c1->SetTicky(1); c1->SetPhi(150); c1->SetLeftMargin(0.17); c1->SetRightMargin(0.08); c1->SetTopMargin(0.08); c1->SetBottomMargin(0.18); c1->SetFrameLineWidth(2); c1->SetFrameBorderMode(0); c1->SetFrameLineWidth(2); c1->SetFrameBorderMode(0); TH1F *hist_pfoEnergyTotal__6 = new TH1F("hist_pfoEnergyTotal__6","hist_pfoEnergyTotal",500,0,500); hist_pfoEnergyTotal__6->SetBinContent(19,1); hist_pfoEnergyTotal__6->SetBinContent(22,1); hist_pfoEnergyTotal__6->SetBinContent(28,2); hist_pfoEnergyTotal__6->SetBinContent(33,1); hist_pfoEnergyTotal__6->SetBinContent(35,2); hist_pfoEnergyTotal__6->SetBinContent(37,1); hist_pfoEnergyTotal__6->SetBinContent(38,1); hist_pfoEnergyTotal__6->SetBinContent(40,1); hist_pfoEnergyTotal__6->SetBinContent(41,1); hist_pfoEnergyTotal__6->SetBinContent(42,1); hist_pfoEnergyTotal__6->SetBinContent(44,2); hist_pfoEnergyTotal__6->SetBinContent(45,1); hist_pfoEnergyTotal__6->SetBinContent(46,2); hist_pfoEnergyTotal__6->SetBinContent(48,1); hist_pfoEnergyTotal__6->SetBinContent(49,2); hist_pfoEnergyTotal__6->SetBinContent(50,2); hist_pfoEnergyTotal__6->SetBinContent(51,4); hist_pfoEnergyTotal__6->SetBinContent(53,1); hist_pfoEnergyTotal__6->SetBinContent(54,2); hist_pfoEnergyTotal__6->SetBinContent(55,4); hist_pfoEnergyTotal__6->SetBinContent(56,5); hist_pfoEnergyTotal__6->SetBinContent(57,5); hist_pfoEnergyTotal__6->SetBinContent(58,2); hist_pfoEnergyTotal__6->SetBinContent(59,5); hist_pfoEnergyTotal__6->SetBinContent(60,2); hist_pfoEnergyTotal__6->SetBinContent(61,2); hist_pfoEnergyTotal__6->SetBinContent(62,4); hist_pfoEnergyTotal__6->SetBinContent(63,3); hist_pfoEnergyTotal__6->SetBinContent(64,5); hist_pfoEnergyTotal__6->SetBinContent(65,7); hist_pfoEnergyTotal__6->SetBinContent(66,6); hist_pfoEnergyTotal__6->SetBinContent(67,4); hist_pfoEnergyTotal__6->SetBinContent(68,13); hist_pfoEnergyTotal__6->SetBinContent(69,2); hist_pfoEnergyTotal__6->SetBinContent(70,12); hist_pfoEnergyTotal__6->SetBinContent(71,7); hist_pfoEnergyTotal__6->SetBinContent(72,2); hist_pfoEnergyTotal__6->SetBinContent(73,7); hist_pfoEnergyTotal__6->SetBinContent(74,11); hist_pfoEnergyTotal__6->SetBinContent(75,11); hist_pfoEnergyTotal__6->SetBinContent(76,12); hist_pfoEnergyTotal__6->SetBinContent(77,29); hist_pfoEnergyTotal__6->SetBinContent(78,27); hist_pfoEnergyTotal__6->SetBinContent(79,37); hist_pfoEnergyTotal__6->SetBinContent(80,42); hist_pfoEnergyTotal__6->SetBinContent(81,64); hist_pfoEnergyTotal__6->SetBinContent(82,112); hist_pfoEnergyTotal__6->SetBinContent(83,132); hist_pfoEnergyTotal__6->SetBinContent(84,184); hist_pfoEnergyTotal__6->SetBinContent(85,266); hist_pfoEnergyTotal__6->SetBinContent(86,365); hist_pfoEnergyTotal__6->SetBinContent(87,528); hist_pfoEnergyTotal__6->SetBinContent(88,744); hist_pfoEnergyTotal__6->SetBinContent(89,896); hist_pfoEnergyTotal__6->SetBinContent(90,1094); hist_pfoEnergyTotal__6->SetBinContent(91,1136); hist_pfoEnergyTotal__6->SetBinContent(92,1054); hist_pfoEnergyTotal__6->SetBinContent(93,857); hist_pfoEnergyTotal__6->SetBinContent(94,660); hist_pfoEnergyTotal__6->SetBinContent(95,495); hist_pfoEnergyTotal__6->SetBinContent(96,313); hist_pfoEnergyTotal__6->SetBinContent(97,245); hist_pfoEnergyTotal__6->SetBinContent(98,171); hist_pfoEnergyTotal__6->SetBinContent(99,101); hist_pfoEnergyTotal__6->SetBinContent(100,78); hist_pfoEnergyTotal__6->SetBinContent(101,51); hist_pfoEnergyTotal__6->SetBinContent(102,39); hist_pfoEnergyTotal__6->SetBinContent(103,27); hist_pfoEnergyTotal__6->SetBinContent(104,19); hist_pfoEnergyTotal__6->SetBinContent(105,24); hist_pfoEnergyTotal__6->SetBinContent(106,9); hist_pfoEnergyTotal__6->SetBinContent(107,7); hist_pfoEnergyTotal__6->SetBinContent(108,8); hist_pfoEnergyTotal__6->SetBinContent(109,2); hist_pfoEnergyTotal__6->SetBinContent(110,3); hist_pfoEnergyTotal__6->SetBinContent(111,2); hist_pfoEnergyTotal__6->SetBinContent(112,2); hist_pfoEnergyTotal__6->SetBinContent(113,5); hist_pfoEnergyTotal__6->SetBinContent(114,6); hist_pfoEnergyTotal__6->SetBinContent(115,1); hist_pfoEnergyTotal__6->SetBinContent(117,2); hist_pfoEnergyTotal__6->SetBinContent(122,1); hist_pfoEnergyTotal__6->SetBinContent(132,1); hist_pfoEnergyTotal__6->SetBinContent(156,1); hist_pfoEnergyTotal__6->SetEntries(10000); hist_pfoEnergyTotal__6->SetStats(0); hist_pfoEnergyTotal__6->SetLineWidth(2); hist_pfoEnergyTotal__6->SetMarkerStyle(0); hist_pfoEnergyTotal__6->SetMarkerSize(1.2); hist_pfoEnergyTotal__6->GetXaxis()->SetTitle("Energy [GeV]"); hist_pfoEnergyTotal__6->GetXaxis()->SetRange(1,120); hist_pfoEnergyTotal__6->GetXaxis()->SetNdivisions(506); hist_pfoEnergyTotal__6->GetXaxis()->SetLabelFont(42); hist_pfoEnergyTotal__6->GetXaxis()->SetLabelOffset(0.015); hist_pfoEnergyTotal__6->GetXaxis()->SetLabelSize(0.06); hist_pfoEnergyTotal__6->GetXaxis()->SetTitleSize(0.07); hist_pfoEnergyTotal__6->GetXaxis()->SetTitleFont(42); hist_pfoEnergyTotal__6->GetYaxis()->SetTitle("Counts"); hist_pfoEnergyTotal__6->GetYaxis()->SetNdivisions(506); hist_pfoEnergyTotal__6->GetYaxis()->SetLabelFont(42); hist_pfoEnergyTotal__6->GetYaxis()->SetLabelOffset(0.015); hist_pfoEnergyTotal__6->GetYaxis()->SetLabelSize(0.06); hist_pfoEnergyTotal__6->GetYaxis()->SetTitleSize(0.07); hist_pfoEnergyTotal__6->GetYaxis()->SetTitleOffset(1.2); hist_pfoEnergyTotal__6->GetYaxis()->SetTitleFont(42); hist_pfoEnergyTotal__6->GetZaxis()->SetLabelFont(42); hist_pfoEnergyTotal__6->GetZaxis()->SetLabelOffset(0.015); hist_pfoEnergyTotal__6->GetZaxis()->SetLabelSize(0.06); hist_pfoEnergyTotal__6->GetZaxis()->SetTitleSize(0.07); hist_pfoEnergyTotal__6->GetZaxis()->SetTitleOffset(1.2); hist_pfoEnergyTotal__6->GetZaxis()->SetTitleFont(42); hist_pfoEnergyTotal__6->Draw("HIST"); TH1F *hist_pfoEnergyTotal__7 = new TH1F("hist_pfoEnergyTotal__7","hist_pfoEnergyTotal",500,0,500); hist_pfoEnergyTotal__7->SetBinContent(16,1); hist_pfoEnergyTotal__7->SetBinContent(24,1); hist_pfoEnergyTotal__7->SetBinContent(28,1); hist_pfoEnergyTotal__7->SetBinContent(30,1); hist_pfoEnergyTotal__7->SetBinContent(31,1); hist_pfoEnergyTotal__7->SetBinContent(33,1); hist_pfoEnergyTotal__7->SetBinContent(34,1); hist_pfoEnergyTotal__7->SetBinContent(36,2); hist_pfoEnergyTotal__7->SetBinContent(38,2); hist_pfoEnergyTotal__7->SetBinContent(39,1); hist_pfoEnergyTotal__7->SetBinContent(42,1); hist_pfoEnergyTotal__7->SetBinContent(43,2); hist_pfoEnergyTotal__7->SetBinContent(45,2); hist_pfoEnergyTotal__7->SetBinContent(46,1); hist_pfoEnergyTotal__7->SetBinContent(47,2); hist_pfoEnergyTotal__7->SetBinContent(48,2); hist_pfoEnergyTotal__7->SetBinContent(49,3); hist_pfoEnergyTotal__7->SetBinContent(50,2); hist_pfoEnergyTotal__7->SetBinContent(51,2); hist_pfoEnergyTotal__7->SetBinContent(53,1); hist_pfoEnergyTotal__7->SetBinContent(55,7); hist_pfoEnergyTotal__7->SetBinContent(56,1); hist_pfoEnergyTotal__7->SetBinContent(57,1); hist_pfoEnergyTotal__7->SetBinContent(59,5); hist_pfoEnergyTotal__7->SetBinContent(61,4); hist_pfoEnergyTotal__7->SetBinContent(62,5); hist_pfoEnergyTotal__7->SetBinContent(63,2); hist_pfoEnergyTotal__7->SetBinContent(64,6); hist_pfoEnergyTotal__7->SetBinContent(65,8); hist_pfoEnergyTotal__7->SetBinContent(66,2); hist_pfoEnergyTotal__7->SetBinContent(67,5); hist_pfoEnergyTotal__7->SetBinContent(68,8); hist_pfoEnergyTotal__7->SetBinContent(69,11); hist_pfoEnergyTotal__7->SetBinContent(70,11); hist_pfoEnergyTotal__7->SetBinContent(71,6); hist_pfoEnergyTotal__7->SetBinContent(72,9); hist_pfoEnergyTotal__7->SetBinContent(73,10); hist_pfoEnergyTotal__7->SetBinContent(74,16); hist_pfoEnergyTotal__7->SetBinContent(75,11); hist_pfoEnergyTotal__7->SetBinContent(76,22); hist_pfoEnergyTotal__7->SetBinContent(77,21); hist_pfoEnergyTotal__7->SetBinContent(78,40); hist_pfoEnergyTotal__7->SetBinContent(79,27); hist_pfoEnergyTotal__7->SetBinContent(80,45); hist_pfoEnergyTotal__7->SetBinContent(81,79); hist_pfoEnergyTotal__7->SetBinContent(82,107); hist_pfoEnergyTotal__7->SetBinContent(83,152); hist_pfoEnergyTotal__7->SetBinContent(84,202); hist_pfoEnergyTotal__7->SetBinContent(85,266); hist_pfoEnergyTotal__7->SetBinContent(86,396); hist_pfoEnergyTotal__7->SetBinContent(87,536); hist_pfoEnergyTotal__7->SetBinContent(88,766); hist_pfoEnergyTotal__7->SetBinContent(89,869); hist_pfoEnergyTotal__7->SetBinContent(90,1082); hist_pfoEnergyTotal__7->SetBinContent(91,1242); hist_pfoEnergyTotal__7->SetBinContent(92,1051); hist_pfoEnergyTotal__7->SetBinContent(93,848); hist_pfoEnergyTotal__7->SetBinContent(94,612); hist_pfoEnergyTotal__7->SetBinContent(95,477); hist_pfoEnergyTotal__7->SetBinContent(96,315); hist_pfoEnergyTotal__7->SetBinContent(97,204); hist_pfoEnergyTotal__7->SetBinContent(98,146); hist_pfoEnergyTotal__7->SetBinContent(99,97); hist_pfoEnergyTotal__7->SetBinContent(100,59); hist_pfoEnergyTotal__7->SetBinContent(101,47); hist_pfoEnergyTotal__7->SetBinContent(102,40); hist_pfoEnergyTotal__7->SetBinContent(103,21); hist_pfoEnergyTotal__7->SetBinContent(104,16); hist_pfoEnergyTotal__7->SetBinContent(105,13); hist_pfoEnergyTotal__7->SetBinContent(106,8); hist_pfoEnergyTotal__7->SetBinContent(107,4); hist_pfoEnergyTotal__7->SetBinContent(108,3); hist_pfoEnergyTotal__7->SetBinContent(109,8); hist_pfoEnergyTotal__7->SetBinContent(110,3); hist_pfoEnergyTotal__7->SetBinContent(112,1); hist_pfoEnergyTotal__7->SetBinContent(113,2); hist_pfoEnergyTotal__7->SetBinContent(114,3); hist_pfoEnergyTotal__7->SetBinContent(115,4); hist_pfoEnergyTotal__7->SetBinContent(116,2); hist_pfoEnergyTotal__7->SetBinContent(117,1); hist_pfoEnergyTotal__7->SetBinContent(119,1); hist_pfoEnergyTotal__7->SetBinContent(120,1); hist_pfoEnergyTotal__7->SetBinContent(126,1); hist_pfoEnergyTotal__7->SetBinContent(168,1); hist_pfoEnergyTotal__7->SetBinContent(218,1); hist_pfoEnergyTotal__7->SetEntries(10000); hist_pfoEnergyTotal__7->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#ff6666"); hist_pfoEnergyTotal__7->SetLineColor(ci); hist_pfoEnergyTotal__7->SetLineWidth(2); ci = TColor::GetColor("#ff6666"); hist_pfoEnergyTotal__7->SetMarkerColor(ci); hist_pfoEnergyTotal__7->SetMarkerStyle(0); hist_pfoEnergyTotal__7->SetMarkerSize(1.2); hist_pfoEnergyTotal__7->GetXaxis()->SetRange(1,1000); hist_pfoEnergyTotal__7->GetXaxis()->SetNdivisions(506); hist_pfoEnergyTotal__7->GetXaxis()->SetLabelFont(42); hist_pfoEnergyTotal__7->GetXaxis()->SetLabelOffset(0.015); hist_pfoEnergyTotal__7->GetXaxis()->SetLabelSize(0.06); hist_pfoEnergyTotal__7->GetXaxis()->SetTitleSize(0.07); hist_pfoEnergyTotal__7->GetXaxis()->SetTitleFont(42); hist_pfoEnergyTotal__7->GetYaxis()->SetNdivisions(506); hist_pfoEnergyTotal__7->GetYaxis()->SetLabelFont(42); hist_pfoEnergyTotal__7->GetYaxis()->SetLabelOffset(0.015); hist_pfoEnergyTotal__7->GetYaxis()->SetLabelSize(0.06); hist_pfoEnergyTotal__7->GetYaxis()->SetTitleSize(0.07); hist_pfoEnergyTotal__7->GetYaxis()->SetTitleOffset(1.2); hist_pfoEnergyTotal__7->GetYaxis()->SetTitleFont(42); hist_pfoEnergyTotal__7->GetZaxis()->SetLabelFont(42); hist_pfoEnergyTotal__7->GetZaxis()->SetLabelOffset(0.015); hist_pfoEnergyTotal__7->GetZaxis()->SetLabelSize(0.06); hist_pfoEnergyTotal__7->GetZaxis()->SetTitleSize(0.07); hist_pfoEnergyTotal__7->GetZaxis()->SetTitleOffset(1.2); hist_pfoEnergyTotal__7->GetZaxis()->SetTitleFont(42); hist_pfoEnergyTotal__7->Draw("HISTsame"); TH1F *hist_pfoEnergyTotal__8 = new TH1F("hist_pfoEnergyTotal__8","hist_pfoEnergyTotal",500,0,500); hist_pfoEnergyTotal__8->SetBinContent(24,1); hist_pfoEnergyTotal__8->SetBinContent(26,1); hist_pfoEnergyTotal__8->SetBinContent(27,1); hist_pfoEnergyTotal__8->SetBinContent(29,1); hist_pfoEnergyTotal__8->SetBinContent(33,1); hist_pfoEnergyTotal__8->SetBinContent(34,1); hist_pfoEnergyTotal__8->SetBinContent(37,1); hist_pfoEnergyTotal__8->SetBinContent(39,3); hist_pfoEnergyTotal__8->SetBinContent(40,1); hist_pfoEnergyTotal__8->SetBinContent(41,2); hist_pfoEnergyTotal__8->SetBinContent(43,2); hist_pfoEnergyTotal__8->SetBinContent(45,3); hist_pfoEnergyTotal__8->SetBinContent(46,3); hist_pfoEnergyTotal__8->SetBinContent(48,1); hist_pfoEnergyTotal__8->SetBinContent(49,1); hist_pfoEnergyTotal__8->SetBinContent(50,2); hist_pfoEnergyTotal__8->SetBinContent(51,1); hist_pfoEnergyTotal__8->SetBinContent(52,2); hist_pfoEnergyTotal__8->SetBinContent(54,1); hist_pfoEnergyTotal__8->SetBinContent(55,4); hist_pfoEnergyTotal__8->SetBinContent(56,2); hist_pfoEnergyTotal__8->SetBinContent(57,1); hist_pfoEnergyTotal__8->SetBinContent(58,4); hist_pfoEnergyTotal__8->SetBinContent(59,2); hist_pfoEnergyTotal__8->SetBinContent(60,2); hist_pfoEnergyTotal__8->SetBinContent(61,4); hist_pfoEnergyTotal__8->SetBinContent(62,3); hist_pfoEnergyTotal__8->SetBinContent(63,4); hist_pfoEnergyTotal__8->SetBinContent(64,8); hist_pfoEnergyTotal__8->SetBinContent(65,8); hist_pfoEnergyTotal__8->SetBinContent(66,8); hist_pfoEnergyTotal__8->SetBinContent(67,5); hist_pfoEnergyTotal__8->SetBinContent(68,2); hist_pfoEnergyTotal__8->SetBinContent(69,4); hist_pfoEnergyTotal__8->SetBinContent(70,6); hist_pfoEnergyTotal__8->SetBinContent(71,11); hist_pfoEnergyTotal__8->SetBinContent(72,7); hist_pfoEnergyTotal__8->SetBinContent(73,10); hist_pfoEnergyTotal__8->SetBinContent(74,8); hist_pfoEnergyTotal__8->SetBinContent(75,18); hist_pfoEnergyTotal__8->SetBinContent(76,16); hist_pfoEnergyTotal__8->SetBinContent(77,15); hist_pfoEnergyTotal__8->SetBinContent(78,41); hist_pfoEnergyTotal__8->SetBinContent(79,27); hist_pfoEnergyTotal__8->SetBinContent(80,48); hist_pfoEnergyTotal__8->SetBinContent(81,77); hist_pfoEnergyTotal__8->SetBinContent(82,110); hist_pfoEnergyTotal__8->SetBinContent(83,144); hist_pfoEnergyTotal__8->SetBinContent(84,210); hist_pfoEnergyTotal__8->SetBinContent(85,261); hist_pfoEnergyTotal__8->SetBinContent(86,402); hist_pfoEnergyTotal__8->SetBinContent(87,544); hist_pfoEnergyTotal__8->SetBinContent(88,744); hist_pfoEnergyTotal__8->SetBinContent(89,954); hist_pfoEnergyTotal__8->SetBinContent(90,1083); hist_pfoEnergyTotal__8->SetBinContent(91,1208); hist_pfoEnergyTotal__8->SetBinContent(92,1099); hist_pfoEnergyTotal__8->SetBinContent(93,820); hist_pfoEnergyTotal__8->SetBinContent(94,609); hist_pfoEnergyTotal__8->SetBinContent(95,437); hist_pfoEnergyTotal__8->SetBinContent(96,316); hist_pfoEnergyTotal__8->SetBinContent(97,206); hist_pfoEnergyTotal__8->SetBinContent(98,132); hist_pfoEnergyTotal__8->SetBinContent(99,97); hist_pfoEnergyTotal__8->SetBinContent(100,68); hist_pfoEnergyTotal__8->SetBinContent(101,41); hist_pfoEnergyTotal__8->SetBinContent(102,37); hist_pfoEnergyTotal__8->SetBinContent(103,24); hist_pfoEnergyTotal__8->SetBinContent(104,19); hist_pfoEnergyTotal__8->SetBinContent(105,15); hist_pfoEnergyTotal__8->SetBinContent(106,11); hist_pfoEnergyTotal__8->SetBinContent(107,5); hist_pfoEnergyTotal__8->SetBinContent(108,4); hist_pfoEnergyTotal__8->SetBinContent(109,8); hist_pfoEnergyTotal__8->SetBinContent(110,4); hist_pfoEnergyTotal__8->SetBinContent(111,3); hist_pfoEnergyTotal__8->SetBinContent(112,1); hist_pfoEnergyTotal__8->SetBinContent(113,2); hist_pfoEnergyTotal__8->SetBinContent(114,1); hist_pfoEnergyTotal__8->SetBinContent(115,1); hist_pfoEnergyTotal__8->SetBinContent(118,2); hist_pfoEnergyTotal__8->SetBinContent(119,1); hist_pfoEnergyTotal__8->SetBinContent(123,1); hist_pfoEnergyTotal__8->SetBinContent(167,1); hist_pfoEnergyTotal__8->SetBinContent(170,1); hist_pfoEnergyTotal__8->SetEntries(10000); hist_pfoEnergyTotal__8->SetStats(0); ci = TColor::GetColor("#0000ff"); hist_pfoEnergyTotal__8->SetLineColor(ci); hist_pfoEnergyTotal__8->SetLineWidth(2); ci = TColor::GetColor("#0000ff"); hist_pfoEnergyTotal__8->SetMarkerColor(ci); hist_pfoEnergyTotal__8->SetMarkerStyle(0); hist_pfoEnergyTotal__8->SetMarkerSize(1.2); hist_pfoEnergyTotal__8->GetXaxis()->SetRange(1,1000); hist_pfoEnergyTotal__8->GetXaxis()->SetNdivisions(506); hist_pfoEnergyTotal__8->GetXaxis()->SetLabelFont(42); hist_pfoEnergyTotal__8->GetXaxis()->SetLabelOffset(0.015); hist_pfoEnergyTotal__8->GetXaxis()->SetLabelSize(0.06); hist_pfoEnergyTotal__8->GetXaxis()->SetTitleSize(0.07); hist_pfoEnergyTotal__8->GetXaxis()->SetTitleFont(42); hist_pfoEnergyTotal__8->GetYaxis()->SetNdivisions(506); hist_pfoEnergyTotal__8->GetYaxis()->SetLabelFont(42); hist_pfoEnergyTotal__8->GetYaxis()->SetLabelOffset(0.015); hist_pfoEnergyTotal__8->GetYaxis()->SetLabelSize(0.06); hist_pfoEnergyTotal__8->GetYaxis()->SetTitleSize(0.07); hist_pfoEnergyTotal__8->GetYaxis()->SetTitleOffset(1.2); hist_pfoEnergyTotal__8->GetYaxis()->SetTitleFont(42); hist_pfoEnergyTotal__8->GetZaxis()->SetLabelFont(42); hist_pfoEnergyTotal__8->GetZaxis()->SetLabelOffset(0.015); hist_pfoEnergyTotal__8->GetZaxis()->SetLabelSize(0.06); hist_pfoEnergyTotal__8->GetZaxis()->SetTitleSize(0.07); hist_pfoEnergyTotal__8->GetZaxis()->SetTitleOffset(1.2); hist_pfoEnergyTotal__8->GetZaxis()->SetTitleFont(42); hist_pfoEnergyTotal__8->Draw("HISTsame"); TLegend *leg = new TLegend(0.2,0.6,0.6,0.9,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(62); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(2); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("hist_pfoEnergyTotal","Nominal (89.96 GeV)","lp"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(2); entry->SetMarkerColor(1); entry->SetMarkerSize(1.2); entry->SetTextFont(62); entry=leg->AddEntry("hist_pfoEnergyTotal","20mm cut (89.76 GeV)","lp"); ci = TColor::GetColor("#ff6666"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(2); ci = TColor::GetColor("#ff6666"); entry->SetMarkerColor(ci); entry->SetMarkerSize(1.2); entry->SetTextFont(62); entry=leg->AddEntry("hist_pfoEnergyTotal","50mm cut (89.76 GeV)","lp"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(2); ci = TColor::GetColor("#0000ff"); entry->SetMarkerColor(ci); entry->SetMarkerSize(1.2); entry->SetTextFont(62); leg->Draw(); c1->Modified(); c1->cd(); c1->SetSelected(c1); }
void ZinvEstimate(){//main programme //Set Canvas Style TStyle *gStyle = new TStyle("gStyle","Style for P-TDR"); SetStyle st; st.SetPars(gStyle); //finished setting canvas style DataMC plot; //Important //In kevins v3 production due to a bug puWeight is divided to all standard MC weights ...this should be removed //from the code if you are using it for version otherthan V3 TString InputFilePathV4="/eos/uscms/store/user/pedrok/SUSY2015/Analysis/Skims/Run2ProductionV4/"; TString InputFilePathV3="/eos/uscms/store/user/pedrok/SUSY2015/Analysis/Skims/Run2ProductionV3/"; TString InputFilePathV2="/eos/uscms/store/user/pedrok/SUSY2015/Analysis/Skims/Run2ProductionV2/"; TChain* tZinv = new TChain("tree"); tZinv->Add(InputFilePathV4+"tree_signal/tree_ZJetsToNuNu_HT*.root"); ReadTree Zinv(tZinv); //reading the GJets MC TChain* tGJets = new TChain("tree"); tGJets->Add(InputFilePathV4+"tree_GJet_CleanVars/tree_GJets_HT-*.root"); ReadTree GJets(tGJets); //reading QCD MC TChain* tQCD = new TChain("tree"); tQCD->Add(InputFilePathV4+"tree_GJet_CleanVars/tree_QCD_HT*.root"); ReadTree QCD(tQCD); //reading Single photon Data TChain* tData = new TChain("tree"); tData->Add(InputFilePathV4+"tree_GJet_CleanVars/tree_SinglePhoton_*.root"); ReadTree Data(tData); double Lumi=1280.23; int nBinsHT=13; int nBinsMHT=7; int nBinsPt=8; int nBinsNJ=6; int nBinsS=25; double HTbins[14]={500.,600.,700,800,900,1000.,1100,1200.,1300,1400,1500,1700,2000,3000}; double MHTbins[8]={200.,300,400,500.,600,750.,1000,1500.}; double Ptbins[9]={100,200.,300,400,500.,600,750.,1000,1500.}; double NJetsbins[7]={4,5,6,7,8,9,12}; /////////Three MHT Bins double MHTbin1Min=200; double MHTbin1Max=350; double MHTbin2Min=350; double MHTbin2Max=500; double MHTbin3Min=500; double MHTbin3Max=1500; ///////////Three MHT Bins int nBinAN=18; double nBinANmax=18.5; /////////////////////////////////////////////////////////////////////////////All user input changes above TH1F *hHT_Zinv=new TH1F("hHT_Zinv","hHT_Zinv",nBinsHT,HTbins); TH1F *hMHT_Zinv=new TH1F("hMHT_Zinv","hMHT_Zinv",nBinsMHT,MHTbins); TH1F *hNJets_Zinv=new TH1F("hNJets_Zinv","hNJets_Zinv",nBinsNJ,NJetsbins); TH1F *hHT_GJets=new TH1F("hHT_GJets","hHT_GJets",nBinsHT,HTbins); TH1F *hMHT_GJets=new TH1F("hMHT_GJets","hMHT_GJets",nBinsMHT,MHTbins); TH1F *hNJets_GJets=new TH1F("hNJets_GJets","hNJets_GJets",nBinsNJ,NJetsbins); TH1F *hSieta_GJetsEB=new TH1F("hSieta_GJetsEB","hSieta_GJetsEB",nBinsS,0.006,0.0107); TH1F *hSieta_GJetsEC=new TH1F("hSieta_GJetsEC","hSieta_GJetsEC",nBinsS,0.01,0.0272); TH1F *hSieta_GJetsEBLow=new TH1F("hSieta_GJetsEBLow","hSieta_GJetsEBLow",nBinsS,0.006,0.0107); TH1F *hSieta_GJetsECLow=new TH1F("hSieta_GJetsECLow","hSieta_GJetsECLow",nBinsS,0.01,0.0272); TH1F *hSieta_GJetsEBMed=new TH1F("hSieta_GJetsEBMed","hSieta_GJetsEBMed",nBinsS,0.006,0.0107); TH1F *hSieta_GJetsECMed=new TH1F("hSieta_GJetsECMed","hSieta_GJetsECMed",nBinsS,0.01,0.0272); TH1F *hSieta_GJetsEBHigh=new TH1F("hSieta_GJetsEBHigh","hSieta_GJetsEBHigh",nBinsS,0.006,0.0107); TH1F *hSieta_GJetsECHigh=new TH1F("hSieta_GJetsECHigh","hSieta_GJetsECHigh",nBinsS,0.01,0.0272); TH1F *hPhPt_GJetsEB=new TH1F("hPhPt_GJetsEB","hPhPt_GJetsEB",nBinsPt,Ptbins); TH1F *hPhPt_GJetsEC=new TH1F("hPhPt_GJetsEC","hPhPt_GJetsEC",nBinsPt,Ptbins); TH1F *hHT_QCD=new TH1F("hHT_QCD","hHT_QCD",nBinsHT,HTbins); TH1F *hMHT_QCD=new TH1F("hMHT_QCD","hMHT_QCD",nBinsMHT,MHTbins); TH1F *hNJets_QCD=new TH1F("hNJets_QCD","hNJets_QCD",nBinsNJ,NJetsbins); TH1F *hSieta_QCDEB=new TH1F("hSieta_QCDEB","hSieta_QCDEB",nBinsS,0.006,0.0107); TH1F *hSieta_QCDEC=new TH1F("hSieta_QCDEC","hSieta_QCDEC",nBinsS,0.01,0.0272); TH1F *hSieta_QCDEBLow=new TH1F("hSieta_QCDEBLow","hSieta_QCDEBLow",nBinsS,0.006,0.0107); TH1F *hSieta_QCDECLow=new TH1F("hSieta_QCDECLow","hSieta_QCDECLow",nBinsS,0.01,0.0272); TH1F *hSieta_QCDEBMed=new TH1F("hSieta_QCDEBMed","hSieta_QCDEBMed",nBinsS,0.006,0.0107); TH1F *hSieta_QCDECMed=new TH1F("hSieta_QCDECMed","hSieta_QCDECMed",nBinsS,0.01,0.0272); TH1F *hSieta_QCDEBHigh=new TH1F("hSieta_QCDEBHigh","hSieta_QCDEBHigh",nBinsS,0.006,0.0107); TH1F *hSieta_QCDECHigh=new TH1F("hSieta_QCDECHigh","hSieta_QCDECHigh",nBinsS,0.01,0.0272); TH1F *hPhPt_QCDEB=new TH1F("hPhPt_QCDEB","hPhPt_QCDEB",nBinsPt,Ptbins); TH1F *hPhPt_QCDEC=new TH1F("hPhPt_QCDEC","hPhPt_QCDEC",nBinsPt,Ptbins); TH1F *hHT_Data=new TH1F("hHT_Data","hHT_Data",nBinsHT,HTbins); TH1F *hMHT_Data=new TH1F("hMHT_Data","hMHT_Data",nBinsMHT,MHTbins); TH1F *hNJets_Data=new TH1F("hNJets_Data","hNJets_Data",nBinsNJ,NJetsbins); TH1F *hSieta_DataEB=new TH1F("hSieta_DataEB","hSieta_DataEB",nBinsS,0.006,0.0107); TH1F *hSieta_DataEC=new TH1F("hSieta_DataEC","hSieta_DataEC",nBinsS,0.01,0.0272);; TH1F *hSieta_DataEBLow=new TH1F("hSieta_DataEBLow","hSieta_DataEBLow",nBinsS,0.006,0.0107); TH1F *hSieta_DataECLow=new TH1F("hSieta_DataECLow","hSieta_DataECLow",nBinsS,0.01,0.0272); TH1F *hSieta_DataEBMed=new TH1F("hSieta_DataEBMed","hSieta_DataEBMed",nBinsS,0.006,0.0107); TH1F *hSieta_DataECMed=new TH1F("hSieta_DataECMed","hSieta_DataECMed",nBinsS,0.01,0.0272); TH1F *hSieta_DataEBHigh=new TH1F("hSieta_DataEBHigh","hSieta_DataEBHigh",nBinsS,0.006,0.0107); TH1F *hSieta_DataECHigh=new TH1F("hSieta_DataECHigh","hSieta_DataECHigh",nBinsS,0.01,0.0272); TH1F *hPhPt_DataEB=new TH1F("hPhPt_DataEB","hPhPt_DataEB",nBinsPt,Ptbins); TH1F *hPhPt_DataEC=new TH1F("hPhPt_DataEC","hPhPt_DataEC",nBinsPt,Ptbins); TH1F *h_NZinv18bin=new TH1F("h_NZinv18bin","h_NZinv18bin",nBinAN,0.5,nBinANmax); // TH1F *h_NZinv18binC=new TH1F("h_NZinv18binC","h_NZinv18binC",nBinAN,0.5,nBinANmax); //TH1F *EBestimate=new TH1F("EBestimate","EBestimate",18,0.5,18.5); //TH1F *ECestimate=new TH1F("ECestimate","ECestimate",18,0.5,18.5); TH1F *ZinvEstimate=new TH1F("ZinvEstimate","ZinvEstimate",nBinAN,0.5,nBinANmax); TH1F *h_NGJets18bin=new TH1F("h_NGJets18binC","h_NGJets18binC",nBinAN,0.5,nBinANmax); TH1F *h_NGJets18binEB=new TH1F("h_NGJets18binEB","h_NGJets18binEB",nBinAN,0.5,nBinANmax); TH1F *h_NGJets18binEC=new TH1F("h_NGJets18binEC","h_NGJets18binEC",nBinAN,0.5,nBinANmax); TH1F *h_NQCD18binEB=new TH1F("h_NQCD18binEB","h_NQCD18binEB",nBinAN,0.5,nBinANmax); TH1F *h_NQCD18binEC=new TH1F("h_NQCD18binEC","h_NQCD18binEC",nBinAN,0.5,nBinANmax); TH1F *h_Ndata18binEB=new TH1F("h_Ndata18binEB","h_Ndata18binEB",nBinAN,0.5,nBinANmax); TH1F *h_Ndata18binEC=new TH1F("h_Ndata18binEC","h_Ndata18binEC",nBinAN,0.5,nBinANmax); TH1F *h_ZgammaR18bin=new TH1F("h_ZgammaR18bin","h_ZgammmaR18bin",nBinAN,0.5,nBinANmax); TH1F *h_ZgammaRWSF=new TH1F("h_ZgammaRWSF","h_ZgammmaRWSF",nBinAN,0.5,nBinANmax); int maxEvents_Zinv=tZinv->GetEntries(); cout<<"maxEventsZinv: "<<maxEvents_Zinv<<endl; for(int iEv=0;iEv<maxEvents_Zinv;iEv++){//Looping over Zinv MC/////////////////////////////////////// tZinv->GetEntry(iEv); if(iEv % 1000000==0){cout<<"Event no Zinv : "<<iEv<<endl;} int binNumber_Zinv = computeBin( Zinv.MHTclean, Zinv.HTclean, Zinv.NJetsclean, k13TeV); double weight=0; if(binNumber_Zinv >-1 && Zinv.BTagsclean==0){//Filling Yield(N_Obsereved) in Zinv h_NZinv18bin->Fill(binNumber_Zinv,(Lumi*Zinv.Weight)); h_NZinv18binC->Fill(binNumber_Zinv,(Lumi*Zinv.Weight)); } }//Lopping over Zinv MC////////////////////////////////////////////////////////// cout<<"Zinv Observed MC: "<<h_NZinv18bin->Integral()<<endl; cout<<"First bin: "<<h_NZinv18bin->GetBinContent(0)<<endl; for(int i=1;i<19;i++){ cout<<"Zinv Bin Content: "<<h_NZinv18bin->GetBinContent(i)<<endl; } int maxEvents_GJets=tGJets->GetEntries(); cout<<"maxEventsGJets: "<<maxEvents_GJets<<endl; for(int iEv=0;iEv<maxEvents_GJets;iEv++){//Looping over GJets MC/////////////////////////////////////// tGJets->GetEntry(iEv); if(iEv % 1000000==0){cout<<"Event no GJets : "<<iEv<<endl;} int binNumber_GJets = computeBin( GJets.MHTclean, GJets.HTclean, GJets.NJetsclean, k13TeV); int index=GJets.photonIndex(); if(binNumber_GJets >-1 && GJets.BTagsclean==0 && index !=-1 && GJets.photon_nonPrompt->at(index) !=1){//Filling Yield(N_Obsereved) in GJets MC hHT_GJets->Fill(GJets.HTclean,Lumi*GJets.Weight); hMHT_GJets->Fill(GJets.MHTclean,Lumi*GJets.Weight); hNJets_GJets->Fill(GJets.NJetsclean,Lumi*GJets.Weight); h_NGJets18bin->Fill(binNumber_GJets,Lumi*GJets.Weight); if(fabs(GJets.bestPhoton->at(0).Eta())< 1.4442){//barrel hSieta_GJetsEB->Fill(GJets.photon_sigmaIetaIeta->at(index),Lumi*GJets.Weight); h_NGJets18binEB->Fill(binNumber_GJets,Lumi*GJets.Weight); hPhPt_GJetsEB->Fill(GJets.photonCands->at(index).Pt(),Lumi*GJets.Weight); ////////////////////////////////////Sieta in MHT bins if(GJets.MHTclean >MHTbin1Min && GJets.MHTclean< MHTbin1Max){ hSieta_GJetsEBLow->Fill(GJets.photon_sigmaIetaIeta->at(index),Lumi*GJets.Weight); } if(GJets.MHTclean >MHTbin2Min && GJets.MHTclean< MHTbin2Max){ hSieta_GJetsEBMed->Fill(GJets.photon_sigmaIetaIeta->at(index),Lumi*GJets.Weight); } if(GJets.MHTclean >MHTbin3Min && GJets.MHTclean< MHTbin3Max){ hSieta_GJetsEBHigh->Fill(GJets.photon_sigmaIetaIeta->at(index),Lumi*GJets.Weight); } /////////////////////////Sieta in MHT bins }//barrel if(fabs(GJets.bestPhoton->at(0).Eta())> 1.566 && fabs(GJets.bestPhoton->at(0).Eta())< 2.5){//endcap hSieta_GJetsEC->Fill(GJets.photon_sigmaIetaIeta->at(index),Lumi*GJets.Weight); h_NGJets18binEC->Fill(binNumber_GJets,Lumi*GJets.Weight); hPhPt_GJetsEC->Fill(GJets.photonCands->at(index).Pt(),Lumi*GJets.Weight); ////////////////////////////////////Sieta in MHT bins if(GJets.MHTclean >MHTbin1Min && GJets.MHTclean< MHTbin1Max){ hSieta_GJetsECLow->Fill(GJets.photon_sigmaIetaIeta->at(index),Lumi*GJets.Weight); } if(GJets.MHTclean >MHTbin2Min && GJets.MHTclean< MHTbin2Max){ hSieta_GJetsECMed->Fill(GJets.photon_sigmaIetaIeta->at(index),Lumi*GJets.Weight); } if(GJets.MHTclean >MHTbin3Min && GJets.MHTclean< MHTbin3Max){ hSieta_GJetsECHigh->Fill(GJets.photon_sigmaIetaIeta->at(index),Lumi*GJets.Weight); } /////////////////////////Sieta in MHT bins }//endcap }//Filling Yield(N_Obsereved) in GJets MC }//Looping over GJets MC////////////////////////////////////////////////////////////////////////// cout<<"Total GJets Events: "<<hHT_GJets->Integral(); int maxEvents_QCD=tQCD->GetEntries(); cout<<"maxEventsQCD: "<<maxEvents_QCD<<endl; for(int iEv=0;iEv<maxEvents_QCD;iEv++){//Looping over QCD MC tQCD->GetEntry(iEv); if(iEv % 1000000==0){cout<<"Event no QCD : "<<iEv<<endl;} int binNumber_QCD = computeBin( QCD.MHTclean, QCD.HTclean, QCD.NJetsclean, k13TeV); int index=QCD.photonIndex(); if(binNumber_QCD >-1 && QCD.BTagsclean==0 && index !=-1 && QCD.photon_nonPrompt->at(index) ==1 ){//Filling Yield(N_Obsereved) in QCD MC hHT_QCD->Fill(QCD.HTclean,Lumi*QCD.Weight); hMHT_QCD->Fill(QCD.MHTclean,Lumi*QCD.Weight); hNJets_QCD->Fill(QCD.NJetsclean,Lumi*QCD.Weight); if(fabs(QCD.bestPhoton->at(0).Eta())< 1.4442){//barrel hSieta_QCDEB->Fill(QCD.photon_sigmaIetaIeta->at(index),Lumi*QCD.Weight); h_NQCD18binEB->Fill(binNumber_QCD,Lumi*QCD.Weight); hPhPt_QCDEB->Fill(QCD.photonCands->at(index).Pt(),Lumi*QCD.Weight); ////////////////////////////////////Sieta in MHT bins if(QCD.MHTclean >MHTbin1Min && QCD.MHTclean< MHTbin1Max){ hSieta_QCDEBLow->Fill(QCD.photon_sigmaIetaIeta->at(index),Lumi*QCD.Weight); } if(QCD.MHTclean >MHTbin2Min && QCD.MHTclean< MHTbin2Max){ hSieta_QCDEBMed->Fill(QCD.photon_sigmaIetaIeta->at(index),Lumi*QCD.Weight); } if(QCD.MHTclean >MHTbin3Min && QCD.MHTclean< MHTbin3Max){ hSieta_QCDEBHigh->Fill(QCD.photon_sigmaIetaIeta->at(index),Lumi*QCD.Weight); } /////////////////////////Sieta in MHT bins }//barrel if(fabs(QCD.bestPhoton->at(0).Eta())> 1.566 && abs(QCD.bestPhoton->at(0).Eta()) <2.5 ){//endcap hSieta_QCDEC->Fill(QCD.photon_sigmaIetaIeta->at(index),Lumi*QCD.Weight); h_NQCD18binEC->Fill(binNumber_QCD,Lumi*QCD.Weight); hPhPt_QCDEC->Fill(QCD.photonCands->at(index).Pt(),Lumi*QCD.Weight); }//endcap ////////////////////////////////////Sieta in MHT bins if(QCD.MHTclean >MHTbin1Min && QCD.MHTclean< MHTbin1Max){ hSieta_QCDECLow->Fill(QCD.photon_sigmaIetaIeta->at(index),Lumi*QCD.Weight); } if(QCD.MHTclean >MHTbin2Min && QCD.MHTclean< MHTbin2Max){ hSieta_QCDECMed->Fill(QCD.photon_sigmaIetaIeta->at(index),Lumi*QCD.Weight); } if(QCD.MHTclean >MHTbin3Min && QCD.MHTclean< MHTbin3Max){ hSieta_QCDECHigh->Fill(QCD.photon_sigmaIetaIeta->at(index),Lumi*QCD.Weight); } /////////////////////////Sieta in MHT bins }//Filling Yield(N_Obsereved) in QCD MC }//Looping over QCD MC int maxEvents_Data=tData->GetEntries(); //cout<<"maxEvents in Single Photon Data: "<<maxEvents_Data<<endl; for(int iEv=0;iEv<maxEvents_Data;iEv++){//Data tData->GetEntry(iEv); if(iEv % 1000000==0){cout<<"Event no Data : "<<iEv<<endl;} //cout<<"Event no: "<<iEv<<endl; int binNumber_Data = computeBin( Data.MHTclean, Data.HTclean, Data.NJetsclean, k13TeV); int index=Data.photonIndex(); if(binNumber_Data >-1 && Data.BTagsclean==0 && index !=-1){//Filling Yield(N_Obsereved) in Data bool PassTrigger=false; for(int itr=0;itr<Data.TriggerNames->size();itr++){ //cout<<"trigger size: "<<Data.TriggerNames->at(itr)<<endl; if(Data.TriggerNames->at(itr)=="HLT_Photon90_CaloIdL_PFHT500_v3" && Data.TriggerPass->at(itr)==1){ PassTrigger=true; } } if(PassTrigger==true){//trigger pass hHT_Data->Fill(Data.HTclean); hMHT_Data->Fill(Data.MHTclean); hNJets_Data->Fill(Data.NJetsclean); if(fabs(Data.bestPhoton->at(0).Eta())< 1.4442){//barrel h_Ndata18binEB->Fill(binNumber_Data); hSieta_DataEB->Fill(Data.photon_sigmaIetaIeta->at(index)); hPhPt_DataEB->Fill(Data.photonCands->at(index).Pt()); ////////////////////////////////////Sieta in MHT bins if(Data.MHTclean >MHTbin1Min && Data.MHTclean< MHTbin1Max){ hSieta_DataEBLow->Fill(Data.photon_sigmaIetaIeta->at(index)); } if(Data.MHTclean >MHTbin2Min && Data.MHTclean< MHTbin2Max){ hSieta_DataEBMed->Fill(Data.photon_sigmaIetaIeta->at(index)); } if(Data.MHTclean >MHTbin3Min && Data.MHTclean< MHTbin3Max){ hSieta_DataEBHigh->Fill(Data.photon_sigmaIetaIeta->at(index)); } /////////////////////////Sieta in MHT bins }//barrel if(fabs(Data.bestPhoton->at(0).Eta())> 1.566 && fabs(Data.bestPhoton->at(0).Eta())< 2.5 ){//endcap h_Ndata18binEC->Fill(binNumber_Data); hSieta_DataEC->Fill(Data.photon_sigmaIetaIeta->at(index)); hPhPt_DataEC->Fill(Data.photonCands->at(index).Pt()); ////////////////////////////////////Sieta in MHT bins if(Data.MHTclean >MHTbin1Min && Data.MHTclean< MHTbin1Max){ hSieta_DataECLow->Fill(Data.photon_sigmaIetaIeta->at(index)); } if(Data.MHTclean >MHTbin2Min && Data.MHTclean< MHTbin2Max){ hSieta_DataECMed->Fill(Data.photon_sigmaIetaIeta->at(index)); } if(Data.MHTclean >MHTbin3Min && Data.MHTclean< MHTbin3Max){ hSieta_DataECHigh->Fill(Data.photon_sigmaIetaIeta->at(index)); } /////////////////////////Sieta in MHT bins }//endcap }//trigger pass }//Filling Yield(N_Obsereved) in Data }//Data //trigger efficiency ///////////////////////////defining legend char Legname1[100]; TLegend *leg[24]; for(int k0=0;k0<24;k0++){ sprintf(Legname1,"leg_1D%i",k0); leg[k0]=new TLegend(0.5,0.7,0.80,0.89); leg[k0]->SetTextFont(62); leg[k0]->SetLineColor(1); leg[k0]->SetLineStyle(1); leg[k0]->SetLineWidth(3); leg[k0]->SetFillColor(0); leg[k0]->SetFillStyle(1001); leg[k0]->SetShadowColor(0); leg[k0]->SetDrawOption(0); leg[k0]->SetBorderSize(0); leg[k0]->SetTextSize(0.03); } ///////////////////////////////ZinvMC Yield //TCanvas *ZinvMCYield=new TCanvas("ZinvMC","ZinvMC"); //ZinvMCYield->SetLogy(); h_NZinv18bin->Sumw2(); h_NZinv18bin->SetFillColor(1); h_NZinv18bin->SetFillStyle(1000); h_NZinv18bin->GetXaxis()->SetTitle("bin Number"); h_NZinv18bin->GetYaxis()->SetTitle("Z/Gamma Ratio"); //h_NZinv18bin->Draw("hist"); //////////////////////////////////////////////Calculating Zgamma Ratio start TPaveText *tpav1 = new TPaveText(0.1956522,0.6247818,0.729097,0.8970332,"brNDC"); tpav1->SetBorderSize(0); tpav1->SetFillStyle(0); tpav1->SetTextAlign(11); tpav1->SetTextFont(42); tpav1->SetTextSize(0.04); tpav1->AddText("HT >500"); tpav1->AddText("#gamma p_{T} > 100 "); tpav1->AddText("NJets >=4"); tpav1->AddText("MHT>200"); tpav1->AddText("Btags=0"); tpav1->AddText("#Delta #Phi_{1,2,3,4}>(0.5,0.5,0.3,0.3)"); TPaveText *pCMS1 = new TPaveText(0.132107,0.9308003,0.8327759,0.9923583,"brNDC"); pCMS1->SetBorderSize(0); pCMS1->SetFillStyle(0); pCMS1->SetTextAlign(11); pCMS1->SetTextFont(42); pCMS1->SetTextSize(0.04); pCMS1->AddText("CMS #it{Preliminary} #sqrt{s}= 13 TeV"); TCanvas *cZgammaR=new TCanvas("cZGammaR","cZGammaR"); TH1F *h_ZgR = (TH1F*)h_NZinv18bin->Clone("h_ZgR"); h_ZgR->Divide(h_NGJets18bin); cZgammaR->cd(); h_ZgR->Draw("E2"); tpav1->Draw(); pCMS1->Draw(); cZgammaR->SaveAs("ZgammaRatioWOSF.png"); cZgammaR->SaveAs("ZgammaRatioWOSF.pdf"); cZgammaR->SaveAs("ZgammaRatioWOSF.gif"); ///////////////////////////////////Calculating ZGamma ratio end /////////////////////////////////////////////////////Dealing with Data barrel TH1F *h_DataSimEB = (TH1F*)h_Ndata18binEB->Clone("h_DataSimEB"); TH1F *h_DataSimEC = (TH1F*)h_Ndata18binEC->Clone("h_DataSimEC"); TH1F *h_DataSimEBforErr = (TH1F*)h_NGJets18binEB->Clone("h_DataSimEBforErr"); TH1F *h_DataSimECforErr = (TH1F*)h_NGJets18binEB->Clone("h_DataSimECforErr"); h_DataSimEBforErr->Scale((1/h_DataSimEBforErr->Integral())*h_Ndata18binEB->Integral()); h_DataSimECforErr->Scale((1/h_DataSimECforErr->Integral())*h_Ndata18binEC->Integral()); /////////////////////Fill the empty bins with simulated data for(int i=1;i<(nBinAN+1);i++){//loop over bins h_DataSimEB->SetBinError(i,0.); h_DataSimEC->SetBinError(i,0.); }//loop over bins TH1F *hEBPurity=new TH1F("hEBPurity","hEBPurity",nBinAN,0.5,nBinANmax); TH1F *hECPurity=new TH1F("hECPurity","hECPurity",nBinAN,0.5,nBinANmax); TH1F *hEBfrag=new TH1F("hEBfrag","hEBfrag",nBinAN,0.5,nBinANmax); TH1F *hECfrag=new TH1F("hECfrag","hECfrag",nBinAN,0.5,nBinANmax); //uncorel //corel double ebpErr=sqrt((0.009*0.009)+(0.03*0.03)); double ecpErr=sqrt((0.016*0.016)+(0.046*0.046)); double ebpErrCorel=0.03; double ebpErrUnCorel=0.009; double ecpErrCorel=0.046; double ecpErrUnCorel=0.016; for(int i=1;i<(nBinAN+1);i++){//set purity stuff hEBPurity->SetBinContent(i,0.967); hEBPurity->SetBinError(i,ebpErr); hECPurity->SetBinContent(i,0.956); hECPurity->SetBinError(i,ecpErr); hEBfrag->SetBinContent(i,0.92); hEBfrag->SetBinError(i,0.04); hECfrag->SetBinContent(i,0.92); hECfrag->SetBinError(i,0.04); }//set purity stuff const Int_t NumBins= nBinAN; double binNumber[nBinAN]; double YieldEstimated[nBinAN]; double YieldErrUp_Estimated[nBinAN]; double YieldErrLow_Estimated[nBinAN]; double YieldPredMC[nBinAN]; double YieldErrUp_PredMC[nBinAN]; double YieldErrLow_PredMC[nBinAN]; double XErrLow[nBinAN]; double XErrUp[nBinAN]; double ZgRwSF[nBinAN]; double ZgRwSF_sys_ErrUp[nBinAN]; double ZgRwSF_sys_ErrLow[nBinAN]; double ZgRwSF_stat_Err[nBinAN]; for(int ibin=1;ibin<(nBinAN+1);ibin++){//loop over bin error calculation double SF=0.98; double SFup=1.03; double SFlow=0.93; double ZgRcentral=h_ZgR->GetBinContent(ibin)/0.98; double ZgRup=h_ZgR->GetBinContent(ibin)/1.03; double ZgRlow=h_ZgR->GetBinContent(ibin)/0.93; double ZgRcorelErrup=fabs(ZgRcentral-ZgRlow); double ZgRcorelErrlow=fabs(ZgRcentral-ZgRup); double ZgRsymErr=0.5*(sqrt((ZgRcorelErrup*ZgRcorelErrup)+(ZgRcorelErrlow*ZgRcorelErrlow))); double ZgRcorel_Rel_Errup=ZgRcorelErrup/ZgRcentral; double ZgRcorel_Rel_Errlow=ZgRcorelErrlow/ZgRcentral; //double ZgRcorelErr=sqrt((ZgRcorelErrup*ZgRcorelErrup)+(ZgRcorelErrlow*ZgRcorelErrlow)); double ZgRuncorelErr=h_ZgR->GetBinError(ibin)/SF; double ZgRuncorel_Rel_Err=ZgRuncorelErr/ZgRcentral; double ZgRsymErrStat=h_ZgR->GetBinError(ibin)/SF;//h_ZgR->GetBinError(ibin); double ZgRallSymErr=sqrt((ZgRsymErr*ZgRsymErr)+(ZgRsymErrStat*ZgRsymErrStat)); //important lines to be changed double ZgR=ZgRcentral; double ZgRerr=ZgRallSymErr; double ZgRerrUp=sqrt((ZgRcorelErrup*ZgRcorelErrup)+(ZgRuncorelErr*ZgRuncorelErr)); double ZgRerrLow=sqrt((ZgRcorelErrlow*ZgRcorelErrlow)+(ZgRuncorelErr*ZgRuncorelErr)); ////////////////////////////////////barrel starts int EBobs=h_DataSimEB->GetBinContent(ibin); double EBobsErr=h_DataSimEB->GetBinError(ibin); double pEB=hEBPurity->GetBinContent(ibin); double pEBerr=hEBPurity->GetBinError(ibin); double pEB_Rel_err=pEBerr/pEB; int ECobs=h_DataSimEC->GetBinContent(ibin); double ECobsErr=h_DataSimEC->GetBinError(ibin); double pEC=hECPurity->GetBinContent(ibin); double pECerr=hECPurity->GetBinError(ibin); double pEC_Rel_err=pECerr/pEC; double f=0.92; double ferr=0.04; double f_Rel_err=ferr/f; double YieldTotal=ZgR*(EBobs*pEB+ECobs*pEC)*f; double YieldTotalErr=0; double YieldTotal_Rel_Err=0; double YieldTotalErrUp=0; double YieldTotal_Rel_ErrUp=0; double YieldTotalErrLow=0; double YieldTotal_Rel_ErrLow=0; int Nobserved=EBobs+ECobs; double totalPurity=0; double totalPurityErr=0; double totalPurity_Rel_Err=0; double ZinvMCYield=h_NZinv18binC->GetBinContent(ibin); double ZinvMCYieldErr=h_NZinv18binC->GetBinError(ibin); double ZinvMCYield_Rel_Err=ZinvMCYieldErr/ZinvMCYield; if(Nobserved !=0){ totalPurity=((EBobs*pEB+ECobs*pEC)*f)/Nobserved; double totalPurityErr1=(EBobs*pEBerr+ECobs*pECerr)/Nobserved; double totalPurityErr2=ferr; totalPurityErr=sqrt((totalPurityErr1*totalPurityErr1)+(totalPurityErr2*totalPurityErr2)); totalPurity_Rel_Err=totalPurityErr/totalPurity; YieldTotalErr=Nobserved*(sqrt((ZgR*ZgR*totalPurityErr*totalPurityErr)+(totalPurity*totalPurity*ZgRerr*ZgRerr))); YieldTotal_Rel_Err=YieldTotalErr/YieldTotal; YieldTotalErrUp=Nobserved*(sqrt((ZgR*ZgR*totalPurityErr*totalPurityErr)+(totalPurity*totalPurity*ZgRerrUp*ZgRerrUp))); YieldTotal_Rel_ErrUp=YieldTotalErrUp/YieldTotal; YieldTotalErrLow=Nobserved*(sqrt((ZgR*ZgR*totalPurityErr*totalPurityErr)+(totalPurity*totalPurity*ZgRerrLow*ZgRerrLow))); YieldTotal_Rel_ErrLow=YieldTotalErrLow/YieldTotal; } if(Nobserved ==0){ double NobservedNew=h_DataSimEBforErr->GetBinContent(ibin)+h_DataSimECforErr->GetBinContent(ibin); double EBobsNew=h_DataSimEBforErr->GetBinContent(ibin); double ECobsNew=h_DataSimECforErr->GetBinContent(ibin); totalPurity=((EBobsNew*pEB+ECobsNew*pEC)*f)/NobservedNew; double totalPurityErr1=(EBobsNew*pEBerr+ECobsNew*pECerr)/NobservedNew; double totalPurityErr2=ferr; totalPurityErr=sqrt((totalPurityErr1*totalPurityErr1)+(totalPurityErr2*totalPurityErr2)); totalPurity_Rel_Err=totalPurityErr/totalPurity; YieldTotalErr=NobservedNew*(sqrt((ZgR*ZgR*totalPurityErr*totalPurityErr)+(totalPurity*totalPurity*ZgRerr*ZgRerr))); double YieldTotalNew=ZgR*(EBobsNew*pEB+ECobsNew*pEC)*f; YieldTotal_Rel_Err=YieldTotalErr/YieldTotalNew; YieldTotalErrUp=NobservedNew*(sqrt((ZgR*ZgR*totalPurityErr*totalPurityErr)+(totalPurity*totalPurity*ZgRerrUp*ZgRerrUp))); YieldTotal_Rel_ErrUp=YieldTotalErrUp/YieldTotalNew; YieldTotalErrLow=NobservedNew*(sqrt((ZgR*ZgR*totalPurityErr*totalPurityErr)+(totalPurity*totalPurity*ZgRerrLow*ZgRerrLow))); YieldTotal_Rel_ErrLow=YieldTotalErrLow/YieldTotalNew; } double YieldErrWithStat=0; double YieldErrWithStatUp=0; double YieldErrWithStatLow=0; double NobsErr=sqrt(Nobserved); YieldErrWithStat=sqrt((ZgR*totalPurity*NobsErr)*(ZgR*totalPurity*NobsErr) + (Nobserved*totalPurity*ZgRerr)*(Nobserved*totalPurity*ZgRerr) + (Nobserved*ZgR*totalPurityErr)*(Nobserved*ZgR*totalPurityErr)); YieldErrWithStatUp=sqrt((ZgR*totalPurity*NobsErr)*(ZgR*totalPurity*NobsErr) + (Nobserved*totalPurity*ZgRerrUp)*(Nobserved*totalPurity*ZgRerrUp) + (Nobserved*ZgR*totalPurityErr)*(Nobserved*ZgR*totalPurityErr)); YieldErrWithStatLow=sqrt((ZgR*totalPurity*NobsErr)*(ZgR*totalPurity*NobsErr) + (Nobserved*totalPurity*ZgRerrLow)*(Nobserved*totalPurity*ZgRerrLow) + (Nobserved*ZgR*totalPurityErr)*(Nobserved*ZgR*totalPurityErr)); ZgRwSF[ibin-1]=ZgR; ZgRwSF_sys_ErrUp[ibin-1]=ZgRcorelErrup; ZgRwSF_sys_ErrLow[ibin-1]=ZgRcorelErrlow; ZgRwSF_stat_Err[ibin-1]=ZgRuncorelErr; binNumber[ibin-1]=ibin; YieldEstimated[ibin-1]=YieldTotal; YieldErrUp_Estimated[ibin-1]=YieldErrWithStatUp; YieldErrLow_Estimated[ibin-1]=YieldErrWithStatLow; YieldPredMC[ibin-1]=ZinvMCYield; YieldErrUp_PredMC[ibin-1]=ZinvMCYieldErr; YieldErrLow_PredMC[ibin-1]=ZinvMCYieldErr; XErrLow[ibin-1]=0.5; XErrUp[ibin-1]=0.5; printf(" %i :%i |%i| %4.3f(%4.3f) |%i| %4.3f(%4.3f) |%4.3f(%4.3f,+%4.3f-%4.3f)| %4.3f(%4.3f) |%4.3f(%4.3f)| %4.3f(+%4.3f-%4.3f) |%4.3f(%4.3f)",ibin,Nobserved, EBobs,pEB,pEB_Rel_err,ECobs,pEC,pEC_Rel_err, ZgR,ZgRuncorel_Rel_Err,ZgRcorel_Rel_Errup,ZgRcorel_Rel_Errlow,f,f_Rel_err,totalPurity,totalPurity_Rel_Err,YieldTotal,YieldTotal_Rel_ErrUp,YieldTotal_Rel_ErrLow,ZinvMCYield,ZinvMCYield_Rel_Err); //printf("%4.3f",ZinvMCYield); //printf("bin %i :%i | %4.3f(%4.3f) | %4.3f(%4.3f) | %4.2f(%4.3f) ",ibin,Nobserved,ZgR,ZgRerr,totalPurity,totalPurityErr,YieldTotal,YieldTotalErr); //printf("bin %i :%i | %4.3f(%4.3f,+%4.3f-%4.3f) | %4.3f(%4.3f) | %4.2f(+%4.3f-%4.3f) ",ibin,Nobserved,ZgR,ZgRuncorel_Rel_Err,ZgRcorel_Rel_Errup,ZgRcorel_Rel_Errlow,totalPurity,totalPurity_Rel_Err,YieldTotal,YieldTotal_Rel_ErrUp,YieldTotal_Rel_ErrLow); cout<<endl; double Percent=(int)round(100*(YieldTotalErr/YieldTotal)); double maxErrorYield=max(YieldErrWithStatUp,YieldErrWithStatLow); ZinvEstimate->SetBinContent(ibin,YieldTotal); ZinvEstimate->SetBinError(ibin,maxErrorYield); /////////////////endcap ends }//loop over bin error calculation ////////////////////////Pred vs Estimated TPaveText *tpa = new TPaveText(0.5056522,0.6247818,0.829097,0.8970332,"brNDC"); tpa->SetBorderSize(0); tpa->SetFillStyle(0); tpa->SetTextAlign(11); tpa->SetTextFont(42); tpa->SetTextSize(0.04); tpa->AddText("HT >500"); tpa->AddText("N_{jets} >=4"); tpa->AddText("MHT>200"); tpa->AddText("Btags=0"); tpa->AddText("#Delta #Phi_{1,2,3,4}>(0.5,0.5,0.3,0.3)"); TPaveText *pCMS = new TPaveText(0.132107,0.9308003,0.8327759,0.9923583,"brNDC"); pCMS->SetBorderSize(0); pCMS->SetFillStyle(0); pCMS->SetTextAlign(11); pCMS->SetTextFont(42); pCMS->SetTextSize(0.04); pCMS->AddText("CMS #it{Preliminary} 1.3 fb^{-1} #sqrt{s}= 13 TeV"); TLegend *legP = new TLegend(0.2173913,0.2478185,0.5167224,0.4363002,NULL,"brNDC"); legP->SetBorderSize(0); legP->SetTextFont(62); legP->SetTextSize(0.03); legP->SetLineColor(1); legP->SetLineStyle(1); legP->SetLineWidth(3); legP->SetFillColor(0); legP->SetFillStyle(1001); cout<<"Est: "<<ZinvEstimate->Integral()<<endl; cout<<"Pred: "<<h_NZinv18binC->Integral()<<endl; //////////////////////////////////ZGammaRatio c_ZgRwSF = new TCanvas("c_ZgRwSF","c_ZgRwSF"); c_ZgRwSF->cd(); gr_ZgRwSFsys = new TGraphAsymmErrors(NumBins,binNumber,ZgRwSF,XErrLow,XErrUp,ZgRwSF_sys_ErrLow,ZgRwSF_sys_ErrUp); gr_ZgRwSFsys->SetTitle("ZgammaRatio"); gr_ZgRwSFsys->SetMarkerColor(4); gr_ZgRwSFsys->SetLineColor(4); gr_ZgRwSFsys->SetMarkerStyle(21); gr_ZgRwSFstat = new TGraphAsymmErrors(NumBins,binNumber,ZgRwSF,XErrLow,XErrUp,ZgRwSF_stat_Err,ZgRwSF_stat_Err); gr_ZgRwSFstat->SetTitle("ZgammaRatio"); gr_ZgRwSFstat->SetMarkerColor(2); gr_ZgRwSFstat->SetLineColor(2); gr_ZgRwSFstat->SetMarkerStyle(21); TLegend *legPZgR = new TLegend(0.2173913,0.7478185,0.5167224,0.8563002,NULL,"brNDC"); legPZgR->SetBorderSize(0); legPZgR->SetTextFont(62); legPZgR->SetTextSize(0.03); legPZgR->SetLineColor(1); legPZgR->SetLineStyle(1); legPZgR->SetLineWidth(3); legPZgR->SetFillColor(0); legPZgR->SetFillStyle(1001); legPZgR->AddEntry(gr_ZgRwSFsys,"Sys Error","l"); legPZgR->AddEntry(gr_ZgRwSFstat,"Stat Error","l"); TMultiGraph *mgZgR=new TMultiGraph(); mgZgR->SetTitle(" ;ith Bin ; Z/#gamma Ratio "); mgZgR->Add(gr_ZgRwSFstat); mgZgR->Add(gr_ZgRwSFsys); mgZgR->Draw("AP"); tpa->Draw(); pCMS->Draw(); legPZgR->Draw(); c_ZgRwSF->SaveAs("ZGammaRatioWSF.png"); c_ZgRwSF->SaveAs("ZGammaRatioWSF.pdf"); c_ZgRwSF->SaveAs("ZGammaRatioWSF.gif"); ///////////////////////////////ZGammaRatio cPredVsEstimated = new TCanvas("estvspred","estvspred"); TPad *pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); pad1->SetBottomMargin(0); // Upperand lower plot are joined pad1->Draw(); // Draw the upper pad: pad1 gPad->Update(); pad1->cd(); // pad1 becomes the current pad gPad->DrawFrame(0.5, 0.01, 18.5, 2000, "PredVsEst;ith Bin;Events"); gPad->SetLogy(); gr_estimated = new TGraphAsymmErrors(NumBins,binNumber,YieldEstimated,XErrLow,XErrUp,YieldErrLow_Estimated,YieldErrUp_Estimated); gr_estimated->SetTitle("Estimated"); gr_estimated->SetMarkerColor(4); gr_estimated->SetLineColor(4); gr_estimated->SetMarkerStyle(21); gr_mcPred = new TGraphAsymmErrors(NumBins,binNumber,YieldPredMC,XErrLow,XErrUp,YieldErrLow_PredMC,YieldErrUp_PredMC); gr_mcPred->SetTitle("MC predicted"); gr_mcPred->SetMarkerColor(2); gr_mcPred->SetLineColor(2); gr_mcPred->SetMarkerStyle(8); legP->AddEntry(gr_mcPred,"Zinv MC Pred ","P"); legP->AddEntry(gr_estimated,"Estimated(from #gamma +Jets)","P"); char TMgname1[100]; TMultiGraph *TMg_1D[2]; for(int k0=0;k0<2;k0++){ sprintf(TMgname1,"TMg_1D%i",k0); TMg_1D[k0]=new TMultiGraph(); } for(int j0=0;j0<2;j0++){ TMg_1D[j0]->SetMinimum(0.01); TMg_1D[j0]->SetMaximum(2000); } TMg_1D[0]->SetTitle(" ;ith Bin ; Events "); TMg_1D[0]->Add(gr_mcPred); TMg_1D[0]->Add(gr_estimated); TMg_1D[0]->Draw("AP"); TMg_1D[0]->GetXaxis()->SetLimits(0.5,18.5); tpa->Draw(); pCMS->Draw(); legP->Draw(); TGaxis *axis = new TGaxis( -5, 20, -5, 220, 20,220,510,""); axis->SetLabelFont(43); // Absolute font size in pixel (precision 3) axis->SetLabelSize(15); axis->Draw(); cPredVsEstimated->cd(); TPad *pad2 = new TPad("pad2", "pad2", 0, 0.05, 1, 0.3); pad2->SetTopMargin(0); pad2->SetBottomMargin(0.2); pad2->SetGridy(); // vertical grid pad2->Draw(); pad2->cd(); // pad2 becomes the current pad TH1F *h3 = (TH1F*)h_NZinv18binC->Clone("h3"); h3->SetLineColor(kBlack); h3->SetMinimum(-1); // Define Y .. h3->SetMaximum(3); // .. range h3->Sumw2(); h3->SetStats(0); // No statistics on lower plot h3->Divide(ZinvEstimate); h3->SetMarkerStyle(21); h3->SetMarkerColor(1); h3->Draw("ep"); // Draw the r h3->GetXaxis()->SetTitle("ith Bin"); // Remove the ratio title // Y axis ratio plot settings h3->GetYaxis()->SetTitle("Pred/Est"); h3->GetYaxis()->SetNdivisions(505); h3->GetYaxis()->SetTitleSize(20); h3->GetYaxis()->SetTitleFont(43); h3->GetYaxis()->SetTitleOffset(1.55); h3->GetYaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3) h3->GetYaxis()->SetLabelSize(15); // X axis ratio plot settings h3->GetXaxis()->SetTitleSize(20); h3->GetXaxis()->SetTitleFont(43); h3->GetXaxis()->SetTitleOffset(3.); h3->GetXaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3) h3->GetXaxis()->SetLabelSize(15); cPredVsEstimated->SaveAs("PredVsEstimated.png"); cPredVsEstimated->SaveAs("PredVsEstimated.gif"); cPredVsEstimated->SaveAs("ZPredVsEstimated.pdf"); /////////////////////////////Fill the empty bins with simulated data TCanvas *c[20]; int a; double promptfrac=hSieta_GJetsEB->Integral()/(hSieta_GJetsEB->Integral()+hSieta_QCDEB->Integral()); cout<<"prompt fraction: "<<promptfrac<<endl; plot.plotHist(hHT_Data,hHT_GJets,hHT_QCD,c[0],"","Data","MC","HT"); plot.plotHist(hMHT_Data,hMHT_GJets,hMHT_QCD,c[1],"","Data","MC","MHT"); plot.plotHist(hNJets_Data,hNJets_GJets,hNJets_QCD,c[2],"","Data","MC","Njets"); plot.plotHist(hSieta_DataEB,hSieta_GJetsEB,hSieta_QCDEB,c[3],"EB","Data","MC","SigmaIetaIeta_EB"); plot.plotHist(hSieta_DataEBLow,hSieta_GJetsEBLow,hSieta_QCDEBLow,c[4],"Low-MHT-EB","Data","MC","SigmaIetaIeta_EB"); plot.plotHist(hSieta_DataEBMed,hSieta_GJetsEBMed,hSieta_QCDEBMed,c[5],"Med-MHT-EB","Data","MC","SigmaIetaIeta_EB"); plot.plotHist(hSieta_DataEBHigh,hSieta_GJetsEBHigh,hSieta_QCDEBHigh,c[6],"High-MHT-EB","Data","MC","SigmaIetaIeta_EB"); plot.plotHist(hSieta_DataEC,hSieta_GJetsEC,hSieta_QCDEC,c[7],"EE","Data","MC","SigmaIetaIeta_EE"); plot.plotHist(hSieta_DataECLow,hSieta_GJetsECLow,hSieta_QCDECLow,c[8],"Low-MHT-EE","Data","MC","SigmaIetaIeta_EE"); plot.plotHist(hSieta_DataECMed,hSieta_GJetsECMed,hSieta_QCDECMed,c[9],"Med-MHT-EE","Data","MC","SigmaIetaIeta_EE"); plot.plotHist(hSieta_DataECHigh,hSieta_GJetsECHigh,hSieta_QCDECHigh,c[10],"High-MHT-EE","Data","MC","SigmaIetaIeta_EE"); plot.plotHist(hPhPt_DataEB,hPhPt_GJetsEB,hPhPt_QCDEB,c[11],"EB","Data","MC","PhotonPt_EB"); plot.plotHist(hPhPt_DataEC,hPhPt_GJetsEC,hPhPt_QCDEC,c[12],"EE","Data","MC","PhotonPt_EE"); plot.plotHist(h_Ndata18binEB,h_NGJets18binEB,h_NQCD18binEB,c[13],"EB","Data","MC","ith-Bin-EB"); plot.plotHist(h_Ndata18binEC,h_NGJets18binEC,h_NQCD18binEC,c[14],"EE","Data","MC","ith-Bin-EE"); }//main programme
void compareMet(){ gStyle->SetOptStat(0); bool isData = true; char* file = "output/v8/ZJets_baby.root"; if( isData ) file = "../../metTemplate/output/v8/lepdata_skim_baby.root"; //if( isData ) file = "../output/V00-00-00/lepdata_skim_baby.root"; //if( isData ) file = "output/uaf/lepdata_skim_baby.root"; //if( isData ) file = "output/v8/lepdata_skim_nov4_baby_nov4json.root"; //if( isData ) file = "output/uaf/lepdata_skim_baby.root"; //if( isData ) file = "lepdata_skim_Nov4_baby.root"; cout << "Adding " << file << endl; TFile *f = TFile::Open( file ); TH1F* hee = new TH1F("hee","",75,0,150); TH1F* hmm = new TH1F("hmm","",75,0,150); TH1F* hem = new TH1F("hem","",75,0,150); TCut sel("njets>-1"); TCut ee("leptype==0&&jetptll-ptll>-5&&jetptlt-ptlt>-5&&dilmass>81&&dilmass<101"); //TCut ee("leptype==0&&dilmass>81&&dilmass<101"); TCut mm("leptype==1&&nmatchedpfmuons==2&&dilmasspf>81&&dilmasspf<101"); TCut em("leptype==2&&nmatchedpfmuons==1&&dilmass>81&&dilmass<101"); //TCut ee("leptype==0&&jetptll-ptll>-5&&jetptlt-ptlt>-5"); //TCut mm("leptype==1&&nmatchedpfmuons==2"); //TCut em("leptype==2&&nmatchedpfmuons==1"); //TCut weight("weight"); TCut weight("1"); TCanvas *c1 = new TCanvas(); c1->cd(); TPad *plotpad = new TPad("plotpad","plotpad",0.0,0.0,1.0,0.8); plotpad->Draw(); plotpad->cd(); TTree* T1 = (TTree*) f->Get("T1"); T1->Draw("TMath::Min(pfmet,149.99)>>hee",(sel+ee)*weight); T1->Draw("TMath::Min(pfmet,149.99)>>hmm",(sel+mm)*weight); T1->Draw("TMath::Min(pfmet,149.99)>>hem",(sel+em)*weight); hee->Sumw2(); hmm->Sumw2(); hem->Sumw2(); hmm->Draw(); hmm->GetXaxis()->SetTitle("pfmet (GeV)"); hee->SetLineColor(2); hee->SetMarkerColor(2); hem->SetLineColor(4); hem->SetMarkerColor(4); hmm->SetMarkerStyle(20); hem->SetMarkerStyle(24); hmm->SetMarkerSize(0.7); hee->Draw("samehist"); hem->Draw("same"); gPad->SetLogy(1); TLegend *leg = new TLegend(0.6,0.65,0.8,0.85); leg->AddEntry(hee,"ee","l"); leg->AddEntry(hmm,"#mu#mu"); leg->AddEntry(hem,"e#mu"); leg->SetFillColor(0); leg->SetBorderSize(1); leg->Draw(); // TLatex *t = new TLatex(); // t->SetNDC(); // if( isData ){ // t->DrawLatex(0.4,0.6, "CMS"); // //t->DrawLatex(0.4,0.53, "Selected Z+#geq2jet Events (DATA)"); // t->DrawLatex(0.4,0.53, "Selected Z Events (DATA)"); // t->DrawLatex(0.4,0.46, "34.0 pb^{-1} at #sqrt{s} = 7 TeV"); // }else{ // t->DrawLatex(0.4,0.6, "CMS"); // t->DrawLatex(0.4,0.53,"Selected Z+0jet Events (Z+jets MC)"); // } c1->cd(); TPad *pullpad = new TPad("pullpad","pullpad",0.0,0.8,1.0,1.0); pullpad->Draw(); pullpad->cd(); TH1F* hratio = (TH1F*) hmm->Clone(); hratio->Divide(hee); hratio->Draw(); gPad->SetGridy(); hratio->SetMinimum(0.8); hratio->SetMaximum(1.6); hratio->GetYaxis()->SetLabelSize(0.15); hratio->GetYaxis()->SetNdivisions(7); hratio->GetYaxis()->SetTitle("#mu#mu / ee "); hratio->GetXaxis()->SetTitle(""); hratio->GetYaxis()->SetTitleSize(0.2); hratio->GetYaxis()->SetTitleOffset(0.2); float cut1 = 30; float cut2 = 60; float cut3 = 120; int bin1 = hee->FindBin(cut1); int bin2 = hee->FindBin(cut2); int bin3 = hee->FindBin(cut3); cout << "ee tot " << hee->Integral() << endl; cout << "ee met>30 GeV " << hee->Integral(bin1,1000) << endl; cout << "ee met>60 GeV " << hee->Integral(bin2,1000) << endl; cout << "ee met>120 GeV " << hee->Integral(bin3,1000) << endl; cout << "mm tot " << hmm->Integral() << endl; cout << "mm met>30 GeV " << hmm->Integral(bin1,1000) << endl; cout << "mm met>60 GeV " << hmm->Integral(bin2,1000) << endl; cout << "mm met>120 GeV " << hmm->Integral(bin3,1000) << endl; int width1 = 15; int width2 = 5; cout << "|" << setw(width1) << "" << setw(width2) << "|" << setw(width1) << Form("N(met>%.0f GeV)",cut1) << setw(width2) << "|" << setw(width1) << Form("N(met>%.0f GeV)",cut2) << setw(width2) << "|" << setw(width1) << Form("N(met>%.0f GeV)",cut3) << setw(width2) << "|" << endl; cout << "|" << setw(width1) << "ee" << setw(width2) << "|" << setw(width1) << hee->Integral(bin1,1000) << setw(width2) << "|" << setw(width1) << hee->Integral(bin2,1000) << setw(width2) << "|" << setw(width1) << hee->Integral(bin3,1000) << setw(width2) << "|" << endl; cout << "|" << setw(width1) << "mm" << setw(width2) << "|" << setw(width1) << hmm->Integral(bin1,1000) << setw(width2) << "|" << setw(width1) << hmm->Integral(bin2,1000) << setw(width2) << "|" << setw(width1) << hmm->Integral(bin3,1000) << setw(width2) << "|" << endl; cout << "|" << setw(width1) << "em" << setw(width2) << "|" << setw(width1) << hem->Integral(bin1,1000) << setw(width2) << "|" << setw(width1) << hem->Integral(bin2,1000) << setw(width2) << "|" << setw(width1) << hem->Integral(bin3,1000) << setw(width2) << "|" << endl; }
int main() { ModTDRStyle(); std::vector<Scan> scans; //scans.push_back({"higgsCombinefullScan.MultiDimFit.mH125.root", "with syst.", 1, nullptr}); //scans.push_back({"higgsCombinefastScan.MultiDimFit.mH125.root", "no syst.", 32, nullptr}); //scans.push_back({"higgsCombinenoBBBScan.MultiDimFit.mH125.root", "no bbb syst.", 38, nullptr}); // scans.push_back({"thesis/higgsCombineFullScan.MultiDimFit.mH125.root", "Stat+Syst+Theory", 1, nullptr}); scans.push_back({"higgsCombineFullScan.MultiDimFit.mH125.root", "Mass Scan", kAzure-4, nullptr}); // scans.push_back({"higgsCombineStatOnly.MultiDimFit.mH125.root", "Stat Only", kBlue+1, nullptr}); //scans.push_back({"thesis/higgsCombineStatAndTh.MultiDimFit.mH125.root", "Stat+Theory", 39, nullptr}); TCanvas c1("canvas","canvas"); std::vector<TLine *> lines; TLegend *leg = new TLegend(0.37,0.65,0.73,0.9,"","brNDC"); unsigned counter = 0; for (auto & sc : scans) { TFile f1(sc.file.c_str()); TTree *t1 = dynamic_cast<TTree*>(f1.Get("limit")); double best1 = 0.0; sc.gr = new TGraph(ExtractGraph(t1, best1)); auto x1 = GetCrossings(*(sc.gr), 1.0); TString res; if (x1.size() == 2) { double err = (x1[1]-x1[0])/2.0; std::cout << "Best fit is: " << best1 << " +/- " << err << std::endl; lines.push_back(new TLine(x1[0],0,x1[0],1.0)); lines.back()->SetLineColor(sc.color); lines.back()->SetLineWidth(2); lines.push_back(new TLine(x1[1],0,x1[1],1.0)); lines.back()->SetLineColor(sc.color); lines.back()->SetLineWidth(2); res = TString::Format("%.1f#pm%.1f",best1,err); } sc.gr->SetLineColor(sc.color); sc.gr->SetLineWidth(3); sc.gr->Draw(counter ? "LSAME" : "AL"); TString leg_text = "#splitline{"+sc.label+"}{"+res+"}"; leg->AddEntry(sc.gr, leg_text, "L"); counter++; } // c1.cd(); // // g1.Print(); // g1.SetLineColor(1); // g1.SetLineWidth(2); // // g1.SetMarkerColor(7); // g1.Draw("AC"); scans[0].gr->SetMaximum(4); scans[0].gr->GetXaxis()->SetRangeUser(110, 130); // scans[0].gr->GetXaxis()->SetTitle("Signal Strength, #mu"); scans[0].gr->GetXaxis()->SetTitle("m_{H} [GeV]"); scans[0].gr->GetYaxis()->SetTitle("-2 #Delta ln L"); scans[0].gr->GetXaxis()->SetTitleFont(62); scans[0].gr->GetYaxis()->SetTitleFont(62); leg->SetBorderSize(1); leg->SetTextFont(42); leg->SetTextSize(0.03); leg->SetLineColor(0); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); leg->Draw(); lines.push_back(new TLine(110,1,130,1)); lines.back()->SetLineColor(2); for (auto l : lines) l->Draw(); TLatex *title_latex = new TLatex(); title_latex->SetNDC(); title_latex->SetTextSize(0.035); title_latex->SetTextFont(62); title_latex->SetTextAlign(31); double height = 0.94; title_latex->DrawLatex(0.95,height,"19.7 fb^{-1} (8 TeV) + 4.9 fb^{-1} (7 TeV)"); title_latex->SetTextAlign(11); title_latex->DrawLatex(0.17,height,"H#rightarrow#tau#tau"); title_latex->SetTextSize(0.08); title_latex->DrawLatex(0.21, 0.25, "#mu#tau_{h}"); c1.Update(); c1.SaveAs("scan.pdf"); return 0; }
void DrawNCLUSTER() { //=========Macro generated from canvas: r1/Energy //========= (Fri Apr 6 17:14:48 2012) by ROOT version5.28/00g TCanvas *r1 = new TCanvas("r1", "Ncluster",12,24,550,741); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetFrameLineWidth(1); r1->Range(0,0,1,1); r1->SetFillColor(0); r1->SetBorderMode(0); r1->SetBorderSize(0); r1->SetTickx(1); r1->SetTicky(1); r1->SetLeftMargin(0.16); r1->SetRightMargin(0.01); r1->SetTopMargin(0.0256917); r1->SetBottomMargin(0.07692308); r1->SetFrameBorderMode(); // ------------>Primitives in pad: r1_1 TPad *r1_1 = new TPad("r1_1", "Energy_1",0.02,0.37,0.95,0.99); r1_1->Draw(); r1_1->cd(); r1_1->Range(-19,0.01,95,95); r1_1->SetFillColor(0); r1_1->SetBorderMode(0); r1_1->SetBorderSize(2); r1_1->SetTickx(1); r1_1->SetTicky(1); r1_1->SetLeftMargin(0.16); r1_1->SetRightMargin(0.01); r1_1->SetTopMargin(0.02); r1_1->SetBottomMargin(0); r1_1->SetFrameBorderMode(0); r1_1->SetFrameBorderMode(0); TH1D *he = new TH1D("he"," ",55,0,55); he->SetMinimum(0.01); he->SetMaximum(70); he->SetStats(0); he->GetXaxis()->SetTitle("E_{beam} [GeV]"); he->GetXaxis()->SetLabelFont(43); he->GetXaxis()->SetLabelSize(0); he->GetXaxis()->SetTitleFont(43); he->GetXaxis()->SetTitleSize(0); he->GetYaxis()->SetTitle("<N_{cluster}>"); he->GetYaxis()->SetLabelFont(43); he->GetYaxis()->SetTitleSize(30); he->GetYaxis()->SetLabelSize(20); he->GetYaxis()->SetTitleFont(43); he->GetYaxis()->SetTitleOffset(1.7); he->GetZaxis()->SetLabelFont(42); he->GetZaxis()->SetTitleSize(0.05); he->GetZaxis()->SetTitleFont(42); he->Draw(""); std::vector<result> resultData=readTXT(std::string("ncluster_augsep2012_electron.txt")); TGraphErrors *gre = new TGraphErrors(resultData.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetLineColor(1); gre->SetFillStyle(1); gre->SetFillColor(1); gre->SetLineWidth(2); gre->SetMarkerColor(1); gre->SetMarkerStyle(34); gre->SetMarkerSize(1.2); for(unsigned int i=0; i<resultData.size(); i++){ gre->SetPoint(i,resultData.at(i).ebeam,resultData.at(i).ncluster); gre->SetPointError(i,0,resultData.at(i).nclusterError); } TH1F *Graph_Graph3 = new TH1F("Graph_Graph3","Graph",100,0,87.5); Graph_Graph3->SetMinimum(0); Graph_Graph3->SetMaximum(1193.483); Graph_Graph3->SetDirectory(0); Graph_Graph3->SetStats(0); Graph_Graph3->GetXaxis()->SetLabelFont(42); Graph_Graph3->GetXaxis()->SetTitleSize(0.05); Graph_Graph3->GetXaxis()->SetTitleFont(42); Graph_Graph3->GetYaxis()->SetLabelFont(42); Graph_Graph3->GetYaxis()->SetTitleSize(0.05); Graph_Graph3->GetYaxis()->SetTitleFont(42); Graph_Graph3->GetZaxis()->SetLabelFont(42); Graph_Graph3->GetZaxis()->SetTitleSize(0.05); Graph_Graph3->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph3); gre->Draw("p"); std::vector<result> resultFTFP=readTXT(std::string("ncluster_ftfp_bert_hp_electron.txt")); gre = new TGraphErrors(resultFTFP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetFillColor(kRed-3); gre->SetMarkerColor(kRed-3); gre->SetLineWidth(2); gre->SetMarkerStyle(20); for(unsigned int i=0; i<resultFTFP.size(); i++){ gre->SetPoint(i,resultFTFP.at(i).ebeam,resultFTFP.at(i).ncluster); gre->SetPointError(i,0,resultFTFP.at(i).nclusterError); } TH1F *Graph1 = new TH1F("Graph1","Graph",100,0,87.17072); Graph1->SetMinimum(2.655724); Graph1->SetMaximum(88.56778); Graph1->SetDirectory(0); Graph1->SetStats(0); Graph1->GetXaxis()->SetLabelFont(42); Graph1->GetXaxis()->SetTitleSize(0.05); Graph1->GetXaxis()->SetTitleFont(42); Graph1->GetYaxis()->SetLabelFont(42); Graph1->GetYaxis()->SetTitleSize(0.05); Graph1->GetYaxis()->SetTitleFont(42); Graph1->GetZaxis()->SetLabelFont(42); Graph1->GetZaxis()->SetTitleSize(0.05); Graph1->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph1); gre->Draw("p"); std::vector<result> resultQGSP=readTXT(std::string("ncluster_qgsp_bert_hp_electron.txt")); gre = new TGraphErrors(resultQGSP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetFillColor(kBlue-6); gre->SetMarkerColor(kBlue-6); gre->SetLineWidth(2); gre->SetMarkerStyle(25); for(unsigned int i=0; i<resultQGSP.size(); i++){ gre->SetPoint(i,resultQGSP.at(i).ebeam,resultQGSP.at(i).ncluster); gre->SetPointError(i,0,resultQGSP.at(i).nclusterError); } TH1F *Graph_Graph2 = new TH1F("Graph_Graph2","Graph",100,0,87.5); Graph_Graph2->SetMinimum(0); Graph_Graph2->SetMaximum(1193.483); Graph_Graph2->SetDirectory(0); Graph_Graph2->SetStats(0); Graph_Graph2->GetXaxis()->SetLabelFont(42); Graph_Graph2->GetXaxis()->SetTitleSize(0.05); Graph_Graph2->GetXaxis()->SetTitleFont(42); Graph_Graph2->GetYaxis()->SetLabelFont(42); Graph_Graph2->GetYaxis()->SetTitleSize(0.05); Graph_Graph2->GetYaxis()->SetTitleFont(42); Graph_Graph2->GetZaxis()->SetLabelFont(42); Graph_Graph2->GetZaxis()->SetTitleSize(0.05); Graph_Graph2->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph2); gre->Draw("p"); TLegend *leg = new TLegend(0.15,0.7,0.75,0.9,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(62); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(0); TLegendEntry *entry=leg->AddEntry("Graph_Graph3","SDHCAL DATA (H6 Cern SPS)","p"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(34); entry->SetMarkerSize(1.2); entry=leg->AddEntry("Graph1","FTFP_BERT_HP","p"); entry->SetLineColor(kRed-3); entry->SetLineStyle(kRed-3); entry->SetLineWidth(kRed-3); entry->SetMarkerColor(kRed-3); entry->SetMarkerStyle(20); entry->SetMarkerSize(1.0); entry=leg->AddEntry("Graph_Graph2","QGSP_BERT_HP","p"); entry->SetLineColor(kBlue-6); entry->SetLineStyle(kBlue-6); entry->SetLineWidth(kBlue-6); entry->SetMarkerColor(kBlue-6); entry->SetMarkerStyle(25); entry->SetMarkerSize(0.9); leg->Draw(); TText *tex=new TText(); tex->SetTextSize(0.05); tex->SetTextColor(kGray+2); //tex->DrawTextNDC(0.5,0.05,"SDHCAL Preliminary"); tex->DrawTextNDC(0.3,0.05,"CALICE Fe-SDHCAL Preliminary"); r1_1->Modified(); r1->cd(); // ------------>Primitives in pad: r1_2 TPad *r1_2 = new TPad("r1_2", "Energy_2",0.02,0.0,0.95,0.38); r1_2->Draw(); r1_2->cd(); r1_2->Range(-19,-0.06545455,95,0.048); r1_2->SetFillColor(0); r1_2->SetBorderMode(0); r1_2->SetBorderSize(2); r1_2->SetTickx(1); r1_2->SetTicky(1); r1_2->SetLeftMargin(0.16); r1_2->SetRightMargin(0.01); r1_2->SetTopMargin(0.0); r1_2->SetBottomMargin(0.23); r1_2->SetFrameBorderMode(0); r1_2->SetFrameBorderMode(0); TH1D *hd = new TH1D("hd"," ",55,0,55); hd->SetMinimum(-0.20); hd->SetMaximum(0.20); hd->SetStats(0); hd->GetXaxis()->SetTitle("E_{beam} [GeV]"); hd->GetXaxis()->SetLabelFont(43); hd->GetXaxis()->SetLabelSize(20); hd->GetXaxis()->SetTitleFont(43); hd->GetXaxis()->SetTitleSize(30); hd->GetXaxis()->SetTitleOffset(2.); hd->GetYaxis()->SetTitle("(#DeltaN_{cluster})/N_{data}"); hd->GetYaxis()->SetLabelFont(43); hd->GetYaxis()->SetLabelSize(20); hd->GetYaxis()->SetTitleSize(30); hd->GetYaxis()->SetTitleOffset(1.7); hd->GetYaxis()->SetTitleFont(43); hd->GetYaxis()->SetNdivisions(505); hd->GetZaxis()->SetLabelFont(42); hd->GetZaxis()->SetTitleSize(0.05); hd->GetZaxis()->SetTitleFont(42); hd->Draw(""); float deltaError; float delta; gre = new TGraphErrors(resultQGSP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); for(unsigned int i=0; i<resultQGSP.size(); i++){ delta=(resultQGSP.at(i).ncluster-resultData.at(i).ncluster)/resultData.at(i).ncluster; deltaError=1/resultData.at(i).ncluster* sqrt(pow(resultQGSP.at(i).nclusterError,2) + pow(resultQGSP.at(i).ncluster/resultData.at(i).ncluster*resultData.at(i).nclusterError,2)); gre->SetPoint(i,resultQGSP.at(i).ebeam,delta); gre->SetPointError(i,0,deltaError); } gre->SetLineWidth(2); gre->SetLineColor(kBlue-6); gre->SetMarkerColor(kBlue-6); gre->SetMarkerSize(1.0); gre->SetMarkerStyle(25); gre->Draw("p"); gre = new TGraphErrors(resultFTFP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); for(unsigned int i=0; i<resultFTFP.size(); i++){ delta=(resultFTFP.at(i).ncluster-resultData.at(i).ncluster)/resultData.at(i).ncluster; deltaError=1/resultData.at(i).ncluster* sqrt(pow(resultFTFP.at(i).nclusterError,2) + pow(resultFTFP.at(i).ncluster/resultData.at(i).ncluster*resultData.at(i).nclusterError,2)); gre->SetPoint(i,resultFTFP.at(i).ebeam,delta); gre->SetPointError(i,0,deltaError); } gre->SetLineWidth(2); gre->SetLineColor(kRed-3); gre->SetMarkerColor(kRed-3); gre->SetMarkerSize(1.0); gre->SetMarkerStyle(20); gre->Draw("p"); TF1 *lin1 = new TF1("lin1","0",-0.01,95); lin1->SetFillColor(19); lin1->SetFillStyle(0); lin1->SetLineWidth(1); lin1->SetLineStyle(1); lin1->SetLineColor(1); lin1->GetXaxis()->SetLabelFont(42); lin1->GetXaxis()->SetTitleSize(0.05); lin1->GetXaxis()->SetTitleFont(42); lin1->GetYaxis()->SetLabelFont(42); lin1->GetYaxis()->SetTitleSize(0.05); lin1->GetYaxis()->SetTitleFont(42); lin1->Draw("same"); lin1 = new TF1("lin1","0.1",0.01,95); lin1->SetFillColor(1); lin1->SetFillStyle(0); lin1->SetLineWidth(1); lin1->SetLineStyle(2); lin1->SetLineColor(17); lin1->GetXaxis()->SetLabelFont(42); lin1->GetXaxis()->SetTitleSize(0.05); lin1->GetXaxis()->SetTitleFont(42); lin1->GetYaxis()->SetLabelFont(42); lin1->GetYaxis()->SetTitleSize(0.05); lin1->GetYaxis()->SetTitleFont(42); lin1->Draw("same"); lin1 = new TF1("lin1","-0.1",0.01,95); lin1->SetFillColor(1); lin1->SetFillStyle(0); lin1->SetLineWidth(1); lin1->SetLineStyle(2); lin1->SetLineColor(17); lin1->GetXaxis()->SetLabelFont(42); lin1->GetXaxis()->SetTitleSize(0.05); lin1->GetXaxis()->SetTitleFont(42); lin1->GetYaxis()->SetLabelFont(42); lin1->GetYaxis()->SetTitleSize(0.05); lin1->GetYaxis()->SetTitleFont(42); lin1->Draw("same"); r1_2->Modified(); r1->cd(); r1->Modified(); r1->cd(); r1->SetSelected(r1); r1->SaveAs("../plots/NCLUSTERELECTRON.pdf"); }
void makePlots( const char * model, const char * src, const char * infile , const char * option ) { //Output path TString path("./paper01-plots/probs/"); TString dataPee = TString( model ) + TString("_") + TString( src ) + TString("_Pee/data"); TString dataPem = TString( model ) + TString("_") + TString( src ) + TString("_Pem/data"); TString dataPet = TString( model ) + TString("_") + TString( src ) + TString("_Pet/data"); TString dataAPee = TString( model ) + TString("_") + TString( src ) + TString("_aPee/data"); TString dataAPem = TString( model ) + TString("_") + TString( src ) + TString("_aPem/data"); TString dataAPet = TString( model ) + TString("_") + TString( src ) + TString("_aPet/data"); TList * v_Labels = new TList(); TObjString *label; label = new TObjString( "Pee" ); v_Labels->Add( label ); label = new TObjString( "Pe#mu" ); v_Labels->Add( label ); label = new TObjString( "Pe#tau" ); v_Labels->Add( label ); TFile * f1 = new TFile(infile); f1->cd(); TTree * PeeTreeNu = (TTree*)gDirectory->Get( dataPee.Data() ); TTree * PemTreeNu = (TTree*)gDirectory->Get( dataPem.Data() ); TTree * PetTreeNu = (TTree*)gDirectory->Get( dataPet.Data() ); TTree * PeeTreeANu = (TTree*)gDirectory->Get( dataAPee.Data() ); TTree * PemTreeANu = (TTree*)gDirectory->Get( dataAPem.Data() ); TTree * PetTreeANu = (TTree*)gDirectory->Get( dataAPet.Data() ); //Branches double xx = 0.0; double yy = 0.0; TCanvas * c1 = new TCanvas(model, "Oscillation probabilities", 184, 60, 861, 670); c1->Divide(1,3); TGraph * ProbNu[3]; ProbNu[0] = new TGraph(); ProbNu[1] = new TGraph(); ProbNu[2] = new TGraph(); TGraph * ProbANu[3]; ProbANu[0] = new TGraph(); ProbANu[1] = new TGraph(); ProbANu[2] = new TGraph(); TGraph * Psum = new TGraph(); TGraph * aPsum = new TGraph(); TLegend * leg = new TLegend(0.14,0.69,0.24,0.85); PeeTreeNu->SetBranchAddress("Ex",&xx); PeeTreeNu->SetBranchAddress("Pb",&yy); Long64_t nentries = PeeTreeNu->GetEntries(); for (Long64_t i=0;i<nentries;i++) { PeeTreeNu->GetEntry(i); ProbNu[0]->SetPoint( i, xx, yy); } PeeTreeANu->SetBranchAddress("Ex",&xx); PeeTreeANu->SetBranchAddress("Pb",&yy); nentries = PeeTreeANu->GetEntries(); for (Long64_t i=0;i<nentries;i++) { PeeTreeANu->GetEntry(i); ProbANu[0]->SetPoint( i, xx, yy); } ///Pem PemTreeNu->SetBranchAddress("Ex",&xx); PemTreeNu->SetBranchAddress("Pb",&yy); nentries = PemTreeNu->GetEntries(); for (Long64_t i=0;i<nentries;i++) { PemTreeNu->GetEntry(i); ProbNu[1]->SetPoint( i, xx, yy); } PemTreeANu->SetBranchAddress("Ex",&xx); PemTreeANu->SetBranchAddress("Pb",&yy); nentries = PemTreeANu->GetEntries(); for (Long64_t i=0;i<nentries;i++) { PemTreeANu->GetEntry(i); ProbANu[1]->SetPoint( i, xx, yy); } ///Pet PetTreeNu->SetBranchAddress("Ex",&xx); PetTreeNu->SetBranchAddress("Pb",&yy); nentries = PetTreeNu->GetEntries(); for (Long64_t i=0;i<nentries;i++) { PetTreeNu->GetEntry(i); ProbNu[2]->SetPoint( i, xx, yy); } PetTreeANu->SetBranchAddress("Ex",&xx); PetTreeANu->SetBranchAddress("Pb",&yy); nentries = PetTreeANu->GetEntries(); for (Long64_t i=0;i<nentries;i++) { PetTreeANu->GetEntry(i); ProbANu[2]->SetPoint( i, xx, yy); } for( int k=0; k < 3; ++k) { ProbNu[k]->SetLineColor(4); ProbNu[k]->SetMarkerColor(4); ProbNu[k]->SetMarkerStyle(7); ProbNu[k]->SetFillColor(10); ProbNu[k]->SetMaximum(1.0); ProbNu[k]->SetMinimum(0.0); TString yaxis = ((TObjString*)v_Labels->At(k))->GetString(); ProbNu[k]->GetYaxis()->SetTitle( yaxis.Data() ); ProbNu[k]->GetXaxis()->SetTitle("E [eV]"); ProbNu[k]->GetYaxis()->CenterTitle(true); ProbNu[k]->GetXaxis()->CenterTitle(true); ProbNu[k]->GetXaxis()->SetLabelOffset(0.007); ProbNu[k]->GetXaxis()->SetLabelSize(0.08); ProbNu[k]->GetXaxis()->SetTitleSize(0.07); ProbNu[k]->GetXaxis()->SetTitleOffset(0.9); ProbNu[k]->GetXaxis()->SetLabelFont(42); ProbNu[k]->GetYaxis()->SetLabelOffset(0.007); ProbNu[k]->GetYaxis()->SetLabelSize(0.08); ProbNu[k]->GetYaxis()->SetLabelFont(42); ProbNu[k]->GetYaxis()->SetTitleSize(0.09); ProbNu[k]->GetYaxis()->SetTitleOffset(0.45); ProbNu[k]->GetYaxis()->SetTitleFont(42); ProbANu[k]->SetMarkerColor(42); ProbANu[k]->SetMarkerStyle(23); ProbANu[k]->SetMarkerSize(0.3); ProbANu[k]->SetFillColor(10); ProbANu[k]->SetMaximum(1.0); ProbANu[k]->SetMinimum(0.0); } leg->AddEntry( ProbNu[0], "#nu"); leg->AddEntry( ProbANu[0], "#bar{#nu}"); leg->SetBorderSize(0); leg->SetTextSize(0.1); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); c1->cd(1); gPad->SetGridx(); gPad->SetGridy(); gPad->SetLogx(); if ( std::string(model).compare("EarthB") == 0 ) ProbNu[0]->GetXaxis()->SetLimits(0.98e9, 1.0e10); ProbNu[0]->Draw("APL"); ProbANu[0]->Draw("PL"); topTitle(model); leg->DrawClone(); c1->cd(2); gPad->SetGridx(); gPad->SetGridy(); gPad->SetLogx(); if ( std::string(model).compare("EarthB") == 0 ) ProbNu[1]->GetXaxis()->SetLimits(0.98e9, 1.0e10); ProbNu[1]->Draw("APL"); ProbANu[1]->Draw("PL"); leg->DrawClone(); c1->cd(3); gPad->SetGridx(); gPad->SetGridy(); gPad->SetLogx(); if ( std::string(model).compare("EarthB") == 0 ) ProbNu[2]->GetXaxis()->SetLimits(0.98e9, 1.0e10); ProbNu[2]->Draw("APL"); ProbANu[2]->Draw("PL"); leg->DrawClone(); c1->cd(); std::stringstream saveAs; saveAs.str(""); saveAs << path << model << "/pdf/" << "nueosc_probs_" << model << "_" << option << ".pdf"; c1->SaveAs( saveAs.str().c_str() ); saveAs.str(""); saveAs << path << model << "/png/" << "nueosc_probs_" << model << "_" << option << ".png"; c1->SaveAs( saveAs.str().c_str() ); saveAs.str(""); saveAs << path << model << "/eps/" << "nueosc_probs_" << model << "_" << option << ".eps"; c1->SaveAs( saveAs.str().c_str() ); TH1D * h_Psum = new TH1D("Psum.Histo","",100, 0.99999, 1.0001); TH1D * h_aPsum = h_Psum->Clone("aPsum.Histo"); for (Long64_t i=0;i<nentries;i++) { double xx = 0.0; double yy = 0.0; double p1 = 0.0; double p2 = 0.0; double p3 = 0.0; ProbNu[0]->GetPoint(i, xx, p1); ProbNu[1]->GetPoint(i, xx, p2); ProbNu[2]->GetPoint(i, xx, p3); yy = p1 + p2 + p3; if ( xx < 1.0e14 ) { Psum->SetPoint( i, xx, yy); h_Psum->Fill( yy ); } else break; } for (Long64_t i=0;i<nentries;i++) { double xx = 0.0; double yy = 0.0; double p1 = 0.0; double p2 = 0.0; double p3 = 0.0; ProbANu[0]->GetPoint(i, xx, p1); ProbANu[1]->GetPoint(i, xx, p2); ProbANu[2]->GetPoint(i, xx, p3); yy = p1 + p2 + p3; if ( xx < 1.0e14 ) { aPsum->SetPoint( i, xx, yy); h_aPsum->Fill( yy ); } else break; } TCanvas * c2 = new TCanvas("Sums", "Oscillation probabilities - SUMS", 184,112,394,472); c2->Divide(2,2); c2->cd(1); gPad->SetLogx(); Psum->SetMaximum(1.1); Psum->SetMinimum(0.0); Psum->SetMarkerStyle(21); Psum->SetMarkerSize(0.2); if ( std::string(model).compare("EarthB") == 0 ) Psum->GetXaxis()->SetLimits(0.98e9, 1.0e10); Psum->Draw("APL"); TLatex * tex = new TLatex(1.823945e+11,0.8753448,"Nu"); tex->SetLineWidth(2); tex->Draw(); c2->Modified(); c2->cd(); //Now the histogram c2->cd(2); // h_Psum->GetXaxis()->SetRange(6,14); h_Psum->GetXaxis()->SetNdivisions(501); h_Psum->GetXaxis()->SetLabelFont(42); h_Psum->GetXaxis()->SetLabelOffset(0.007); h_Psum->GetXaxis()->SetLabelSize(0.05); h_Psum->GetXaxis()->SetTitleSize(0.06); h_Psum->GetXaxis()->SetTitleOffset(0.9); h_Psum->GetXaxis()->SetTitleFont(42); h_Psum->Draw(""); h_Psum->Draw(); ///// c2->cd(3); gPad->SetLogx(); aPsum->SetMaximum(1.1); aPsum->SetMinimum(0.0); aPsum->SetMarkerStyle(21); aPsum->SetMarkerSize(0.2); aPsum->SetMarkerColor(2); aPsum->GetXaxis()->SetTitle("E [eV]"); aPsum->GetXaxis()->CenterTitle(true); aPsum->GetXaxis()->SetLabelFont(42); aPsum->GetXaxis()->SetLabelOffset(0.007); aPsum->GetXaxis()->SetLabelSize(0.05); aPsum->GetXaxis()->SetTitleSize(0.06); aPsum->GetXaxis()->SetTitleOffset(1.06); if ( std::string(model).compare("EarthB") == 0 ) aPsum->GetXaxis()->SetLimits(0.98e9, 1.0e10); aPsum->Draw("APL"); tex = new TLatex(1.56236e+11,0.8214771,"anti-Nu"); tex->SetLineWidth(2); tex->Draw(); //Now the histogram c2->cd(4); h_aPsum->Draw(); ///// c2->Modified(); c2->cd(); saveAs.str(""); saveAs << path << model << "/png/" << "nueosc_sum_of_probs_" << model << "_" << option << ".png"; c2->SaveAs( saveAs.str().c_str() ); }
void Jet_eta(){ int jet = 8; //nth jet for eta plot vector<string> samples; samples.push_back( "TTH" ); samples.push_back( "TTJets" ); samples.push_back( "QCD300" ); samples.push_back( "QCD500" ); samples.push_back( "QCD700" ); samples.push_back( "QCD1000" ); samples.push_back( "QCD1500" ); samples.push_back( "QCD2000" ); gStyle->SetOptStat(0); gStyle->SetTitleFillColor(0); gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(0); gStyle->SetPadBorderMode(0); gStyle->SetPadColor(0); gStyle->SetTitleFillColor(0); gStyle->SetTitleBorderSize(0); gStyle->SetTitleH(0.04); //gStyle->SetTitleFontSize(0.025); gStyle->SetTitleStyle(0); gStyle->SetTitleOffset(1.3,"y"); TCanvas *c2 = new TCanvas("c2","",5,30,640,580); TPad *p2 = new TPad("p2","",0,0,1,1); p2->SetGrid(0,0); p2->SetFillStyle(4000); p2->SetFillColor(10); p2->SetTicky(); p2->SetTicks(0,0); p2->SetObjectStat(0); p2->Draw(); p2->cd(); p2->SetTopMargin(0.05); TString cmsinfo = ""; cmsinfo = "Simulation Normalized"; TPaveText *pt_title = new TPaveText(0.1, 0.952, 0.9, 1.0,"brNDC"); pt_title->SetFillStyle(1001); pt_title->SetBorderSize(0); pt_title->SetFillColor(0); pt_title->SetTextFont(42); pt_title->SetTextSize(0.04); pt_title->AddText(cmsinfo); TLegend* leg = new TLegend(0.22,0.54,0.47,0.91,NULL,"brNDC"); leg->SetFillStyle(0); leg->SetBorderSize(0); leg->SetFillColor(kYellow); leg->SetTextSize(0.04); TH1F* httH = 0; TH1F* hQCD = 0; TH1F* httJ = 0; string n = ""; if(jet==1) n = "1st"; else if(jet==2) n = "2nd"; else if(jet==3) n = "3rd"; else n= Form("%dth",jet); // master histogram (all other histograms are a clone of this one) TH1F* h1 = new TH1F("h1",("Eta of "+n+" jet; #eta; Normalized units").c_str(), 100 , -5.0, 5.0 ); if(VAR == "nj"){ TH1F* h2 = new TH1F("h2","Number of jets with |#eta|<2.4; n_{jet}; Normalized units", 9 , 0, 9 ); h1 = (TH1F*)h2->Clone("h1" ); } h1->GetXaxis()->SetTitleFont(62); h1->GetXaxis()->SetTitleSize(0.04); h1->GetXaxis()->SetLabelFont(62); h1->GetXaxis()->SetLabelSize(0.038); h1->GetYaxis()->SetTitleFont(62); h1->GetYaxis()->SetTitleSize(0.039); h1->GetYaxis()->SetLabelFont(62); h1->GetYaxis()->SetLabelSize(0.038); // clone histograms httH = (TH1F*)h1->Clone("httH" ); hQCD = (TH1F*)h1->Clone("hQCD" ); httJ = (TH1F*)h1->Clone("httJ" ); // set histogram styles httH ->SetLineColor( kBlue+2 ); httH ->SetMarkerColor( kBlue+2 ); httH ->SetMarkerStyle( 20 ); httH ->SetMarkerSize( 1 ); httH ->SetLineWidth( 4 ); httH ->SetFillStyle( 0 ); //httH ->Sumw2(); hQCD ->SetLineColor( kGreen+3 ); hQCD ->SetMarkerColor( kGreen+3 ); hQCD ->SetMarkerStyle( 21 ); hQCD ->SetMarkerSize( 1 ); hQCD ->SetLineWidth( 4 ); hQCD ->SetFillStyle( 0 ); //hQCD ->Sumw2(); httJ ->SetLineColor( kRed-2 ); httJ ->SetFillColor( kRed-2 ); httJ ->SetMarkerColor( kRed-2 ); httJ ->SetMarkerStyle( 22 ); httJ ->SetMarkerSize( 1 ); httJ ->SetLineWidth( 4 ); httJ ->SetFillStyle( 0 ); //httJ ->Sumw2(); cout << "Sample Total Range1 Range2 Range3" << endl; // loop over samples for(int s=0; s<samples.size(); s++){ float weight = -99.0; if(samples[s] == "TTH") weight = 0.5085*0.577/90000; //xsec*BR/nGen in file only else if(samples[s] == "TTJets") weight = 831.76/90555; else if(samples[s] == "QCD300") weight = 366800.0/85185; else if(samples[s] == "QCD500") weight = 29370.0/98732; else if(samples[s] == "QCD700") weight = 6524.0/83929; else if(samples[s] == "QCD1000") weight = 1064.0/70989; else if(samples[s] == "QCD1500") weight = 121.5/93081; else if(samples[s] == "QCD2000") weight = 25.42/84179; if(weight<0){ cout << "negative weight! return" << endl; return; } cout << samples[s] << " "; //cout << endl << "Running sample " << samples[s] << endl; // load file TFile* file = TFile::Open( ("jets_"+samples[s]+".root").c_str() ); if(file==0 || file->IsZombie() ) continue; // load tree TTree *tree = (TTree*)file->Get("tree"); // Declare calculated variables int numEvents = 0; int numSelected = 0; float numTotal = 0.0; float numRange1 = 0.0; //|eta|<2.4 or njeteta==jet float numRange2 = 0.0; //|eta|>2.4 or njeteta==jet-1 float numRange3 = 0.0; //2.4<|eta|>3.0 or njeteta < jet-1 float eta; int nj; // declare leaf types int njet; //njets with pT>30 GeV int njeteta; //njets with pT>30 GeV && |eta|<2.4 int nbtag; //njets with pT>30 GeV && CSV>0.89 int nbtageta; //njets with pT>30 GeV && CSV>0.89 && |eta|<2.4 int nhardjet; //njets with pT>40 GeV && |eta|<2.4 float HT; float jet_pt [NMAXJETS]; //jets sorted by decreasing pT float jet_eta [NMAXJETS]; float jet_csv [NMAXJETS]; // Connect the branches with their member variables. if(!tree) return; tree->SetBranchAddress("njet", &njet); tree->SetBranchAddress("njeteta", &njeteta); tree->SetBranchAddress("nbtag", &nbtag); tree->SetBranchAddress("nbtageta", &nbtageta); tree->SetBranchAddress("nhardjet", &nhardjet); tree->SetBranchAddress("HT", &HT); tree->SetBranchAddress("jet_pt", jet_pt); tree->SetBranchAddress("jet_eta", jet_eta); tree->SetBranchAddress("jet_csv", jet_csv); int totalEntries = tree->GetEntries(); //cout << totalEntries << endl; // loop over events for(int entry=0; entry < totalEntries; entry++){ tree->GetEntry(entry); numEvents++; eta = -99.; nj = -99; // get nth jet eta if( njet >= jet ){ numSelected ++; eta = jet_eta[jet-1]; if( njet == jet ) nj = njeteta; if( VAR=="eta" ){ numTotal += weight*1000*LUMI; if( abs(jet_eta[jet-1]) < 2.4 ) numRange1 += weight*1000*LUMI; if( abs(jet_eta[jet-1]) > 2.4 ) numRange2 += weight*1000*LUMI; if( abs(jet_eta[jet-1]) > 2.4 && abs(jet_eta[jet-1]) < 3.0 ) numRange3 += weight*1000*LUMI; } else if( VAR=="nj" && njet == jet ){ numTotal += weight*1000*LUMI; if( njeteta == jet ) numRange1 += weight*1000*LUMI; if( njeteta == jet-1 ) numRange2 += weight*1000*LUMI; if( njeteta < jet-1 ) numRange3 += weight*1000*LUMI; } if( samples[s]=="TTH" ){ if(VAR == "eta") httH->Fill(eta,weight); else if( nj>-1 ) httH->Fill(nj,weight); } else if( samples[s]=="TTJets" ){ if(VAR == "eta") httJ->Fill(eta,weight); else if( nj>-1 ) httJ->Fill(nj,weight); } else if( samples[s].find("QCD") != string::npos ){ if(VAR == "eta") hQCD->Fill(eta,weight); else if( nj>-1 ) hQCD->Fill(nj,weight); } else{ cout << "sample not found. return" << endl; return; } } //end selection } //end loop over events cout << numTotal << " " << numRange1 << " " << numRange2 << " " << numRange3 << " " << endl; } //end loop over samples leg->AddEntry(httH, "t#bar{t}H (125)", "F"); leg->AddEntry(httJ, "t#bar{t}", "F"); leg->AddEntry(hQCD, "QCD", "F"); hQCD ->GetYaxis()->SetTitle("Normalized units"); hQCD ->SetMaximum( hQCD->GetMaximum()*2.0 ); //CHANGE HERE hQCD ->DrawNormalized("HIST"); httJ ->DrawNormalized("HISTSAME"); httH ->DrawNormalized("HISTSAME"); leg->Draw(); pt_title->Draw(); string variable = Form("%d",jet); if( SAVEPLOTS ){ if(VAR=="eta") c2->SaveAs( ("./Jet_plots/eta_"+variable+"jet_norm.pdf").c_str() ); else if(VAR=="nj") c2->SaveAs( ("./Jet_plots/nj_"+variable+"jet_norm.pdf").c_str() ); } }
void vs_PlotQCDcomp() { Bool_t saveC = false; Bool_t diJets = true; Bool_t isMC = false; TString vsSave; vsSave = "_T07w"; TString jSave; if(diJets) jSave = "2j"; else jSave = "3j"; TString sample; if(diJets) sample = "select_1ph_2jets"; else sample = "select_1ph_3jets"; TString FOtag; if(isMC) FOtag = "_FO_CorrMC"; // else FOtag = "_FO_Corr"; else FOtag = "_FO"; TString sysu = "SYSTUP_"; TString sysd = "SYSTDOWN_"; TString outDir; outDir = "Plots_PhotonSusyAnalysis/QCDweights/"; // string inputFile1 = "/data/user/vsola/CMSSW_Releases/CMSSW_5_3_9/src/Plots_PhotonSusyAnalysis/Merged_QCD_PhotonJet_T07w_PAT/mergedHistos.root"; // string inputFile1 = "/data/user/vsola/CMSSW_Releases/CMSSW_5_3_9/src/Plots_PhotonSusyAnalysis/Merged_Data_V05w_PAT/mergedHistos.root"; string inputFile1 = "/data/user/vsola/CMSSW_Releases/CMSSW_5_3_9/src/Plots_PhotonSusyAnalysis/PhotonHadReReco_22Jan2013_V05_PAT/mergedHistos.root"; setMyTDRStyle(); gROOT->SetStyle("mytdrStyle"); // gStyle->SetHistMinimumZero(); // gStyle->SetPaintTextFormat("4.2f"); gStyle->SetHistLineWidth(2); gStyle->UseCurrentStyle(); // gStyle->SetPadTopMargin(1.0); // gStyle->SetPadLeftMargin(3.2); // gStyle->SetPadRightMargin(4.5); // gStyle->SetPadBottomMargin(3.2); gROOT->ForceStyle(1); static const Int_t nHt = 7; static const Int_t nPt = 13; static const Int_t nMet = 16; static const Int_t nJet = 15; Double_t binPt[nPt+1] = {0.,75.,90.,120.,160.,210.,260.,320.,400.,500.,650.,800.,1000.,1500.}; Double_t binHt[nHt+1] = {0.,400.,450.,550.,700.,900.,1200.,1500.}; Double_t binMet[nMet+1] = {0.,10.,20.,30.,40.,50.,60.,70.,80.,90.,100.,120.,160.,200.,270.,350.,500.}; Double_t binJet[nJet+1] = {0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15}; TLatex *as = new TLatex(); as->SetNDC(true); as->SetTextColor(12); as->SetTextFont(43); as->SetTextSize(19); TLegend *legend = new TLegend(0.60, 0.70, 0.75, 0.85, ""); legend->SetFillColor(10); legend->SetFillStyle(1001); legend->SetTextSize(0.04); legend->SetBorderSize(0); legend->SetShadowColor(0); std::string outLumi = "CMS Work in Progress - QCD MC #sqrt{s} = 8 TeV - #geq 1 #gamma, #geq 2 j"; TFile* f1 = TFile::Open( inputFile1.c_str() ); //photon Pt TCanvas * cPt = new TCanvas("cPt","cPt"); TH1F* hpt = (TH1F*) f1->Get( sample+"/PreselCut_photonPt" ); TH1F* hptFO = (TH1F*) f1->Get( sample+FOtag+"/PreselCut_photonPt" ); TH1F *hptR = (TH1F*) hpt->Rebin(nPt,hpt->GetTitle(),binPt); if (hptR->GetSumw2N() == 0) hptR->Sumw2(); TH1F *hptFOR = (TH1F*) hptFO->Rebin(nPt,hptFO->GetTitle(),binPt); if (hptFOR->GetSumw2N() == 0) hptFOR->Sumw2(); TH1F* hptSU = (TH1F*) f1->Get( sample+FOtag+"/PreselCut_"+sysu+"photonPt" ); TH1F* hptSD = (TH1F*) f1->Get( sample+FOtag+"/PreselCut_"+sysd+"photonPt" ); TH1F *hptSUR = (TH1F*) hptSU->Rebin(nPt,hptSU->GetTitle(),binPt); if (hptSUR->GetSumw2N() == 0) hptSUR->Sumw2(); TH1F *hptSDR = (TH1F*) hptSD->Rebin(nPt,hptSD->GetTitle(),binPt); if (hptSDR->GetSumw2N() == 0) hptSDR->Sumw2(); if ( hptFOR != 0 ) { for (int b = 0; b < hptFOR->GetNbinsX(); b++) { Double_t mainHistoContent = hptFOR->GetBinContent(b); Double_t systUpHistoContent = hptSUR->GetBinContent(b); Double_t systDnHistoContent = hptSDR->GetBinContent(b); Double_t systDiffUp = fabs( (double) systUpHistoContent - mainHistoContent ); Double_t systDiffDn = fabs( (double) mainHistoContent - systDnHistoContent ); // use average error for histogram Double_t systDiff = ( systDiffUp + systDiffDn ) / 2.; Double_t statErr = hptFOR->GetBinError(b); Double_t combError = sqrt( systDiff * systDiff + statErr * statErr ); hptFOR->SetBinError(b, combError); } //for }//if cPt->SetLogy(1); gPad->Update(); cPt->Update(); // hptR->Scale(1,"width"); // hptR->SetMinimum(0.02); // hptR->SetMaximum(1000); hptR->GetXaxis()->SetTitle("1^{st} photon p_{T} [GeV]"); hptR->GetYaxis()->SetTitle("Number of Events / GeV"); if(isMC) hptR->SetMarkerSize(0); if(isMC) hptR->Draw("histE"); else hptR->Draw("E X0"); hptFOR->SetMarkerSize(0); hptFOR->SetLineColor(2); hptFOR->SetFillColor(2); hptFOR->SetFillStyle(3004); hptFOR->Draw("same hist ][ E2"); legend->Clear(); if(isMC) legend->SetHeader("#gamma/QCD (Sim)"); else legend->SetHeader("#gamma/QCD (Data)"); if(isMC) legend->AddEntry(hptR, "#gamma", "l"); else legend->AddEntry(hptR, "#gamma", "p"); legend->AddEntry(hptFOR, "Pred (from #gamma_{jet})", "f"); legend->Draw(); as->DrawLatex(0.17, 0.93, outLumi.c_str() ); cPt->Update(); cPt->SetBottomMargin(0.2 + 0.8 * cPt->GetBottomMargin() - 0.2 * cPt->GetTopMargin()); TPad *ratioPt = new TPad("BottomPad", "", 0, 0, 1, 1); ratioPt->SetTopMargin(0.8 - 0.8 * ratioPt->GetBottomMargin() + 0.2 * ratioPt->GetTopMargin()); ratioPt->SetFillStyle(0); ratioPt->SetFrameFillColor(10); ratioPt->SetFrameBorderMode(0); ratioPt->Draw(); ratioPt->cd(); ratioPt->SetLogy(0); TH1F *hptRat = (TH1F*) divideHistosForRatio(hptR,hptFOR); hptRat->SetMinimum(0.); hptRat->SetMaximum(10.); hptRat->GetXaxis()->SetNdivisions(505); if(isMC) hptRat->GetYaxis()->SetTitle("Sim/Pred"); else hptRat->GetYaxis()->SetTitle("Data/Pred"); hptRat->GetYaxis()->SetTitleSize(0.04); hptRat->GetYaxis()->SetLabelSize(0.03); hptRat->GetYaxis()->SetTitleOffset(1.3); hptRat->GetYaxis()->SetNdivisions(505); hptRat->SetMarkerStyle(20); hptRat->SetMarkerSize(1); hptRat->SetMarkerColor(1); hptRat->SetLineColor(1); hptRat->Draw("E X0"); TH1F *hptFRat = (TH1F*) getSystErrForRatio(hptFOR); hptFRat->SetLineColor(2); hptFRat->SetFillColor(2); hptFRat->SetFillStyle(3004); hptFRat->Draw("same hist ][ E2"); TLine * line = new TLine( hptRat->GetXaxis()->GetXmin(), 1., hptRat->GetXaxis()->GetXmax(), 1. ); line->SetLineColor(1); line->SetLineWidth(0.5); line->SetLineStyle(1); line->Draw("same"); hptR->GetXaxis()->SetLabelSize(0); hptR->GetXaxis()->SetTitle(""); cPt->RedrawAxis(); gPad->Update(); cPt->Update(); return; }
TF1* fit(TString variable, TString variableplot, TTree* nt, TTree* ntMC, Double_t ptmin, Double_t ptmax, int isMC) { static int count=0; count++; TCanvas* c= new TCanvas(Form("c%d",count),"",600,600); TH1D* h = new TH1D(Form("h-%d",count),"",nbinsmasshisto,minhisto,maxhisto); TH1D* hMCSignal = new TH1D(Form("hMCSignal-%d",count),"",nbinsmasshisto,minhisto,maxhisto); TH1D* hMCSwapped = new TH1D(Form("hMCSwapped-%d",count),"",nbinsmasshisto,minhisto,maxhisto); TF1* f = new TF1(Form("f%d",count),"[0]*([7]*([9]*Gaus(x,[1],[2])/(sqrt(2*3.14159)*[2])+(1-[9])*Gaus(x,[1],[10])/(sqrt(2*3.14159)*[10]))+(1-[7])*Gaus(x,[1],[8])/(sqrt(2*3.14159)*[8]))+[3]+[4]*x+[5]*x*x+[6]*x*x*x", 1.7, 2.0); TString mycut=Form("(%s&&(%s)>%f&&(%s)<%f)",seldata.Data(),variable.Data(),ptmin,variable.Data(),ptmax); if(isMC==1) nt->Project(Form("h-%d",count),"Dmass",TCut(weight)*TCut(mycut)); else nt->Project(Form("h-%d",count),"Dmass",Form("(%s&&(%s)>%f&&(%s)<%f)",seldata.Data(),variable.Data(),ptmin,variable.Data(),ptmax)); ntMC->Project(Form("hMCSignal-%d",count),"Dmass",Form("%s*(%s&&(%s)>%f&&(%s)<%f&&(Dgen==23333))",weight.Data(),selmc.Data(),variable.Data(),ptmin,variable.Data(),ptmax)); ntMC->Project(Form("hMCSwapped-%d",count),"Dmass",Form("%s*(%s&&(%s)>%f&&(%s)<%f&&(Dgen==23344))",weight.Data(),selmc.Data(),variable.Data(),ptmin,variable.Data(),ptmax)); TFile *fout=new TFile(Form("FitsFiles/Fits_%s_%d.root",collisionsystem.Data(),count),"recreate"); fout->cd(); hMCSignal->Write(); hMCSwapped->Write(); h->Write(); fout->Close(); f->SetParLimits(4,-1000,1000); f->SetParLimits(10,0.001,0.05); f->SetParLimits(2,0.01,0.1); f->SetParLimits(8,0.02,0.2); f->SetParLimits(7,0,1); f->SetParLimits(9,0,1); f->SetParameter(0,setparam0); f->SetParameter(1,setparam1); f->SetParameter(2,setparam2); f->SetParameter(10,setparam10); f->SetParameter(9,setparam9); f->FixParameter(8,setparam8); f->FixParameter(7,1); f->FixParameter(1,fixparam1); f->FixParameter(3,0); f->FixParameter(4,0); f->FixParameter(5,0); f->FixParameter(6,0); h->GetEntries(); hMCSignal->Fit(Form("f%d",count),"q","",minhisto,maxhisto); hMCSignal->Fit(Form("f%d",count),"q","",minhisto,maxhisto); f->ReleaseParameter(1); hMCSignal->Fit(Form("f%d",count),"L q","",minhisto,maxhisto); hMCSignal->Fit(Form("f%d",count),"L q","",minhisto,maxhisto); hMCSignal->Fit(Form("f%d",count),"L m","",minhisto,maxhisto); f->FixParameter(1,f->GetParameter(1)); f->FixParameter(2,f->GetParameter(2)); f->FixParameter(10,f->GetParameter(10)); f->FixParameter(9,f->GetParameter(9)); f->FixParameter(7,0); f->ReleaseParameter(8); f->SetParameter(8,setparam8); hMCSwapped->Fit(Form("f%d",count),"L q","",minhisto,maxhisto); hMCSwapped->Fit(Form("f%d",count),"L q","",minhisto,maxhisto); hMCSwapped->Fit(Form("f%d",count),"L q","",minhisto,maxhisto); hMCSwapped->Fit(Form("f%d",count),"L m","",minhisto,maxhisto); f->FixParameter(7,hMCSignal->Integral(0,1000)/(hMCSwapped->Integral(0,1000)+hMCSignal->Integral(0,1000))); f->FixParameter(8,f->GetParameter(8)); f->ReleaseParameter(3); f->ReleaseParameter(4); f->ReleaseParameter(5); f->ReleaseParameter(6); f->SetLineColor(kRed); h->Fit(Form("f%d",count),"q","",minhisto,maxhisto); h->Fit(Form("f%d",count),"q","",minhisto,maxhisto); f->ReleaseParameter(1); //f->ReleaseParameter(2); // you need to release these two parameters if you want to perform studies on the sigma shape //f->ReleaseParameter(10); // you need to release these two parameters if you want to perform studies on the sigma shape h->Fit(Form("f%d",count),"L q","",minhisto,maxhisto); h->Fit(Form("f%d",count),"L q","",minhisto,maxhisto); h->Fit(Form("f%d",count),"L q","",minhisto,maxhisto); h->Fit(Form("f%d",count),"L m","",minhisto,maxhisto); TF1* background = new TF1(Form("background%d",count),"[0]+[1]*x+[2]*x*x+[3]*x*x*x"); background->SetParameter(0,f->GetParameter(3)); background->SetParameter(1,f->GetParameter(4)); background->SetParameter(2,f->GetParameter(5)); background->SetParameter(3,f->GetParameter(6)); background->SetLineColor(4); background->SetRange(minhisto,maxhisto); background->SetLineStyle(2); TF1* mass = new TF1(Form("fmass%d",count),"[0]*([3]*([4]*Gaus(x,[1],[2])/(sqrt(2*3.14159)*[2])+(1-[4])*Gaus(x,[1],[5])/(sqrt(2*3.14159)*[5])))"); mass->SetParameters(f->GetParameter(0),f->GetParameter(1),f->GetParameter(2),f->GetParameter(7),f->GetParameter(9),f->GetParameter(10)); mass->SetParError(0,f->GetParError(0)); mass->SetParError(1,f->GetParError(1)); mass->SetParError(2,f->GetParError(2)); mass->SetParError(3,f->GetParError(7)); mass->SetParError(4,f->GetParError(9)); mass->SetParError(5,f->GetParError(10)); mass->SetFillColor(kOrange-3); mass->SetFillStyle(3002); mass->SetLineColor(kOrange-3); mass->SetLineWidth(3); mass->SetLineStyle(2); TF1* massSwap = new TF1(Form("fmassSwap%d",count),"[0]*(1-[2])*Gaus(x,[1],[3])/(sqrt(2*3.14159)*[3])"); massSwap->SetParameters(f->GetParameter(0),f->GetParameter(1),f->GetParameter(7),f->GetParameter(8)); massSwap->SetParError(0,f->GetParError(0)); massSwap->SetParError(1,f->GetParError(1)); massSwap->SetParError(2,f->GetParError(7)); massSwap->SetParError(3,f->GetParError(8)); massSwap->SetFillColor(kGreen+4); massSwap->SetFillStyle(3005); massSwap->SetLineColor(kGreen+4); massSwap->SetLineWidth(3); massSwap->SetLineStyle(1); h->SetXTitle("m_{#piK} (GeV/c^{2})"); h->SetYTitle("Entries / (5 MeV/c^{2})"); h->GetXaxis()->CenterTitle(); h->GetYaxis()->CenterTitle(); h->SetAxisRange(0,h->GetMaximum()*1.4*1.2,"Y"); h->GetXaxis()->SetTitleOffset(1.3); h->GetYaxis()->SetTitleOffset(1.8); h->GetXaxis()->SetLabelOffset(0.007); h->GetYaxis()->SetLabelOffset(0.007); h->GetXaxis()->SetTitleSize(0.045); h->GetYaxis()->SetTitleSize(0.045); h->GetXaxis()->SetTitleFont(42); h->GetYaxis()->SetTitleFont(42); h->GetXaxis()->SetLabelFont(42); h->GetYaxis()->SetLabelFont(42); h->GetXaxis()->SetLabelSize(0.04); h->GetYaxis()->SetLabelSize(0.04); h->SetMarkerSize(0.8); h->SetMarkerStyle(20); h->SetStats(0); h->Draw("e"); background->Draw("same"); mass->SetRange(minhisto,maxhisto); mass->Draw("same"); massSwap->SetRange(minhisto,maxhisto); massSwap->Draw("same"); f->Draw("same"); Double_t yield = mass->Integral(minhisto,maxhisto)/binwidthmass; Double_t yieldErr = mass->Integral(minhisto,maxhisto)/binwidthmass*mass->GetParError(0)/mass->GetParameter(0); std::cout<<"YIELD="<<yield<<"and error"<<yieldErr<<std::endl; std::cout<<"relative error="<<yieldErr/yield<<std::endl; TLegend* leg = new TLegend(0.65,0.58,0.82,0.88,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextSize(0.04); leg->SetTextFont(42); leg->SetFillStyle(0); leg->AddEntry(h,"Data","pl"); leg->AddEntry(f,"Fit","l"); leg->AddEntry(mass,"D^{0}+#bar{D^{#lower[0.2]{0}}} Signal","f"); leg->AddEntry(massSwap,"K-#pi swapped","f"); leg->AddEntry(background,"Combinatorial","l"); leg->Draw("same"); TLatex Tl; Tl.SetNDC(); Tl.SetTextAlign(12); Tl.SetTextSize(0.04); Tl.SetTextFont(42); Tl.DrawLatex(0.18,0.93, "#scale[1.25]{CMS} Preliminary"); Tl.DrawLatex(0.65,0.93, Form("%s #sqrt{s_{NN}} = 5.02 TeV",collisionsystem.Data())); TLatex* tex; tex = new TLatex(0.22,0.78,Form("%.1f < %s < %.1f",ptmin,variableplot.Data(),ptmax)); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.22,0.83,"|y| < 1.0"); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); h->GetFunction(Form("f%d",count))->Delete(); TH1F* histo_copy_nofitfun = ( TH1F * ) h->Clone("histo_copy_nofitfun"); histo_copy_nofitfun->Draw("esame"); // if(nBins==1) c->SaveAs(Form("DMass-inclusive%s_%d.pdf",collisionsystem.Data(),count)); else c->SaveAs(Form("DMass%s_%d.pdf",collisionsystem.Data(),count)); return mass; }
void hPYphocalc(){ gStyle->SetOptStat(kFALSE); const int maxNpart = 100; int sth=0, Gth=0; TFile *f = TFile::Open(outG); if(sth==0){TString dirname = "std";} else if(sth==1){TString dirname ="Gri055";} else {TString dirname ="Gri101";} TObjString* dataname = (TObjString*)f->Get(Form("dataname")); TObjString* histoname = (TObjString*)f->Get(Form("histoname")); TFile *fdata = TFile::Open(dataname->GetName()); TString name; if(Gth==0) name = "G0"; else if(Gth<nGlau) name = Form("Glau_%d",Gth); else name = Form("bin_%d",Gth-nGlau+1); TObjString* Glaubername = (TObjString*)f->Get(Form("%s/%s/Glaubername",dirname.Data(),name.Data())); TVectorD* k0 = (TVectorD*)f->Get(Form("%s/%s/k0",dirname.Data(),name.Data())); TVectorD* theta0 = (TVectorD*)f->Get(Form("%s/%s/theta0",dirname.Data(),name.Data())); TVectorD* xmin = (TVectorD*)f->Get(Form("%s/%s/xmin",dirname.Data(),name.Data())); TVectorD* xmax = (TVectorD*)f->Get(Form("%s/%s/xmax",dirname.Data(),name.Data())); TVectorD* thetabest = (TVectorD*)f->Get(Form("%s/%s/thetabest",dirname.Data(),name.Data())); TVectorD* kbest = (TVectorD*)f->Get(Form("%s/%s/kbest",dirname.Data(),name.Data())); TVectorD* kpoint = (TVectorD*)f->Get(Form("%s/%s/kpoint",dirname.Data(),name.Data())); TVectorD* NcollAver = (TVectorD*)f->Get(Form("%s/%s/NcollAver",dirname.Data(),name.Data())); TVectorD* centbin = (TVectorD*)f->Get(Form("%s/%s/centbin",dirname.Data(),name.Data())); TFile *fGlauber = TFile::Open(Glaubername->GetName()); //(*k0)[0]=1.39; (*kbest)[0]=0.425; //(*theta0)[0]=3.41; (*thetabest)[0]=1.30; TF1 *gammafun[maxNpart]; TF1 *gammafunevt[maxNpart]; TF1 *gammafunnucl[maxNpart]; TF1 *gammafunnuclNcoll[maxNpart]; double kevt = (*k0)[0]-(*kbest)[0]; for(int iNpart=0;iNpart<maxNpart;iNpart++){ gammafun[iNpart] = new TF1("gammafun","TMath::GammaDist(x,[0],0,[1])",0,200); gammafunevt[iNpart] = new TF1("gammafunevt","TMath::GammaDist(x,[0],0,[1])",0,200); gammafunnucl[iNpart] = new TF1("gammafunnucl","TMath::GammaDist(x,[0],0,[1])",0,200); gammafunnuclNcoll[iNpart] = new TF1("gammafunnuclNcoll","TMath::GammaDist(x,[0],0,[1])",0,200); double k_=(*k0)[0]+(*kbest)[0]*(iNpart-2); double theta_=(*theta0)[0]+(*thetabest)[0]*TMath::Log(iNpart-1); gammafun[iNpart]->SetParameter(0,k_); //[1]: k value gammafun[iNpart]->SetParameter(1,theta_); //[2]: theta value gammafunevt[iNpart]->SetParameter(0,kevt); gammafunevt[iNpart]->SetParameter(1,theta_); gammafunnucl[iNpart]->SetParameter(0,(*kbest)[0]); gammafunnucl[iNpart]->SetParameter(1,theta_); gammafunnuclNcoll[iNpart]->SetParameter(0,(*kbest)[0]*(iNpart-1)); gammafunnuclNcoll[iNpart]->SetParameter(1,theta_); if(iNpart==2){ gammafunnuclNcoll[iNpart]->SetNpx(1e4); gammafunnuclNcoll[iNpart]->SetRange(1e-11,200); } } TTree *t = (TTree*)fGlauber->Get("nt_p_Pb"); Float_t Ncoll, Npart, B; Long_t Nevent; t->SetBranchAddress("Ncoll",&Ncoll); t->SetBranchAddress("Npart",&Npart); t->SetBranchAddress("B",&B); Nevent = (Long_t) t->GetEntries(); Long_t Ev; Int_t Bino; Double_t Para, Para_nucl, Para_p, Para_evt, Bi_Para_nucl, Bi_Para_evt; double yUCM[8]={}; double yPCM[8]={}; double yVCM[8]={}; double yUCM_[200]={}; double yPCM_[200]={}; double yVCM_[200]={}; double C=1e-4; double PNcoll[maxNpart]={}; TH1D *histo_obs = (TH1D*)fdata->Get(histoname->GetName()); TH1D *histo_obs_norm = (TH1D*)histo_obs->Clone(); histo_obs_norm->Scale(1/histo_obs->Integral()); TH1D* hUCM = new TH1D("hUCM","hUCM",200,0,200); TH1D* hPCM = new TH1D("hPCM","hPCM",200,0,200); TH1D* hVCM = new TH1D("hVCM","hVCM",200,0,200); TH2D* NcollvsET = new TH2D("NcollvsET","NcollvsET",100,0,100,2000,0,400); for(Ev=0;Ev<Nevent;Ev++){ t->GetEntry(Ev); PNcoll[(int)Ncoll]++; } for(int i=0;i<maxNpart;i++){ PNcoll[i]/=Nevent; cout<<PNcoll[i]<<"\t"; } cout<<endl; for(Ev=0;Ev<Nevent;Ev++){ if(Ev%100000==0) cout<<"\t"<<"Have run "<<Ev<<" events"<<endl; t->GetEntry(Ev); Para = gammafun[(int)Npart]->GetRandom(); Para_nucl = gammafunnuclNcoll[(int)Npart]->GetRandom(); Para_p = gammafunnuclNcoll[(int)Npart]->GetRandom(); Para_evt = 0; for(int i=0;i<N-1;i++) if(Para>=(*kpoint)[i] && Para<(*kpoint)[i+1]) int ibin = i; for(int Bino=0;Bino<Ncoll;Bino++){ Bi_Para_evt = gammafunevt[(int)Npart]->GetRandom(); Para_evt += Bi_Para_evt; } double PNcollET = gammafun[(int)Npart]->Eval(Para); // double k = gammafun[(int)Npart]->GetParameter(0); double theta=(*theta0)[0]+(*thetabest)[0]*TMath::Log(Npart-1); double YNcollUCM = C*Ncoll; double YNcollPCM = C/1.0/(*kbest)[0]/theta*(Para_nucl); double YNcollVCM = C/2.0*(Para_nucl/(*kbest)[0]/theta+Ncoll); yUCM[ibin] += PNcoll[(int)Ncoll]*PNcollET*YNcollUCM; yPCM[ibin] += PNcoll[(int)Ncoll]*PNcollET*YNcollPCM; yVCM[ibin] += PNcoll[(int)Ncoll]*PNcollET*YNcollVCM; yUCM_[(int)Para] += PNcoll[(int)Ncoll]*PNcollET*YNcollUCM; yPCM_[(int)Para] += PNcoll[(int)Ncoll]*PNcollET*YNcollPCM; yVCM_[(int)Para] += PNcoll[(int)Ncoll]*PNcollET*YNcollVCM; NcollvsET->Fill(Ncoll,Para); } for(int ibin=1;ibin<hUCM->GetNbinsX();ibin++){ hUCM->SetBinContent(ibin,yUCM_[ibin-1]); hPCM->SetBinContent(ibin,yPCM_[ibin-1]); hVCM->SetBinContent(ibin,yVCM_[ibin-1]); } TCanvas *c1 = new TCanvas(); TCanvas *c2 = new TCanvas(); c1->SetLogy(); c2->SetLogx(); c2->SetLogy(); c2->SetLogz(); c1->cd(); TH1D* hFrame = new TH1D("","",200,0,200); hFrame->SetTitle(""); hFrame->GetXaxis()->SetTitle("HF #Sigma E_{T} |#eta|>4"); hFrame->GetYaxis()->SetTitle("Yield no units"); hFrame->GetXaxis()->SetRangeUser(0,150); hFrame->GetYaxis()->SetRangeUser(1e-6,1); hFrame->Draw(); histo_obs_norm->SetMarkerStyle(20); histo_obs_norm->SetMarkerSize(1.0); histo_obs_norm->SetMarkerColor(1); histo_obs_norm->Draw("Psame"); hUCM->SetMarkerStyle(24); hUCM->SetMarkerSize(1.0); hUCM->SetMarkerColor(2); hPCM->SetMarkerStyle(29); hPCM->SetMarkerSize(1.0); hPCM->SetMarkerColor(4); hVCM->SetMarkerStyle(34); hVCM->SetMarkerSize(1.0); hVCM->SetMarkerColor(5); hUCM->Draw("Psame"); hPCM->Draw("Psame"); hVCM->Draw("Psame"); TLegend *leg = new TLegend(0.1,0.2,0.5,0.45); leg->SetFillColor(0); leg->SetFillStyle(0); leg->SetBorderSize(0); leg->SetTextFont(42); leg->SetTextSize(0.03); leg->AddEntry(histo_obs_norm,"minimum bias events","lp"); leg->AddEntry(hUCM,"hard scattering events(UCM)","lp"); leg->AddEntry(hPCM,"hard scattering events(PCM)","lp"); leg->AddEntry(hVCM,"hard scattering events(VCM)","lp"); leg->Draw("same"); c1->Print("paperfig3_CMS.png"); c2->cd(); gStyle->SetOptStat("nemr"); NcollvsET->GetXaxis()->SetTitle("Ncoll"); NcollvsET->GetYaxis()->SetTitle("HF #Sigma E_{T} |#eta|>4"); NcollvsET->Draw("colz"); c2->Print("NcollvsET2D.png"); ofstream fstr("result_CMS.dat"); fstr<<"i"<<"\t"<<"centbin"<<"\t"<<"kpoint"<<"\t"<<"NcollAver"<<"\t"<<"UCM"<<"\t"<<"PCM"<<"\t"<<"VCM"<<"\t"<<"pho1"<<"\t"<<"pho2"<<"\t"<<"MB"<<endl; for(int i=0;i<N-1;i++){ fstr<<i<<"\t"<<(*centbin)[i]*100<<"% to "<<(*centbin)[i+1]*100<<"% \t"<<(*kpoint)[i]<<" to "<<(*kpoint)[i+1]<<"\t"<<(*NcollAver)[i]<<"\t"<<yUCM[i]<<"\t"<<yPCM[i]<<"\t"<<yVCM[i]<<"\t"<<yPCM[i]/yUCM[i]<<"\t"<<yVCM[i]/yUCM[i]<<"\t"<<"undetermined"<<endl; } }
void simulateResponse() { TF1 MyPoisson("MyPoisson", PoissonReal, 0., 20, 1); gStyle->SetPadLeftMargin(0.15); gStyle->SetPadRightMargin(0.05); int NEVT = 10000; // the mean number of photons from clas6 // was 9. // For pions however, depending on momemntum, // this number will change. // Taking 9 as the number of photons for pions at 7.5 GeV // and calculating the ratio of pi3 for each momentum double mean7 = 9; double means[MNP]; double pion_ratio_1[MNP]; // no changes: same mirror, same PMT, same wc (so-so) double pion_ratio_2[MNP]; // recoated mirror, same PMT, same wc (so-so) double pion_ratio_3[MNP]; // recoated mirror, improved PMT, same wc (so-so) double pion_ratio_4[MNP]; // recoated mirror, improved PMT, coated wc (good) double pion_ratio_5[MNP]; // recoated mirror, improved PMT, bad wc double pion_ratio_6[MNP]; // recoated mirror, improved PMT, perfect wc (2 // reflections only) TH1D* perfec[MNP]; TH1D* doNoth[MNP]; TH1D* fixBad[MNP]; TH1D* fixAll[MNP]; // assuming show_ration has been run (need to re-run if RECALC is 1) ifstream in("pionYield.txt"); for (int i = 0; i < MNP; i++) { in >> pion_ratio_1[i] >> pion_ratio_2[i] >> pion_ratio_3[i] >> pion_ratio_4[i] >> pion_ratio_5[i] >> pion_ratio_6[i]; } in.close(); if (RECALC2 == 0) { TFile f("dist.root"); for (int i = 0; i < MNP; i++) { perfec[i] = (TH1D*)f.Get(Form("perfec%d", i)); doNoth[i] = (TH1D*)f.Get(Form("doNoth%d", i)); fixBad[i] = (TH1D*)f.Get(Form("fixBad%d", i)); fixAll[i] = (TH1D*)f.Get(Form("fixAll%d", i)); perfec[i]->SetDirectory(0); doNoth[i]->SetDirectory(0); fixBad[i]->SetDirectory(0); fixAll[i]->SetDirectory(0); } f.Close(); } else { for (int i = 0; i < MNP; i++) { perfec[i] = new TH1D(Form("perfec%d", i), Form("perfec%d", i), 250, 0, 25); doNoth[i] = new TH1D(Form("doNoth%d", i), Form("doNoth%d", i), 250, 0, 25); fixBad[i] = new TH1D(Form("fixBad%d", i), Form("fixBad%d", i), 250, 0, 25); fixAll[i] = new TH1D(Form("fixAll%d", i), Form("fixAll%d", i), 250, 0, 25); } for (int i = 2; i < MNP; i++) { // means[i] = mean7*pion_ratio_2[i]/pion_ratio_2[11]; means[i] = mean7 * pion_ratio_3[i] / pion_ratio_3[11]; for (int e = 1; e < NEVT; e++) { if (e % 1000 == 0) { cout << " Event number " << e << " for momentum: " << i << endl; } MyPoisson.SetParameter(0, means[i]); double r = MyPoisson.GetRandom(); perfec[i]->Fill(r); int nr = calculateNReflection(gRandom->Uniform(0, 1)); int gr = calculateWCgroup(gRandom->Uniform(0, 1)); // only 2 reflections // wc are "perfect" if (nr == 2) { doNoth[i]->Fill(r * pion_ratio_4[i]); fixBad[i]->Fill(r * pion_ratio_4[i]); fixAll[i]->Fill(r * pion_ratio_4[i]); } if (nr == 3) { // bad if (gr == 1) { doNoth[i]->Fill(r * pion_ratio_5[i]); fixBad[i]->Fill(r * pion_ratio_4[i]); fixAll[i]->Fill(r * pion_ratio_4[i]); } // so-so if (gr == 2) { doNoth[i]->Fill(r * pion_ratio_3[i]); fixBad[i]->Fill(r * pion_ratio_3[i]); fixAll[i]->Fill(r * pion_ratio_4[i]); } // good if (gr == 3) { doNoth[i]->Fill(r * pion_ratio_4[i]); fixBad[i]->Fill(r * pion_ratio_4[i]); fixAll[i]->Fill(r * pion_ratio_4[i]); } } if (nr == 4) { r = r * 0.8; // bad if (gr == 1) { doNoth[i]->Fill(r * pion_ratio_5[i]); fixBad[i]->Fill(r * pion_ratio_4[i]); fixAll[i]->Fill(r * pion_ratio_4[i]); } // so-so if (gr == 2) { doNoth[i]->Fill(r * pion_ratio_3[i]); fixBad[i]->Fill(r * pion_ratio_3[i]); fixAll[i]->Fill(r * pion_ratio_4[i]); } // good if (gr == 3) { doNoth[i]->Fill(r * pion_ratio_4[i]); fixBad[i]->Fill(r * pion_ratio_4[i]); fixAll[i]->Fill(r * pion_ratio_4[i]); } } } } // saving histos TFile f("dist.root", "RECREATE"); for (int i = 0; i < MNP; i++) { perfec[i]->Write(); doNoth[i]->Write(); fixBad[i]->Write(); fixAll[i]->Write(); } f.Close(); } // histos loaded, now plotting for (int i = 0; i < MNP; i++) { doNoth[i]->SetLineColor(kRed); fixBad[i]->SetLineColor(kBlue); fixAll[i]->SetLineColor(kGreen); perfec[i]->GetXaxis()->SetLabelSize(0.08); perfec[i]->GetYaxis()->SetLabelSize(0.08); perfec[i]->GetXaxis()->SetLabelOffset(-0.02); perfec[i]->GetYaxis()->SetLabelOffset(0.02); } double xmom[10]; double ymomA[10]; double ymomB[10]; double ymomC[10]; TCanvas* res = new TCanvas("res", "Photon Yields", 1500, 1200); TPad* pres = new TPad("pres", "pres", 0.01, 0.01, 0.98, 0.9); pres->Divide(5, 2); pres->Draw(); TLatex lab; lab.SetTextFont(102); lab.SetTextColor(kBlue + 2); lab.SetTextSize(0.06); lab.SetNDC(); for (int i = 2; i < 12; i++) { pres->cd(i - 1); perfec[i]->Draw(); fixAll[i]->Draw("same"); doNoth[i]->Draw("same"); fixBad[i]->Draw("same"); double perfectCounts = perfec[i]->Integral(40, 250); double donothCounts = doNoth[i]->Integral(40, 250); double fixBadCounts = fixBad[i]->Integral(40, 250); double fixAllCounts = fixAll[i]->Integral(40, 250); double dmom = (max_m - min_m) / MNP; double mom = min_m + i * dmom; xmom[i - 2] = mom; ymomA[i - 2] = 100 * donothCounts / perfectCounts; ymomB[i - 2] = 100 * fixBadCounts / perfectCounts; ymomC[i - 2] = 100 * fixAllCounts / perfectCounts; cout << " momentum: " << mom << " perfect: " << perfectCounts << " nothing: " << donothCounts << " fix bad: " << fixBadCounts << " fix all " << fixAllCounts << endl; lab.DrawLatex(.5, .82, Form(" mom: %2.1f GeV", mom)); lab.DrawLatex(.5, .75, Form(" do nothing: %3.1f%%", 100 * donothCounts / perfectCounts)); lab.DrawLatex( .5, .68, Form(" fix bad: %3.1f%%", 100 * fixBadCounts / perfectCounts)); lab.DrawLatex( .5, .60, Form(" fix all: %3.1f%%", 100 * fixAllCounts / perfectCounts)); } // res->Print("allMoms.png"); TCanvas* res2 = new TCanvas("res2", "Photon Yields", 1000, 1000); // perfec[5]->Draw(); // fixAll[5]->Draw("same"); // doNoth[5]->Draw("same"); // fixBad[5]->Draw("same"); // // res2->Print("fixAll.png"); TGraph* mresA = new TGraph(10, xmom, ymomA); TGraph* mresB = new TGraph(10, xmom, ymomB); TGraph* mresC = new TGraph(10, xmom, ymomC); mresA->SetMarkerStyle(8); mresB->SetMarkerStyle(21); mresC->SetMarkerStyle(8); mresA->SetMarkerSize(1.6); mresB->SetMarkerSize(1.6); mresC->SetMarkerSize(1.6); mresA->SetMarkerColor(kBlack); mresB->SetMarkerColor(kRed); mresC->SetMarkerColor(kBlue); mresA->Draw("AP"); mresB->Draw("Psame"); mresC->Draw("Psame"); TLegend* lstudy = new TLegend(0.6, 0.35, 0.95, 0.58); lstudy->AddEntry(mresA, "Current Situation", "P"); lstudy->AddEntry(mresB, "Fix Bad", "P"); lstudy->AddEntry(mresC, "Fix So-So", "P"); lstudy->SetBorderSize(0); lstudy->SetFillColor(0); lstudy->Draw(); }
int makePWhisto(TString filename_MC="/home/jpavel/analysis/CMS/ZHtautau/histos/2012ABCD/mc/20130114_AnalFullMC_DYJetsToLL_M-50_TuneZ2Star_8TeV-madgraph-tarball/20130114_AnalFullMC_DYJetsToLL_M-50_TuneZ2Star_8TeV-madgraph-tarball_histo.root",TString filename_data="/home/jpavel/analysis/CMS/ZHtautau/ZHtautauAnalysis/config/dataPileUpHistogramABCD_True_2012.root") { gROOT->Reset(); SetAtlasStyle(); gStyle->SetPalette(1); TFile *f = TFile::Open(filename_MC); if(!f) { std::cerr << "Error: file " << filename_MC << " could not be opened." << std::endl; return 1; } else std::cout << "File " << filename_MC << " succesfully opened!" << std::endl; TFile *g = TFile::Open(filename_data); if(!f) { std::cerr << "Error: file " << filename_data << " could not be opened." << std::endl; return 1; } else std::cout << "File " << filename_data << " succesfully opened!" << std::endl; TH1F* mu_orig_import= (TH1F*)f->Get("h_nPU_raw"); TH1F* mu_RW_import= (TH1F*)f->Get("h_nPU_reweight"); TH1F* mu_data= (TH1F*)g->Get("pileup"); mu_orig_import->Draw(); TH1F* mu_orig_mine = new TH1F("mu_orig_mine","#mu distribution before reweighting;#mu;fraction of events",21,-0.5,20.5); TH1F* mu_RW_mine = new TH1F("mu_RW_mine","#mu distribution after reweighting;#mu;fraction of events",21,-0.5,20.5); TH1F* mu_data_mine = new TH1F("mu_data_mine","#mu distribution in data;#mu;fraction of events",21,-0.5,20.5); for(int iBin = 1; iBin <= mu_orig_mine->GetNbinsX(); iBin++) { mu_orig_mine->SetBinContent(iBin,mu_orig_import->GetBinContent(iBin)); mu_RW_mine->SetBinContent(iBin,mu_RW_import->GetBinContent((iBin-1)*5+1)); float dataMuLowEdge = mu_orig_mine->GetBinLowEdge(iBin); float dataMuHighEdge = mu_orig_mine->GetBinLowEdge(iBin) + mu_orig_mine->GetBinWidth(iBin); int dataBinNumberLowEdge = mu_data->GetXaxis()->FindFixBin(dataMuLowEdge); int dataBinNumberHighEdge = mu_data->GetXaxis()->FindFixBin(dataMuHighEdge); float dataBinContent = mu_data->Integral( dataBinNumberLowEdge, dataBinNumberHighEdge-1 ); mu_data_mine->SetBinContent(iBin,dataBinContent); } mu_orig_mine->SetBinContent(1,mu_orig_import->GetBinContent(101)); mu_orig_import->Scale(1./mu_orig_import->GetSumOfWeights()); mu_RW_import->Scale(1./mu_RW_import->GetSumOfWeights()); mu_data->Scale(1./mu_data->GetSumOfWeights()); //mu_data->Scale(10./mu_data->GetSumOfWeights()); TCanvas* c1 = new TCanvas("c1","c1", 800,600); mu_orig_import->Draw(); c1->Print("mu_mc.png"); c1->Print("mu_mc.eps"); mu_data->GetXaxis()->SetTitle("#mu"); mu_data->GetYaxis()->SetTitle("fraction of events"); mu_data->Draw(); c1->Print("mu_data.png"); c1->Print("mu_data.eps"); float myMax[] = {mu_RW_import->GetMaximum(),mu_data->GetMaximum()}; float Max_h = *max_element(myMax,myMax+2); mu_RW_import->SetMaximum(1.2*Max_h); mu_RW_import->SetMarkerStyle(25); mu_RW_import->SetMarkerSize(1.5); mu_RW_import->GetXaxis()->SetTitle("True number of interactions per event"); mu_RW_import->GetXaxis()->SetRangeUser(0,60); mu_RW_import->GetYaxis()->SetTitle("Fraction of events"); mu_RW_import->Draw("phist"); //~ //~ //mu_data->SetLineColor(kRed); //~ //mu_data->Draw("same"); mu_data->SetLineColor(kGreen); mu_data->SetMarkerStyle(22); mu_data->SetMarkerSize(1.5); mu_data->SetMarkerColor(kGreen); mu_data->Draw("phistsame"); mu_data->Draw("same"); mu_RW_import->Draw("same"); mu_orig_import->SetLineColor(kRed); mu_orig_import->Draw("histsame"); gPad->RedrawAxis(); TLegend* leg = new TLegend(0.6,0.7,0.8,0.93); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextSize(legend_size); leg->AddEntry(mu_RW_import,"re-weighted MC","p"); leg->AddEntry(mu_data,"data 2012ABCD","lp"); leg->AddEntry(mu_orig_import,"Summer12 53x MC","l"); leg->Draw(); c1->Print("mu_reweight.png"); c1->Print("mu_reweight.eps"); c1->SetLogy(); mu_RW_import->SetMaximum(1200*Max_h); c1->Print("mu_reweight_log.png"); c1->Print("mu_reweight_log.eps"); //~ return 0; }
void makeTree(string sample = "DY", string selection = "", float Lumi = 1){ vector<pair<string,float> > files; vector< TH1F* > histos; vector<string> directories; if(sample.find("DY")!=string::npos){ files.push_back( make_pair("DY-madgraph-10to50.root", (310*0.19*Lumi) ) ); files.push_back( make_pair("DY-madgraph-50.root", (2289*0.56*Lumi) ) ); } if(sample.find("Wjets")!=string::npos){ files.push_back( make_pair("W1Jets_ptW-0to100.root", (3.693e+03*0.44*Lumi) ) ); files.push_back( make_pair("W1Jets_ptW-100to300.root", (7.197e+01*0.58*Lumi) ) ); files.push_back( make_pair("W1Jets_ptW-300to800.root", (5.658e-01*0.73*Lumi) ) ); files.push_back( make_pair("W2Jets_ptW-0to100.root", (9.434e+02*0.46*Lumi) ) ); files.push_back( make_pair("W2Jets_ptW-100to300.root", (6.718e+01*0.59*Lumi) ) ); files.push_back( make_pair("W2Jets_ptW-300to800.root", (8.553e-01*0.75*Lumi) ) ); files.push_back( make_pair("W3Jets_ptW-0to100.root", (2.087e+02*0.48*Lumi) ) ); files.push_back( make_pair("W3Jets_ptW-100to300.root", (3.243e+01*0.60*Lumi) ) ); files.push_back( make_pair("W3Jets_ptW-300to800.root", (6.229e-01*0.76*Lumi) ) ); files.push_back( make_pair("W4Jets_ptW-0to100.root", (4.446e+01*0.50*Lumi) ) ); files.push_back( make_pair("W4Jets_ptW-100to300.root", (1.138e+01*0.61*Lumi) ) ); files.push_back( make_pair("W4Jets_ptW-300to800.root", (2.950e-01*0.77*Lumi) ) ); files.push_back( make_pair("W5Jets_ptW-0to100.root", (1.111e+01*0.53*Lumi) ) ); files.push_back( make_pair("W5Jets_ptW-100to300.root", (3.789e+00*0.65*Lumi) ) ); files.push_back( make_pair("W5Jets_ptW-300to800.root", (1.565e-01*0.79*Lumi) ) ); } if(sample.find("TT")!=string::npos){ files.push_back( make_pair("TT.root", (94*Lumi) ) ); } if(sample.find("QCD")!=string::npos){ files.push_back( make_pair("QCD_Pt-0to5.root", (4.84e+10*6.07E-07*Lumi)) ); files.push_back( make_pair("QCD_Pt-5to15.root", (3.68e+10*1.82E-06*Lumi)) ); files.push_back( make_pair("QCD_Pt-15to30.root", (8.16e+08*0.000113*Lumi)) ); files.push_back( make_pair("QCD_Pt-30to50.root", (5.31e+07*0.00388126*Lumi)) ); files.push_back( make_pair("QCD_Pt-50to80.root", (6.36e+06*0.02321727*Lumi)) ); files.push_back( make_pair("QCD_Pt-80to120.root", (7.84e+05*0.06100585*Lumi)) ); files.push_back( make_pair("QCD_Pt-120to170.root", (1.15e+05*0.11389810*Lumi)) ); files.push_back( make_pair("QCD_Pt-170to300.root", (2.43e+04*0.13732413*Lumi)) ); files.push_back( make_pair("QCD_Pt-300to470.root", (1.17e+03*0.317390358*Lumi)) ); files.push_back( make_pair("QCD_Pt_470to600.root", (7.02e+01*0.431763719*Lumi)) ); files.push_back( make_pair("QCD_Pt_600to800.root", (1.56e+01*0.508048972*Lumi)) ); files.push_back( make_pair("QCD_Pt_800to1000.root", (1.84e+00*0.385363968*Lumi)) ); files.push_back( make_pair("QCD_Pt_1000to1400.root", (3.32e-01*0.661857989*Lumi)) ); //files.push_back( make_pair("QCD_Pt_1400to1800.root", (1.09e-02*0.784767648*Lumi)) ); } directories.push_back("etoTauMargLooseNoCracks80"); directories.push_back("etoTauMargLooseNoCracks70"); directories.push_back("etoTauMargLooseNoCracks60"); directories.push_back("etoTauMargMediumNoCracks80"); directories.push_back("etoTauMargMediumNoCracks70"); directories.push_back("etoTauMargMediumNoCracks60"); directories.push_back("etoTauMargTightNoCracks80"); directories.push_back("etoTauMargTightNoCracks70"); directories.push_back("etoTauMargTightNoCracks60"); directories.push_back("etoTauSCMargNoCracks80"); directories.push_back("etoTauSCMargNoCracks70"); directories.push_back("etoTauSCMargNoCracks60"); TFile *outFile = new TFile(("testNewWriteFromPAT_soup"+selection+".root").c_str(),"RECREATE"); int numFiles = 0; for(unsigned int j = 0; j<directories.size(); j++){ numFiles = 0; histos.clear(); for(unsigned int i = 0; i<files.size();i++){ histos.push_back( new TH1F(Form("h_%d",i),Form("file %s",(files[i].first).c_str()),20,40,120) ); } THStack* aStack = new THStack("aStack",""); TLegend* leg = new TLegend(0.1331269,0.5926573,0.3622291,0.8671329,NULL,"brNDC"); leg->SetFillStyle(4000); leg->SetBorderSize(0); leg->SetFillColor(10); leg->SetTextSize(0.03); cout << "Directory " << directories[j] << endl; TChain* outChain = new TChain((directories[j]+"/fitter_tree").c_str()); int counter = 0; for(unsigned int i = 0; i<files.size();i++){ TFile *file = new TFile(("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_"+files[i].first).c_str(),"READ"); if(file->IsZombie()){ cout << "No file " << files[i].first << " is found" << endl; continue; } file->cd("allEventsFilter"); TH1F* totalEvents = (TH1F*)gDirectory->Get("totalEvents"); float readEvents = totalEvents->GetBinContent(1); file->cd(directories[j].c_str()); TTree *oldTree = (TTree*) gDirectory->Get("fitter_tree"); float scaleToNNLO = 1.0; if((files[i].first).find("DY")!=string::npos) scaleToNNLO = 1.33; if((files[i].first).find("W")!=string::npos) scaleToNNLO = 1.23; if((files[i].first).find("TT")!=string::npos) scaleToNNLO = 1.75; int entries = std::min( (int)oldTree->GetEntries(), (int)(((files[i].second*scaleToNNLO)/readEvents)*oldTree->GetEntries()) ); TFile *newFile = new TFile( ("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_"+files[i].first+"new").c_str(), "RECREATE"); TDirectory* dir = (TDirectory*) newFile->mkdir(directories[j].c_str()); TTree *tree = oldTree->CloneTree( entries ); // weight for the tree: 1 if you require less than the overall tree entries, otherwise set it to L*sigma/processed //float weight = std::max((double)files[i].second,1.0); //tree->SetWeight( weight ); double weight; tree->Branch("weight", &weight,"weight/D"); weight = std::max((double)(files[i].second/readEvents),1.0); tree->Fill(); TH1F* h = new TH1F("h","",20,40,120); tree->Draw("mass>>h",("weight*("+selection+")").c_str()); histos[i]->Add(h,1); histos[i]->SetFillColor(i+1); histos[i]->SetLineColor(i+1); //setUpHisto(histos[i],Lumi, directories[j]); aStack->Add( histos[i] ); leg->AddEntry( histos[i], (files[i].first).c_str(),"F"); dir->cd(); tree->Write(); newFile->Write(); counter+=entries; cout << files[i].first << " ==> total entries " << oldTree->GetEntries() << " --- Required " << (int)(files[i].second/readEvents*oldTree->GetEntries()) << " --- Provided " << entries << endl; std::cout << "The tree will have weight: " << weight << std::endl; //outTree->CopyEntries(tree,entries); if(entries>0){ int isOK = outChain->AddFile( ("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_"+files[i].first+"new").c_str()); if( isOK == 0) cout << "No linked file" << endl; numFiles += isOK; } cout << " outChain has " << outChain->GetEntries() << " and attached files " << numFiles << endl; file->Close(); newFile->Close(); //delete h; delete file; delete newFile; } // file //outFile->cd(); TDirectory* dir = (TDirectory*) outFile->mkdir(directories[j].c_str()); TTree* outTree = (TTree*) outChain->CopyTree(""); //outTree->Draw("mass"); cout<< "Total events copied in output directory " << outTree->GetEntries() << " from requested " << counter << endl; dir->cd(); outTree->Write("", TObject::kOverwrite); TCanvas *c1 = new TCanvas("c1","stacked mass",10,30,650,600); c1->SetGrid(0,0); c1->SetFillStyle(4000); c1->SetFillColor(10); c1->SetTicky(); c1->SetObjectStat(0); aStack->Draw("HIST"); setUpHisto( (TH1F*)aStack->GetHistogram(), Lumi, directories[j] ); leg->SetHeader(directories[j].c_str()); leg->Draw(); c1->Write(); for(int i = 0; i<histos.size(); i++){ delete histos[i]; } delete aStack; delete leg; }//directories outFile->Write(); outFile->Close(); delete outFile; }
void tnpScale( bool printplot = false ) { //---------------------------------------- // Files //---------------------------------------- char* version = (char*) "V00-00-00"; TChain *chmc = new TChain("leptons"); TChain *chdata = new TChain("leptons"); char* suffix = ""; //char* suffix = "_2jets"; chmc-> Add(Form("smurf/ZJets_V00-00-01/merged%s.root" ,suffix)); chdata->Add(Form("smurf/SingleMu2012A_V00-00-01/merged%s.root",suffix)); chdata->Add(Form("smurf/SingleMu2012B_V00-00-01/merged%s.root",suffix)); chdata->Add(Form("smurf/SingleMu2012C_V00-00-01/merged%s.root",suffix)); chdata->Add(Form("smurf/SingleEl2012A_V00-00-01/merged%s.root",suffix)); chdata->Add(Form("smurf/SingleEl2012B_V00-00-01/merged%s.root",suffix)); chdata->Add(Form("smurf/SingleEl2012C_V00-00-01/merged%s.root",suffix)); //---------------------------------------- // bins //---------------------------------------- //float ptbin[] = {10., 15., 20., 30., 40., 50., 7000.}; float ptbin[] = {10., 15., 20., 30., 40., 50., 60. , 70. , 80.0 , 100.0 , 7000.}; float etabin[] = {0, 0.8, 1.479, 2.0, 2.5}; int nptbin=10; int netabin=4; // // histogram // //deno TH2F *hmcid_deno = new TH2F("hmcid_deno", "hmcid_deno", nptbin, ptbin, netabin, etabin); TH2F *hmciso_deno = new TH2F("hmciso_deno", "hmciso_deno", nptbin, ptbin, netabin, etabin); TH2F *hdataid_deno = new TH2F("hdataid_deno", "hdataid_deno", nptbin, ptbin, netabin, etabin); TH2F *hdataiso_deno = new TH2F("hdataiso_deno", "hdataiso_deno", nptbin, ptbin, netabin, etabin); hmcid_deno->Sumw2(); hmciso_deno->Sumw2(); hdataid_deno->Sumw2(); hdataiso_deno->Sumw2(); //num TH2F *hmcid_num = new TH2F("hmcid_num", "hmcid_num", nptbin, ptbin, netabin, etabin); TH2F *hmciso_num = new TH2F("hmciso_num", "hmciso_num", nptbin, ptbin, netabin, etabin); TH2F *hdataid_num = new TH2F("hdataid_num", "hdataid_num", nptbin, ptbin, netabin, etabin); TH2F *hdataiso_num = new TH2F("hdataiso_num", "hdataiso_num", nptbin, ptbin, netabin, etabin); hmcid_num->Sumw2(); hmciso_num->Sumw2(); hdataid_num->Sumw2(); hdataiso_num->Sumw2(); // eff TH2F *hmcid = new TH2F("hmcid", "hmcid", nptbin, ptbin, netabin, etabin); TH2F *hmciso = new TH2F("hmciso", "hmciso", nptbin, ptbin, netabin, etabin); TH2F *hdataid = new TH2F("hdataid", "hdataid", nptbin, ptbin, netabin, etabin); TH2F *hdataiso = new TH2F("hdataiso", "hdataiso", nptbin, ptbin, netabin, etabin); hmcid->Sumw2(); hmciso->Sumw2(); hdataid->Sumw2(); hdataiso->Sumw2(); // SF TH2F *hsfid = new TH2F("hsfid", "hsfid", nptbin, ptbin, netabin, etabin); TH2F *hsfiso = new TH2F("hsfiso", "hsfiso", nptbin, ptbin, netabin, etabin); hsfid->Sumw2(); hsfiso->Sumw2(); //--------------------------- // tag cuts //--------------------------- TCut zmass("abs(tagAndProbeMass-91)<15"); TCut eltnp("(eventSelection&1)==1"); TCut mutnp("(eventSelection&2)==2"); TCut os("qProbe*qTag<0"); TCut tag_eta21("abs(tag->eta())<2.1"); TCut tag_eta25("abs(tag->eta())<2.5"); TCut njets1("njets>=1"); TCut njets2("njets>=2"); TCut njets3("njets>=3"); TCut njets4("njets>=4"); TCut tag_pt30("tag->pt()>30.0"); TCut met30("met<30"); TCut met20("met<20"); TCut nbm0("nbm==0"); TCut nbl0("nbl==0"); TCut mt30("mt<30"); TCut eltnptrig("HLT_Ele27_WP80_tag > 0"); TCut mutnptrig("HLT_IsoMu24_tag > 0"); //--------------------------- // tag cuts //--------------------------- TCut mufo = "(leptonSelection&32768)==32768"; // mu fo TCut muid = "(leptonSelection&65536)==65536"; // mu id TCut muiso = "(leptonSelection&131072)==131072"; // mu iso TCut elfo = "(leptonSelection&4)==4"; // ele fo TCut elid = "(leptonSelection&8)==8"; // ele id TCut eliso = "(leptonSelection&16)==16"; // ele iso TCut probept = "probe->pt()>30"; // probe pt TCut drprobe = "drprobe<0.05"; // dR(probe,pfcandidate) TCut eltnpcut; eltnpcut += zmass; eltnpcut += os; eltnpcut += eltnp; eltnpcut += tag_eta21; //eltnpcut += njets2; eltnpcut += tag_pt30; eltnpcut += eltnptrig; eltnpcut += met30; // eltnpcut += mt30; eltnpcut += nbl0; eltnpcut += elid; eltnpcut += probept; eltnpcut += drprobe; TCut mutnpcut; mutnpcut += zmass; mutnpcut += os; mutnpcut += mutnp; mutnpcut += tag_eta21; //mutnpcut += njets2; mutnpcut += tag_pt30; mutnpcut += mutnptrig; mutnpcut += met30; // mutnpcut += mt30; mutnpcut += nbl0; mutnpcut += muid; mutnpcut += probept; mutnpcut += drprobe; //eltnpcut += njets2; //eltnpcut += njets3; //eltnpcut += nbm0; //eltnpcut += mt30; //eltnpcut += met20; //TCut eltnpcut = "abs(tagAndProbeMass-91)<15 && (eventSelection&1)==1 && qProbe*qTag<0 && abs(tag->eta())<2.5 && njets>=4 && tag->pt()>30.0 && met<30.0 && nbm==0 && mt<30"; //TCut mutnpcut = "abs(tagAndProbeMass-91)<15 && (eventSelection&2)==2 && HLT_IsoMu30_eta2p1_tag>0 && qProbe*qTag<0 && abs(tag->eta())<2.1 && njets>=4 && tag->pt()>30.0"; TCut vtxweight = "vtxweight"; cout << "Electrons:" << endl; cout << "Selection : " << eltnpcut.GetTitle() << endl; cout << "Total MC yields : " << chmc->GetEntries(eltnpcut) << endl; cout << "Total DATA yields : " << chdata->GetEntries(eltnpcut) << endl; cout << "Muons:" << endl; cout << "Selection : " << mutnpcut.GetTitle() << endl; cout << "Total MC yields : " << chmc->GetEntries(mutnpcut) << endl; cout << "Total DATA yields : " << chdata->GetEntries(mutnpcut) << endl; //TCut njets = "njets>=2"; TCut tkisoold = "tkisoold/probe->pt()>0.1"; TCut tkisonew = "tkisonew/probe->pt()>0.1"; //----------------------------------------- // check nvtx data vs. MC //----------------------------------------- TH1F *hnvtx_mc = new TH1F("hnvtx_mc" ,"",30,0,30); TH1F *hnvtx_data = new TH1F("hnvtx_data","",30,0,30); hnvtx_mc->Sumw2(); hnvtx_data->Sumw2(); chdata->Draw("nvtx>>hnvtx_data",(eltnpcut||mutnpcut)); chmc->Draw("nvtx>>hnvtx_mc",(eltnpcut||mutnpcut)*vtxweight); TCanvas *c1 = new TCanvas(); c1->cd(); hnvtx_mc->SetLineColor(2); hnvtx_mc->SetMarkerColor(2); hnvtx_data->SetLineColor(4); hnvtx_data->SetMarkerColor(4); hnvtx_data->GetXaxis()->SetTitle("N_{VTX}"); hnvtx_data->DrawNormalized(); hnvtx_mc->DrawNormalized("same"); TLegend *leg = new TLegend(0.6,0.6,0.8,0.8); leg->AddEntry(hnvtx_data,"data","lp"); leg->AddEntry(hnvtx_mc,"MC","lp"); leg->SetFillColor(0); leg->SetBorderSize(0); leg->Draw(); if( printplot ) c1->Print("plots/nvtx.pdf"); //-------------------------- // absolute track isolation //-------------------------- bool residual = true; bool log = true; char* var = "tkisonewnoveto"; plotDistribution( chdata , chmc , TCut(eltnpcut) , vtxweight , var , 10 , 0 , 10 , "abs tkiso [GeV]" , "el_tkiso_0j" , printplot , residual , log ); plotDistribution( chdata , chmc , TCut(mutnpcut) , vtxweight , var , 10 , 0 , 10 , "abs tkiso [GeV]" , "mu_tkiso_0j" , printplot , residual , log ); plotDistribution( chdata , chmc , TCut(eltnpcut+njets1) , vtxweight , var , 10 , 0 , 10 , "abs tkiso [GeV]" , "el_tkiso_1j" , printplot , residual , log ); plotDistribution( chdata , chmc , TCut(mutnpcut+njets1) , vtxweight , var , 10 , 0 , 10 , "abs tkiso [GeV]" , "mu_tkiso_1j" , printplot , residual , log ); plotDistribution( chdata , chmc , TCut(eltnpcut+njets2) , vtxweight , var , 10 , 0 , 10 , "abs tkiso [GeV]" , "el_tkiso_2j" , printplot , residual , log ); plotDistribution( chdata , chmc , TCut(mutnpcut+njets2) , vtxweight , var , 10 , 0 , 10 , "abs tkiso [GeV]" , "mu_tkiso_2j" , printplot , residual , log ); plotDistribution( chdata , chmc , TCut(eltnpcut+njets3) , vtxweight , var , 10 , 0 , 10 , "abs tkiso [GeV]" , "el_tkiso_3j" , printplot , residual , log ); plotDistribution( chdata , chmc , TCut(mutnpcut+njets3) , vtxweight , var , 10 , 0 , 10 , "abs tkiso [GeV]" , "mu_tkiso_3j" , printplot , residual , log ); plotDistribution( chdata , chmc , TCut(eltnpcut+njets4) , vtxweight , var , 10 , 0 , 10 , "abs tkiso [GeV]" , "el_tkiso_4j" , printplot , residual , log ); plotDistribution( chdata , chmc , TCut(mutnpcut+njets4) , vtxweight , var , 10 , 0 , 10 , "abs tkiso [GeV]" , "mu_tkiso_4j" , printplot , residual , log ); //-------------------------- // relative track isolation //-------------------------- // plotDistribution( chdata , chmc , TCut(eltnpcut) , vtxweight , "tkisonew/probe->pt()" , 10 , 0 , 1 , "rel tkiso [GeV]" , "el_tkrliso_2j" , printplot ); // plotDistribution( chdata , chmc , TCut(mutnpcut) , vtxweight , "tkisonew/probe->pt()" , 10 , 0 , 1 , "rel tkiso [GeV]" , "mu_tkrliso_2j" , printplot ); // plotDistribution( chdata , chmc , TCut(eltnpcut+njets3) , vtxweight , "tkisonew/probe->pt()" , 10 , 0 , 1 , "rel tkiso [GeV]" , "el_tkrliso_3j" , printplot ); // plotDistribution( chdata , chmc , TCut(mutnpcut+njets3) , vtxweight , "tkisonew/probe->pt()" , 10 , 0 , 1 , "rel tkiso [GeV]" , "mu_tkrliso_3j" , printplot ); // plotDistribution( chdata , chmc , TCut(eltnpcut+njets4) , vtxweight , "tkisonew/probe->pt()" , 10 , 0 , 1 , "rel tkiso [GeV]" , "el_tkrliso_4j" , printplot ); // plotDistribution( chdata , chmc , TCut(mutnpcut+njets4) , vtxweight , "tkisonew/probe->pt()" , 10 , 0 , 1 , "rel tkiso [GeV]" , "mu_tkrliso_4j" , printplot ); // plotDistribution( chdata , chmc , TCut(eltnpcut) , vtxweight , "tkisoold" , 10 , 0 , 10 , "trkiso (old) [GeV]" , "el_tkiso_old" , printplot ); // plotDistribution( chdata , chmc , TCut(mutnpcut) , vtxweight , "tkisoold" , 10 , 0 , 10 , "trkiso (old) [GeV]" , "mu_tkiso_old" , printplot ); //printHisto( chdata , chmc , TCut(muiso) , TCut(tnpcut+muid) , "probe.pt()" , 10 , 0.0 , 100.0 , "lepton p_{T} [GeV]" , "iso efficiency" ); //printHisto( chdata , chmc , tkisoold , TCut(tnpcut+muid+njets) , "probe.pt()" , 10 , 0.0 , 100.0 , "lepton p_{T} [GeV]" , "tkiso(old) efficiency" ); //printHisto( chdata , chmc , tkisonew , TCut(tnpcut+muid+njets) , "probe.pt()" , 10 , 0.0 , 100.0 , "lepton p_{T} [GeV]" , "tkiso(new) efficiency" ); /* // // Fill histograms // // chmc->Draw("abs(probe->eta()):probe->pt()>>hmcid_deno", tnpcut+"&&"+eliso, "goff"); // chmc->Draw("abs(probe->eta()):probe->pt()>>hmcid_num", tnpcut+"&&"+eliso+"&&"+elid, "goff"); // chmc->Draw("abs(probe->eta()):probe->pt()>>hmciso_deno", tnpcut+"&&"+elid, "goff"); // chmc->Draw("abs(probe->eta()):probe->pt()>>hmciso_num", tnpcut+"&&"+elid+"&&"+eliso, "goff"); // chdata->Draw("abs(probe->eta()):probe->pt()>>hdataid_deno", tnpcut+"&&"+eliso, "goff"); // chdata->Draw("abs(probe->eta()):probe->pt()>>hdataid_num", tnpcut+"&&"+eliso+"&&"+elid, "goff"); // chdata->Draw("abs(probe->eta()):probe->pt()>>hdataiso_deno", tnpcut+"&&"+elid, "goff"); // chdata->Draw("abs(probe->eta()):probe->pt()>>hdataiso_num", tnpcut+"&&"+elid+"&&"+eliso, "goff"); TCut tnpcut = "abs(tagAndProbeMass-91)<15 && (eventSelection&2)==2 && HLT_IsoMu30_eta2p1_tag>0 && qProbe*qTag<0 && abs(tag->eta())<2.1 && njets>=4 && tag->pt()>30.0"; chmc->Draw("abs(probe->eta()):probe->pt()>>hmcid_deno", tnpcut+muiso, "goff"); chmc->Draw("abs(probe->eta()):probe->pt()>>hmcid_num", tnpcut+muiso+muid, "goff"); chmc->Draw("abs(probe->eta()):probe->pt()>>hmciso_deno", tnpcut+muid, "goff"); chmc->Draw("abs(probe->eta()):probe->pt()>>hmciso_num", tnpcut+muid+muiso, "goff"); chdata->Draw("abs(probe->eta()):probe->pt()>>hdataid_deno", tnpcut+muiso, "goff"); chdata->Draw("abs(probe->eta()):probe->pt()>>hdataid_num", tnpcut+muiso+muid, "goff"); chdata->Draw("abs(probe->eta()):probe->pt()>>hdataiso_deno", tnpcut+muid, "goff"); chdata->Draw("abs(probe->eta()):probe->pt()>>hdataiso_num", tnpcut+muid+muiso, "goff"); // get efficiencies // hmcid->Divide(hmcid_num,hmcid_deno,1,1,"B"); // hmciso->Divide(hmciso_num,hmciso_deno,1,1,"B"); // hdataid->Divide(hdataid_num,hdataid_deno,1,1,"B"); // hdataiso->Divide(hdataiso_num,hdataiso_deno,1,1,"B"); hmcid->Divide(hmcid_num,hmcid_deno,1,1); hmciso->Divide(hmciso_num,hmciso_deno,1,1); hdataid->Divide(hdataid_num,hdataid_deno,1,1); hdataiso->Divide(hdataiso_num,hdataiso_deno,1,1); // get scale factors hsfid->Divide(hdataid, hmcid, 1, 1); hsfiso->Divide(hdataiso, hmciso, 1, 1); // Draw histograms //hmcid->Draw("text"); */ /* // print table cout << " ------ MC ID ----- " << endl; printline(hmcid); cout << " ------ MC ISO ----- " << endl; printline(hmciso); cout << " ------ DATA ID ----- " << endl; printline(hdataid); cout << " ------ DATA ISO ----- " << endl; printline(hdataiso); cout << " ------ Scale Factor ID ----- " << endl; printline(hsfid); cout << " ------ Scale Factor ISO ----- " << endl; printline(hsfiso); */ }
void SegtoLCTY_2016B_June22all_sameYrange_fullIntegral_10k9k() { //=========Macro generated from canvas: SegtoLCTY/SegtoLCTY //========= (Fri Aug 5 09:22:37 2016) by ROOT version6.06/01 TCanvas *SegtoLCTY = new TCanvas("SegtoLCTY", "SegtoLCTY",0,0,500,500); gStyle->SetOptStat(0); SegtoLCTY->SetHighLightColor(2); SegtoLCTY->Range(-50,-2.848556,50,2.626708); SegtoLCTY->SetFillColor(0); SegtoLCTY->SetBorderMode(0); SegtoLCTY->SetBorderSize(2); SegtoLCTY->SetLogy(); SegtoLCTY->SetFrameBorderMode(0); SegtoLCTY->SetFrameBorderMode(0); TH1D *SegtoLCTY_1__37 = new TH1D("SegtoLCTY_1__37","SegtoLCTY",100,-40,40); SegtoLCTY_1__37->SetBinContent(0,1.898254); SegtoLCTY_1__37->SetBinContent(1,0.002442073); SegtoLCTY_1__37->SetBinContent(2,0.002136814); SegtoLCTY_1__37->SetBinContent(3,0.0009157775); SegtoLCTY_1__37->SetBinContent(4,0.002594703); SegtoLCTY_1__37->SetBinContent(5,0.002594703); SegtoLCTY_1__37->SetBinContent(6,0.002594703); SegtoLCTY_1__37->SetBinContent(7,0.002442073); SegtoLCTY_1__37->SetBinContent(8,0.001831555); SegtoLCTY_1__37->SetBinContent(9,0.002747332); SegtoLCTY_1__37->SetBinContent(10,0.003052592); SegtoLCTY_1__37->SetBinContent(11,0.00366311); SegtoLCTY_1__37->SetBinContent(12,0.001831555); SegtoLCTY_1__37->SetBinContent(13,0.003052592); SegtoLCTY_1__37->SetBinContent(14,0.004273628); SegtoLCTY_1__37->SetBinContent(15,0.003815739); SegtoLCTY_1__37->SetBinContent(16,0.003968369); SegtoLCTY_1__37->SetBinContent(17,0.002594703); SegtoLCTY_1__37->SetBinContent(18,0.002899962); SegtoLCTY_1__37->SetBinContent(19,0.005036776); SegtoLCTY_1__37->SetBinContent(20,0.004120999); SegtoLCTY_1__37->SetBinContent(21,0.003815739); SegtoLCTY_1__37->SetBinContent(22,0.005036776); SegtoLCTY_1__37->SetBinContent(23,0.004426258); SegtoLCTY_1__37->SetBinContent(24,0.005036776); SegtoLCTY_1__37->SetBinContent(25,0.006868331); SegtoLCTY_1__37->SetBinContent(26,0.007020961); SegtoLCTY_1__37->SetBinContent(27,0.006257813); SegtoLCTY_1__37->SetBinContent(28,0.006868331); SegtoLCTY_1__37->SetBinContent(29,0.007020961); SegtoLCTY_1__37->SetBinContent(30,0.01068407); SegtoLCTY_1__37->SetBinContent(31,0.006868331); SegtoLCTY_1__37->SetBinContent(32,0.01007355); SegtoLCTY_1__37->SetBinContent(33,0.009310404); SegtoLCTY_1__37->SetBinContent(34,0.01037881); SegtoLCTY_1__37->SetBinContent(35,0.01266826); SegtoLCTY_1__37->SetBinContent(36,0.01159985); SegtoLCTY_1__37->SetBinContent(37,0.01648399); SegtoLCTY_1__37->SetBinContent(38,0.01831555); SegtoLCTY_1__37->SetBinContent(39,0.01984185); SegtoLCTY_1__37->SetBinContent(40,0.01846818); SegtoLCTY_1__37->SetBinContent(41,0.02243655); SegtoLCTY_1__37->SetBinContent(42,0.02671018); SegtoLCTY_1__37->SetBinContent(43,0.03937843); SegtoLCTY_1__37->SetBinContent(44,0.03617321); SegtoLCTY_1__37->SetBinContent(45,0.04868884); SegtoLCTY_1__37->SetBinContent(46,0.05479402); SegtoLCTY_1__37->SetBinContent(47,0.07723057); SegtoLCTY_1__37->SetBinContent(48,0.1245457); SegtoLCTY_1__37->SetBinContent(49,1.805913); SegtoLCTY_1__37->SetBinContent(50,5.034181); SegtoLCTY_1__37->SetBinContent(51,85.83888); SegtoLCTY_1__37->SetBinContent(52,3.317862); SegtoLCTY_1__37->SetBinContent(53,1.832013); SegtoLCTY_1__37->SetBinContent(54,0.3237273); SegtoLCTY_1__37->SetBinContent(55,0.2254339); SegtoLCTY_1__37->SetBinContent(56,0.1320246); SegtoLCTY_1__37->SetBinContent(57,0.1472875); SegtoLCTY_1__37->SetBinContent(58,0.0799779); SegtoLCTY_1__37->SetBinContent(59,0.07280431); SegtoLCTY_1__37->SetBinContent(60,0.05342035); SegtoLCTY_1__37->SetBinContent(61,0.04533098); SegtoLCTY_1__37->SetBinContent(62,0.03724162); SegtoLCTY_1__37->SetBinContent(63,0.03479954); SegtoLCTY_1__37->SetBinContent(64,0.0257944); SegtoLCTY_1__37->SetBinContent(65,0.01663662); SegtoLCTY_1__37->SetBinContent(66,0.02258918); SegtoLCTY_1__37->SetBinContent(67,0.02106288); SegtoLCTY_1__37->SetBinContent(68,0.01419455); SegtoLCTY_1__37->SetBinContent(69,0.0190787); SegtoLCTY_1__37->SetBinContent(70,0.01465244); SegtoLCTY_1__37->SetBinContent(71,0.0175524); SegtoLCTY_1__37->SetBinContent(72,0.0108367); SegtoLCTY_1__37->SetBinContent(73,0.01144722); SegtoLCTY_1__37->SetBinContent(74,0.01419455); SegtoLCTY_1__37->SetBinContent(75,0.008852516); SegtoLCTY_1__37->SetBinContent(76,0.009157775); SegtoLCTY_1__37->SetBinContent(77,0.009768293); SegtoLCTY_1__37->SetBinContent(78,0.007784109); SegtoLCTY_1__37->SetBinContent(79,0.009615663); SegtoLCTY_1__37->SetBinContent(80,0.006410442); SegtoLCTY_1__37->SetBinContent(81,0.007936738); SegtoLCTY_1__37->SetBinContent(82,0.006105183); SegtoLCTY_1__37->SetBinContent(83,0.007020961); SegtoLCTY_1__37->SetBinContent(84,0.006868331); SegtoLCTY_1__37->SetBinContent(85,0.005494665); SegtoLCTY_1__37->SetBinContent(86,0.005494665); SegtoLCTY_1__37->SetBinContent(87,0.005342035); SegtoLCTY_1__37->SetBinContent(88,0.005494665); SegtoLCTY_1__37->SetBinContent(89,0.005647294); SegtoLCTY_1__37->SetBinContent(90,0.005036776); SegtoLCTY_1__37->SetBinContent(91,0.003052592); SegtoLCTY_1__37->SetBinContent(92,0.004273628); SegtoLCTY_1__37->SetBinContent(93,0.002899962); SegtoLCTY_1__37->SetBinContent(94,0.003357851); SegtoLCTY_1__37->SetBinContent(95,0.002899962); SegtoLCTY_1__37->SetBinContent(96,0.005647294); SegtoLCTY_1__37->SetBinContent(97,0.003052592); SegtoLCTY_1__37->SetBinContent(98,0.002594703); SegtoLCTY_1__37->SetBinContent(99,0.003052592); SegtoLCTY_1__37->SetBinContent(100,0.002594703); SegtoLCTY_1__37->SetBinContent(101,1.24912); SegtoLCTY_1__37->SetMinimum(0.005); SegtoLCTY_1__37->SetMaximum(120); SegtoLCTY_1__37->SetEntries(675802); SegtoLCTY_1__37->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#ff00ff"); SegtoLCTY_1__37->SetLineColor(ci); ci = TColor::GetColor("#ff00ff"); SegtoLCTY_1__37->SetMarkerColor(ci); SegtoLCTY_1__37->GetXaxis()->SetTitle("cm"); SegtoLCTY_1__37->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTY_1__37->Draw("H"); TLegend *leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("SegtoLCTY_1","ME11A: mean:0.1cm;RMS:1.7cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_2","ME11B: mean:0.2cm;RMS:1.6cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_3","ME12+13: mean:0.5cm;RMS:1.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_4","ME2: mean:0.2cm;RMS:1.1cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_5","ME3: mean:-0.1cm;RMS:1.1cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_6","ME4: mean:-0.1cm;RMS:1.2cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegtoLCTY_2__38 = new TH1D("SegtoLCTY_2__38","SegtoLCTY",100,-40,40); SegtoLCTY_2__38->SetBinContent(0,0.6313823); SegtoLCTY_2__38->SetBinContent(1,0.002236199); SegtoLCTY_2__38->SetBinContent(2,0.002494222); SegtoLCTY_2__38->SetBinContent(3,0.001720153); SegtoLCTY_2__38->SetBinContent(4,0.001376123); SegtoLCTY_2__38->SetBinContent(5,0.002150192); SegtoLCTY_2__38->SetBinContent(6,0.002064184); SegtoLCTY_2__38->SetBinContent(7,0.00369833); SegtoLCTY_2__38->SetBinContent(8,0.003182284); SegtoLCTY_2__38->SetBinContent(9,0.003096276); SegtoLCTY_2__38->SetBinContent(10,0.003526314); SegtoLCTY_2__38->SetBinContent(11,0.003354299); SegtoLCTY_2__38->SetBinContent(12,0.001376123); SegtoLCTY_2__38->SetBinContent(13,0.00369833); SegtoLCTY_2__38->SetBinContent(14,0.004128368); SegtoLCTY_2__38->SetBinContent(15,0.002150192); SegtoLCTY_2__38->SetBinContent(16,0.002924261); SegtoLCTY_2__38->SetBinContent(17,0.003010268); SegtoLCTY_2__38->SetBinContent(18,0.004214376); SegtoLCTY_2__38->SetBinContent(19,0.004128368); SegtoLCTY_2__38->SetBinContent(20,0.005246468); SegtoLCTY_2__38->SetBinContent(21,0.005246468); SegtoLCTY_2__38->SetBinContent(22,0.003870345); SegtoLCTY_2__38->SetBinContent(23,0.005676506); SegtoLCTY_2__38->SetBinContent(24,0.005934529); SegtoLCTY_2__38->SetBinContent(25,0.006364568); SegtoLCTY_2__38->SetBinContent(26,0.00516046); SegtoLCTY_2__38->SetBinContent(27,0.00627856); SegtoLCTY_2__38->SetBinContent(28,0.006880614); SegtoLCTY_2__38->SetBinContent(29,0.006880614); SegtoLCTY_2__38->SetBinContent(30,0.008342744); SegtoLCTY_2__38->SetBinContent(31,0.00885879); SegtoLCTY_2__38->SetBinContent(32,0.009202821); SegtoLCTY_2__38->SetBinContent(33,0.01083697); SegtoLCTY_2__38->SetBinContent(34,0.01049294); SegtoLCTY_2__38->SetBinContent(35,0.01247111); SegtoLCTY_2__38->SetBinContent(36,0.01358921); SegtoLCTY_2__38->SetBinContent(37,0.01505134); SegtoLCTY_2__38->SetBinContent(38,0.01530937); SegtoLCTY_2__38->SetBinContent(39,0.01608343); SegtoLCTY_2__38->SetBinContent(40,0.02124389); SegtoLCTY_2__38->SetBinContent(41,0.02451219); SegtoLCTY_2__38->SetBinContent(42,0.02459819); SegtoLCTY_2__38->SetBinContent(43,0.03552117); SegtoLCTY_2__38->SetBinContent(44,0.03835942); SegtoLCTY_2__38->SetBinContent(45,0.0538408); SegtoLCTY_2__38->SetBinContent(46,0.07448264); SegtoLCTY_2__38->SetBinContent(47,0.07998713); SegtoLCTY_2__38->SetBinContent(48,0.1540397); SegtoLCTY_2__38->SetBinContent(49,3.500856); SegtoLCTY_2__38->SetBinContent(50,4.506716); SegtoLCTY_2__38->SetBinContent(51,79.10719); SegtoLCTY_2__38->SetBinContent(52,6.900309); SegtoLCTY_2__38->SetBinContent(53,3.7692); SegtoLCTY_2__38->SetBinContent(54,0.4788907); SegtoLCTY_2__38->SetBinContent(55,0.2770307); SegtoLCTY_2__38->SetBinContent(56,0.1499114); SegtoLCTY_2__38->SetBinContent(57,0.09228623); SegtoLCTY_2__38->SetBinContent(58,0.06829009); SegtoLCTY_2__38->SetBinContent(59,0.05237867); SegtoLCTY_2__38->SetBinContent(60,0.04240178); SegtoLCTY_2__38->SetBinContent(61,0.033629); SegtoLCTY_2__38->SetBinContent(62,0.02924261); SegtoLCTY_2__38->SetBinContent(63,0.02313606); SegtoLCTY_2__38->SetBinContent(64,0.02029781); SegtoLCTY_2__38->SetBinContent(65,0.01745956); SegtoLCTY_2__38->SetBinContent(66,0.01849165); SegtoLCTY_2__38->SetBinContent(67,0.01315917); SegtoLCTY_2__38->SetBinContent(68,0.01315917); SegtoLCTY_2__38->SetBinContent(69,0.00885879); SegtoLCTY_2__38->SetBinContent(70,0.01023491); SegtoLCTY_2__38->SetBinContent(71,0.00885879); SegtoLCTY_2__38->SetBinContent(72,0.007052629); SegtoLCTY_2__38->SetBinContent(73,0.007568675); SegtoLCTY_2__38->SetBinContent(74,0.008084721); SegtoLCTY_2__38->SetBinContent(75,0.006106545); SegtoLCTY_2__38->SetBinContent(76,0.006192552); SegtoLCTY_2__38->SetBinContent(77,0.006536583); SegtoLCTY_2__38->SetBinContent(78,0.005504491); SegtoLCTY_2__38->SetBinContent(79,0.003784337); SegtoLCTY_2__38->SetBinContent(80,0.005074453); SegtoLCTY_2__38->SetBinContent(81,0.004730422); SegtoLCTY_2__38->SetBinContent(82,0.004300384); SegtoLCTY_2__38->SetBinContent(83,0.003010268); SegtoLCTY_2__38->SetBinContent(84,0.003526314); SegtoLCTY_2__38->SetBinContent(85,0.003354299); SegtoLCTY_2__38->SetBinContent(86,0.002752245); SegtoLCTY_2__38->SetBinContent(87,0.003784337); SegtoLCTY_2__38->SetBinContent(88,0.00369833); SegtoLCTY_2__38->SetBinContent(89,0.004214376); SegtoLCTY_2__38->SetBinContent(90,0.003096276); SegtoLCTY_2__38->SetBinContent(91,0.003182284); SegtoLCTY_2__38->SetBinContent(92,0.00369833); SegtoLCTY_2__38->SetBinContent(93,0.003010268); SegtoLCTY_2__38->SetBinContent(94,0.002322207); SegtoLCTY_2__38->SetBinContent(95,0.002752245); SegtoLCTY_2__38->SetBinContent(96,0.001978176); SegtoLCTY_2__38->SetBinContent(97,0.00258023); SegtoLCTY_2__38->SetBinContent(98,0.002666238); SegtoLCTY_2__38->SetBinContent(99,0.002322207); SegtoLCTY_2__38->SetBinContent(100,0.002236199); SegtoLCTY_2__38->SetBinContent(101,1.317035); SegtoLCTY_2__38->SetEntries(1185341); SegtoLCTY_2__38->SetStats(0); ci = TColor::GetColor("#ff9999"); SegtoLCTY_2__38->SetLineColor(ci); ci = TColor::GetColor("#ff9999"); SegtoLCTY_2__38->SetMarkerColor(ci); SegtoLCTY_2__38->GetXaxis()->SetTitle("cm"); SegtoLCTY_2__38->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTY_2__38->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegtoLCTY_1","ME11A: mean:0.1cm;RMS:1.7cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_2","ME11B: mean:0.2cm;RMS:1.6cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_3","ME12+13: mean:0.5cm;RMS:1.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_4","ME2: mean:0.2cm;RMS:1.1cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_5","ME3: mean:-0.1cm;RMS:1.1cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_6","ME4: mean:-0.1cm;RMS:1.2cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegtoLCTY_3__39 = new TH1D("SegtoLCTY_3__39","SegtoLCTY",100,-40,40); SegtoLCTY_3__39->SetBinContent(0,0.2784678); SegtoLCTY_3__39->SetBinContent(1,0.002072319); SegtoLCTY_3__39->SetBinContent(2,0.002072319); SegtoLCTY_3__39->SetBinContent(3,0.0007771195); SegtoLCTY_3__39->SetBinContent(4,0.002072319); SegtoLCTY_3__39->SetBinContent(5,0.002072319); SegtoLCTY_3__39->SetBinContent(6,0.003108478); SegtoLCTY_3__39->SetBinContent(7,0.002331359); SegtoLCTY_3__39->SetBinContent(8,0.002849438); SegtoLCTY_3__39->SetBinContent(9,0.002331359); SegtoLCTY_3__39->SetBinContent(10,0.002072319); SegtoLCTY_3__39->SetBinContent(11,0.001554239); SegtoLCTY_3__39->SetBinContent(12,0.001813279); SegtoLCTY_3__39->SetBinContent(13,0.001813279); SegtoLCTY_3__39->SetBinContent(14,0.001813279); SegtoLCTY_3__39->SetBinContent(15,0.002849438); SegtoLCTY_3__39->SetBinContent(16,0.002590398); SegtoLCTY_3__39->SetBinContent(17,0.001813279); SegtoLCTY_3__39->SetBinContent(18,0.001554239); SegtoLCTY_3__39->SetBinContent(19,0.002590398); SegtoLCTY_3__39->SetBinContent(20,0.004144637); SegtoLCTY_3__39->SetBinContent(21,0.002331359); SegtoLCTY_3__39->SetBinContent(22,0.002849438); SegtoLCTY_3__39->SetBinContent(23,0.002072319); SegtoLCTY_3__39->SetBinContent(24,0.003626558); SegtoLCTY_3__39->SetBinContent(25,0.001554239); SegtoLCTY_3__39->SetBinContent(26,0.003367518); SegtoLCTY_3__39->SetBinContent(27,0.003885598); SegtoLCTY_3__39->SetBinContent(28,0.002331359); SegtoLCTY_3__39->SetBinContent(29,0.003108478); SegtoLCTY_3__39->SetBinContent(30,0.004662717); SegtoLCTY_3__39->SetBinContent(31,0.006735036); SegtoLCTY_3__39->SetBinContent(32,0.004144637); SegtoLCTY_3__39->SetBinContent(33,0.004921757); SegtoLCTY_3__39->SetBinContent(34,0.004921757); SegtoLCTY_3__39->SetBinContent(35,0.006216956); SegtoLCTY_3__39->SetBinContent(36,0.006216956); SegtoLCTY_3__39->SetBinContent(37,0.006216956); SegtoLCTY_3__39->SetBinContent(38,0.009325434); SegtoLCTY_3__39->SetBinContent(39,0.008030235); SegtoLCTY_3__39->SetBinContent(40,0.009325434); SegtoLCTY_3__39->SetBinContent(41,0.01036159); SegtoLCTY_3__39->SetBinContent(42,0.01165679); SegtoLCTY_3__39->SetBinContent(43,0.01554239); SegtoLCTY_3__39->SetBinContent(44,0.01735567); SegtoLCTY_3__39->SetBinContent(45,0.02642206); SegtoLCTY_3__39->SetBinContent(46,0.03237998); SegtoLCTY_3__39->SetBinContent(47,0.04766333); SegtoLCTY_3__39->SetBinContent(48,0.07667579); SegtoLCTY_3__39->SetBinContent(49,1.295458); SegtoLCTY_3__39->SetBinContent(50,14.74714); SegtoLCTY_3__39->SetBinContent(51,54.13544); SegtoLCTY_3__39->SetBinContent(52,15.52219); SegtoLCTY_3__39->SetBinContent(53,7.625356); SegtoLCTY_3__39->SetBinContent(54,3.031284); SegtoLCTY_3__39->SetBinContent(55,2.189923); SegtoLCTY_3__39->SetBinContent(56,0.5009831); SegtoLCTY_3__39->SetBinContent(57,0.1761471); SegtoLCTY_3__39->SetBinContent(58,0.09325434); SegtoLCTY_3__39->SetBinContent(59,0.05517549); SegtoLCTY_3__39->SetBinContent(60,0.03807886); SegtoLCTY_3__39->SetBinContent(61,0.02460879); SegtoLCTY_3__39->SetBinContent(62,0.02719918); SegtoLCTY_3__39->SetBinContent(63,0.01631951); SegtoLCTY_3__39->SetBinContent(64,0.01165679); SegtoLCTY_3__39->SetBinContent(65,0.01476527); SegtoLCTY_3__39->SetBinContent(66,0.01010255); SegtoLCTY_3__39->SetBinContent(67,0.004921757); SegtoLCTY_3__39->SetBinContent(68,0.01036159); SegtoLCTY_3__39->SetBinContent(69,0.004921757); SegtoLCTY_3__39->SetBinContent(70,0.003626558); SegtoLCTY_3__39->SetBinContent(71,0.006994076); SegtoLCTY_3__39->SetBinContent(72,0.005698877); SegtoLCTY_3__39->SetBinContent(73,0.005698877); SegtoLCTY_3__39->SetBinContent(74,0.003626558); SegtoLCTY_3__39->SetBinContent(75,0.003108478); SegtoLCTY_3__39->SetBinContent(76,0.004144637); SegtoLCTY_3__39->SetBinContent(77,0.003108478); SegtoLCTY_3__39->SetBinContent(78,0.002331359); SegtoLCTY_3__39->SetBinContent(79,0.003108478); SegtoLCTY_3__39->SetBinContent(80,0.003885598); SegtoLCTY_3__39->SetBinContent(81,0.003367518); SegtoLCTY_3__39->SetBinContent(82,0.002331359); SegtoLCTY_3__39->SetBinContent(83,0.002072319); SegtoLCTY_3__39->SetBinContent(84,0.001813279); SegtoLCTY_3__39->SetBinContent(85,0.002331359); SegtoLCTY_3__39->SetBinContent(86,0.003367518); SegtoLCTY_3__39->SetBinContent(87,0.002849438); SegtoLCTY_3__39->SetBinContent(88,0.002072319); SegtoLCTY_3__39->SetBinContent(89,0.001813279); SegtoLCTY_3__39->SetBinContent(90,0.002849438); SegtoLCTY_3__39->SetBinContent(91,0.002072319); SegtoLCTY_3__39->SetBinContent(92,0.001554239); SegtoLCTY_3__39->SetBinContent(93,0.001036159); SegtoLCTY_3__39->SetBinContent(94,0.002849438); SegtoLCTY_3__39->SetBinContent(95,0.001295199); SegtoLCTY_3__39->SetBinContent(96,0.001554239); SegtoLCTY_3__39->SetBinContent(97,0.001813279); SegtoLCTY_3__39->SetBinContent(98,0.001554239); SegtoLCTY_3__39->SetBinContent(99,0.001295199); SegtoLCTY_3__39->SetBinContent(100,0.001295199); SegtoLCTY_3__39->SetBinContent(101,0.6424188); SegtoLCTY_3__39->SetEntries(389596); SegtoLCTY_3__39->SetStats(0); SegtoLCTY_3__39->GetXaxis()->SetTitle("cm"); SegtoLCTY_3__39->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTY_3__39->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegtoLCTY_1","ME11A: mean:0.1cm;RMS:1.7cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_2","ME11B: mean:0.2cm;RMS:1.6cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_3","ME12+13: mean:0.5cm;RMS:1.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_4","ME2: mean:0.2cm;RMS:1.1cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_5","ME3: mean:-0.1cm;RMS:1.1cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_6","ME4: mean:-0.1cm;RMS:1.2cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegtoLCTY_4__40 = new TH1D("SegtoLCTY_4__40","SegtoLCTY",100,-40,40); SegtoLCTY_4__40->SetBinContent(0,0.8410274); SegtoLCTY_4__40->SetBinContent(1,0.0004816881); SegtoLCTY_4__40->SetBinContent(2,0.000535209); SegtoLCTY_4__40->SetBinContent(3,0.0006957717); SegtoLCTY_4__40->SetBinContent(4,0.0006957717); SegtoLCTY_4__40->SetBinContent(5,0.001016897); SegtoLCTY_4__40->SetBinContent(6,0.0009098553); SegtoLCTY_4__40->SetBinContent(7,0.0002140836); SegtoLCTY_4__40->SetBinContent(8,0.000535209); SegtoLCTY_4__40->SetBinContent(9,0.0006957717); SegtoLCTY_4__40->SetBinContent(10,0.000535209); SegtoLCTY_4__40->SetBinContent(11,0.0006957717); SegtoLCTY_4__40->SetBinContent(12,0.0006957717); SegtoLCTY_4__40->SetBinContent(13,0.0007492926); SegtoLCTY_4__40->SetBinContent(14,0.0007492926); SegtoLCTY_4__40->SetBinContent(15,0.0004816881); SegtoLCTY_4__40->SetBinContent(16,0.001016897); SegtoLCTY_4__40->SetBinContent(17,0.0007492926); SegtoLCTY_4__40->SetBinContent(18,0.0008028135); SegtoLCTY_4__40->SetBinContent(19,0.001123939); SegtoLCTY_4__40->SetBinContent(20,0.001338022); SegtoLCTY_4__40->SetBinContent(21,0.001284502); SegtoLCTY_4__40->SetBinContent(22,0.001498585); SegtoLCTY_4__40->SetBinContent(23,0.001284502); SegtoLCTY_4__40->SetBinContent(24,0.001605627); SegtoLCTY_4__40->SetBinContent(25,0.001819711); SegtoLCTY_4__40->SetBinContent(26,0.00117746); SegtoLCTY_4__40->SetBinContent(27,0.001230981); SegtoLCTY_4__40->SetBinContent(28,0.001498585); SegtoLCTY_4__40->SetBinContent(29,0.001712669); SegtoLCTY_4__40->SetBinContent(30,0.001445064); SegtoLCTY_4__40->SetBinContent(31,0.002676045); SegtoLCTY_4__40->SetBinContent(32,0.00235492); SegtoLCTY_4__40->SetBinContent(33,0.002676045); SegtoLCTY_4__40->SetBinContent(34,0.00240844); SegtoLCTY_4__40->SetBinContent(35,0.003211254); SegtoLCTY_4__40->SetBinContent(36,0.004121109); SegtoLCTY_4__40->SetBinContent(37,0.003907026); SegtoLCTY_4__40->SetBinContent(38,0.004121109); SegtoLCTY_4__40->SetBinContent(39,0.00776053); SegtoLCTY_4__40->SetBinContent(40,0.00711828); SegtoLCTY_4__40->SetBinContent(41,0.009098553); SegtoLCTY_4__40->SetBinContent(42,0.009633762); SegtoLCTY_4__40->SetBinContent(43,0.01081122); SegtoLCTY_4__40->SetBinContent(44,0.01546754); SegtoLCTY_4__40->SetBinContent(45,0.0163774); SegtoLCTY_4__40->SetBinContent(46,0.03163085); SegtoLCTY_4__40->SetBinContent(47,0.06224481); SegtoLCTY_4__40->SetBinContent(48,1.059553); SegtoLCTY_4__40->SetBinContent(49,1.844384); SegtoLCTY_4__40->SetBinContent(50,7.443151); SegtoLCTY_4__40->SetBinContent(51,76.64963); SegtoLCTY_4__40->SetBinContent(52,6.21854); SegtoLCTY_4__40->SetBinContent(53,2.206881); SegtoLCTY_4__40->SetBinContent(54,2.981221); SegtoLCTY_4__40->SetBinContent(55,0.782422); SegtoLCTY_4__40->SetBinContent(56,0.2253765); SegtoLCTY_4__40->SetBinContent(57,0.1047404); SegtoLCTY_4__40->SetBinContent(58,0.06138847); SegtoLCTY_4__40->SetBinContent(59,0.04115757); SegtoLCTY_4__40->SetBinContent(60,0.02788439); SegtoLCTY_4__40->SetBinContent(61,0.0179295); SegtoLCTY_4__40->SetBinContent(62,0.01525346); SegtoLCTY_4__40->SetBinContent(63,0.01107883); SegtoLCTY_4__40->SetBinContent(64,0.01038305); SegtoLCTY_4__40->SetBinContent(65,0.007599968); SegtoLCTY_4__40->SetBinContent(66,0.007225321); SegtoLCTY_4__40->SetBinContent(67,0.005833778); SegtoLCTY_4__40->SetBinContent(68,0.005405611); SegtoLCTY_4__40->SetBinContent(69,0.003639421); SegtoLCTY_4__40->SetBinContent(70,0.002676045); SegtoLCTY_4__40->SetBinContent(71,0.003157733); SegtoLCTY_4__40->SetBinContent(72,0.002676045); SegtoLCTY_4__40->SetBinContent(73,0.002194357); SegtoLCTY_4__40->SetBinContent(74,0.001819711); SegtoLCTY_4__40->SetBinContent(75,0.002301399); SegtoLCTY_4__40->SetBinContent(76,0.002087315); SegtoLCTY_4__40->SetBinContent(77,0.001926752); SegtoLCTY_4__40->SetBinContent(78,0.002140836); SegtoLCTY_4__40->SetBinContent(79,0.00176619); SegtoLCTY_4__40->SetBinContent(80,0.001552106); SegtoLCTY_4__40->SetBinContent(81,0.0009633762); SegtoLCTY_4__40->SetBinContent(82,0.001338022); SegtoLCTY_4__40->SetBinContent(83,0.00117746); SegtoLCTY_4__40->SetBinContent(84,0.001498585); SegtoLCTY_4__40->SetBinContent(85,0.00117746); SegtoLCTY_4__40->SetBinContent(86,0.000535209); SegtoLCTY_4__40->SetBinContent(87,0.001445064); SegtoLCTY_4__40->SetBinContent(88,0.001016897); SegtoLCTY_4__40->SetBinContent(89,0.00117746); SegtoLCTY_4__40->SetBinContent(90,0.00117746); SegtoLCTY_4__40->SetBinContent(91,0.0006422508); SegtoLCTY_4__40->SetBinContent(92,0.0008028135); SegtoLCTY_4__40->SetBinContent(93,0.0009633762); SegtoLCTY_4__40->SetBinContent(94,0.0005887299); SegtoLCTY_4__40->SetBinContent(95,0.0006957717); SegtoLCTY_4__40->SetBinContent(96,0.0009633762); SegtoLCTY_4__40->SetBinContent(97,0.001016897); SegtoLCTY_4__40->SetBinContent(98,0.0008028135); SegtoLCTY_4__40->SetBinContent(99,0.001123939); SegtoLCTY_4__40->SetBinContent(100,0.001016897); SegtoLCTY_4__40->SetBinContent(101,0.3512041); SegtoLCTY_4__40->SetEntries(1890705); SegtoLCTY_4__40->SetStats(0); ci = TColor::GetColor("#ff0000"); SegtoLCTY_4__40->SetLineColor(ci); ci = TColor::GetColor("#ff0000"); SegtoLCTY_4__40->SetMarkerColor(ci); SegtoLCTY_4__40->GetXaxis()->SetTitle("cm"); SegtoLCTY_4__40->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTY_4__40->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegtoLCTY_1","ME11A: mean:0.1cm;RMS:1.7cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_2","ME11B: mean:0.2cm;RMS:1.6cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_3","ME12+13: mean:0.5cm;RMS:1.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_4","ME2: mean:0.2cm;RMS:1.1cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_5","ME3: mean:-0.1cm;RMS:1.1cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_6","ME4: mean:-0.1cm;RMS:1.2cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegtoLCTY_5__41 = new TH1D("SegtoLCTY_5__41","SegtoLCTY",100,-40,40); SegtoLCTY_5__41->SetBinContent(0,0.5244401); SegtoLCTY_5__41->SetBinContent(1,0.0003618825); SegtoLCTY_5__41->SetBinContent(2,0.000289506); SegtoLCTY_5__41->SetBinContent(3,0.0003618825); SegtoLCTY_5__41->SetBinContent(4,0.0005066355); SegtoLCTY_5__41->SetBinContent(5,0.0003618825); SegtoLCTY_5__41->SetBinContent(6,0.0003618825); SegtoLCTY_5__41->SetBinContent(7,0.000434259); SegtoLCTY_5__41->SetBinContent(8,0.0002171295); SegtoLCTY_5__41->SetBinContent(9,0.0007961415); SegtoLCTY_5__41->SetBinContent(10,0.000434259); SegtoLCTY_5__41->SetBinContent(11,0.000289506); SegtoLCTY_5__41->SetBinContent(12,0.0003618825); SegtoLCTY_5__41->SetBinContent(13,0.0003618825); SegtoLCTY_5__41->SetBinContent(14,0.000868518); SegtoLCTY_5__41->SetBinContent(15,0.0006513885); SegtoLCTY_5__41->SetBinContent(16,0.0006513885); SegtoLCTY_5__41->SetBinContent(17,0.0009408945); SegtoLCTY_5__41->SetBinContent(18,0.0009408945); SegtoLCTY_5__41->SetBinContent(19,0.0007961415); SegtoLCTY_5__41->SetBinContent(20,0.001085647); SegtoLCTY_5__41->SetBinContent(21,0.0003618825); SegtoLCTY_5__41->SetBinContent(22,0.0012304); SegtoLCTY_5__41->SetBinContent(23,0.0009408945); SegtoLCTY_5__41->SetBinContent(24,0.001302777); SegtoLCTY_5__41->SetBinContent(25,0.002026542); SegtoLCTY_5__41->SetBinContent(26,0.0009408945); SegtoLCTY_5__41->SetBinContent(27,0.002098918); SegtoLCTY_5__41->SetBinContent(28,0.001809412); SegtoLCTY_5__41->SetBinContent(29,0.00144753); SegtoLCTY_5__41->SetBinContent(30,0.001664659); SegtoLCTY_5__41->SetBinContent(31,0.00267793); SegtoLCTY_5__41->SetBinContent(32,0.00267793); SegtoLCTY_5__41->SetBinContent(33,0.002098918); SegtoLCTY_5__41->SetBinContent(34,0.002967436); SegtoLCTY_5__41->SetBinContent(35,0.004197837); SegtoLCTY_5__41->SetBinContent(36,0.004632096); SegtoLCTY_5__41->SetBinContent(37,0.004776849); SegtoLCTY_5__41->SetBinContent(38,0.005717743); SegtoLCTY_5__41->SetBinContent(39,0.0135344); SegtoLCTY_5__41->SetBinContent(40,0.01179737); SegtoLCTY_5__41->SetBinContent(41,0.01150786); SegtoLCTY_5__41->SetBinContent(42,0.01331728); SegtoLCTY_5__41->SetBinContent(43,0.0193969); SegtoLCTY_5__41->SetBinContent(44,0.02258147); SegtoLCTY_5__41->SetBinContent(45,0.04031371); SegtoLCTY_5__41->SetBinContent(46,0.1180461); SegtoLCTY_5__41->SetBinContent(47,3.074409); SegtoLCTY_5__41->SetBinContent(48,3.030983); SegtoLCTY_5__41->SetBinContent(49,5.040154); SegtoLCTY_5__41->SetBinContent(50,10.08465); SegtoLCTY_5__41->SetBinContent(51,70.76684); SegtoLCTY_5__41->SetBinContent(52,3.508089); SegtoLCTY_5__41->SetBinContent(53,3.107702); SegtoLCTY_5__41->SetBinContent(54,0.5185776); SegtoLCTY_5__41->SetBinContent(55,0.1874551); SegtoLCTY_5__41->SetBinContent(56,0.1121836); SegtoLCTY_5__41->SetBinContent(57,0.06492172); SegtoLCTY_5__41->SetBinContent(58,0.04552482); SegtoLCTY_5__41->SetBinContent(59,0.03242467); SegtoLCTY_5__41->SetBinContent(60,0.02258147); SegtoLCTY_5__41->SetBinContent(61,0.01787699); SegtoLCTY_5__41->SetBinContent(62,0.0132449); SegtoLCTY_5__41->SetBinContent(63,0.008395674); SegtoLCTY_5__41->SetBinContent(64,0.006369132); SegtoLCTY_5__41->SetBinContent(65,0.00579012); SegtoLCTY_5__41->SetBinContent(66,0.003908331); SegtoLCTY_5__41->SetBinContent(67,0.004921602); SegtoLCTY_5__41->SetBinContent(68,0.002388424); SegtoLCTY_5__41->SetBinContent(69,0.003329319); SegtoLCTY_5__41->SetBinContent(70,0.002822683); SegtoLCTY_5__41->SetBinContent(71,0.002533177); SegtoLCTY_5__41->SetBinContent(72,0.001809412); SegtoLCTY_5__41->SetBinContent(73,0.002243671); SegtoLCTY_5__41->SetBinContent(74,0.001519906); SegtoLCTY_5__41->SetBinContent(75,0.00144753); SegtoLCTY_5__41->SetBinContent(76,0.001013271); SegtoLCTY_5__41->SetBinContent(77,0.0012304); SegtoLCTY_5__41->SetBinContent(78,0.000868518); SegtoLCTY_5__41->SetBinContent(79,0.001302777); SegtoLCTY_5__41->SetBinContent(80,0.000868518); SegtoLCTY_5__41->SetBinContent(81,0.001085647); SegtoLCTY_5__41->SetBinContent(82,0.001375153); SegtoLCTY_5__41->SetBinContent(83,0.0006513885); SegtoLCTY_5__41->SetBinContent(84,0.0007961415); SegtoLCTY_5__41->SetBinContent(85,0.0007961415); SegtoLCTY_5__41->SetBinContent(86,0.000579012); SegtoLCTY_5__41->SetBinContent(87,0.0007961415); SegtoLCTY_5__41->SetBinContent(88,0.001085647); SegtoLCTY_5__41->SetBinContent(89,0.0009408945); SegtoLCTY_5__41->SetBinContent(90,0.001085647); SegtoLCTY_5__41->SetBinContent(91,0.000434259); SegtoLCTY_5__41->SetBinContent(92,0.0006513885); SegtoLCTY_5__41->SetBinContent(93,0.000434259); SegtoLCTY_5__41->SetBinContent(94,0.0006513885); SegtoLCTY_5__41->SetBinContent(95,0.0006513885); SegtoLCTY_5__41->SetBinContent(96,0.000723765); SegtoLCTY_5__41->SetBinContent(97,0.000434259); SegtoLCTY_5__41->SetBinContent(98,0.0005066355); SegtoLCTY_5__41->SetBinContent(99,0.0003618825); SegtoLCTY_5__41->SetBinContent(100,0.000434259); SegtoLCTY_5__41->SetBinContent(101,0.4193494); SegtoLCTY_5__41->SetEntries(1394704); SegtoLCTY_5__41->SetStats(0); ci = TColor::GetColor("#00ff00"); SegtoLCTY_5__41->SetLineColor(ci); ci = TColor::GetColor("#00ff00"); SegtoLCTY_5__41->SetMarkerColor(ci); SegtoLCTY_5__41->GetXaxis()->SetTitle("cm"); SegtoLCTY_5__41->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTY_5__41->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegtoLCTY_1","ME11A: mean:0.1cm;RMS:1.7cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_2","ME11B: mean:0.2cm;RMS:1.6cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_3","ME12+13: mean:0.5cm;RMS:1.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_4","ME2: mean:0.2cm;RMS:1.1cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_5","ME3: mean:-0.1cm;RMS:1.1cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_6","ME4: mean:-0.1cm;RMS:1.2cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegtoLCTY_6__42 = new TH1D("SegtoLCTY_6__42","SegtoLCTY",100,-40,40); SegtoLCTY_6__42->SetBinContent(0,0.2770893); SegtoLCTY_6__42->SetBinContent(1,0.0004566402); SegtoLCTY_6__42->SetBinContent(2,0.0001826561); SegtoLCTY_6__42->SetBinContent(3,0.0003653122); SegtoLCTY_6__42->SetBinContent(4,9.132804e-05); SegtoLCTY_6__42->SetBinContent(5,0.0002739841); SegtoLCTY_6__42->SetBinContent(6,0.0001826561); SegtoLCTY_6__42->SetBinContent(7,0.0004566402); SegtoLCTY_6__42->SetBinContent(8,0.0002739841); SegtoLCTY_6__42->SetBinContent(9,0.0005479682); SegtoLCTY_6__42->SetBinContent(10,0.0004566402); SegtoLCTY_6__42->SetBinContent(11,0.0002739841); SegtoLCTY_6__42->SetBinContent(12,0.0005479682); SegtoLCTY_6__42->SetBinContent(13,0.0006392963); SegtoLCTY_6__42->SetBinContent(14,0.0006392963); SegtoLCTY_6__42->SetBinContent(15,0.0008219523); SegtoLCTY_6__42->SetBinContent(16,9.132804e-05); SegtoLCTY_6__42->SetBinContent(17,0.0002739841); SegtoLCTY_6__42->SetBinContent(18,0.0009132804); SegtoLCTY_6__42->SetBinContent(19,0.0005479682); SegtoLCTY_6__42->SetBinContent(20,0.0008219523); SegtoLCTY_6__42->SetBinContent(21,0.001004608); SegtoLCTY_6__42->SetBinContent(22,0.0006392963); SegtoLCTY_6__42->SetBinContent(23,0.001278593); SegtoLCTY_6__42->SetBinContent(24,0.0009132804); SegtoLCTY_6__42->SetBinContent(25,0.001278593); SegtoLCTY_6__42->SetBinContent(26,0.001004608); SegtoLCTY_6__42->SetBinContent(27,0.0008219523); SegtoLCTY_6__42->SetBinContent(28,0.001552577); SegtoLCTY_6__42->SetBinContent(29,0.001369921); SegtoLCTY_6__42->SetBinContent(30,0.002009217); SegtoLCTY_6__42->SetBinContent(31,0.002009217); SegtoLCTY_6__42->SetBinContent(32,0.002465857); SegtoLCTY_6__42->SetBinContent(33,0.002465857); SegtoLCTY_6__42->SetBinContent(34,0.002922497); SegtoLCTY_6__42->SetBinContent(35,0.003379137); SegtoLCTY_6__42->SetBinContent(36,0.003470465); SegtoLCTY_6__42->SetBinContent(37,0.005844994); SegtoLCTY_6__42->SetBinContent(38,0.007032259); SegtoLCTY_6__42->SetBinContent(39,0.01324257); SegtoLCTY_6__42->SetBinContent(40,0.0104114); SegtoLCTY_6__42->SetBinContent(41,0.0126946); SegtoLCTY_6__42->SetBinContent(42,0.0120553); SegtoLCTY_6__42->SetBinContent(43,0.02164474); SegtoLCTY_6__42->SetBinContent(44,0.02803771); SegtoLCTY_6__42->SetBinContent(45,0.04338082); SegtoLCTY_6__42->SetBinContent(46,0.114708); SegtoLCTY_6__42->SetBinContent(47,3.722987); SegtoLCTY_6__42->SetBinContent(48,4.052682); SegtoLCTY_6__42->SetBinContent(49,4.146202); SegtoLCTY_6__42->SetBinContent(50,11.80935); SegtoLCTY_6__42->SetBinContent(51,66.46654); SegtoLCTY_6__42->SetBinContent(52,3.982907); SegtoLCTY_6__42->SetBinContent(53,4.192048); SegtoLCTY_6__42->SetBinContent(54,0.6763754); SegtoLCTY_6__42->SetBinContent(55,0.2176347); SegtoLCTY_6__42->SetBinContent(56,0.1273113); SegtoLCTY_6__42->SetBinContent(57,0.0788161); SegtoLCTY_6__42->SetBinContent(58,0.05004776); SegtoLCTY_6__42->SetBinContent(59,0.03607457); SegtoLCTY_6__42->SetBinContent(60,0.02538919); SegtoLCTY_6__42->SetBinContent(61,0.02146209); SegtoLCTY_6__42->SetBinContent(62,0.01397319); SegtoLCTY_6__42->SetBinContent(63,0.01159866); SegtoLCTY_6__42->SetBinContent(64,0.01013741); SegtoLCTY_6__42->SetBinContent(65,0.005844994); SegtoLCTY_6__42->SetBinContent(66,0.005388354); SegtoLCTY_6__42->SetBinContent(67,0.004018434); SegtoLCTY_6__42->SetBinContent(68,0.004840386); SegtoLCTY_6__42->SetBinContent(69,0.002374529); SegtoLCTY_6__42->SetBinContent(70,0.003379137); SegtoLCTY_6__42->SetBinContent(71,0.002465857); SegtoLCTY_6__42->SetBinContent(72,0.001826561); SegtoLCTY_6__42->SetBinContent(73,0.003013825); SegtoLCTY_6__42->SetBinContent(74,0.001552577); SegtoLCTY_6__42->SetBinContent(75,0.001187264); SegtoLCTY_6__42->SetBinContent(76,0.001187264); SegtoLCTY_6__42->SetBinContent(77,0.0009132804); SegtoLCTY_6__42->SetBinContent(78,0.0008219523); SegtoLCTY_6__42->SetBinContent(79,0.001004608); SegtoLCTY_6__42->SetBinContent(80,0.0004566402); SegtoLCTY_6__42->SetBinContent(81,0.0009132804); SegtoLCTY_6__42->SetBinContent(82,0.0009132804); SegtoLCTY_6__42->SetBinContent(83,0.0005479682); SegtoLCTY_6__42->SetBinContent(84,0.0004566402); SegtoLCTY_6__42->SetBinContent(85,0.0003653122); SegtoLCTY_6__42->SetBinContent(86,0.0007306243); SegtoLCTY_6__42->SetBinContent(87,0.001095936); SegtoLCTY_6__42->SetBinContent(88,0.0006392963); SegtoLCTY_6__42->SetBinContent(89,0.0005479682); SegtoLCTY_6__42->SetBinContent(90,0.0004566402); SegtoLCTY_6__42->SetBinContent(91,9.132804e-05); SegtoLCTY_6__42->SetBinContent(92,0.0004566402); SegtoLCTY_6__42->SetBinContent(93,0.0006392963); SegtoLCTY_6__42->SetBinContent(94,0.0003653122); SegtoLCTY_6__42->SetBinContent(95,0.0004566402); SegtoLCTY_6__42->SetBinContent(96,0.0005479682); SegtoLCTY_6__42->SetBinContent(97,0.001004608); SegtoLCTY_6__42->SetBinContent(98,0.0001826561); SegtoLCTY_6__42->SetBinContent(99,0.0006392963); SegtoLCTY_6__42->SetBinContent(100,0.0006392963); SegtoLCTY_6__42->SetBinContent(101,0.3928932); SegtoLCTY_6__42->SetEntries(1102290); SegtoLCTY_6__42->SetStats(0); ci = TColor::GetColor("#0000ff"); SegtoLCTY_6__42->SetLineColor(ci); ci = TColor::GetColor("#0000ff"); SegtoLCTY_6__42->SetMarkerColor(ci); SegtoLCTY_6__42->GetXaxis()->SetTitle("cm"); SegtoLCTY_6__42->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTY_6__42->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegtoLCTY_1","ME11A: mean:0.1cm;RMS:1.7cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_2","ME11B: mean:0.2cm;RMS:1.6cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_3","ME12+13: mean:0.5cm;RMS:1.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_4","ME2: mean:0.2cm;RMS:1.1cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_5","ME3: mean:-0.1cm;RMS:1.1cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTY_6","ME4: mean:-0.1cm;RMS:1.2cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TPaveText *pt = new TPaveText(0.01,0.9390678,0.2699194,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(1); pt->SetFillColor(0); TText *AText = pt->AddText("SegtoLCTY"); pt->Draw(); SegtoLCTY->Modified(); SegtoLCTY->cd(); SegtoLCTY->SetSelected(SegtoLCTY); }
void plotDistribution( TChain* data , TChain *mc , TCut sel , TCut vtxweight , char* var , int nbins , float xmin , float xmax , char* xtitle , char* plottitle = "" , bool printplot = false , bool residual = false , bool log = false ){ //-------------------------------------- // define histograms and TGraphs //-------------------------------------- TH1F* hdata = new TH1F(Form("hdata_%i" , iplot),Form("hdata_%i" , iplot),nbins,xmin,xmax); TH1F* hmc = new TH1F(Form("hmc_%i" , iplot),Form("hmc_%i" , iplot),nbins,xmin,xmax); TH1F* hmc_novtx = new TH1F(Form("hmc_novtx_%i" , iplot),Form("hmc_novtx%i" , iplot),nbins,xmin,xmax); hdata->Sumw2(); hmc->Sumw2(); TGraphAsymmErrors* grdata = new TGraphAsymmErrors(); TGraphAsymmErrors* grmc = new TGraphAsymmErrors(); TH1F* hdata_denom = new TH1F(Form("hdata_denom_%i",iplot),"",nbins,xmin,xmax); TH1F* hmc_denom = new TH1F(Form("hmc_denom_%i" ,iplot),"",nbins,xmin,xmax); //-------------------------------------- // set up canvas and pads //-------------------------------------- TCanvas *can = new TCanvas(Form("can_%i",iplot),Form("can_%i",iplot),600,600); can->cd(); if( log ) gPad->SetLogy(); TPad *mainpad = new TPad("mainpad","mainpad",0.0,0.0,1.0,0.8); if( residual ){ mainpad->Draw(); mainpad->cd(); if( log ) mainpad->SetLogy(); } //-------------------------------------- // fill histos and TGraphs //-------------------------------------- data->Draw(Form("min(%s,%f)>>hdata_%i" , var,xmax-0.0001,iplot),sel); mc ->Draw(Form("min(%s,%f)>>hmc_%i" , var,xmax-0.0001,iplot),sel*vtxweight); mc ->Draw(Form("min(%s,%f)>>hmc_novtx_%i" , var,xmax-0.0001,iplot),sel); for( int ibin = 1 ; ibin <= nbins ; ibin++ ){ hdata_denom->SetBinContent(ibin,hdata->Integral()); hmc_denom->SetBinContent(ibin,hmc->Integral()); } grdata->BayesDivide(hdata,hdata_denom); grmc->BayesDivide(hmc_novtx,hmc_denom); //-------------------------------------- // get efficiencies and errors //-------------------------------------- /* float ndata1 = (float) hdata->GetBinContent(1); float ndata = (float) hdata->Integral(); float effdata = 1-ndata1 / ndata; // TGraphAsymmErrors* grdata_temp = new TGraphAsymmErrors(); // TH1F* hdata_num_temp = new TH1F(Form("hdata_num_temp_%i",iplot),"",1,0,1); // TH1F* hdata_den_temp = new TH1F(Form("hdata_den_temp_%i",iplot),"",1,0,1); // hdata_num_temp->SetBinContent(1,ndata-ndata1); // hdata_den_temp->SetBinContent(1,ndata); // grdata_temp->BayesDivide(hdata_num_temp,hdata_den_temp); //float effdataerr = sqrt(ndata1) / ndata; float effdataerr = 0.5 * ( grdata->GetErrorYlow(0) + grdata->GetErrorYhigh(0) ); //float effdataerr = 0.5 * ( grdata_temp->GetErrorYlow(0) + grdata_temp->GetErrorYhigh(0) ); float nmc1 = (float) hmc->GetBinContent(1); float nmc = (float) hmc->Integral(); float effmc = 1-nmc1 / nmc; //float effmcerr = hmc->GetBinError(1) / nmc; float effmcerr = 0.5 * ( grmc->GetErrorYlow(0) + grmc->GetErrorYhigh(0) ); float datatot = hdata->Integral(); float mctot = hmc->Integral(); cout << endl; cout << plottitle << endl; cout << "Data eff " << Form("%.2f +/- %.3f",effdata,effdataerr) << endl; cout << "MC eff " << Form("%.2f +/- %.3f",effmc ,effmcerr) << endl; cout << "Data/MC " << Form("%.2f +/- %.2f",ratio ,ratioerr) << endl; */ float ndata = hdata->Integral(); float ndata1 = hdata->Integral(2,20); float ndata2 = hdata->Integral(3,20); float ndata3 = hdata->Integral(4,20); float ndata4 = hdata->Integral(5,20); float ndata5 = hdata->Integral(6,20); float nmc = hmc->Integral(); float nmc1 = hmc->Integral(2,20); float nmc2 = hmc->Integral(3,20); float nmc3 = hmc->Integral(4,20); float nmc4 = hmc->Integral(5,20); float nmc5 = hmc->Integral(6,20); float effdata1 = ndata1/ndata; float effdata2 = ndata2/ndata; float effdata3 = ndata3/ndata; float effdata4 = ndata4/ndata; float effdata5 = ndata5/ndata; float effmc1 = nmc1/nmc; float effmc2 = nmc2/nmc; float effmc3 = nmc3/nmc; float effmc4 = nmc4/nmc; float effmc5 = nmc5/nmc; float effdata1err = getBinomialError(ndata1,ndata); float effdata2err = getBinomialError(ndata2,ndata); float effdata3err = getBinomialError(ndata3,ndata); float effdata4err = getBinomialError(ndata4,ndata); float effdata5err = getBinomialError(ndata5,ndata); float effmc1err = getBinomialError(nmc1,nmc); float effmc2err = getBinomialError(nmc2,nmc); float effmc3err = getBinomialError(nmc3,nmc); float effmc4err = getBinomialError(nmc4,nmc); float effmc5err = getBinomialError(nmc5,nmc); float ratio1 = effdata1/effmc1; float ratio2 = effdata2/effmc2; float ratio3 = effdata3/effmc3; float ratio4 = effdata4/effmc4; float ratio5 = effdata5/effmc5; float ratio1err = ratio1 * sqrt(pow(effdata1err/effdata1,2)+pow(effmc1err/effmc1,2)); float ratio2err = ratio2 * sqrt(pow(effdata2err/effdata2,2)+pow(effmc2err/effmc2,2)); float ratio3err = ratio3 * sqrt(pow(effdata3err/effdata3,2)+pow(effmc3err/effmc3,2)); float ratio4err = ratio4 * sqrt(pow(effdata4err/effdata4,2)+pow(effmc4err/effmc4,2)); float ratio5err = ratio5 * sqrt(pow(effdata5err/effdata5,2)+pow(effmc5err/effmc5,2)); //cout << endl << endl << plottitle << endl; int left = 20; // char* delimstart = "|"; // char* delim = "|"; // char* delimend = "|"; // char* pm = "+/-"; char* delimstart = ""; char* delim = "&"; char* delimend = "\\\\"; char* pm = "$\\pm$"; char* hline = "\\hline"; cout << endl; cout << hline << endl; cout << hline << endl; cout << delimstart << setw(10) << histLabel(plottitle) << setw(4) << delim << setw(left) << "$>$ 1 GeV" << setw(4) << delim << setw(left) << "$>$ 2 GeV" << setw(4) << delim << setw(left) << "$>$ 3 GeV" << setw(4) << delim << setw(left) << "$>$ 4 GeV" << setw(4) << delim << setw(left) << "$>$ 5 GeV" << setw(4) << delimend << endl; cout << hline << endl; cout << delimstart << setw(10) << "data" << setw(4) << delim << setw(left) << Form("%.3f %s %.4f",effdata1,pm,effdata1err) << setw(4) << delim << setw(left) << Form("%.3f %s %.4f",effdata2,pm,effdata2err) << setw(4) << delim << setw(left) << Form("%.3f %s %.4f",effdata3,pm,effdata3err) << setw(4) << delim << setw(left) << Form("%.3f %s %.4f",effdata4,pm,effdata4err) << setw(4) << delim << setw(left) << Form("%.3f %s %.4f",effdata5,pm,effdata5err) << setw(4) << delimend << endl; cout << delimstart << setw(10) << "mc" << setw(4) << delim << setw(left) << Form("%.3f %s %.4f",effmc1,pm,effmc1err) << setw(4) << delim << setw(left) << Form("%.3f %s %.4f",effmc2,pm,effmc2err) << setw(4) << delim << setw(left) << Form("%.3f %s %.4f",effmc3,pm,effmc3err) << setw(4) << delim << setw(left) << Form("%.3f %s %.4f",effmc4,pm,effmc4err) << setw(4) << delim << setw(left) << Form("%.3f %s %.4f",effmc5,pm,effmc5err) << setw(4) << delimend << endl; cout << delimstart << setw(10) << "data/mc" << setw(4) << delim << setw(left) << Form("%.2f %s %.2f",ratio1,pm,ratio1err) << setw(4) << delim << setw(left) << Form("%.2f %s %.2f",ratio2,pm,ratio2err) << setw(4) << delim << setw(left) << Form("%.2f %s %.2f",ratio3,pm,ratio3err) << setw(4) << delim << setw(left) << Form("%.2f %s %.2f",ratio4,pm,ratio4err) << setw(4) << delim << setw(left) << Form("%.2f %s %.2f",ratio5,pm,ratio5err) << setw(4) << delimend << endl; //-------------------------------------- // draw stuff //-------------------------------------- hdata->Scale(1.0/hdata->Integral()); hmc->Scale(1.0/hmc->Integral()); if( log ) hmc->GetYaxis()->SetRangeUser(0.0001,5); else hmc->GetYaxis()->SetRangeUser(0.0,1); hmc->GetXaxis()->SetTitle(xtitle); hmc->SetLineColor(2); hmc->SetMarkerColor(2); hmc->DrawNormalized("hist"); hmc->DrawNormalized("sameE1"); hdata->SetLineColor(4); hdata->SetMarkerColor(4); hdata->Draw("sameE1"); grdata->SetLineColor(6); grmc->SetLineColor(7); //grdata->Draw("sameP"); //grmc->Draw("sameP"); TLegend *leg = new TLegend(0.6,0.7,0.8,0.9); leg->AddEntry(hdata , "data" , "lp"); leg->AddEntry(hmc , "MC" , "lp"); leg->SetBorderSize(0); leg->SetFillColor(0); leg->Draw(); TLatex *t = new TLatex(); t->SetNDC(); if( TString(plottitle).Contains("el") ) t->DrawLatex(0.6,0.6,"electrons"); if( TString(plottitle).Contains("mu") ) t->DrawLatex(0.6,0.6,"muons"); if( TString(plottitle).Contains("0j") ) t->DrawLatex(0.6,0.5,"n_{jets} #geq 0"); if( TString(plottitle).Contains("1j") ) t->DrawLatex(0.6,0.5,"n_{jets} #geq 1"); if( TString(plottitle).Contains("2j") ) t->DrawLatex(0.6,0.5,"n_{jets} #geq 2"); if( TString(plottitle).Contains("3j") ) t->DrawLatex(0.6,0.5,"n_{jets} #geq 3"); if( TString(plottitle).Contains("4j") ) t->DrawLatex(0.6,0.5,"n_{jets} #geq 4"); //-------------------------------------- // draw residual plots //-------------------------------------- if( residual ){ can->cd(); TPad *respad = new TPad("respad","respad",0.0,0.8,1.0,1.0); respad->Draw(); respad->cd(); respad->SetGridy(); TH1F* hratio = (TH1F*) hdata->Clone(Form("hratio_%i",iplot)); hratio->Divide(hmc); hratio->SetMarkerColor(1); hratio->SetLineColor(1); hratio->Draw(); hratio->GetYaxis()->SetRangeUser(0.5,1.5); hratio->GetYaxis()->SetNdivisions(5); hratio->GetYaxis()->SetLabelSize(0.2); hratio->GetXaxis()->SetLabelSize(0.0); TLine line; line.DrawLine(xmin,1.0,xmax,1.0); } //data->Scan("run:lumi:event:probe->pt():probe->eta():tkisonew:met:mt:njets:nbl:nbm",sel+"tkisonew>20"); //data->Scan("run:lumi:event:probe->pt():probe->eta():tkisonew:met:mt:njets:nbl:nbm",sel); if( printplot ) can->Print(Form("plots/%s.pdf",plottitle)); iplot++; // TCanvas *c2 = new TCanvas(); // c2->cd(); // grdata->Draw("AP"); }
void VBFDeltaEta() { //=========Macro generated from canvas: VBFDeltaEta/VBFDeltaEta //========= (Wed Nov 4 11:47:03 2015) by ROOT version6.02/05 TCanvas *VBFDeltaEta = new TCanvas("VBFDeltaEta", "VBFDeltaEta",220,242,700,700); VBFDeltaEta->Range(-12.5,-5.529375,12.5,2.023205); VBFDeltaEta->SetFillColor(0); VBFDeltaEta->SetBorderMode(0); VBFDeltaEta->SetBorderSize(2); VBFDeltaEta->SetLogy(); VBFDeltaEta->SetFrameBorderMode(0); VBFDeltaEta->SetFrameBorderMode(0); THStack *VBFDeltaEta = new THStack(); VBFDeltaEta->SetName("VBFDeltaEta"); VBFDeltaEta->SetTitle("VBFDeltaEta"); TH1F *VBFDeltaEta_stack_12 = new TH1F("VBFDeltaEta_stack_12","VBFDeltaEta",20,-10,10); VBFDeltaEta_stack_12->SetMinimum(1.682221e-05); VBFDeltaEta_stack_12->SetMaximum(18.53305); VBFDeltaEta_stack_12->SetDirectory(0); VBFDeltaEta_stack_12->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); VBFDeltaEta_stack_12->SetLineColor(ci); VBFDeltaEta_stack_12->GetXaxis()->SetTitle("VBFDeltaEta"); VBFDeltaEta_stack_12->GetXaxis()->SetLabelFont(42); VBFDeltaEta_stack_12->GetXaxis()->SetLabelSize(0.035); VBFDeltaEta_stack_12->GetXaxis()->SetTitleSize(0.035); VBFDeltaEta_stack_12->GetXaxis()->SetTitleFont(42); VBFDeltaEta_stack_12->GetYaxis()->SetTitle("Events/pb"); VBFDeltaEta_stack_12->GetYaxis()->SetLabelFont(42); VBFDeltaEta_stack_12->GetYaxis()->SetLabelSize(0.035); VBFDeltaEta_stack_12->GetYaxis()->SetTitleSize(0.035); VBFDeltaEta_stack_12->GetYaxis()->SetTitleFont(42); VBFDeltaEta_stack_12->GetZaxis()->SetLabelFont(42); VBFDeltaEta_stack_12->GetZaxis()->SetLabelSize(0.035); VBFDeltaEta_stack_12->GetZaxis()->SetTitleSize(0.035); VBFDeltaEta_stack_12->GetZaxis()->SetTitleFont(42); VBFDeltaEta->SetHistogram(VBFDeltaEta_stack_12); TH1D *VBFDeltaEta56 = new TH1D("VBFDeltaEta56","#Delta_{#eta} + VBF cuts",20,-10,10); VBFDeltaEta56->SetBinContent(2,0.02757404); VBFDeltaEta56->SetBinContent(3,0.03883215); VBFDeltaEta56->SetBinContent(4,0.634203); VBFDeltaEta56->SetBinContent(5,5.370436); VBFDeltaEta56->SetBinContent(6,3.979399); VBFDeltaEta56->SetBinContent(11,6.295011); VBFDeltaEta56->SetBinContent(15,1.928552); VBFDeltaEta56->SetBinContent(16,5.0433); VBFDeltaEta56->SetBinContent(17,3.894055); VBFDeltaEta56->SetBinContent(18,0.1366193); VBFDeltaEta56->SetBinContent(19,0.003752704); VBFDeltaEta56->SetBinContent(20,0.02632314); VBFDeltaEta56->SetBinError(2,0.02635285); VBFDeltaEta56->SetBinError(3,0.0266187); VBFDeltaEta56->SetBinError(4,0.1263838); VBFDeltaEta56->SetBinError(5,1.984666); VBFDeltaEta56->SetBinError(6,1.622458); VBFDeltaEta56->SetBinError(11,1.989275); VBFDeltaEta56->SetBinError(15,0.2097407); VBFDeltaEta56->SetBinError(16,1.982566); VBFDeltaEta56->SetBinError(17,1.975533); VBFDeltaEta56->SetBinError(18,0.05891348); VBFDeltaEta56->SetBinError(19,0.002166624); VBFDeltaEta56->SetBinError(20,0.02632314); VBFDeltaEta56->SetEntries(1398); ci = TColor::GetColor("#00cc00"); VBFDeltaEta56->SetFillColor(ci); ci = TColor::GetColor("#00cc00"); VBFDeltaEta56->SetLineColor(ci); ci = TColor::GetColor("#00cc00"); VBFDeltaEta56->SetMarkerColor(ci); VBFDeltaEta56->SetMarkerStyle(22); VBFDeltaEta56->GetXaxis()->SetTitle("VBFDeltaEta"); VBFDeltaEta56->GetXaxis()->SetLabelFont(42); VBFDeltaEta56->GetXaxis()->SetLabelSize(0.035); VBFDeltaEta56->GetXaxis()->SetTitleSize(0.035); VBFDeltaEta56->GetXaxis()->SetTitleFont(42); VBFDeltaEta56->GetYaxis()->SetTitle("Events/pb"); VBFDeltaEta56->GetYaxis()->SetLabelFont(42); VBFDeltaEta56->GetYaxis()->SetLabelSize(0.035); VBFDeltaEta56->GetYaxis()->SetTitleSize(0.035); VBFDeltaEta56->GetYaxis()->SetTitleFont(42); VBFDeltaEta56->GetZaxis()->SetLabelFont(42); VBFDeltaEta56->GetZaxis()->SetLabelSize(0.035); VBFDeltaEta56->GetZaxis()->SetTitleSize(0.035); VBFDeltaEta56->GetZaxis()->SetTitleFont(42); VBFDeltaEta->Add(VBFDeltaEta,""); TH1D *VBFDeltaEta57 = new TH1D("VBFDeltaEta57","#Delta_{#eta} + VBF cuts",20,-10,10); VBFDeltaEta57->SetBinContent(1,0.02028896); VBFDeltaEta57->SetBinContent(2,0.08985857); VBFDeltaEta57->SetBinContent(3,0.4571356); VBFDeltaEta57->SetBinContent(4,1.161785); VBFDeltaEta57->SetBinContent(5,3.111093); VBFDeltaEta57->SetBinContent(6,3.297386); VBFDeltaEta57->SetBinContent(11,9.104142); VBFDeltaEta57->SetBinContent(15,3.349544); VBFDeltaEta57->SetBinContent(16,2.978421); VBFDeltaEta57->SetBinContent(17,1.133212); VBFDeltaEta57->SetBinContent(18,0.5140127); VBFDeltaEta57->SetBinContent(19,0.0909154); VBFDeltaEta57->SetBinContent(20,0.01469553); VBFDeltaEta57->SetBinError(1,0.00406594); VBFDeltaEta57->SetBinError(2,0.00809007); VBFDeltaEta57->SetBinError(3,0.01852798); VBFDeltaEta57->SetBinError(4,0.02902226); VBFDeltaEta57->SetBinError(5,0.04737842); VBFDeltaEta57->SetBinError(6,0.04719168); VBFDeltaEta57->SetBinError(11,0.08243018); VBFDeltaEta57->SetBinError(15,0.04736777); VBFDeltaEta57->SetBinError(16,0.04612548); VBFDeltaEta57->SetBinError(17,0.02866639); VBFDeltaEta57->SetBinError(18,0.01972925); VBFDeltaEta57->SetBinError(19,0.008035675); VBFDeltaEta57->SetBinError(20,0.003248628); VBFDeltaEta57->SetEntries(106434); ci = TColor::GetColor("#00ffff"); VBFDeltaEta57->SetFillColor(ci); ci = TColor::GetColor("#00ffff"); VBFDeltaEta57->SetLineColor(ci); ci = TColor::GetColor("#00ffff"); VBFDeltaEta57->SetMarkerColor(ci); VBFDeltaEta57->SetMarkerStyle(20); VBFDeltaEta57->GetXaxis()->SetTitle("VBFDeltaEta"); VBFDeltaEta57->GetXaxis()->SetLabelFont(42); VBFDeltaEta57->GetXaxis()->SetLabelSize(0.035); VBFDeltaEta57->GetXaxis()->SetTitleSize(0.035); VBFDeltaEta57->GetXaxis()->SetTitleFont(42); VBFDeltaEta57->GetYaxis()->SetTitle("Events/pb"); VBFDeltaEta57->GetYaxis()->SetLabelFont(42); VBFDeltaEta57->GetYaxis()->SetLabelSize(0.035); VBFDeltaEta57->GetYaxis()->SetTitleSize(0.035); VBFDeltaEta57->GetYaxis()->SetTitleFont(42); VBFDeltaEta57->GetZaxis()->SetLabelFont(42); VBFDeltaEta57->GetZaxis()->SetLabelSize(0.035); VBFDeltaEta57->GetZaxis()->SetTitleSize(0.035); VBFDeltaEta57->GetZaxis()->SetTitleFont(42); VBFDeltaEta->Add(VBFDeltaEta,""); TH1D *VBFDeltaEta58 = new TH1D("VBFDeltaEta58","#Delta_{#eta} + VBF cuts",20,-10,10); VBFDeltaEta58->SetBinContent(1,0.002795082); VBFDeltaEta58->SetBinContent(2,0.01316622); VBFDeltaEta58->SetBinContent(3,0.0740267); VBFDeltaEta58->SetBinContent(4,0.1689951); VBFDeltaEta58->SetBinContent(5,0.474113); VBFDeltaEta58->SetBinContent(6,0.5076733); VBFDeltaEta58->SetBinContent(11,1.595792); VBFDeltaEta58->SetBinContent(15,0.5220246); VBFDeltaEta58->SetBinContent(16,0.472889); VBFDeltaEta58->SetBinContent(17,0.1752986); VBFDeltaEta58->SetBinContent(18,0.0716702); VBFDeltaEta58->SetBinContent(19,0.01745); VBFDeltaEta58->SetBinContent(20,0.003213651); VBFDeltaEta58->SetBinError(1,0.0006578478); VBFDeltaEta58->SetBinError(2,0.001353033); VBFDeltaEta58->SetBinError(3,0.003294266); VBFDeltaEta58->SetBinError(4,0.004879182); VBFDeltaEta58->SetBinError(5,0.008172085); VBFDeltaEta58->SetBinError(6,0.008148824); VBFDeltaEta58->SetBinError(11,0.01529831); VBFDeltaEta58->SetBinError(15,0.008295855); VBFDeltaEta58->SetBinError(16,0.008141481); VBFDeltaEta58->SetBinError(17,0.00495115); VBFDeltaEta58->SetBinError(18,0.003269719); VBFDeltaEta58->SetBinError(19,0.001647783); VBFDeltaEta58->SetBinError(20,0.0006736957); VBFDeltaEta58->SetEntries(92263); ci = TColor::GetColor("#ffcc00"); VBFDeltaEta58->SetFillColor(ci); ci = TColor::GetColor("#ffcc00"); VBFDeltaEta58->SetLineColor(ci); ci = TColor::GetColor("#ffcc00"); VBFDeltaEta58->SetMarkerColor(ci); VBFDeltaEta58->SetMarkerStyle(21); VBFDeltaEta58->GetXaxis()->SetTitle("VBFDeltaEta"); VBFDeltaEta58->GetXaxis()->SetLabelFont(42); VBFDeltaEta58->GetXaxis()->SetLabelSize(0.035); VBFDeltaEta58->GetXaxis()->SetTitleSize(0.035); VBFDeltaEta58->GetXaxis()->SetTitleFont(42); VBFDeltaEta58->GetYaxis()->SetTitle("Events/pb"); VBFDeltaEta58->GetYaxis()->SetLabelFont(42); VBFDeltaEta58->GetYaxis()->SetLabelSize(0.035); VBFDeltaEta58->GetYaxis()->SetTitleSize(0.035); VBFDeltaEta58->GetYaxis()->SetTitleFont(42); VBFDeltaEta58->GetZaxis()->SetLabelFont(42); VBFDeltaEta58->GetZaxis()->SetLabelSize(0.035); VBFDeltaEta58->GetZaxis()->SetTitleSize(0.035); VBFDeltaEta58->GetZaxis()->SetTitleFont(42); VBFDeltaEta->Add(VBFDeltaEta,""); TH1D *VBFDeltaEta59 = new TH1D("VBFDeltaEta59","#Delta_{#eta} + VBF cuts",20,-10,10); VBFDeltaEta59->SetBinContent(1,0.0002467932); VBFDeltaEta59->SetBinContent(2,0.001758402); VBFDeltaEta59->SetBinContent(3,0.005568272); VBFDeltaEta59->SetBinContent(4,0.01050414); VBFDeltaEta59->SetBinContent(5,0.01783081); VBFDeltaEta59->SetBinContent(6,0.01866374); VBFDeltaEta59->SetBinContent(11,0.02649942); VBFDeltaEta59->SetBinContent(15,0.01784623); VBFDeltaEta59->SetBinContent(16,0.01798506); VBFDeltaEta59->SetBinContent(17,0.01124452); VBFDeltaEta59->SetBinContent(18,0.004843317); VBFDeltaEta59->SetBinContent(19,0.002082318); VBFDeltaEta59->SetBinContent(20,0.0002467932); VBFDeltaEta59->SetBinError(1,6.16983e-05); VBFDeltaEta59->SetBinError(2,0.0001646894); VBFDeltaEta59->SetBinError(3,0.0002930669); VBFDeltaEta59->SetBinError(4,0.0004025194); VBFDeltaEta59->SetBinError(5,0.0005244356); VBFDeltaEta59->SetBinError(6,0.0005365447); VBFDeltaEta59->SetBinError(11,0.0006393296); VBFDeltaEta59->SetBinError(15,0.0005246624); VBFDeltaEta59->SetBinError(16,0.000526699); VBFDeltaEta59->SetBinError(17,0.0004164636); VBFDeltaEta59->SetBinError(18,0.0002733242); VBFDeltaEta59->SetBinError(19,0.0001792174); VBFDeltaEta59->SetBinError(20,6.16983e-05); VBFDeltaEta59->SetEntries(8773); ci = TColor::GetColor("#ff0000"); VBFDeltaEta59->SetFillColor(ci); ci = TColor::GetColor("#ff0000"); VBFDeltaEta59->SetLineColor(ci); ci = TColor::GetColor("#ff0000"); VBFDeltaEta59->SetMarkerColor(ci); VBFDeltaEta59->SetMarkerStyle(20); VBFDeltaEta59->GetXaxis()->SetTitle("VBFDeltaEta"); VBFDeltaEta59->GetXaxis()->SetLabelFont(42); VBFDeltaEta59->GetXaxis()->SetLabelSize(0.035); VBFDeltaEta59->GetXaxis()->SetTitleSize(0.035); VBFDeltaEta59->GetXaxis()->SetTitleFont(42); VBFDeltaEta59->GetYaxis()->SetTitle("Events/pb"); VBFDeltaEta59->GetYaxis()->SetLabelFont(42); VBFDeltaEta59->GetYaxis()->SetLabelSize(0.035); VBFDeltaEta59->GetYaxis()->SetTitleSize(0.035); VBFDeltaEta59->GetYaxis()->SetTitleFont(42); VBFDeltaEta59->GetZaxis()->SetLabelFont(42); VBFDeltaEta59->GetZaxis()->SetLabelSize(0.035); VBFDeltaEta59->GetZaxis()->SetTitleSize(0.035); VBFDeltaEta59->GetZaxis()->SetTitleFont(42); VBFDeltaEta->Add(VBFDeltaEta,""); TH1D *VBFDeltaEta60 = new TH1D("VBFDeltaEta60","#Delta_{#eta} + VBF cuts",20,-10,10); VBFDeltaEta60->SetBinContent(2,0.0001341732); VBFDeltaEta60->SetBinContent(3,0.0003186613); VBFDeltaEta60->SetBinContent(4,0.0007211808); VBFDeltaEta60->SetBinContent(5,0.001911968); VBFDeltaEta60->SetBinContent(6,0.003136298); VBFDeltaEta60->SetBinContent(11,0.004327085); VBFDeltaEta60->SetBinContent(15,0.003304015); VBFDeltaEta60->SetBinContent(16,0.001995826); VBFDeltaEta60->SetBinContent(17,0.0008218107); VBFDeltaEta60->SetBinContent(18,0.0003522046); VBFDeltaEta60->SetBinContent(19,6.708659e-05); VBFDeltaEta60->SetBinError(2,4.743738e-05); VBFDeltaEta60->SetBinError(3,7.310592e-05); VBFDeltaEta60->SetBinError(4,0.000109979); VBFDeltaEta60->SetBinError(5,0.0001790722); VBFDeltaEta60->SetBinError(6,0.0002293488); VBFDeltaEta60->SetBinError(11,0.0002693925); VBFDeltaEta60->SetBinError(15,0.0002354013); VBFDeltaEta60->SetBinError(16,0.0001829571); VBFDeltaEta60->SetBinError(17,0.0001174015); VBFDeltaEta60->SetBinError(18,7.685734e-05); VBFDeltaEta60->SetBinError(19,3.35433e-05); VBFDeltaEta60->SetEntries(1019); ci = TColor::GetColor("#0000ff"); VBFDeltaEta60->SetFillColor(ci); ci = TColor::GetColor("#0000ff"); VBFDeltaEta60->SetLineColor(ci); ci = TColor::GetColor("#0000ff"); VBFDeltaEta60->SetMarkerColor(ci); VBFDeltaEta60->SetMarkerStyle(21); VBFDeltaEta60->GetXaxis()->SetTitle("VBFDeltaEta"); VBFDeltaEta60->GetXaxis()->SetLabelFont(42); VBFDeltaEta60->GetXaxis()->SetLabelSize(0.035); VBFDeltaEta60->GetXaxis()->SetTitleSize(0.035); VBFDeltaEta60->GetXaxis()->SetTitleFont(42); VBFDeltaEta60->GetYaxis()->SetTitle("Events/pb"); VBFDeltaEta60->GetYaxis()->SetLabelFont(42); VBFDeltaEta60->GetYaxis()->SetLabelSize(0.035); VBFDeltaEta60->GetYaxis()->SetTitleSize(0.035); VBFDeltaEta60->GetYaxis()->SetTitleFont(42); VBFDeltaEta60->GetZaxis()->SetLabelFont(42); VBFDeltaEta60->GetZaxis()->SetLabelSize(0.035); VBFDeltaEta60->GetZaxis()->SetTitleSize(0.035); VBFDeltaEta60->GetZaxis()->SetTitleFont(42); VBFDeltaEta->Add(VBFDeltaEta,""); VBFDeltaEta->Draw("nostack"); TPaveText *pt = new TPaveText(0.3391379,0.94,0.6608621,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); TText *AText = pt->AddText("VBFDeltaEta"); pt->Draw(); TLegend *leg = new TLegend(0.54023,0.639881,0.938218,0.924107,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextSize(0.034965); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("VBFDeltaEta","VBFDeltaEta_QCD","lp"); ci = TColor::GetColor("#00cc00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#00cc00"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(22); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("VBFDeltaEta","VBFDeltaEta_WJetsToLNu","lp"); ci = TColor::GetColor("#00ffff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#00ffff"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("VBFDeltaEta","VBFDeltaEta_ZJetsToNuNu","lp"); ci = TColor::GetColor("#ffcc00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#ffcc00"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("VBFDeltaEta","VBFDeltaEta_signal","lp"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#ff0000"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("VBFDeltaEta","VBFDeltaEta_ttbar","lp"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#0000ff"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); VBFDeltaEta->Modified(); VBFDeltaEta->cd(); VBFDeltaEta->SetSelected(VBFDeltaEta); }
void drawGraphs(TGraphErrors* data, TGraphErrors* mc, const std::string& method, const std::string& xTitle, const std::string& yTitle, const std::string& legendTitle, double lumi, const std::string& outputName, int dataMarkerStyle = 20, int dataMarkerColor = kBlack, int mcMarkerStyle = 29, int mcMarkerColor = kBlue) { data->SetMarkerSize(1.5); data->SetMarkerStyle(dataMarkerStyle); data->SetMarkerColor(dataMarkerColor); data->SetLineColor(dataMarkerColor); mc->SetMarkerSize(1.5); mc->SetMarkerStyle(mcMarkerStyle); mc->SetMarkerColor(mcMarkerColor); mc->SetLineColor(mcMarkerColor); // Fit TF1* data_fct = nullptr; TF1* mc_fct = nullptr; TH1D* errors_data = new TH1D("errors_data", "errors", 100, 0, 1); errors_data->SetStats(false); errors_data->SetFillColor(LIGHT_GRAY); //errors_data->SetLineColor(kRed); errors_data->SetFillStyle(1001); TH1D* errors_mc = (TH1D*) errors_data->Clone("errors_mc"); errors_mc->SetFillColor(LIGHT_BLUE); if (method == "Balancing") { data_fct = new TF1("data_fct", "[0] - x*x*[1]", 0, 1); data_fct->SetLineColor(dataMarkerColor); data_fct->SetLineWidth(1); data_fct->SetLineStyle(2); data->Fit(data_fct, "RQN"); (TVirtualFitter::GetFitter())->GetConfidenceIntervals(errors_data, 0.68); mc_fct = new TF1("mc_fct", "[0] - x*x*[1]", 0, 1); mc_fct->SetLineColor(mcMarkerColor); mc_fct->SetLineWidth(1); mc_fct->SetLineStyle(2); mc->Fit(mc_fct, "RQN"); (TVirtualFitter::GetFitter())->GetConfidenceIntervals(errors_mc, 0.68); } else { data_fct = new TF1("data_fct", "[0] + x*[1]", 0, 1); data_fct->SetLineColor(dataMarkerColor); data_fct->SetLineWidth(1); data_fct->SetLineStyle(2); data->Fit(data_fct, "RQN"); (TVirtualFitter::GetFitter())->GetConfidenceIntervals(errors_data, 0.68); mc_fct = new TF1("mc_fct", "[0] + x*[1]", 0, 1); mc_fct->SetLineColor(mcMarkerColor); mc_fct->SetLineWidth(1); mc_fct->SetLineStyle(2); mc->Fit(mc_fct, "RQN"); (TVirtualFitter::GetFitter())->GetConfidenceIntervals(errors_mc, 0.68); } data_fct->SetRange(0, 1); mc_fct->SetRange(0, 1); TMultiGraph* mg = new TMultiGraph(); mg->Add(data); mg->Add(mc); TString title = TString::Format(";%s;%s", xTitle.c_str(), yTitle.c_str()); mg->SetTitle(title); TCanvas* canvas = new TCanvas("canvas", "", 800, 800); mg->Draw("ap"); errors_data->Draw("e3 same"); errors_mc->Draw("e3 same"); data_fct->Draw("same"); mc_fct->Draw("same"); mg->Draw("ap same"); TLegend* legend = new TLegend(0.18, 0.18, 0.55, 0.35); legend->SetTextFont(42); legend->SetFillColor(kWhite); legend->SetFillStyle(0); legend->SetTextSize(0.035); legend->SetBorderSize(1); TString legendTitleWithPtCut = TString::Format("%s, p_{T}^{#gamma} #geq 170 GeV", legendTitle.c_str()); legend->SetHeader(legendTitleWithPtCut); legend->AddEntry(data, TString::Format("%s (data)", method.c_str()), "p"); legend->AddEntry(mc, TString::Format("%s (MC)", method.c_str()), "p"); legend->Draw(); TLatex tl; tl.SetNDC(); tl.SetTextSize(0.035); tl.SetTextFont(42); // Luminosity TString sLumi = TString::Format("L = %.02f fb^{-1}", lumi); tl.DrawLatex(0.18, 0.96, sLumi); // Energy tl.DrawLatex(0.80, 0.96, "#sqrt{s} = 8 TeV"); canvas->Print(outputName.c_str()); delete canvas; delete mg; delete errors_data; delete errors_mc; }