#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; void overlap2() { gROOT->SetStyle("Plain"); gStyle->SetTitle(0); char buf[256]; TFile* f1 = new TFile("tau3_40.root"); TFile* f2 = new TFile("el3_40.root"); TFile* f3 = new TFile("J_1_40.root"); TFile* output = new TFile("test.root", "RECREATE"); const int nvar =12; const char* chvar[nvar]={"tau_seedCalo_EMRadius" ,"tau_seedCalo_centFrac","tau_seedCalo_isolFrac","tau_seedCalo_trkAvgDist","tau_etOverPtLeadTrk","tau_massTrkSys","tau_jet_emfrac","tau_calcVars_topoInvMass","tau_TRThitsRatio","tau_trFlightPathSig","tau_ipZ0SinThetaSigLeadTrk","tau_seedCalo_nIsolLooseTrk"}; for (int ivar = 0; ivarGet(chvar[ivar])->Clone(buf); strcpy(buf,chvar[ivar]); strcat(buf,"_teste4"); TH1F* h2 = (TH1F*)f2->Get(chvar[ivar])->Clone(buf); strcpy(buf,chvar[ivar]); strcat(buf,"_teste6"); TH1F* h3 = (TH1F*)f3->Get(chvar[ivar])->Clone(buf); double scalefactorT = 1/(h1->GetBinContent(h1->GetMaximumBin())); h1->Scale(scalefactorT); double scalefactorE = 1/(h2->GetBinContent(h2->GetMaximumBin())); h2->Scale(scalefactorE); double scalefactorJ = 1/(h3->GetBinContent(h3->GetMaximumBin())); h3->Scale(scalefactorJ); h1->SetLineWidth(2); h1->SetLineColor(kRed); //h1->SetFillColor(4); h2->SetLineWidth(2); h2->SetLineColor(kBlue); // h2->SetFillColor(kYellow); h3->SetLineWidth(2); h3->SetLineColor(kYellow); //h3->SetFillColor(kGreen); //TLegend*leg =new TLegend(0.7, 0.9, 0.93, 0.75); // leg->SetHeader("Z -> #tau #tau"); // leg->AddEntry(h1, "Ztautau", "l"); //leg->AddEntry(h2, "Zee", "l"); //leg->AddEntry(h3,"QCD dijets","l"); // leg->SetFillColor(0); //leg->Draw(); sprintf(buf,"test%d",ivar+1); TCanvas* c1 = new TCanvas(buf,buf); h1->Draw(); h2->Draw("same"); h3->Draw("same"); //TLegend*leg =new TLegend(0.75, 0.9, 0.93, 0.75); // leg->SetHeader("Z -> #tau #tau"); //leg->AddEntry(h1, "Ztautau", "l"); //leg->AddEntry(h2, "Zee", "l"); // leg->AddEntry(h3,"QCD dijets","l"); //leg->SetFillColor(0); //leg->Draw(); c1->Modified(); strcat(buf,".pdf"); c1->SaveAs(buf); c1->Write(); // c1->Update(); // output->close(); } }