// ----------------------------------------------------------------------------- // TCanvas* createPlot( TString path, TString canvas_name, TString name, TString dirmame, int rebin, bool norm, bool log, TDirectory* file ) { // SetSomeStyles(); float lumi = 250.0;// 15.04;//10.9;//6.8; // Create legend TLegend* legend = new TLegend(0.75, 0.6, 0.99, 0.99, "", "brNDC" ); legend->SetFillColor(0); legend->SetLineColor(0); legend->SetShadowColor(0); TLatex* prelim = new TLatex(0.6,0.54,"#scale[0.8]{CMS preliminary 2010}"); prelim->SetNDC(); TLatex* alumi = new TLatex(0.6,.45,"#scale[0.8]{#int L dt = 35 pb^{-1}, #sqrt{s} = 7 TeV}"); alumi->SetNDC(); // Create canvas TCanvas* aCanvas = createCanvas( canvas_name, file, log ); // Create histogram TString aname("nAll"); // TH1D* data1 = getHisto( path+"S14datacleaned/Edward_Data_Skim/",name,"data.root",aname,rebin); // TH1D* data = getHisto( path+"S14datacleaned/Edward_Data_Skim/",name,"data.root",dirmame,rebin); TH1D* data = getHisto( path+"", name, "tt.root", dirmame, rebin ); TH1D* qcd = getHisto( path+"", name, "lm1.root", dirmame, rebin ); TH1D* w_jets = getHisto( path+"", name, "w.root", dirmame, rebin ); TH1D* tt_jets = getHisto( path+"", name, "tt.root", dirmame, rebin ); TH1D* z_jets = getHisto( path+"", name, "z.root", dirmame, rebin ); TH1D* lm3 = getHisto( path+"", name, "lm3.root", dirmame, rebin ); TH1D* lm1 = getHisto( path+"", name, "lm1.root", dirmame, rebin ); TH1D* lm6 = getHisto( path+"", name, "data.root", dirmame, rebin ); TH1D* wm = getHisto( path+"", name, "w.root", dirmame, rebin ); data->Scale(lumi/100.); qcd->Scale(lumi/100.); tt_jets->Scale(lumi/100); w_jets->Scale(lumi/100); // w_jets->Scale(10); // z_inv->Scale(lumi/100); // lm6->Scale(lumi/100); lm1->Scale(lumi/100); lm3->Scale(lumi/100); z_jets->Scale(lumi/100); wm->Scale(lumi/100); // Combine Z+jets and Z->inv // TH1D* z_all = z_inv->Clone(); // z_all->Add(z_jets,1); //z_jets->Add(z_inv,1); TH1D* total = tt_jets->Clone(); total->Add(w_jets); total->Add(z_jets); // total-> Int_t binMax = total->GetNbinsX(); Double_t& err = new Double_t(0.); total->IntegralAndError(10,binMax ,err); Double_t& errW = new Double_t(0.); w_jets->IntegralAndError(10,binMax ,errW); Double_t& errtt = new Double_t(0.); tt_jets->IntegralAndError(10,binMax ,errtt); Double_t& errZ = new Double_t(0.); z_jets->IntegralAndError(10,binMax ,errZ); Double_t& errQCD = new Double_t(0.); qcd->IntegralAndError(10,binMax ,errQCD ); cout <<endl; // cout << "MC:" << total->IntegralAndError(11,binMax ,err) <<" && " << w_jets->Integral(11,binMax)<<" && "<<tt_jets->Integral(11,binMax) << "&& "<<z_jets->Integral(11,binMax)<<" && "<< "\/\ /\hline"<<endl; // cout << total->IntegralAndError(0,binMax ,err) <<" & " << lm1->Integral(0,binMax) <<" & " << lm3->Integral(0,binMax)<<" & " << lm6->Integral(0,binMax) <<"\\\\ \\hline"<<endl; // cout <<"270: " << total->IntegralAndError(27,binMax ,err) <<" & " << lm1->Integral(27,binMax) <<" & " << lm3->Integral(27,binMax)<<" & " << lm6->Integral(27,binMax) <<"\\\\ \\hline"<<endl; cout <<"250& " << total->IntegralAndError(6,binMax ,err) <<" & " << lm1->Integral(6,binMax) <<" & " << lm3->Integral(6,binMax)<<" & " << lm6->Integral(6,binMax) <<"\\\\ \\hline"<<endl; // cout << "300: " << total->IntegralAndError(7,binMax ,err) <<" & " << lm1->Integral(7,binMax) <<" & " << lm3->Integral(7,binMax)<<" &" << lm6->Integral(7,binMax) <<"\\\\ \\hline"<<endl; cout <<"350& " << total->IntegralAndError(8,binMax ,err) <<" & " << lm1->Integral(8,binMax) <<" & " << lm3->Integral(8,binMax)<<" & " << lm6->Integral(8,binMax) <<"\\\\ \\hline"<<endl; // cout << "400: " << total->IntegralAndError(9,binMax ,err) <<" & " << lm1->Integral(9,binMax) <<" & " << lm3->Integral(9,binMax)<<" & " << lm6->Integral(9,binMax) <<"\\\\ \\hline"<<endl; cout << "450& " << total->IntegralAndError(10,binMax ,err) <<" & " << lm1->Integral(10,binMax) <<" & " << lm3->Integral(10,binMax)<<" & " << lm6->Integral(10,binMax) <<"\\\\ \\hline"<<endl; //cout << "500: " << total->IntegralAndError(11,binMax ,err) <<" & " << lm1->Integral(11,binMax) <<" & " << lm3->Integral(11,binMax)<<" & " << lm6->Integral(11,binMax) <<"\\\\ \\hline"<<endl; cout <<"550& " << total->IntegralAndError(12,binMax ,err) <<" & " << lm1->Integral(12,binMax) <<" & " << lm3->Integral(12,binMax)<<" & " << lm6->Integral(12,binMax) <<"\\\\ \\hline"<<endl; /* cout << "MC:" << total->IntegralAndError(7,binMax ,err) <<" && " << lm1->Integral(7,binMax) <<" && " << lm3->Integral(7,binMax)<<" && " << lm6->Integral(6,binMax) <<"/\/\ /\hline"<<endl; cout << "MC:" << total->IntegralAndError(8,binMax ,err) <<" && " << lm1->Integral(8,binMax) <<" && " << lm3->Integral(8,binMax)<<" && " << lm6->Integral(7,binMax) <<"/\/\ /\hline"<<endl; cout << "MC:" << total->IntegralAndError(10,binMax ,err) <<" && " << lm1->Integral(10,binMax) <<" && " << lm3->Integral(10,binMax)<<" && " << lm6->Integral(10,binMax) <<"/\/\ /\hline"<<endl; cout << "MC:" << total->IntegralAndError(11,binMax ,err) <<" && " << lm1->Integral(11,binMax) <<" && " << lm3->Integral(11,binMax)<<" && " << lm6->Integral(11,binMax) <<"/\/\ /\hline"<<endl; cout << "MC:" << total->IntegralAndError(12,binMax ,err) <<" && " << lm1->Integral(12,binMax) <<" && " << lm3->Integral(12,binMax)<<" && " << lm6->Integral(12,binMax) <<"/\/\ /\hline"<<endl; // cout << "MC:" << err <<", W: " << errW<<", tt: "<<errtt << ", Z: "<<errZ<<", QCD: "<< errQCD<< endl; */ // cout << "data:" << data->Integral() << endl; TH1D* hcen = total->Clone(); TH1D* herr = total->Clone(); herr->SetLineColor(kTeal+3); herr->SetMarkerColor(kAzure+6); herr->SetFillColor(kAzure+6); herr->SetLineWidth(3); total->SetLineWidth(3); total->SetFillColor(kAzure+2); total->SetLineColor(kAzure+2); total->SetFillStyle(3245); hcen->SetFillStyle(0); hcen->SetMarkerColor(kTeal+3); hcen->SetLineColor(kTeal+3); hcen->SetLineWidth(3); // Merge Z+jets and Z->inv bool combine = false; // Line colour and fill qcd->SetLineColor(kPink+4); qcd->SetLineWidth(3); tt_jets->SetLineColor(kBlue+1); tt_jets->SetLineWidth(3); w_jets->SetLineColor(kPink+7); w_jets->SetLineWidth(3); z_jets->SetLineWidth(3); z_jets->SetLineColor(kTeal-7); if ( combine ) { z_all->SetLineColor(kBlack); z_all->SetLineStyle(3); z_all->SetLineWidth(1); } else { data->SetLineColor(1); data->SetLineStyle(1); data->SetLineWidth(3); data->SetMarkerStyle(20); data->SetFillColor(0); } // lm0->SetLineColor(kRed); // lm0->SetLineWidth(3); // lm1->SetLineColor(kRed+3); // lm1->SetLineWidth(3); // Populate legend // legend->AddEntry( data, "tt fully leptonic/", "LP" ); legend->AddEntry( herr, "full SM", "LP" ); legend->AddEntry( z_jets, " Z+jets ", "LP" ); legend->AddEntry( w_jets, " W+jets", "LP" ); legend->AddEntry( tt_jets, " t#bar{t}", "LP" ); // legend->AddEntry( lm3, " SUSY LM3", "LP" ); // legend->AddEntry( lm1, " SUSY LM1", "LP" ); legend->AddEntry( lm6, " data", "LP" ); // legend->AddEntry(wm,"W Mad","lp"); // Calc maximum number of entries double aMax = 0.; if( data->GetMaximum() > aMax ) { aMax = data->GetMaximum()+data->GetBinError(data->GetMaximumBin()); } if ( qcd->GetMaximum() > aMax ) { aMax = qcd->GetMaximum(); } // if ( lm0->GetMaximum() > aMax ) { aMax = lm0->GetMaximum(); } // if ( lm1->GetMaximum() > aMax ) { aMax = lm1->GetMaximum(); } if ( tt_jets->GetMaximum() > aMax ) { aMax = tt_jets->GetMaximum(); } if ( w_jets->GetMaximum() > aMax ) { aMax = w_jets->GetMaximum(); } if ( combine ) { if ( z_all->GetMaximum() > aMax ) { aMax = z_all->GetMaximum(); } } else { // if ( data->GetMaximum() > aMax ) { aMax = z_inv->GetMaximum(); } if ( z_jets->GetMaximum() > aMax ) { aMax = z_jets->GetMaximum(); } } // Calc minimum number of entries double aMin = 1.e12; if ( qcd->GetMinimum(1.e-12) < aMin ) { aMin = qcd->GetMinimum(1.e-12); } // if ( lm0->GetMinimum(1.e-12) < aMin ) { aMin = lm0->GetMinimum(1.e-12); } // if ( lm1->GetMinimum(1.e-12) < aMin ) { aMin = lm1->GetMinimum(1.e-12); } if ( tt_jets->GetMinimum(1.e-12) < aMin ) { aMin = tt_jets->GetMinimum(1.e-12); } if ( w_jets->GetMinimum(1.e-12) < aMin ) { aMin = w_jets->GetMinimum(1.e-12); } if ( combine ) { if ( z_all->GetMinimum(1.e-12) < aMin ) { aMin = z_all->GetMinimum(1.e-12); } } else { // if ( data->GetMinimum(1.e-12) < aMin ) { aMin = z_inv->GetMinimum(1.e-12); } if ( z_jets->GetMinimum(1.e-12) < aMin ) { aMin = z_jets->GetMinimum(1.e-12); } } if ( qcd ) qcd->GetYaxis()->SetTitleOffset(1.43); if ( qcd ) qcd->GetYaxis()->SetTitleSize(0.06); if ( qcd ) qcd->GetXaxis()->SetTitleSize(0.06); if ( qcd ) qcd->GetXaxis()->SetTitleOffset(0.9); if ( log ) { if ( qcd ) herr->SetMaximum( aMax * 10. ); // if ( qcd ) herr->SetMinimum( aMin * 0.1 ); if ( qcd ) herr->SetMinimum( 0.005); } else { if ( qcd ) herr->SetMaximum( aMax * 1.1 ); // if ( qcd ) herr->SetMinimum( aMin * 0.9 ); if ( qcd ) herr->SetMinimum( 0.005); } /* TPad* mainPad = new TPad("","",0.01,0.25,0.99,0.99); mainPad->SetNumber(1); mainPad->SetFillColor(0); // mainPad->Range(-288.2483,-2.138147,1344.235,6.918939); mainPad->SetFillColor(0); mainPad->SetBorderMode(0); mainPad->SetBorderSize(2); if ( log == true)mainPad->SetLogy(); mainPad->SetLeftMargin(0.1765705); mainPad->SetRightMargin(0.05772496); mainPad->SetTopMargin(0.04778761); mainPad->SetBottomMargin(0.1256637); mainPad->SetFrameFillStyle(0); mainPad->SetFrameLineWidth(2); mainPad->SetFrameBorderMode(0); mainPad->SetFrameFillStyle(0); mainPad->SetFrameLineWidth(2); mainPad->SetFrameBorderMode(0); if ( log == true)mainPad->SetLogy(); mainPad->Draw(); TPad* ratioPad = new TPad("","",0.01,0.01,0.99,0.25); ratioPad->SetNumber(2); ratioPad->SetFillColor(0); ratioPad->SetFillColor(0); ratioPad->SetBorderMode(0); ratioPad->SetBorderSize(2); // if ( log == true)ratioPad->SetLogy(); ratioPad->SetLeftMargin(0.1765705); ratioPad->SetRightMargin(0.05772496); ratioPad->SetTopMargin(0.04778761); ratioPad->SetBottomMargin(0.1256637); ratioPad->SetFrameFillStyle(0); ratioPad->SetFrameLineWidth(2); ratioPad->SetFrameBorderMode(0); ratioPad->SetFrameFillStyle(0); ratioPad->SetFrameLineWidth(2); ratioPad->SetFrameBorderMode(0); // if ( log == true)ratioPad->SetLogy(); ratioPad->Draw(); aCanvas->cd(1); */ herr->GetYaxis()->SetTitle("events"); if ( norm ) { if ( qcd ) qcd->DrawNormalized("Ehist"); // if ( lm0->GetEntries() > 0. ) { lm0->DrawNormalized("hsame"); } if ( lm1->GetEntries() > 0. ) { lm1->DrawNormalized("hsame"); } if ( tt_jets->GetEntries() > 0. ) { tt_jets->DrawNormalized("hsame"); } if ( w_jets->GetEntries() > 0. ) { w_jets->DrawNormalized("hsame"); } if ( combine ) { if ( z_all->GetEntries() > 0. ) { z_all->DrawNormalized("hsame"); } } else { if ( data->GetEntries() > 0. ) { z_inv->DrawNormalized("hsame"); } if ( z_jets->GetEntries() > 0. ) { z_jets->DrawNormalized("hsame"); } } } else { herr->Draw("hist"); // qcd->SetFillStyle(3240); // qcd->SetFillColor(kPink+4); // qcd->Draw("hist"); w_jets->Draw("hSameh"); z_jets->Draw("9Sameh"); w_jets->Draw("9Sameh"); tt_jets->Draw("9SAMEh"); //data1->Draw("9SAMEh"); //lm0->Draw("9SAMEh"); lm1->SetLineColor(12); lm1->SetLineStyle(2); lm1->SetLineWidth(2); // lm1->Draw("9SAMEh"); lm3->SetLineColor(14); lm3->SetLineStyle(2); lm3->SetLineWidth(2); // lm3->Draw("9SAMEh"); lm6->Draw("9SAMEh"); wm->SetLineStyle(2); wm->SetLineColor(kPink+7); // wm->Draw("9Sameh"); // total->DrawNormalized("9E2same"); // data->Draw("SAMEh"); // tt_jets->Divide(data); // tt_jets->Draw("h"); // data->SetLineColor(kRed); // data->Draw("sameh"); // data1->SetLineColor(kRed); // data1->Draw("9SAMEP"); } legend->Draw(); // prelim->Draw(); // alumi->Draw(); /* TH1D* ratioBottom = total->Clone(); TH1D* ratioTop = data->Clone(); ratioTop->GetYaxis()->SetTitle("data / sim"); ratioTop->Divide(ratioBottom); aCanvas->cd(1)->Update(); aCanvas->cd(2); ratioTop->SetTitleSize(0.1, "XYZ"); ratioTop->SetTitleOffset(0.55, "X"); ratioTop->SetTitleOffset(0.3, "Y"); ratioTop->SetLabelSize(0.06,"XY"); // ratioTop->GetXaxis().SetRangeUser(MinX,MaxX); ratioTop->GetYaxis()->SetRangeUser(0.,2.0); ratioTop->Draw();*/ /* TBox* unity = TBox(ratioTop->GetXaxis()->GetBinLowEdge(ratioTop->GetXaxis()->GetFirst()), 0.89,ratioTop->GetXaxis()->GetBinLowEdge(ratioTop->GetXaxis()->GetLast()), 1.11); unity->SetLineWidth(2); unity->SetLineColor(2); unity->SetFillColor(2); unity->SetFillStyle(3002); unity->Draw(); */ file->cd(); aCanvas->SaveAs( std::string(canvas_name+".pdf").c_str() ); aCanvas->Write(); // aCanvas->Print(".png"); return aCanvas; }
int lireLigne(int fd, char *b, char *s, int nc) /* fd = file descriptor b = adresse du buffer nc = nb de caracteres possible (longueur du buffer */ { char *d, *f, c, c2, c3, *h, *w, *Wl, *rac; int n, i, l, ls=0, ins=0, ignTild=0, nbT=0, Nc; unsigned int j; char bufd[50]; /* printf("lireLigne ... \n"); */ d = b; f = b+nc; while(d<f-ls) { if (noErr()) { n = -1; break; } /* fprintf(stderr,"d-b=%d ins=%d s=<%s> b=<%s>\n",d-b,ins,s,b); */ if ((n=read(fd,d,1)) != 1) break; c=*d; if (ignTild && (c == '~')) { ignTild=0; continue; } if ((c > 31) && (c < 127)) { /* de SPACE a TILDE */ if (!((FD_IN || iTERM) && ECHOOFF)) { printf("%c",c); if (ins) { if (ins==2) /* rewrite */ enleve1(s); if(*s =='\0') ins=0; else { printf("%s",s); for (j=0; j<strlen(s); j++) printf("\b"); } } } fflush(stdout); d++; } else { switch (c) { /* Ctrl C case '\003' : kill(getpid(), SIGINT); break; */ case '\t': /* tab */ if (d>b) { *d='\0'; w=d-1; while ((w>b) && (!(isSepa(*w,1)))) w--; if (isSepa(*w,0)) w++; /* fprintf(stderr,"d-b=%d w=<%s>\n",d-b,w); */ if (strlen(w) > 0) { j=nbLibBegin(w, &rac); /* fprintf(stderr,"j=%d w=<%s>\n",j,w); */ if (j==0) printf("\a"); else { if (j==1) { Wl=getLibBegin(w); i=strlen(Wl)-strlen(w); /* fprintf(stderr,"i=%d Wl=<%s>\n",i,Wl); */ if (i>0) { strcpy(w,Wl); printf("%s ",d); d+=i; *d++ = ' '; if (ins) { printf("%s ",s); for (j=0; j<(strlen(s)+1); j++) printf("\b"); } } else { /* XXXX */ if (i==0) { printf (" "); *d++ = ' '; } } } else { if (rac != NULL) { i=strlen(rac)-strlen(w); strcpy(w,rac); printf("%s",d); d+=i; if (ins) { printf("%s ",s); for (j=0; j<(strlen(s)+1); j++) printf("\b"); } } else { nbT++; if (nbT>1) { nbT=0; printf("\n"); listLibBegin(w); *d='\0'; printf("> %s",b); if (ins) { printf("%s ",s); for (j=0; j<(strlen(s)+1); j++) printf("\b"); } fflush(stdout); } } } } fflush(stdout); } } break; case '\177': if (d>b) { printf("\b \b"); if (ins) { printf("%s ",s); for (j=0; j<(strlen(s)+1); j++) printf("\b"); } fflush(stdout); d--; } break; case '\n': case '\r': if ((FD_IN || iTERM) && ECHOOFF) printf("."); else { printf("\n"); if (ins) { if (d+strlen(s) < f) { sprintf(d,"%s",s); d+=strlen(s); } else return(-1); } } goto finBoucle; /* gestion des caracteres speciaux */ case '\033': /* ESCAPE */ ignTild=1; Nc=read(fd,&c2,1); Nc=read(fd,&c3,1); if (c2 == '[') { /* CSI - see XTerm Control Sequences */ switch(c3) { case '2' : /* Insert */ if (ins) { ins++; if (ins==3) ins=1; } break; case '3' : /* Suppr */ if (ins) { enleve1(s); if(*s =='\0') ins=0; printf("%s \b",s); for (j=0; j<strlen(s); j++) printf("\b"); fflush(stdout); } break; case 'A' : /* UpArrow */ case 'B' : /* DownArrow */ ins = 0; /* efface la ligne en cours */ l=d-b; for(i=0;i<l;i++) printf("\b \b"); fflush(stdout); d=b; *d = '\0'; if ((h=getHisto(c3)) != NULL) { strcpy(b,h); d=b+strlen(h); /* printf("\n%s (iH=%d iHt=%d)\n",h,iH,iHt); *d='\0'; */ printf("%s",b); fflush(stdout); } break; case 'C' : /* -> */ if (ins) { *d = *s; printf("%c",*d++); enleve1(s); if(*s =='\0') ins=0; else { printf("%s",s); for (j=0; j<strlen(s); j++) printf("\b"); } fflush(stdout); } break; case 'D' : /* <- */ if (d>b) { if (ins==0) { ins=1; *d='\0'; strcpy(s,d-1); } else insertC(*(d-1),s); d--; printf("\b"); fflush(stdout); } break; case 'H' : /* home : debug terms ON */ case '1' : /* home numeric */ IFD_DebugTOn(); break; case 'F' : /* end : debug terms OFF */ case '4' : /* end numeric */ IFD_DebugTOff(); break; default: sprintf(bufd,"# ignore : ESC [ %d (%c) !",(int)c3, c3); D_Tracenl(bufd); *d='\0'; /* ************** printf("> %s",b); fflush(stdout); */ } } else { if (c2 == 'O') { /* SS3 - see XTerm Control Sequences */ switch(c3) { case 'P' : /* F1 */ break; case 'Q' : /* F2 */ break; case 'R' : /* F3 */ break; case 'S' : /* F4 */ break; case 'H' : /* home : debug terms ON */ IFD_DebugTOn(); break; case 'F' : /* end : debug terms OFF */ IFD_DebugTOff(); break; } } else { sprintf(bufd,"# ignore : ESC %d %d (%c) !",(int)c2,(int)c3, c3); D_Tracenl(bufd); *d='\0'; /* ************** printf("> %s",b); fflush(stdout); */ } } break; default : /* printf("\nCar = %d !\n",(int)c); *d='\0'; printf("> %s",b); fflush(stdout); */ break; } } if (ins) ls = strlen(s); } finBoucle: /* printf("fin lireLigne!\n"); */ if ((n<1) && (FD_IN !=0)) { closeFD(); /* fichier loader */ if (ECHOOFF) printf("\n"); return 0; } if ((n<1) && iTERM) { close(FD_IN); /* pipe ou autre */ Nc=dup(iTERM); /* stdin on term */ iTERM = 0; if (ECHOOFF) printf("\n"); return 0; } if (d == f) { /* cas du buffer trop petit */ /* d=b; while (*d != '\n') read(fd,d,1); **** not in raw mode */ #ifdef DEBUG printf("lireLigne : erreur !\n"); #endif return(-1); } *d = '\0'; #ifdef DEBUG printf("lireLigne : retour <%s> !\n",b); #endif if (!FD_IN) putHisto(b); incFDlig(); return(strlen(b)); }
// ----------------------------------------------------------------------------- // TCanvas* createPlot( TDirectory* output_file, std::string output_canvas, std::vector<std::string> input_files, std::vector<std::string> input_histos, std::vector<std::string> input_legend, std::vector<int> marker_style, std::vector<int> marker_colour, std::vector<float> marker_size, std::vector<float> lumis, double lumi, int rebin, bool norm, bool log, double min = -1., double max = -1. ) { // SetSomeStyles(); // Create legend TLegend* legend = new TLegend( 0.6, 0.5, 0.9, 0.7, NULL, "brNDC" ); legend->SetFillColor(0); legend->SetLineColor(0); // Create canvas TCanvas* aCanvas = createCanvas( output_canvas, output_file, log ); TPaveText* stats = new TPaveText( 0.6, 0.3, 0.9, 0.45, "brNDC" ); stats->SetFillColor(0); stats->SetLineColor(0); TLatex* prelim = new TLatex( 0.55, 0.8, "#scale[0.8]{CMS preliminary 2011}" ); prelim->SetTextSize(0.04); prelim->SetNDC(); std::stringstream ssl; ssl << "#scale[0.8]{#int L dt = " << lumi << "pb^{-1}, #sqrt{s} = 7 TeV}"; TLatex* lumistxt = new TLatex( 0.51, 0.87, ssl.str().c_str() ); lumistxt->SetTextSize(0.04); lumistxt->SetNDC(); // First histo be drawn bool first = true; // Loop through histogram names std::vector<TH1D*> his; for ( uint ihis = 0; ihis < input_histos.size(); ++ihis ) { his.push_back( (TH1D*)getHisto( input_files[ihis], input_histos[ihis], "QcdBkgdEst", rebin ) ); } // For Ted bool print_ted = true; std::stringstream ted; if ( print_ted ) { ted << "self._htMeans = ("; } // Loop through histograms double aMax = 0.; double aMin = 1.e12; for ( uint ihis = 0; ihis < his.size(); ++ihis ) { if ( !his[ihis] ) { continue; } // Line colour and fill his[ihis]->Scale(lumis[ihis]/100.); his[ihis]->SetMarkerStyle(marker_style[ihis]); his[ihis]->SetMarkerColor(marker_colour[ihis]); his[ihis]->SetMarkerSize(marker_size[ihis]); his[ihis]->SetLineColor(marker_colour[ihis]); his[ihis]->SetLineStyle(0); his[ihis]->SetLineWidth(0); // Populate legend if ( input_legend.size() > ihis ) { legend->AddEntry( his[ihis], input_legend[ihis].c_str(), "EPL" ); } else { legend->AddEntry( his[ihis], input_histos[ihis].c_str(), "EPL" ); } // Populate stats box std::stringstream ss; ss << "Mean=" << int(his[ihis]->GetMean()*100.)/100. << ", RMS=" << int(his[ihis]->GetRMS()*100.)/100.; TText* text = stats->AddText(ss.str().c_str()); text->SetTextAlign(11); text->SetTextSize(0.03); text->SetTextColor(marker_colour[ihis]); // For Ted if ( print_ted ) ted << std::setw(9) << std::scientific << std::setprecision(3) << his[ihis]->GetMean() << ", "; // Calc min/max number of entries if ( his[ihis]->GetMaximum() > aMax ) { aMax = his[ihis]->GetMaximum(); } if ( his[ihis]->GetMinimum(1.e-12) < aMin ) { aMin = his[ihis]->GetMinimum(1.e-12); } } // For Ted if ( print_ted ) { ted << ")" << std::endl; std::cout << ted.str() << std::endl; } if ( !his.empty() ) { if ( his[0] ) his[0]->GetYaxis()->SetTitleOffset(1.43); if ( his[0] ) his[0]->GetYaxis()->SetTitleSize(0.06); if ( his[0] ) his[0]->GetXaxis()->SetTitleSize(0.06); if ( his[0] ) his[0]->GetXaxis()->SetTitleOffset(0.9); } for ( uint ihis = 0; ihis < his.size(); ++ihis ) { if ( !his[ihis] ) { continue; } //his[ihis]->GetYaxis()->SetTitle("a.u."); if ( log ) { his[ihis]->SetMaximum( aMax * 10. ); his[ihis]->SetMinimum( aMin * 0.1 ); } else { his[ihis]->SetMaximum( aMax * 1.1 ); his[ihis]->SetMinimum( aMin * 0.9 ); } if ( min > 0. ) his[ihis]->SetMinimum( min ); if ( max > 0. ) his[ihis]->SetMaximum( max ); if ( norm ) { std::string options = ""; if ( first ) { options = "Ehist"; first = false; } else { options = "hsame"; } if ( his[ihis]->GetEntries() > 0. ) { his[ihis]->DrawNormalized(options.c_str()); } } else { std::string options = ""; if ( first ) { options = "h"; first = false; } else { options = "hsame"; } his[ihis]->Draw(options.c_str()); } } // Loop through histos output_file->cd(); legend->Draw("same"); stats->Draw("same"); prelim->Draw("same"); lumistxt->Draw("same"); aCanvas->Modified(); //aCanvas->SaveAs( std::string(output_canvas+".png").c_str() ); aCanvas->SaveAs( std::string(output_canvas+".pdf").c_str() ); aCanvas->SaveAs( std::string(output_canvas+".C").c_str() ); aCanvas->Write(); return aCanvas; }
// ----------------------------------------------------------------------------- // TCanvas* createPlot( TString path, TString canvas_name, TString name, TString dirmame, int rebin, bool norm, bool log, TDirectory* file ) { // SetSomeStyles(); // Create legend TLegend* legend = new TLegend( 0.75, 0.65, 0.92, 0.92, NULL, "brNDC" ); legend->SetFillColor(0); legend->SetLineColor(0); // Create canvas TCanvas* aCanvas = createCanvas( canvas_name, file, log ); // Create histograms // TGraph* DataClean = getHisto( path, name, "Jet6.root", dirmame, rebin ); if(1){ TH1* Data = getHisto( path, name, "JetsDataPlotME.root", dirmame, rebin ); TH1* MC = getHisto( path, name, "JetsMCPlotME.root", dirmame, rebin ); } if(0){ TH1* Data = getHisto( path, name, "L1Jets_Data38.root", dirmame, rebin ); TH1* MC = getHisto( path, name, "L1Jets_MC38.root", dirmame, rebin ); } // Line colour and fill if ( Data ) Data->SetLineColor(1); if ( Data ) Data->SetFillColor(1); if ( Data ) Data->SetFillStyle(3003); if ( Data ) Data->SetMarkerStyle(20); if ( Data ) Data->SetMarkerColor(1); // if ( DataClean ) DataClean->SetLineColor(6); // if ( DataClean ) DataClean->SetFillColor(6); // if ( DataClean ) DataClean->SetFillStyle(3003); // if ( DataClean ) DataClean->SetMarkerStyle(25); // if ( DataClean ) DataClean->SetMarkerColor(6); if ( MC ) MC->SetLineColor(2); if ( MC ) MC->SetLineStyle(1); if ( MC ) MC->SetLineWidth(2); if ( MC ) MC->SetMarkerStyle(23); if ( MC ) MC->SetMarkerColor(2); // Populate legend legend->AddEntry( Data, " Data", "P" ); // legend->AddEntry( DataClean, " DataCleaned", "P" ); legend->AddEntry( MC, " MC", "P" ); // Calc maximum number of entries double aMax = 0.; if ( Data->GetMaximum() > aMax ) { aMax = Data->GetMaximum(); } if ( MC->GetMaximum() > aMax ) { aMax = MC->GetMaximum(); } // Calc minimum number of entries double aMin = 1.e12; if ( Data->GetMinimum(1.e-12) < aMin ) { aMin = Data->GetMinimum(1.e-12); } if ( MC->GetMinimum(1.e-12) < aMin ) { aMin = MC->GetMinimum(1.e-12); } // Data->GetYaxis()->SetRangeUser(-0.6,2.0); if ( Data ) Data->GetYaxis()->SetTitleOffset(1.43); if ( Data ) Data->GetYaxis()->SetTitleSize(0.06); if ( Data ) Data->GetXaxis()->SetTitleSize(0.06); if ( Data ) Data->GetXaxis()->SetTitleOffset(0.9); // Data->SumW2(); // MC->SumW2(); // DataClean->SumW2(); // if ( log ) { // if ( Data ) Data->SetMaximum( aMax * 10. ); // if ( Data ) Data->SetMinimum( aMin * 0.1 ); // } else { // if ( Data ) Data->SetMaximum( aMax * 1.1 ); // if ( Data ) Data->SetMinimum( aMin * 0.9 ); // } if ( norm ) { if ( Data ) Data->Draw("Phist"); if ( MC->GetEntries() > 0. ) { MC->Scale(Data->Integral()/MC->Integral()); MC->Draw("lsamehist"); // DataClean->Draw("Psame"); } }else{ Data->Draw("EPhist"); MC->Draw("EPLsamehist"); } file->cd(); legend->Draw("same"); aCanvas->SaveAs( std::string(canvas_name+".pdf").c_str() ); aCanvas->Write(); return aCanvas; }
void analyzeCutflowWithAnalyzers(bool save=false) { gStyle->SetOptStat(0); gStyle->SetTitleBorderSize(0); gStyle->SetLegendBorderSize(0); gStyle->SetPadBottomMargin(0.11); gStyle->SetLabelSize(0.05,"XY"); gStyle->SetTitleSize(0.05,"XY"); gStyle->SetFillColor(0); /// path where input files are stored TString inputPathScratch ="/scratch/hh/current/cms/user/jlange/output_4_2_4/fullLeptonic"; TString inputPath42 ="/afs/naf.desy.de/user/j/jlange/nafscratch/top/CMSSW_4_2_4/src/TopAnalysis/Configuration/analysis/fullLeptonic"; TString outputFolder = "/afs/desy.de/user/j/jlange/analysis/tagAndProbe/plots/CutStudiesForTrigger"; TString outputFileName = "/cutStudiesDifferentPU_"; TString fileFormat = "png"; TFile* file= new TFile(inputPath42+"/naf_analyzeCutflowWithAnalyzers_cfg/analyzeCutflowWithAnalyzers_MinJet4_pt30_MuPt20.root"); file->cd(); TTree *tJet = (TTree*) file->Get("analyzeJetAllTrig2AfterCut/tree")->Clone(); tJet->AddFriend("tMu = analyzeMuonKinematicsTrig2/tree"); TCut cutPtMu = "tMu.pt>30"; TCut cutPtJet = "pt1>35 && pt2>35 && pt3>35 && pt4>35"; TCut cutPtMuJet = cutPtMu && cutPtJet; /// calculate efficiencies // no PUrew double NeventIni = 1000000.; double NmuPt20_minJet4pt30 = (double)tJet->GetEntries(); double NmuPt23_minJet4pt30 = (double)tJet->GetEntries("tMu.pt>23"); double NmuPt30_minJet4pt30 = (double)tJet->GetEntries("tMu.pt>30"); // double NmuPt20_minJet4pt35 = (double)tJet->GetEntries("pt1>35 && pt2>35 && pt3>35 && pt4>35"); // double NmuPt23_minJet4pt35 = (double)tJet->GetEntries("pt1>35 && pt2>35 && pt3>35 && pt4>35 && tMu.pt>23"); // double NmuPt23_minJet4pt1_65 = (double)tJet->GetEntries("pt1>65 && pt2>50 && pt3>35 && pt4>20 && tMu.pt>23"); // double NmuPt30_minJet4pt1_65 = (double)tJet->GetEntries("pt1>65 && pt2>50 && pt3>35 && pt4>20 && tMu.pt>30"); double NmuPt20_minJet4pt35 = (double)tJet->GetEntries("pt1>35 && pt2>35 && pt3>35 && pt4>35"); double NmuPt23_minJet4pt35 = (double)tJet->GetEntries("pt1>35 && pt2>35 && pt3>35 && pt4>35 && tMu.pt>23"); double NmuPt23_minJet4pt1_65 = (double)tJet->GetEntries("pt1>65 && pt2>50 && pt3>35 && pt4>30 && tMu.pt>23"); double NmuPt30_minJet4pt1_65 = (double)tJet->GetEntries("pt1>65 && pt2>50 && pt3>35 && pt4>30 && tMu.pt>30"); double NmuPt30_minJet4pt1_50 = (double)tJet->GetEntries("pt1>50 && pt2>40 && pt3>35 && pt4>30 && tMu.pt>30"); double NmuPt20_minJet4pt30_PUlo = (double)tJet->GetEntries("pv<10"); double NmuPt20_minJet4pt30_PUhi = (double)tJet->GetEntries("pv>10"); std::cout<<"NeventIni= "<<NeventIni<<std::endl; std::cout<<"NmuPt20_minJet4pt30= "<<NmuPt20_minJet4pt30<<std::endl; std::cout<<"NmuPt23_minJet4pt30= "<<NmuPt23_minJet4pt30<<std::endl; std::cout<<"NmuPt30_minJet4pt30= "<<NmuPt30_minJet4pt30<<std::endl; std::cout<<"NmuPt20_minJet4pt35= "<<NmuPt20_minJet4pt35<<std::endl; std::cout<<"NmuPt23_minJet4pt35= "<<NmuPt23_minJet4pt35<<std::endl; std::cout<<"NmuPt23_minJet4pt1_65= "<<NmuPt23_minJet4pt1_65<<std::endl; std::cout<<"NmuPt30_minJet4pt1_65= "<<NmuPt30_minJet4pt1_65<<std::endl; std::cout<<"NmuPt30_minJet4pt1_50= "<<NmuPt30_minJet4pt1_50<<std::endl; std::cout<<"eff muPt>20 minJet4pt>30 wrt NeventIni "<< NmuPt20_minJet4pt30/NeventIni <<std::endl; std::cout<<"eff muPt>23 minJet4pt>30 wrt NeventIni "<< NmuPt23_minJet4pt30/NeventIni <<std::endl; std::cout<<"eff muPt>30 minJet4pt>30 wrt NeventIni "<< NmuPt30_minJet4pt30/NeventIni <<std::endl; std::cout<<"eff muPt>20 minJet4pt>35 wrt NeventIni "<< NmuPt20_minJet4pt35/NeventIni <<std::endl; std::cout<<"eff muPt>23 minJet4pt>35 wrt NeventIni "<< NmuPt23_minJet4pt35/NeventIni <<std::endl; std::cout<<"eff muPt>23 minJet4pt1_65 wrt NeventIni "<< NmuPt23_minJet4pt1_65/NeventIni <<std::endl; std::cout<<std::endl; std::cout<<"eff muPt>30 minJet4pt1_65 wrt NeventIni "<< NmuPt30_minJet4pt1_65/NeventIni <<std::endl; std::cout<<std::endl; std::cout<<"eff muPt>30 minJet4pt1_50 wrt NeventIni "<< NmuPt30_minJet4pt1_50/NeventIni <<std::endl; std::cout<<std::endl; std::cout<<"eff muPt>23 minJet4pt>30 wrt muPt>20 minJet4pt>30 "<< NmuPt23_minJet4pt30/NmuPt20_minJet4pt30 <<std::endl; std::cout<<"eff muPt>30 minJet4pt>30 wrt muPt>20 minJet4pt>30 "<< NmuPt30_minJet4pt30/NmuPt20_minJet4pt30 <<std::endl; std::cout<<"eff muPt>20 minJet4pt>35 wrt muPt>20 minJet4pt>30 "<< NmuPt20_minJet4pt35/NmuPt20_minJet4pt30 <<std::endl; std::cout<<"eff muPt>23 minJet4pt>35 wrt muPt>20 minJet4pt>30 "<< NmuPt23_minJet4pt35/NmuPt20_minJet4pt30 <<std::endl; std::cout<<"eff muPt>23 minJet4pt1_65 wrt muPt>20 minJet4pt>30 "<< NmuPt23_minJet4pt1_65/NmuPt20_minJet4pt30 <<std::endl; std::cout<<"eff muPt>30 minJet4pt1_65 wrt muPt>20 minJet4pt>30 "<< NmuPt30_minJet4pt1_65/NmuPt20_minJet4pt30 <<std::endl; std::cout<<"eff muPt>30 minJet4pt1_50 wrt muPt>20 minJet4pt>30 "<< NmuPt30_minJet4pt1_50/NmuPt20_minJet4pt30 <<std::endl; // with PUrew // std::cout<<"--------------------------------------------"<<std::endl; // std::cout<<"!!! PU rew !!! "<<NeventIni<<std::endl; // NeventIni = 1000000.; // NmuPt20_minJet4pt30 = (double)tJet->GetEntries("weight"); // NmuPt23_minJet4pt30 = (double)tJet->GetEntries("weight*(tMu.pt>23)"); // NmuPt20_minJet4pt35 = (double)tJet->GetEntries("weight*(pt1>35 && pt2>35 && pt3>35 && pt4>35)"); // NmuPt23_minJet4pt35 = (double)tJet->GetEntries("weight*(pt1>35 && pt2>35 && pt3>35 && pt4>35 && tMu.pt>23)"); // // std::cout<<"NeventIni= "<<NeventIni<<std::endl; // std::cout<<"NmuPt20_minJet4pt30= "<<NmuPt20_minJet4pt30<<std::endl; // std::cout<<"NmuPt23_minJet4pt30= "<<NmuPt23_minJet4pt30<<std::endl; // std::cout<<"NmuPt20_minJet4pt35= "<<NmuPt20_minJet4pt35<<std::endl; // std::cout<<"NmuPt23_minJet4pt35= "<<NmuPt23_minJet4pt35<<std::endl; // // std::cout<<"eff muPt>20 minJet4pt>30 wrt NeventIni "<< NmuPt20_minJet4pt30/NeventIni <<std::endl; // std::cout<<"eff muPt>23 minJet4pt>30 wrt NeventIni "<< NmuPt23_minJet4pt30/NeventIni <<std::endl; // std::cout<<"eff muPt>20 minJet4pt>35 wrt NeventIni "<< NmuPt20_minJet4pt35/NeventIni <<std::endl; // std::cout<<"eff muPt>23 minJet4pt>35 wrt NeventIni "<< NmuPt23_minJet4pt35/NeventIni <<std::endl; // std::cout<<std::endl; // // std::cout<<"eff muPt>23 minJet4pt>30 wrt muPt>20 minJet4pt>30 "<< NmuPt23_minJet4pt30/NmuPt20_minJet4pt30 <<std::endl; // std::cout<<"eff muPt>20 minJet4pt>35 wrt muPt>20 minJet4pt>30 "<< NmuPt20_minJet4pt35/NmuPt20_minJet4pt30 <<std::endl; // std::cout<<"eff muPt>23 minJet4pt>35 wrt muPt>20 minJet4pt>30 "<< NmuPt23_minJet4pt35/NmuPt20_minJet4pt30 <<std::endl; // tJet->Scan("*", "","",10,10); // tJet->Scan("*", cutPtMu,"",10,10); // tJet->Scan("*", cutPtJet,"",10,10); TCanvas* canv1=new TCanvas("c","c",1); canv1->cd(); //tree -> Draw("probePt>>hnew(30,0,150)", "", "", 100); tJet -> Draw("tMu.pt>>hnew1(30,0,150)", cutPtJet); TCanvas* canv2=new TCanvas("c2","c2",1); canv2->cd(); tJet -> Draw("pt1>>hnew2(30,0,150)",cutPtJet); /// ------------------------------------------------------------------------------ /// map with structure that keeps features of methods, ignore file, filename="" /// use source for cuts std::map<TString, method*> method_; TString mIDarr []= {"m1", "m2", "m3", "m4"}; //TString mIDarr []= {"m1", "m2", "m3", "m4","m5","m6","m7","m8"}; std::vector<TString> mID(mIDarr, mIDarr + sizeof(mIDarr)/sizeof(TString)); int mIDNum = mID.size(); std::cout<< "Number of considered methods (i.e. cuts): " << mIDNum << std::endl; /// Constructor for struct method(TString iniFileName, TString iniLegName, int iniLineStyle, int iniLineColor, int iniMarkerStyle, int iniMarkerColor, TString iniDrawOpt, TString iniLepOpt, TString source) // no PUrew method_["m1"] = new method("", "p_{T}(mu)>20, p_{T}(jet)>30", 1, 1, 1, 2, "", "L","tree"); method_["m2"] = new method("", "p_{T}(mu)>30, p_{T}(jet)>30", 1, 2, 1, 2, "same", "L", "tree",cutPtMu); method_["m3"] = new method("", "p_{T}(mu)>20, p_{T}(jet)>35", 1, 3, 1, 2, "same", "L","tree",cutPtJet); method_["m4"] = new method("", "p_{T}(mu)>30, p_{T}(jet)>35", 1, 4, 1, 2, "same", "L","tree",cutPtMuJet); // with PUrew method_["m5"] = new method("", "", 2, 1, 1, 2, "same", "","treeWeight"); method_["m6"] = new method("", "", 2, 2, 1, 2, "same", "", "treeWeight",cutPtMu); method_["m7"] = new method("", "", 2, 3, 1, 2, "same", "","treeWeight",cutPtJet); method_["m8"] = new method("", "", 2, 4, 1, 2, "same", "","treeWeight",cutPtMuJet); // // no PUrew // method_["m1"] = new method("", "no PU reweighting", 1, 1, 1, 2, "", "L","tree"); // method_["m2"] = new method("", "", 1, 2, 1, 2, "same", "", "tree",cutPtMu); // method_["m3"] = new method("", "", 1, 3, 1, 2, "same", "","tree",cutPtJet); // method_["m4"] = new method("", "", 1, 4, 1, 2, "same", "","tree",cutPtMuJet); // // with PUrew // method_["m5"] = new method("", "PU reweighting (first 1 fb^{-1})", 2, 1, 1, 2, "same", "L","treeWeight"); // method_["m6"] = new method("", "", 2, 2, 1, 2, "same", "", "treeWeight",cutPtMu); // method_["m7"] = new method("", "", 2, 3, 1, 2, "same", "","treeWeight",cutPtJet); // method_["m8"] = new method("", "", 2, 4, 1, 2, "same", "","treeWeight",cutPtMuJet); // method_["m1"] = new method("", "no PU reweighting", 1, 1, 1, 2, "", "L","tree","1/NmuPt20_minJet4pt30"); // method_["m2"] = new method("", "PU reweighting (first 1 fb^{-1}", 1, 2, 1, 2, "same", "L", "treeWeight"); // method_["m3"] = new method("", "low PU N_{PV}<10", 1, 3, 1, 2, "same", "L","tree","pv<10"); // method_["m4"] = new method("", "high PU N_{PV}>10", 1, 4, 1, 2, "same", "L","tree","pv>10"); /// draw with the help of efficiency structure // variables to be plotted TString effIDarr[] = {"muPt", "muEta", "jet1Pt", "jet2Pt", "jet3Pt", "jet4Pt", "jet1Eta", "jet2Eta", "jet3Eta", "jet4Eta"}; std::vector<TString> effID(effIDarr, effIDarr + sizeof(effIDarr)/sizeof(TString)); int effIDNum = effID.size(); std::cout<< "Number of considered plots: " << effIDNum << std::endl; /// map with structure that keeps features of histograms std::map<TString, eff*> eff_; /// title for histo, x and y axis (separated by "/") TString title =""; TString title0 ="t#bar{t} Summer11 sample, 10^{6} events"; double yLoEta=0; double yHiEta=12000; // int mBinsPt0 = 60; // int mBinsEta0 = -1; // // double binsPt0[] = { 0., 300. }; // std::vector<double> binsPt0_(binsPt0, binsPt0 + sizeof(binsPt0)/sizeof(double)); // double binsEta0[] = { -2.4,-2.1,-1.65,-1.2,-0.9,-0.45,0.,0.45,0.9,1.2,1.65,2.1,2.4 }; // std::vector<double> binsEta0_(binsEta0, binsEta0 + sizeof(binsEta0)/sizeof(double)); int mBinsPt0 = 240; int mBinsEta0 = 120; double binsPt0[] = { 0., 300. }; std::vector<double> binsPt0_(binsPt0, binsPt0 + sizeof(binsPt0)/sizeof(double)); double binsEta0[] = { -2.4,2.4 }; std::vector<double> binsEta0_(binsEta0, binsEta0 + sizeof(binsEta0)/sizeof(double)); /// Constructor for struct eff(TString iniVar, TCut iniCuts, TString iniBins, TString iniTitles, double iniYLo=-9999., double iniYHi=-9999., double iniXLo=-9999., double iniXHi=-9999.) title = title0+"/ p_{T}(mu) / "; eff_["muPt"] =new eff("tMu.pt", "", mBinsPt0, binsPt0_, title,0,5000); title = title0+"/ #eta(mu) / "; eff_["muEta"] =new eff("tMu.eta", "", mBinsEta0, binsEta0_, title,yLoEta,yHiEta); title = title0+"/ p_{T}(jet 1) / "; eff_["jet1Pt"] =new eff("pt1", "", mBinsPt0, binsPt0_, title,0,3000); title = title0+"/ p_{T}(jet 2) / "; eff_["jet2Pt"] =new eff("pt2", "", mBinsPt0, binsPt0_, title,0,5000); title = title0+"/ p_{T}(jet 3) / "; eff_["jet3Pt"] =new eff("pt3", "", mBinsPt0, binsPt0_, title,0,7000); title = title0+"/ p_{T}(jet 4) / "; eff_["jet4Pt"] =new eff("pt4", "", mBinsPt0, binsPt0_, title,0,13000); title = title0+"/ #eta(jet 1) / "; eff_["jet1Eta"] =new eff("eta1", "", mBinsEta0, binsEta0_, title,yLoEta,yHiEta); title = title0+"/ #eta(jet 2) / "; eff_["jet2Eta"] =new eff("eta2", "", mBinsEta0, binsEta0_, title,yLoEta,yHiEta); title = title0+"/ #eta(jet 3) / "; eff_["jet3Eta"] =new eff("eta3", "", mBinsEta0, binsEta0_, title,yLoEta,yHiEta); title = title0+"/ #eta(jet 4) / "; eff_["jet4Eta"] =new eff("eta4", "", mBinsEta0, binsEta0_, title,yLoEta,yHiEta); /// PU reweightung TString PU; /// --- /// get histos from tree /// --- for(int iMethod=0; iMethod<mIDNum; iMethod++){ for(int iEff=0; iEff<effIDNum; iEff++){ getHisto(eff_[effID[iEff]]->his[mID[iMethod]], eff_[effID[iEff]]->var, tJet, eff_[effID[iEff]]->binMode, eff_[effID[iEff]]->bins, method_[mID[iMethod]]->cuts, method_[mID[iMethod]]->source); setHistoStyle(eff_[effID[iEff]]->his[mID[iMethod]], eff_[effID[iEff]]->titles, method_[mID[iMethod]]->lineStyle, method_[mID[iMethod]]->lineColor, method_[mID[iMethod]]->markerStyle, method_[mID[iMethod]]->markerColor, eff_[effID[iEff]]->yLo, eff_[effID[iEff]]->yHi); } } /// Draw Canvas TCanvas* CanvMu= new TCanvas("CanvMu", "CanvMu", 1280,900); TCanvas* CanvJetPt= new TCanvas("CanvJetPt", "CanvJetPt", 1280,900); TCanvas* CanvJetEta= new TCanvas("CanvJetEta", "CanvJetEta", 1280,900); CanvMu->Divide(2,2); CanvJetPt->Divide(2,2); CanvJetEta->Divide(2,2); CanvMu->cd(1); drawEfficiencies(eff_["muPt"], method_, mID, 0.45,0.6,0.85,0.85); CanvMu->cd(2); drawEfficiencies(eff_["muEta"], method_, mID, 0.45,0.6,0.85,0.85); CanvJetPt->cd(1); drawEfficiencies(eff_["jet1Pt"], method_, mID, 0.45,0.6,0.85,0.85); CanvJetPt->cd(2); drawEfficiencies(eff_["jet2Pt"], method_, mID, 0.45,0.6,0.85,0.85); CanvJetPt->cd(3); drawEfficiencies(eff_["jet3Pt"], method_, mID, 0.45,0.6,0.85,0.85); CanvJetPt->cd(4); drawEfficiencies(eff_["jet4Pt"], method_, mID, 0.45,0.6,0.85,0.85); CanvJetEta->cd(1); drawEfficiencies(eff_["jet1Eta"], method_, mID, 0.45,0.6,0.85,0.85); CanvJetEta->cd(2); drawEfficiencies(eff_["jet2Eta"], method_, mID, 0.45,0.6,0.85,0.85); CanvJetEta->cd(3); drawEfficiencies(eff_["jet3Eta"], method_, mID, 0.45,0.6,0.85,0.85); CanvJetEta->cd(4); drawEfficiencies(eff_["jet4Eta"], method_, mID, 0.45,0.6,0.85,0.85); // make studies of integral for shape uncertainties // load b-jets // TFile* fileBjet= new TFile(inputPath42+"/../semiLeptonic/diffXSection/naf_analyzeBTagEfficiency_cfg_new/analyzeBTagEfficiency.root"); // fileBjet->cd(); // TH1F* hisBjet= (TH1F*) fileBjet->Get("bTagEff/NumBJetsEta")->Clone(); // // double* integral = hisBjet->GetIntegral(); // int binsNum = hisBjet->GetNbinsX(); // // for(int iBin = 0; iBin < binsNum+1; iBin++){ // std::cout<<"Bin=" << iBin << "; binCenter=" << hisBjet->GetBinCenter(iBin) << "; cum. int.=" << integral[iBin] << std::endl; // } TString methodChoice="m2"; TString effChoice="muEta"; double* muIntegral = eff_[effChoice]->his[methodChoice]->GetIntegral(); int muBinsNum = eff_[effChoice]->his[methodChoice]->GetNbinsX(); for(int iBin = 0; iBin < muBinsNum+1; iBin++){ std::cout<<"Bin=" << iBin << "; binCenter=" << eff_[effChoice]->his[methodChoice]->GetBinCenter(iBin) << "; cum. int.=" << muIntegral[iBin] << std::endl; } if(save){ CanvMu->cd(1)->Print(outputFolder+outputFileName+"muPt."+fileFormat); CanvMu->cd(2)->Print(outputFolder+outputFileName+"muEta."+fileFormat); CanvJetPt->Print(outputFolder+outputFileName+"jetPt_overview."+fileFormat); CanvJetEta->Print(outputFolder+outputFileName+"jetEta_overview."+fileFormat); std::cout<<"Canvas with plots is saved in "<<outputFolder<<std::endl; } }