//****************************************************** //* Multi Root Files Handling Macro //* Author:Mi Ran Kim //* Sungkyunkwan University.South Korea //* 25th.March.2020 //******************************************************** #include #include #include #include #include #include "TCanvas.h" #include "TColor.h" #include "TFile.h" #include "TFrame.h" #include "TF1.h" #include "TGraph.h" #include "TGraphErrors.h" #include "TGraphAsymmErrors.h" #include "TH1.h" #include "TH2.h" #include "TLegend.h" #include "TLegendEntry.h" #include "TLine.h" #include "TMath.h" #include "TPaletteAxis.h" #include "TROOT.h" #include "TSpline.h" #include "TStyle.h" #include "TSystem.h" #include "TTree.h" #include #include "TLorentzVector.h" #include "stdlib.h" using namespace std; void Ratio_Tau0Tau2_ew() { std::ofstream myfile; //gStyle->SetOptStat(000000000);//Not drawing status box // gStyle->SetTitleFontSize(.08); //gStyle->SetLabelSize(.05,"xy"); //gstyle->SetCanvasColor(-1); //gStyle->SetPadColor(-1); //gStyle->SetFrameFillColor(-1); //gStyle->SetHistFillColor(-1); // gStyle->SetTitleFillColor(-1); //gStyle->SetFillColor(-1); //gStyle->SetFillStyle(4000); // gStyle->SetStatStyle(0); // gStyle->SetTitleStyle(0); //gStyle->SetCanvasBorderSize(0); // gStyle->SetFrameBorderSize(0); gStyle->SetLegendBorderSize(0); // gStyle->SetStatBorderSize(0); //gStyle->SetTitleBorderSize(0); gROOT->ForceStyle(); //------2018,2018,2018, with eventweight-------------- TFile *f1=TFile::Open("./test/Ntuple2Dratio_ggH.root","READ"); TFile *f2=TFile::Open("./test/Ntuple2Dratio_VBFH.root","READ");//Name change:VBH->VBFH TFile *f3=TFile::Open("./test/Ntuple2Dratio_ttH.root","READ"); TFile *f4=TFile::Open("./test/Ntuple2Dratio_ZZTo4l.root","READ"); //-----Histo Fasullo------ //TH1F* Fasullo1 = new TH1F("Fasullo1","JetN0_#tau 0",100,70.,300.); //TH1F* Fasullo2 = new TH1F("Fasullo2","JetN>=4",100,70.,300.); TH1F *h1=(TH1F*)f1->Get("Ratio_Tau0Tau2"); // TH1F *h1a=(TH1F*)f1->Get("Macro_ggH_tau0"); TH1F *h2=(TH1F*)f2->Get("Ratio_Tau0Tau2"); // TH1F *h2a=(TH1F*)f2->Get("Macro_VBH_tau0"); TH1F *h3=(TH1F*)f3->Get("Ratio_Tau0Tau2"); // TH1F *h3a=(TH1F*)f3->Get("Macro_ttH_tau0"); TH1F *h4=(TH1F*)f4->Get("Ratio_Tau0Tau2"); h1->SetLineColor(kRed);//Red // h1a->SetLineColor(kRed-7);//Blue h2->SetLineColor(kGreen+2);//Fucsia//kOrange-3/kMagenta // h2a->SetLineColor(kGreen-7);//kViolet+1//kPink+8/kViolet-5 h3->SetLineColor(kBlue);//kMagenta/kPink-9 // h3a->SetLineColor(kBlue-7);//kGreen+1 h4->SetLineColor(kViolet-5);//kMagenta/kPink-9 h1->GetXaxis()->SetTitle("#tau 0/#tau 2"); //h1->GetXaxis()->SetTitleSize(.15);//NOT WORKING h1->GetYaxis()->SetTitle("A.U");//A.U h1->GetYaxis()->SetTitleOffset(1.5); h2->GetXaxis()->SetTitle("#tau 0/#tau 2"); h2->GetYaxis()->SetTitle("A.U"); h2->GetYaxis()->SetTitleOffset(1.5); h3->GetXaxis()->SetTitle("#tau 0/#tau 2"); h3->GetYaxis()->SetTitle("A.U"); h3->GetYaxis()->SetTitleOffset(1.6); h4->GetXaxis()->SetTitle("#tau 0/#tau 2"); h4->GetYaxis()->SetTitle("A.U"); h4->GetYaxis()->SetTitleOffset(1.6); auto leg1=new TLegend(0.65,0.35,0.9,0.55); //auto leg1=new TLegend(0.65,0.65,0.9,0.85); leg1->AddEntry(h1,"ggH"); leg1->AddEntry(h2,"VBFH"); leg1->AddEntry(h3,"ttH"); leg1->AddEntry(h4,"ZZTo4l"); //leg1->AddEntry(h1a,"Macro_ggH"); /* auto leg2=new TLegend(0.65,0.75,0.9,0.85); leg2->AddEntry(h2,"VBH"); //leg2->AddEntry(h2a,"Macro_VBH"); auto leg3=new TLegend(0.65,0.75,0.9,0.85); leg3->AddEntry(h3,"ttH"); //leg3->AddEntry(h3a,"Macro_ttH"); */ Double_t w1=1000;//600X3 Double_t hh1=1000;// auto c1=new TCanvas("c1","c1",w1,hh1); c1->SetWindowSize(w1+(w1-c1->GetWw()),hh1+(hh1-c1->GetWh())); c1->SetCanvasSize(w1,hh1); c1->Divide(2,2); //TCanvas *c1=new TCanvas(); h1->SetLineWidth(2); // h1a->SetLineWidth(2); // h1a->SetLineStyle(2); h2->SetLineWidth(2); // h2a->SetLineWidth(2); // h2a->SetLineStyle(2); h3->SetLineWidth(2); // h3a->SetLineWidth(2); // h3a->SetLineStyle(2); h4->SetLineWidth(2); h4->SetLineStyle(2); //c1->Divide(2,2); c1->cd(1); //Fasullo1->Draw("same"); h4->DrawNormalized("histo");//Jetti3 //h4->Draw("histo");//Jetti3 c1->cd(2); h1->DrawNormalized("histo");//Jetti3 //h1->Draw("histo");//Jetti3 c1->cd(3); h2->DrawNormalized("histo");//Jetti3 //h2->Draw("histo");//Jetti3 c1->cd(4); h3->DrawNormalized("histo");//Jetti3 // h3->Draw("histo");//Jetti3 //h1a->DrawNormalized("histo same");//Jetti3 leg1->Draw("same"); /* c1->cd(2); h2->DrawNormalized("histo same");//Jetti3 // h2a->DrawNormalized("histo same");//Jetti3 leg2->Draw("same"); //h1->GetXaxis()->SetTitleSize(.15); c1->cd(3); h3->DrawNormalized("histo same");//Jetti3 // h3a->DrawNormalized("histo same");//Jetti3 leg3->Draw("same"); */ c1->SaveAs("/home/cms-skku/Desktop/Ratio_Tau0Tau2_Normalew.png"); } //end multiRoot function