/* * HEADER:100:spread:output:1:write text - spread sheet format into X (WxText enabled) */ int f_spread(ARG1) { unsigned int i; if (mode == -1) { if ((*local = (void *) ffopen(arg1,file_append ? "a" : "w")) == NULL) fatal_error("Could not open %s", arg1); WxText = latlon = decode = 1; } else if (mode == -2) { ffclose((FILE *) *local); } else if (mode >= 0) { if (lat == NULL || lon == NULL || data == NULL) { fprintf(stderr,"no code to determine lat-lon information, no spread sheet output\n"); return 0; } set_mode(0); f_var(call_ARG0(inv_out,NULL)); fprintf((FILE *) *local,"lon,lat,%s",inv_out); f_lev(call_ARG0(inv_out,NULL)); fprintf((FILE *) *local," %s", inv_out); f_t(call_ARG0(inv_out,NULL)); fprintf((FILE *) *local," %s", inv_out); f_ftime(call_ARG0(inv_out,NULL)); fprintf((FILE *) *local," %s\n", inv_out); if (WxNum > 0) { for (i = 0; i < ndata; i++) { if(!UNDEFINED_VAL(data[i])) fprintf((FILE *) *local,"%lf,%lf,\"%s\"\n",lon[i],lat[i],WxLabel(data[i])); } } else { for (i = 0; i < ndata; i++) { if(!UNDEFINED_VAL(data[i])) fprintf((FILE *) *local,"%lf,%lf,%g\n",lon[i],lat[i],data[i]); } } if (flush_mode) fflush((FILE *) *local); inv_out[0] = 0; set_mode(mode); } return 0; }
int f_S(ARG0) { if (mode >= 0) { f_T(CALL_ARG0); strcat(inv_out,item_deliminator); inv_out += strlen(inv_out); f_var(CALL_ARG0); strcat(inv_out,item_deliminator); inv_out += strlen(inv_out); f_lev(CALL_ARG0); strcat(inv_out,item_deliminator); inv_out += strlen(inv_out); f_ftime(CALL_ARG0); strcat(inv_out,item_deliminator); inv_out += strlen(inv_out); f_misc(CALL_ARG0); } return 0; }
int f_V(ARG0) { int oldmode; if (mode == -1) decode = 1; if (mode >= 0) { f_vt(CALL_ARG0); strcat(inv_out,item_deliminator); inv_out += strlen(inv_out); f_lev(CALL_ARG0); strcat(inv_out,item_deliminator); inv_out += strlen(inv_out); f_ftime(CALL_ARG0); strcat(inv_out,item_deliminator); inv_out += strlen(inv_out); oldmode=mode; mode=1; f_var(CALL_ARG0); strcat(inv_out,item_deliminator); inv_out += strlen(inv_out); mode=oldmode; f_ens(CALL_ARG0); strcat(inv_out,"\n "); inv_out += strlen(inv_out); f_stats(CALL_ARG0); strcat(inv_out,"\n "); inv_out += strlen(inv_out); f_grid(CALL_ARG0); strcat(inv_out,"\n"); } return 0; }
void newhistos(int cem = 8, int iPlot = 0){ gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetErrorX(0); gStyle->SetOptStat(0); gStyle->SetPalette(1); gROOT->SetBatch(1); gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); gStyle->SetCanvasDefH(600); gStyle->SetCanvasDefW(600); gStyle->SetLabelFont(18,""); labelcms = new TPaveText(0.12,0.88,0.5,0.94,"NDCBR"); labelcms->SetTextAlign(12); labelcms->SetTextSize(0.045); labelcms->SetFillColor(kWhite); if (cem !=8) labelcms->AddText("CMS Preliminary, #sqrt{s} = 7 TeV"); else labelcms->AddText("CMS Preliminary, #sqrt{s} = 8 TeV"); labelcms->SetBorderSize(0); char myRootFile[300]; if (cem !=8) sprintf(myRootFile,"rootfiles/signal_study_7TeV.root"); else sprintf(myRootFile,"rootfiles/signal_study.root"); TFile *_file0 = TFile::Open(myRootFile); const int nProcess = 4; TString processName[nProcess] = { "wz", "www", "fakes","zz"}; TString processTitle[nProcess] = { "WZ", "tri-boson", "fakes", "ZZ"}; Color_t color[nProcess] = { kBlue+2, kBlue-9, kGray, kGray+2}; const int nPlots = 17; TString cutLabel[nPlots] = { "mH_2d", "dphiljj", "dphilmjj", "met", "mllz", "mt", "ptjet", "mjj", "dRll", "tmet", "minmet", "njets", "minmll", "id", "mlll", "mH", "njets"}; int rebinHisto[nPlots] = { 20, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, 1, 10, 1, 10, 10, 1}; TString cutTitle[nPlots] = { "Reconstructed mass m_{H}", "#Delta#Phi_{jjl}", "#Delta#Phi_{jjlMET}", "MET", "m_{ll} Z", "m_{T}", "P_{T} of the leading jet", "m_{jj}", "#DeltaR_{ll}", "tracker MET", "min(MET, tracker MET)", "# of jets", "|m_{jj} - m{Z}|", "lepton content", "m_{lll}", "Reconstructed mass m_{H}", "Number of jets" }; TString cm[2] = {"8TeV", "7TeV"}; TFile f_var("rootfiles/ZH_histos_" + cm[8 - cem] + ".root", "RECREATE"); TH1D* h [nPlots][nProcess]; TH1D* h0 [nPlots]; TH1D* h1 [nPlots]; THStack* hStack[nPlots]; h0[iPlot] = (TH1D*) _file0->Get("sig_" + cutLabel[iPlot]); // h0[iPlot]->SetLineColor(kMagenta-4); //h0[iPlot]->SetLineWidth(2); h0[iPlot]->Rebin(rebinHisto[iPlot]); for (int iProcess = 0; iProcess < nProcess; iProcess++){ h[iPlot][iProcess] = (TH1D*) _file0->Get("bck_" + cutLabel[iPlot]+ "_" + processName[iProcess]); h[iPlot][iProcess]->Rebin(rebinHisto[iPlot]); // h[iPlot][iProcess]->SetFillColor(color[iProcess]); // h[iPlot][iProcess]->SetLineColor(kBlack); // h[iPlot][iProcess]->SetLineWidth(1); } hStack[iPlot] = new THStack(cutLabel[iPlot],cutLabel[iPlot]); for (int iProcess = nProcess-1; iProcess > -1; iProcess--){ hStack[iPlot]->Add(h[iPlot][iProcess]); } h1[iPlot] = (TH1D*) _file0->Get("data_" + cutLabel[iPlot]); h1[iPlot]->Rebin(rebinHisto[iPlot]); //h1[iPlot]->SetMarkerStyle(20); //h1[iPlot]->SetMarkerSize(1.2); //h1[iPlot]->SetLineWidth(1); //h1[iPlot]->SetMarkerColor(kBlack); //h1[iPlot]->SetLineColor(kBlack); TH1F* histo2 = h[iPlot][3]->Clone(); //ZZ histo2->SetName("ZZ"); TH1F* histo3 = h[iPlot][0]->Clone(); //WZ histo3->Add(h[iPlot][1]); // VVV histo3->SetName("WZ"); TH1F* histo4 = h[iPlot][2]->Clone(); //fakes histo4->SetName("fakes"); TH1F* histo5 = h1[iPlot]->Clone(); //data histo5->SetName("Data"); TH1F* histos = h0[iPlot]->Clone(); //signal histos->SetName("VH"); f_var.Write(); f_var.Close(); }
void looper::myLoop(int nsel, int mode, bool silent) { char plotName[300]; sprintf(plotName,"test"); if (nsel == 0) {sprintf(plotName,"tt");} else if (nsel == 1) {sprintf(plotName,"twdr");} else if (nsel == -1) {sprintf(plotName,"twds");} else if (nsel == 2) {sprintf(plotName,"zjets");} else if (nsel == 3) {sprintf(plotName,"di");} else if (nsel == 4) {sprintf(plotName, "st");} else if (nsel == 5) {sprintf(plotName,"wjets");} else if (nsel == 6) {sprintf(plotName,"qcd_mu");} else if (nsel == 7) {sprintf(plotName,"others");} else if (nsel == 555) {sprintf(plotName,"mc");} else if (nsel == 666) {sprintf(plotName,"data");} bool nosf = false; char newRootFile[300]; double lumi = luminosity; if (mode == 0 ) lumi = 11966.617; else if ( mode == 1) lumi = 12067.294; else if ( mode == 2) lumi = 12093.792; sprintf(newRootFile,"results/an_%dpb_%d.root", (int)lumi, mode); TFile f_var(newRootFile, "UPDATE"); if(!silent){ std::cout << "[Info:] results root file " << newRootFile << std::endl; } ////////// char title[300]; sprintf(title,"cuts_%s",plotName); TH1F* histo = new TH1F( title, " ", 10, 0, 10 ); histo->Sumw2(); sprintf(title,"met_high_%s",plotName); TH1F* histo_met_high = new TH1F( title, " ", 100, 0, 200 ); histo_met_high->Sumw2(); sprintf(title,"met_low_%s",plotName); TH1F* histo_met_low = new TH1F( title, " ", 100, 0, 200 ); histo_met_low->Sumw2(); sprintf(title,"promet_%s",plotName); TH1F* histo_promet = new TH1F( title, " ", 100, 0, 200 ); histo_promet->Sumw2(); sprintf(title,"met_cut_%s",plotName); TH1F* histo_met_cut = new TH1F( title, " ", 100, 0, 200 ); histo_met_cut->Sumw2(); sprintf(title,"met_bt_%s",plotName); TH1F* histo_met_bt = new TH1F( title, " ", 100, 0, 200 ); histo_met_bt->Sumw2(); sprintf(title,"mll_after_%s",plotName); TH1F* histo_mll_after = new TH1F( title, " ", 100, 0, 200 ); histo_mll_after->Sumw2(); sprintf(title,"njets_cut_%s",plotName); TH1F* histo_njets_cut = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njets_cut->Sumw2(); sprintf(title,"njetsbt_cut_%s",plotName); TH1F* histo_njetsbt_cut = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njetsbt_cut->Sumw2(); sprintf(title,"njetsbt_high_%s",plotName); TH1F* histo_njetsbt_high = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njetsbt_high->Sumw2(); sprintf(title,"njetsbt_low_%s",plotName); TH1F* histo_njetsbt_low = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njetsbt_low->Sumw2(); sprintf(title,"njets_high_%s",plotName); TH1F* histo_njets_high = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njets_high->Sumw2(); sprintf(title,"njets_low_%s",plotName); TH1F* histo_njets_low = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njets_low->Sumw2(); sprintf(title,"ptsys_high_%s",plotName); TH1F* histo_ptsys_high = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_high->Sumw2(); sprintf(title,"ptsys_low_%s",plotName); TH1F* histo_ptsys_low = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_low->Sumw2(); sprintf(title,"ht_high_%s",plotName); TH1F* histo_ht_high = new TH1F( title, " ", 300, 0, 600 ); histo_ht_high->Sumw2(); sprintf(title,"ht_low_%s",plotName); TH1F* histo_ht_low = new TH1F( title, " ", 300, 0, 600 ); histo_ht_low->Sumw2(); sprintf(title,"ht_cut_%s",plotName); TH1F* histo_ht_cut = new TH1F( title, " ", 300, 0, 600 ); histo_ht_cut->Sumw2(); sprintf(title,"pt_max_%s",plotName); TH1F* histo_pt_max = new TH1F( title, " ", 100, 0, 200 ); histo_pt_max->Sumw2(); sprintf(title,"pt_min_%s",plotName); TH1F* histo_pt_min = new TH1F( title, " ", 100, 0, 200 ); histo_pt_min->Sumw2(); sprintf(title,"btagHE_%s",plotName); TH2F* histo_btagHE = new TH2F( title, " ", 300, -200, 100, 100, -2, 7); histo_btagHE->Sumw2(); sprintf(title,"btagHP_%s",plotName); TH2F* histo_btagHP = new TH2F( title, " ", 300, -200, 100, 100, -2, 7); histo_btagHP->Sumw2(); sprintf(title,"etalepton_%s",plotName); TH1F* histo_etalepton = new TH1F( title, " ", 101, -3, 3); histo_etalepton->Sumw2(); sprintf(title,"ht_bf_%s",plotName); TH1F* histo_ht_bf = new TH1F( title, " ", 300, 0, 600 ); histo_ht_bf->Sumw2(); sprintf(title,"ptsys_bf_%s",plotName); TH1F* histo_ptsys_bf = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_bf->Sumw2(); sprintf(title,"npu_%s",plotName); TH1F* histo_npu = new TH1F( title, " ", 30, -0.5, 29.5 ); histo_npu->Sumw2(); /// Classic plotmaker plots sprintf(title,"met_%s",plotName); TH1F* histo_met = new TH1F( title, " ", 100, 0, 200 ); histo_met->Sumw2(); sprintf(title,"mll_%s",plotName); TH1F* histo_mll = new TH1F( title, " ", 100, 0, 200 ); histo_mll->Sumw2(); sprintf(title,"njets_%s",plotName); TH1F* histo_njets = new TH1F( title, " ", 10, 0, 10 ); histo_njets->Sumw2(); sprintf(title,"njetsbt_%s",plotName); TH1F* histo_njetsbt = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njetsbt->Sumw2(); sprintf(title,"ptsys_%s",plotName); TH1F* histo_ptsys = new TH1F( title, " ", 200, 0, 200 ); histo_ptsys->Sumw2(); sprintf(title,"ht_%s",plotName); TH1F* histo_ht = new TH1F( title, " ", 300, 0, 600 ); histo_ht->Sumw2(); sprintf(title,"pt_leading_%s",plotName); TH1F* histo_pt_leading = new TH1F( title, " ", 100, 0, 200 ); histo_pt_leading->Sumw2(); sprintf(title,"nvertex_%s",plotName); TH1F* histo_nvertex = new TH1F( title, " ", 70, -0.5, 69.5 ); histo_nvertex->Sumw2(); sprintf(title,"nloosejets_%s",plotName); TH1F* histo_nloosejets = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_nloosejets->Sumw2(); sprintf(title,"nloosejets_bt_%s",plotName); TH1F* histo_nloosejets_bt = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_nloosejets_bt->Sumw2(); // 1 jet level /// Classic plotmaker plots sprintf(title,"met_1j_%s",plotName); TH1F* histo_met_1j = new TH1F( title, " ", 100, 0, 200 ); histo_met_1j->Sumw2(); sprintf(title,"mll_1j_%s",plotName); TH1F* histo_mll_1j = new TH1F( title, " ", 100, 0, 200 ); histo_mll_1j->Sumw2(); sprintf(title,"ptsys_1j_%s",plotName); TH1F* histo_ptsys_1j = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_1j->Sumw2(); sprintf(title,"ht_1j_%s",plotName); TH1F* histo_ht_1j = new TH1F( title, " ", 300, 0, 600 ); histo_ht_1j->Sumw2(); sprintf(title,"pt_leading_1j_%s",plotName); TH1F* histo_pt_leading_1j = new TH1F( title, " ", 100, 0, 200 ); histo_pt_leading_1j->Sumw2(); sprintf(title,"nvertex_1j_%s",plotName); TH1F* histo_nvertex_1j = new TH1F( title, " ", 30, -0.5, 29.5 ); histo_nvertex_1j->Sumw2(); // 1 jet level /// Classic plotmaker plots sprintf(title,"met_1j1t_%s",plotName); TH1F* histo_met_1j1t = new TH1F( title, " ", 100, 0, 200 ); histo_met_1j1t->Sumw2(); sprintf(title,"mll_1j1t_%s",plotName); TH1F* histo_mll_1j1t = new TH1F( title, " ", 100, 0, 200 ); histo_mll_1j1t->Sumw2(); sprintf(title,"ptsys_1j1t_%s",plotName); TH1F* histo_ptsys_1j1t = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_1j1t->Sumw2(); sprintf(title,"ht_1j1t_%s",plotName); TH1F* histo_ht_1j1t = new TH1F( title, " ", 200, 0, 200 ); histo_ht_1j1t->Sumw2(); sprintf(title,"pt_leading_1j1t_%s",plotName); TH1F* histo_pt_leading_1j1t = new TH1F( title, " ", 100, 0, 200 ); histo_pt_leading_1j1t->Sumw2(); sprintf(title,"nvertex_1j1t_%s",plotName); TH1F* histo_nvertex_1j1t = new TH1F( title, " ", 30, -0.5, 29.5 ); histo_nvertex_1j1t->Sumw2(); // 2j1t /// Classic plotmaker plots sprintf(title,"met_2j1t_%s",plotName); TH1F* histo_met_2j1t = new TH1F( title, " ", 100, 0, 200 ); histo_met_2j1t->Sumw2(); sprintf(title,"mll_2j1t_%s",plotName); TH1F* histo_mll_2j1t = new TH1F( title, " ", 100, 0, 200 ); histo_mll_2j1t->Sumw2(); sprintf(title,"ptsys_2j1t_%s",plotName); TH1F* histo_ptsys_2j1t = new TH1F( title, " ", 200, 0, 200 ); histo_ptsys_2j1t->Sumw2(); sprintf(title,"ht_2j1t_%s",plotName); TH1F* histo_ht_2j1t = new TH1F( title, " ", 300, 0, 600 ); histo_ht_2j1t->Sumw2(); sprintf(title,"pt_leading_2j1t_%s",plotName); TH1F* histo_pt_leading_2j1t = new TH1F( title, " ", 100, 0, 200 ); histo_pt_leading_2j1t->Sumw2(); sprintf(title,"nvertex_2j1t_%s",plotName); TH1F* histo_nvertex_2j1t = new TH1F( title, " ", 30, -0.5, 29.5 ); histo_nvertex_2j1t->Sumw2(); // 2j2t /// Classic plotmaker plots sprintf(title,"met_2j2t_%s",plotName); TH1F* histo_met_2j2t = new TH1F( title, " ", 100, 0, 200 ); histo_met_2j2t->Sumw2(); sprintf(title,"mll_2j2t_%s",plotName); TH1F* histo_mll_2j2t = new TH1F( title, " ", 100, 0, 200 ); histo_mll_2j2t->Sumw2(); sprintf(title,"ptsys_2j2t_%s",plotName); TH1F* histo_ptsys_2j2t = new TH1F( title, " ", 300, 0, 600 ); histo_ptsys_2j2t->Sumw2(); sprintf(title,"ht_2j2t_%s",plotName); TH1F* histo_ht_2j2t = new TH1F( title, " ", 300, 0, 600 ); histo_ht_2j2t->Sumw2(); sprintf(title,"pt_leading_2j2t_%s",plotName); TH1F* histo_pt_leading_2j2t = new TH1F( title, " ", 100, 0, 200 ); histo_pt_leading_2j2t->Sumw2(); sprintf(title,"nvertex_2j2t_%s",plotName); TH1F* histo_nvertex_2j2t = new TH1F( title, " ", 30, -0.5, 29.5 ); histo_nvertex_2j2t->Sumw2(); // all regions sprintf(title,"R_%s",plotName); TH1F* histo_R = new TH1F( title, " ", 40, 0, 40 ); histo_R->Sumw2(); sprintf(title,"nvertex_2lep_%s",plotName); TH1F* histo_nvertex_2lep = new TH1F( title, " ", 70, -0.5, 69.5 ); histo_nvertex_2lep->Sumw2(); // Test jets sprintf(title,"ht_2j1t_leading_%s",plotName); TH1F* histo_ht_2j1t_leading = new TH1F( title, " ", 300, 0, 600 ); histo_ht_2j1t_leading->Sumw2(); sprintf(title,"ht_2j1t_all_%s",plotName); TH1F* histo_ht_2j1t_all = new TH1F( title, " ", 300, 0, 600 ); histo_ht_2j1t_all->Sumw2(); sprintf(title,"ht_2j2t_leading_%s",plotName); TH1F* histo_ht_2j2t_leading = new TH1F( title, " ", 300, 0, 600 ); histo_ht_2j1t_leading->Sumw2(); sprintf(title,"ht_2j2t_all_%s",plotName); TH1F* histo_ht_2j2t_all = new TH1F( title, " ", 300, 0, 600 ); histo_ht_2j2t_all->Sumw2(); sprintf(title,"ptsys_2j1t_leading_%s",plotName); TH1F* histo_ptsys_2j1t_leading = new TH1F( title, " ", 200, 0, 200 ); histo_ptsys_2j1t_leading->Sumw2(); sprintf(title,"ptsys_2j1t_all_%s",plotName); TH1F* histo_ptsys_2j1t_all = new TH1F( title, " ", 200, 0, 200 ); histo_ptsys_2j1t_all->Sumw2(); sprintf(title,"ptsys_2j2t_leading_%s",plotName); TH1F* histo_ptsys_2j2t_leading = new TH1F( title, " ", 200, 0, 200 ); histo_ptsys_2j1t_leading->Sumw2(); sprintf(title,"ptsys_2j2t_all_%s",plotName); TH1F* histo_ptsys_2j2t_all = new TH1F( title, " ", 200, 0, 200 ); histo_ptsys_2j2t_all->Sumw2(); if (fChain == 0) return; Long64_t nentries = fChain->GetEntriesFast(); Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentry<nentries;jentry++) { Long64_t ientry = LoadTree(jentry); if (ientry < 0) break; nb = fChain->GetEntry(jentry); nbytes += nb; if (lumi != lum && nsel != 666 && mode !=3){ if (jentry == 0)std::cout << "[Warning:] This tree was made with a different luminosity (" << lum << ") than " << lumi << std::endl; //xlWeight*=(lumi/lum); } if(ptLepton->size() != 2){ std::cout << "[Warning:] Something is wrong, your Tree is not correctly filled" << std::endl; break; } else { histo->Fill(0.,xlWeight); histo_nvertex_2lep->Fill(nvertex,xlWeight); TLorentzVector lepton0(pxLepton->at(0),pyLepton->at(0), pzLepton->at(0), eLepton->at(0)); TLorentzVector lepton1(pxLepton->at(1),pyLepton->at(1), pzLepton->at(1), eLepton->at(1)); TLorentzVector pair = lepton0+lepton1; //if (ptLepton->at(0) < 40 && ptLepton->at(1) < 40) continue; if(ptLepton->at(0) < 30 || ptLepton->at(1) < 30)continue; double phipairmet_t = 0; double pi_m = 3.1416/2; phipairmet_t = pi_m; TVector3 vmet(metPx, metPy, 0); double promet = metPt*sin(phipairmet_t); TVector3 m0(pxLepton->at(0),pyLepton->at(0), pzLepton->at(0)); TVector3 m1(pxLepton->at(1),pyLepton->at(1), pzLepton->at(1)); if (fabs(m0.DeltaPhi(vmet)) < phipairmet_t) phipairmet_t = fabs(m0.DeltaPhi(vmet)); if (fabs(m1.DeltaPhi(vmet)) < phipairmet_t) phipairmet_t = fabs(m1.DeltaPhi(vmet)); if (phipairmet_t == pi_m) promet = metPt; if (pair.M() > 20){ histo->Fill(1, xlWeight); double SFval, SFerror; if ( nsel == 666 || nosf){ SFval = 1; SFerror = 0; } else if (nsel == 0){ SFval = 0.95; SFerror = 0.03; } else { SFval = 0.97; SFerror = 0.03; } int nJetsBT = 0; int nTightJetsBT = 0; int nJets = 0; bool bTagged = false; int iJet = -5; int iSF; double tempSF = SFval; int iLead = -5; int SFvalue = int(tempSF*100); int nloose = 0; int nloosebt = 0; for (unsigned int i =0; i < ptJet->size(); i ++){ TLorentzVector tempJet(pxJet->at(i),pyJet->at(i), pzJet->at(i), eJet->at(i)); if (ptJet->at(i) > 30 && fabs(tempJet.Eta()) < 2.5 && TMath::Min(fabs(lepton0.DeltaR(tempJet)), fabs(lepton1.DeltaR(tempJet))) > 0.3) { nJets++; iJet = i; if (iLead == -5) iLead = iJet; if (btCSVBJet->at(i) > 0.679){ iSF = rand() % 100; if (iSF < SFvalue ){ bTagged = true; nJetsBT++; nTightJetsBT++; } } } else if (btCSVBJet->at(i) > 0.679 && fabs(tempJet.Eta()) < 2.5){ iSF = rand() % 100; if (iSF < SFvalue ){ nJetsBT++; nloosebt++;} } if (ptJet->at(i) <= 30 || fabs(tempJet.Eta()) >= 2.5) nloose++; } histo_nloosejets->Fill(nloose, xlWeight); histo_nloosejets_bt->Fill(nloosebt, xlWeight); histo_pt_max->Fill(TMath::Max(lepton0.Pt(), lepton1.Pt()), xlWeight); histo_pt_min->Fill(TMath::Min(lepton0.Pt(), lepton1.Pt()), xlWeight); histo_njets->Fill(nJets, xlWeight); histo_njetsbt->Fill(nJetsBT, xlWeight); histo_mll->Fill(pair.M(), xlWeight); histo_met->Fill(metPt, xlWeight); histo_promet->Fill(promet, xlWeight); if (nvertex > 5){ histo_met_high->Fill(metPt, xlWeight); histo_njets_high->Fill(nJets, xlWeight); histo_njetsbt_high->Fill(nJetsBT, xlWeight); } else { histo_met_low->Fill(metPt, xlWeight); histo_njets_low->Fill(nJets, xlWeight); histo_njetsbt_low->Fill(nJetsBT, xlWeight); } if (nJets) histo_pt_leading->Fill(ptJet->at(0), xlWeight); if (nJets == 1){ histo_etalepton->Fill(lepton0.Eta(), xlWeight); TLorentzVector jet(pxJet->at(iJet),pyJet->at(iJet), pzJet->at(iJet), eJet->at(iJet)); double ptSysPx1 = lepton0.Px() + lepton1.Px() + jet.Px() + metPx; double ptSysPy1 = lepton0.Py() + lepton1.Py() + jet.Py() + metPy; double ptSystem1 = sqrt(ptSysPx1*ptSysPx1 + ptSysPy1*ptSysPy1); double ht1 = lepton0.Pt() + lepton1.Pt() + jet.Pt() + metPt; histo_ptsys_bf->Fill(ptSystem1, xlWeight); histo_ht_bf->Fill(ht1, xlWeight); } bool invMass = false; if (mode == 0) invMass = true; else if (mode == 1 && (pair.M() > invMax || pair.M() < invMin)) invMass = true; else if (mode == 2 && (pair.M() > invMax || pair.M() < invMin)) invMass = true; if (invMass){ histo->Fill(2, xlWeight); histo_mll_after->Fill(pair.M(), xlWeight); histo_met_cut->Fill(metPt, xlWeight); if (metPt >= metCut || mode ==0){ histo->Fill(3, xlWeight); histo_njets_cut->Fill(nJets, xlWeight); if (nJets == 1){ histo->Fill(4, xlWeight); histo_njetsbt_cut->Fill(nJetsBT, xlWeight); TLorentzVector jet(pxJet->at(iJet),pyJet->at(iJet), pzJet->at(iJet), eJet->at(iJet)); double ptSysPx = lepton0.Px() + lepton1.Px() + jet.Px() + metPx; double ptSysPy = lepton0.Py() + lepton1.Py() + jet.Py() + metPy; double ptSystem = sqrt(ptSysPx*ptSysPx + ptSysPy*ptSysPy); double ht = lepton0.Pt() + lepton1.Pt() + jet.Pt() + metPt; histo_mll_1j->Fill(pair.M(), xlWeight); histo_met_1j->Fill(metPt, xlWeight); histo_ptsys_1j->Fill(ptSystem, xlWeight); histo_ht_1j->Fill(ht, xlWeight); histo_pt_leading_1j->Fill(jet.Pt(), xlWeight); if (nJets == 1 && nTightJetsBT == 1 && bTagged && nJetsBT == 1){ histo->Fill(5, xlWeight); histo_mll_1j1t->Fill(pair.M(), xlWeight); histo_met_1j1t->Fill(metPt, xlWeight); histo_ptsys_1j1t->Fill(ptSystem, xlWeight); histo_ht_1j1t->Fill(ht, xlWeight); histo_pt_leading_1j1t->Fill(jet.Pt(), xlWeight); histo_ptsys->Fill(ptSystem, xlWeight); histo_ht->Fill(ht, xlWeight); histo_met_bt->Fill(metPt, xlWeight); histo_nvertex->Fill(nvertex, xlWeight); histo_npu->Fill(npu, xlWeight); if (nvertex > 5) { histo_ptsys_high->Fill(ptSystem, xlWeight); histo_ht_high->Fill(ht, xlWeight); } else { histo_ptsys_low->Fill(ptSystem, xlWeight); histo_ht_low->Fill(ht, xlWeight); } if (ht > htMin || mode !=0){ histo->Fill(6, xlWeight); histo_ht_cut->Fill(ht, xlWeight); } } } } //Filling of all region from here if (metPt >= metCut || mode ==0){ if (nJets != 0){ TLorentzVector jet(pxJet->at(iJet),pyJet->at(iJet), pzJet->at(iJet), eJet->at(iJet)); double ptSysPx = lepton0.Px() + lepton1.Px() + jet.Px() + metPx; double ptSysPy = lepton0.Py() + lepton1.Py() + jet.Py() + metPy; double ptSystem = sqrt(ptSysPx*ptSysPx + ptSysPy*ptSysPy); double ht = lepton0.Pt() + lepton1.Pt() + jet.Pt() + metPt; if (nJets == 2 && nTightJetsBT == 1 && nJetsBT == 1) { histo_mll_2j1t->Fill(pair.M(), xlWeight); histo_met_2j1t->Fill(metPt, xlWeight); histo_ptsys_2j1t->Fill(ptSystem, xlWeight); histo_ht_2j1t->Fill(ht, xlWeight); histo_pt_leading_2j1t->Fill(jet.Pt(), xlWeight); TLorentzVector jet2(pxJet->at(iLead),pyJet->at(iLead), pzJet->at(iLead), eJet->at(iLead)); double htled = lepton0.Pt() + lepton1.Pt() + jet2.Pt() + metPt; histo_ht_2j1t_leading->Fill(htled, xlWeight); double htall = lepton0.Pt() + lepton1.Pt() + jet.Pt() + jet2.Pt() + metPt; histo_ht_2j1t_all->Fill(htall, xlWeight); double ptSysPxled = lepton0.Px() + lepton1.Px() + jet2.Px() + metPx; double ptSysPyled = lepton0.Py() + lepton1.Py() + jet2.Py() + metPy; double ptSystemled = sqrt(ptSysPxled*ptSysPxled + ptSysPyled*ptSysPyled); histo_ptsys_2j1t_leading->Fill(ptSystemled, xlWeight); double ptSysPxall = lepton0.Px() + lepton1.Px() + jet.Px() + jet2.Px() + metPx; double ptSysPyall = lepton0.Py() + lepton1.Py() + jet.Py() + jet2.Py() + metPy; double ptSystemall = sqrt(ptSysPxall*ptSysPxall + ptSysPyall*ptSysPyall); histo_ptsys_2j1t_all->Fill(ptSystemall, xlWeight); } else if (nJets == 2 && nTightJetsBT == 2 && nJetsBT == 2) { histo_mll_2j2t->Fill(pair.M(), xlWeight); histo_met_2j2t->Fill(metPt, xlWeight); histo_ptsys_2j2t->Fill(ptSystem, xlWeight); histo_ht_2j2t->Fill(ht, xlWeight); histo_pt_leading_2j2t->Fill(jet.Pt(), xlWeight); TLorentzVector jet2(pxJet->at(iLead),pyJet->at(iLead), pzJet->at(iLead), eJet->at(iLead)); double htled = lepton0.Pt() + lepton1.Pt() + jet2.Pt() + metPt; histo_ht_2j2t_leading->Fill(htled, xlWeight); double htall = lepton0.Pt() + lepton1.Pt() + jet.Pt() + jet2.Pt() + metPt; histo_ht_2j2t_all->Fill(htall, xlWeight); double ptSysPxled = lepton0.Px() + lepton1.Px() + jet2.Px() + metPx; double ptSysPyled = lepton0.Py() + lepton1.Py() + jet2.Py() + metPy; double ptSystemled = sqrt(ptSysPxled*ptSysPxled + ptSysPyled*ptSysPyled); histo_ptsys_2j2t_leading->Fill(ptSystemled, xlWeight); double ptSysPxall = lepton0.Px() + lepton1.Px() + jet.Px() + jet2.Px() + metPx; double ptSysPyall = lepton0.Py() + lepton1.Py() + jet.Py() + jet2.Py() + metPy; double ptSystemall = sqrt(ptSysPxall*ptSysPxall + ptSysPyall*ptSysPyall); histo_ptsys_2j2t_all->Fill(ptSystemall, xlWeight); } //All possible regions if (nJets == 1 && nTightJetsBT == 1 && bTagged && nJetsBT == 1 && ptSystem <= ptsysCut && (ht > htMin || mode !=0))histo_R->Fill(1, xlWeight); //signal if (nJets == 1 && nTightJetsBT == 2) histo_R->Fill(2, xlWeight); if (nJets == 1 && nTightJetsBT > 0) histo_R->Fill(3, xlWeight); if (nJets == 1 && nTightJetsBT > 1) histo_R->Fill(4, xlWeight); if (nJets == 2 && nTightJetsBT == 0) histo_R->Fill(5, xlWeight); if (nJets == 2 && nTightJetsBT == 1) histo_R->Fill(6, xlWeight); //CR1 no ht no ptsys if (nJets == 2 && nTightJetsBT == 2) histo_R->Fill(7, xlWeight); //CR2 no ht no ptsys if (nJets == 2 && nTightJetsBT > 0) histo_R->Fill(8, xlWeight); if (nJets == 2 && nTightJetsBT > 1) histo_R->Fill(9, xlWeight); if (nJets > 1 && nTightJetsBT == 0) histo_R->Fill(10, xlWeight); if (nJets > 1 && nTightJetsBT == 1) histo_R->Fill(11, xlWeight); if (nJets > 1 && nTightJetsBT == 2) histo_R->Fill(12, xlWeight); if (nJets > 1 && nTightJetsBT !=0 ) histo_R->Fill(13, xlWeight); if (nJets > 1 && nTightJetsBT > 1 ) histo_R->Fill(14, xlWeight); if (nJets == 3 && nTightJetsBT ==3 ) histo_R->Fill(15, xlWeight); if (nJets == 1 && nTightJetsBT ==1 && bTagged && nJetsBT == 1) histo_R->Fill(16, xlWeight); if (nJets == 2 && nTightJetsBT == 1 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(17, xlWeight); //CR 1 regular if (nJets == 2 && nTightJetsBT == 2 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(18, xlWeight); //CR 2 regular if (nJets == 2 && nTightJetsBT == 1 && nJetsBT == 1 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(19, xlWeight); if (nJets == 2 && nTightJetsBT == 2 && nJetsBT == 2 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(20, xlWeight); if (nJets == 2 && nJetsBT == 1 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(21, xlWeight); //CR 1 another way if (nJets == 2 && nJetsBT == 2 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(22, xlWeight); //CR 2 another way if (nJets == 2 && nTightJetsBT == 1 && nJetsBT == 1) histo_R->Fill(23, xlWeight); //CR1 no ht no ptsys tighter if (nJets == 2 && nTightJetsBT == 2 && nJetsBT == 2) histo_R->Fill(24, xlWeight); //CR2 no ht no ptsys tighter if (nJets == 2 && nJetsBT == 1) histo_R->Fill(25, xlWeight); //CR1 no ht no ptsys another flavor if (nJets == 2 && nJetsBT == 2) histo_R->Fill(26, xlWeight); //CR2 no ht no ptsys another flavor if (nJets == 1 && nTightJetsBT == 1 && bTagged && nJetsBT == 1 && (ht > htMin || mode !=0))histo_R->Fill(27, xlWeight); //signal no ptsys if (nJets == 1 && nTightJetsBT == 1 && bTagged && nJetsBT == 1 && ptSystem <= ptsysCut)histo_R->Fill(28, xlWeight); //signal no ht if (nJets == 2 && nTightJetsBT == 1 && (ht > htMin || mode !=0)) histo_R->Fill(29, xlWeight); //CR 1 if (nJets == 2 && nTightJetsBT == 2 && (ht > htMin || mode !=0)) histo_R->Fill(30, xlWeight); //CR 2 } //jets in the event } //all CR } // mll } //mll pre } // 2 leptons }// event loop. if (!silent){ cout << "------------------------------------------" << endl; cout << "[Results:] " << plotName << endl; cout << "------------------------------------------" << endl; for (int i = 2; i < 9; i++){ if (i == 2) cout << " leptons: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; if (i == 3) cout << " inv. mass: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; if (i == 4) cout << " met: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; if (i == 5) cout << " jet: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; if (i == 6) cout << " jet_bt: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; if (i == 7) cout << " ht: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; } cout << "------------------------------------------" << endl; } f_var.Write(); f_var.Close(); }
int main() { cv::FileStorage fs("config.yml", cv::FileStorage::READ); std::string folder_name = static_cast<std::string>(fs["folder_name"]); double c = static_cast<double>(fs["f_edge_scale"]); std::cout << c << " a" << folder_name << std::endl; std::stringstream stream_result; stream_result << folder_name << "/result.csv"; std::string fileName_result = stream_result.str(); std::ofstream ofs( fileName_result ); ofs << "thita" << "," << "fay" << "," << "f_edge" << "," << "f_grad" << "," << "f_var" << "," << "f_mean" << "," << "f_hist" << "," << "f_dir" << "," << "f_Q" << std::endl; std::vector< std::vector <double> > f_e_all, f_g_all, f_v_all, f_m_all, f_h_all, f_q_all; double min[6] = {1000000,1000000,1000000,1000000,1000000,1000000}; double max[6]= {-1000000,-1000000,-1000000,-1000000,-1000000,-1000000}; std::cout << "|----------|" << std::endl; std::cout << " "; for(int i = 0; i <= 9; ++i ) { std::vector<double> f_e_tmp, f_g_tmp, f_v_tmp, f_m_tmp, f_h_tmp, f_q_tmp; std::cout << "+"; for(int j = 0; j < 36; ++j) { if(j!=0 && i==0) break; std::stringstream stream; stream << folder_name << "/" << "sita" << i*10 << "fay" << j*10 << ".png"; std::string fileName = stream.str(); std::stringstream stream_pim; stream_pim << folder_name << "/PIM.bmp"; std::string fileName_pim = stream_pim.str(); cv::Mat raw_img = cv::imread(fileName,0); cv::Mat PIM = cv::imread(fileName_pim,0); double f_e = f_edge(raw_img, PIM); double f_g = f_grad(raw_img, PIM); double f_v = f_var(raw_img, PIM); double f_m = f_mean(raw_img, PIM); double f_h = f_hist(raw_img, PIM); double f_d = f_dir(raw_img, PIM); double f_q = f_Q( f_g, f_e, f_v, f_m, f_h,f_d); f_e_tmp.push_back(f_e); f_g_tmp.push_back(f_g); f_v_tmp.push_back(f_v); f_m_tmp.push_back(f_m); f_h_tmp.push_back(f_h); f_q_tmp.push_back(f_q); if(min[0] > f_e) min[0] = f_e; if(min[1] > f_g) min[1] = f_g; if(min[2] > f_v) min[2] = f_v; if(min[3] > f_m) min[3] = f_m; if(min[4] > f_h) min[4] = f_h; if(min[5] > f_q) min[5] = f_q; if(max[0] < f_e) max[0] = f_e; if(max[1] < f_g) max[1] = f_g; if(max[2] < f_v) max[2] = f_v; if(max[3] < f_m) max[3] = f_m; if(max[4] < f_h) max[4] = f_h; if(max[5] < f_q) max[5] = f_q; ofs << i*10 << "," << j*10 << "," << f_e << ","<< f_g << "," << f_v << ","<< f_m << "," << f_h << "," << f_d << ","<< f_q << std::endl; } f_e_all.push_back(f_e_tmp); f_g_all.push_back(f_g_tmp); f_v_all.push_back(f_v_tmp); f_m_all.push_back(f_m_tmp); f_h_all.push_back(f_h_tmp); f_q_all.push_back(f_q_tmp); } std::cout << std::endl; std::vector<cv::Mat> results; for(int k = 0; k < 6; ++k) { results.push_back(cv::Mat::zeros(600, 600, CV_8UC3)); int angle = 270; cv::ellipse(results[k], cv::Point(300, 300), cv::Size(250, 250), angle, angle, angle+360, cv::Scalar(255,255,255), 3, CV_AA); for( int i = 9; i >= 0; --i ) { for( int j = 35; j >= 0; --j ) { double color = 0.0; /*if (k == 0) color = f_e_all[i][j] == 0 ? 0 : 255 - (255 * (max[k] - f_e_all[i][j]) / (max[k] - min[k])); else if (k == 1) color = f_g_all[i][j] == 0 ? 0 : 255 - (255 * (max[k] - f_g_all[i][j]) / (max[k] - min[k])); else if (k == 2) color = f_v_all[i][j] == 0 ? 0 : 255 - (255 * (max[k] - f_v_all[i][j]) / (max[k] - min[k])); else if (k == 3) color = f_m_all[i][j] == 0 ? 0 : 255 - (255 * (max[k] - f_m_all[i][j]) / (max[k] - min[k])); else if (k == 4) color = f_h_all[i][j] == 0 ? 0 : 255 - (255 * (max[k] - f_h_all[i][j]) / (max[k] - min[k])); else if (k == 5) color = f_q_all[i][j] == 0 ? 0 : 255 - (255 * (max[k] - f_q_all[i][j]) / (max[k] - min[k])); */ if (k == 0) color = f_e_all[i][j] == 0 ? 0 : 255 - (255 * (f_e_all[i][j] - min[k]) / (max[k] - min[k])); else if (k == 1) color = f_g_all[i][j] == 0 ? 0 : 255 - (255 * (f_g_all[i][j] - min[k]) / (max[k] - min[k])); else if (k == 2) color = f_v_all[i][j] == 0 ? 0 : 255 - (255 * (f_v_all[i][j] - min[k]) / (max[k] - min[k])); else if (k == 3) color = f_m_all[i][j] == 0 ? 0 : 255 - (255 * (f_m_all[i][j] - min[k]) / (max[k] - min[k])); else if (k == 4) color = f_m_all[i][j] == 0 ? 0 : 255 - (255 * (f_h_all[i][j] - min[k]) / (max[k] - min[k])); else if (k == 5) color = f_q_all[i][j] == 0 ? 0 : 255 - (255 * (f_q_all[i][j] - min[k]) / (max[k] - min[k])); /*if (k == 0) color = f_e_all[i][j] == 0 ? 0 : (255 * (1 - f_e_all[i][j]) / (1 - 0)); else if (k == 1) color = f_g_all[i][j] == 0 ? 0 : (255 * (1 - f_g_all[i][j]) / (1 - 0)); else if (k == 2) color = f_v_all[i][j] == 0 ? 0 : (255 * (1 - f_v_all[i][j]) / (1 - 0)); else if (k == 3) color = f_m_all[i][j] == 0 ? 0 : (255 * (1 - f_m_all[i][j]) / (1 - 0)); else if (k == 4) color = f_m_all[i][j] == 0 ? 0 : (255 * (1 - f_h_all[i][j]) / (1 - 0)); else if (k == 5) color = f_q_all[i][j] == 0 ? 0 : (255 * (max[k] - f_q_all[i][j]) / (max[k] - min[k])); */ if(i==0 && j == 0){ cv::ellipse(results[k], cv::Point(300, 300), cv::Size(25, 25), angle, angle-90, angle-90+360, cv::Scalar(color,color,color), -1, CV_AA); } else if(i==0 && j != 0) ; else cv::ellipse(results[k], cv::Point(300, 300), cv::Size(250*(i+1)/10.0, 250*(i+1)/10.0), angle, angle-90-10*(j), angle-90-10*(j+1), cv::Scalar(color,color,color), -1, CV_AA); } } if(k==0) cv::imwrite("f_edge.jpg",results[k]); else if(k==1) cv::imwrite("f_grad.jpg",results[k]); else if(k==2) cv::imwrite("f_var.jpg",results[k]); else if(k==3) cv::imwrite("f_mean.jpg",results[k]); else if(k==4) cv::imwrite("f_hist.jpg",results[k]); else if(k==5) cv::imwrite("f_Q.jpg",results[k]); cv::waitKey( 0 ); } return 0; }
void isis_looper::myLoop(int nsel, int mode, bool silent) { char plotName[300]; sprintf(plotName,"test"); if (nsel == 0) {sprintf(plotName,"tt");} else if (nsel == 1) {sprintf(plotName,"twdr");} else if (nsel == -1) {sprintf(plotName,"twds");} else if (nsel == 2) {sprintf(plotName,"zjets");} else if (nsel == 3) {sprintf(plotName,"di");} else if (nsel == 4) {sprintf(plotName, "st");} else if (nsel == 5) {sprintf(plotName,"wjets");} else if (nsel == 6) {sprintf(plotName,"qcd_mu");} else if (nsel == 7) {sprintf(plotName,"others");} else if (nsel == 555) {sprintf(plotName,"mc");} else if (nsel == 666) {sprintf(plotName,"data");} else if (nsel == -10) {sprintf(plotName,"tt");} else if (nsel == 10) {sprintf(plotName,"tt");} bool nosf = false; char newRootFile[300]; double lumi = luminosity; if (mode == 0 ) lumi = 4399; else if ( mode == 1) lumi = 1000; // to check else if ( mode == 2) lumi = 5103.58; // to check sprintf(newRootFile,"results/an_%dpb_%d.root", (int)lumi, mode); if(nsel == -10){ sprintf(newRootFile,"results/JERsysDown_an_%dpb_%d.root", (int)lumi, mode); }else if(nsel == 10 ){ sprintf(newRootFile,"results/JERsysUp_an_%dpb_%d.root", (int)lumi, mode); } TFile f_var(newRootFile, "UPDATE"); if(!silent){ std::cout << "[Info:] results root file " << newRootFile << std::endl; } ////////// char title[300]; sprintf(title,"cuts_%s",plotName); TH1F* histo = new TH1F( title, " ", 10, 0, 10 ); histo->Sumw2(); sprintf(title,"met_high_%s",plotName); TH1F* histo_met_high = new TH1F( title, " ", 100, 0, 200 ); histo_met_high->Sumw2(); sprintf(title,"met_low_%s",plotName); TH1F* histo_met_low = new TH1F( title, " ", 100, 0, 200 ); histo_met_low->Sumw2(); sprintf(title,"promet_%s",plotName); TH1F* histo_promet = new TH1F( title, " ", 100, 0, 200 ); histo_promet->Sumw2(); sprintf(title,"met_cut_%s",plotName); TH1F* histo_met_cut = new TH1F( title, " ", 100, 0, 200 ); histo_met_cut->Sumw2(); sprintf(title,"met_bt_%s",plotName); TH1F* histo_met_bt = new TH1F( title, " ", 100, 0, 200 ); histo_met_bt->Sumw2(); sprintf(title,"mll_after_%s",plotName); TH1F* histo_mll_after = new TH1F( title, " ", 100, 0, 200 ); histo_mll_after->Sumw2(); sprintf(title,"njets_cut_%s",plotName); TH1F* histo_njets_cut = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njets_cut->Sumw2(); sprintf(title,"njetsbt_cut_%s",plotName); TH1F* histo_njetsbt_cut = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njetsbt_cut->Sumw2(); sprintf(title,"njetsbt_high_%s",plotName); TH1F* histo_njetsbt_high = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njetsbt_high->Sumw2(); sprintf(title,"njetsbt_low_%s",plotName); TH1F* histo_njetsbt_low = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njetsbt_low->Sumw2(); sprintf(title,"njets_high_%s",plotName); TH1F* histo_njets_high = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njets_high->Sumw2(); sprintf(title,"njets_low_%s",plotName); TH1F* histo_njets_low = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njets_low->Sumw2(); sprintf(title,"ptsys_high_%s",plotName); TH1F* histo_ptsys_high = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_high->Sumw2(); sprintf(title,"ptsys_low_%s",plotName); TH1F* histo_ptsys_low = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_low->Sumw2(); sprintf(title,"ht_high_%s",plotName); TH1F* histo_ht_high = new TH1F( title, " ", 300, 0, 600 ); histo_ht_high->Sumw2(); sprintf(title,"ht_low_%s",plotName); TH1F* histo_ht_low = new TH1F( title, " ", 300, 0, 600 ); histo_ht_low->Sumw2(); sprintf(title,"ht_cut_%s",plotName); TH1F* histo_ht_cut = new TH1F( title, " ", 300, 0, 600 ); histo_ht_cut->Sumw2(); sprintf(title,"pt_max_%s",plotName); TH1F* histo_pt_max = new TH1F( title, " ", 100, 0, 200 ); histo_pt_max->Sumw2(); sprintf(title,"pt_min_%s",plotName); TH1F* histo_pt_min = new TH1F( title, " ", 100, 0, 200 ); histo_pt_min->Sumw2(); sprintf(title,"btagHE_%s",plotName); TH2F* histo_btagHE = new TH2F( title, " ", 300, -200, 100, 100, -2, 7); histo_btagHE->Sumw2(); sprintf(title,"btagHP_%s",plotName); TH2F* histo_btagHP = new TH2F( title, " ", 300, -200, 100, 100, -2, 7); histo_btagHP->Sumw2(); sprintf(title,"etalepton_%s",plotName); TH1F* histo_etalepton = new TH1F( title, " ", 101, -3, 3); histo_etalepton->Sumw2(); sprintf(title,"ht_bf_%s",plotName); TH1F* histo_ht_bf = new TH1F( title, " ", 300, 0, 600 ); histo_ht_bf->Sumw2(); sprintf(title,"ptsys_bf_%s",plotName); TH1F* histo_ptsys_bf = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_bf->Sumw2(); sprintf(title,"npu_%s",plotName); TH1F* histo_npu = new TH1F( title, " ", 30, -0.5, 29.5 ); histo_npu->Sumw2(); /// Classic plotmaker plots sprintf(title,"met_%s",plotName); TH1F* histo_met = new TH1F( title, " ", 100, 0, 200 ); histo_met->Sumw2(); sprintf(title,"mll_%s",plotName); TH1F* histo_mll = new TH1F( title, " ", 100, 0, 200 ); histo_mll->Sumw2(); sprintf(title,"njets_%s",plotName); TH1F* histo_njets = new TH1F( title, " ", 10, 0, 10 ); histo_njets->Sumw2(); sprintf(title,"njetsbt_%s",plotName); TH1F* histo_njetsbt = new TH1F( title, " ", 10, -0.5, 9.5 ); histo_njetsbt->Sumw2(); sprintf(title,"ptsys_%s",plotName); TH1F* histo_ptsys = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys->Sumw2(); sprintf(title,"ht_%s",plotName); TH1F* histo_ht = new TH1F( title, " ", 300, 0, 600 ); histo_ht->Sumw2(); sprintf(title,"pt_leading_%s",plotName); TH1F* histo_pt_leading = new TH1F( title, " ", 100, 0, 200 ); histo_pt_leading->Sumw2(); sprintf(title,"eta_leading_%s",plotName); TH1F* histo_eta_leading = new TH1F( title, " ", 101, -3, 3); histo_eta_leading->Sumw2(); sprintf(title,"nvertex_%s",plotName); TH1F* histo_nvertex = new TH1F( title, " ", 70, -0.5, 69.5 ); histo_nvertex->Sumw2(); // 1 jet level /// Classic plotmaker plots sprintf(title,"met_1j_%s",plotName); TH1F* histo_met_1j = new TH1F( title, " ", 100, 0, 200 ); histo_met_1j->Sumw2(); sprintf(title,"mll_1j_%s",plotName); TH1F* histo_mll_1j = new TH1F( title, " ", 100, 0, 200 ); histo_mll_1j->Sumw2(); sprintf(title,"ptsys_1j_%s",plotName); TH1F* histo_ptsys_1j = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_1j->Sumw2(); sprintf(title,"ht_1j_%s",plotName); TH1F* histo_ht_1j = new TH1F( title, " ", 300, 0, 600 ); histo_ht_1j->Sumw2(); sprintf(title,"pt_leading_1j_%s",plotName); TH1F* histo_pt_leading_1j = new TH1F( title, " ", 100, 0, 200 ); histo_pt_leading_1j->Sumw2(); sprintf(title,"nvertex_1j_%s",plotName); TH1F* histo_nvertex_1j = new TH1F( title, " ", 30, -0.5, 29.5 ); histo_nvertex_1j->Sumw2(); // 1 jet level /// Classic plotmaker plots sprintf(title,"met_1j1t_%s",plotName); TH1F* histo_met_1j1t = new TH1F( title, " ", 100, 0, 200 ); histo_met_1j1t->Sumw2(); sprintf(title,"mll_1j1t_%s",plotName); TH1F* histo_mll_1j1t = new TH1F( title, " ", 100, 0, 200 ); histo_mll_1j1t->Sumw2(); sprintf(title,"ptsys_1j1t_%s",plotName); TH1F* histo_ptsys_1j1t = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_1j1t->Sumw2(); sprintf(title,"ht_1j1t_%s",plotName); TH1F* histo_ht_1j1t = new TH1F( title, " ", 300, 0, 600 ); histo_ht_1j1t->Sumw2(); sprintf(title,"pt_leading_1j1t_%s",plotName); TH1F* histo_pt_leading_1j1t = new TH1F( title, " ", 100, 0, 200 ); histo_pt_leading_1j1t->Sumw2(); sprintf(title,"nvertex_1j1t_%s",plotName); TH1F* histo_nvertex_1j1t = new TH1F( title, " ", 30, -0.5, 29.5 ); histo_nvertex_1j1t->Sumw2(); // 2j1t /// Classic plotmaker plots sprintf(title,"met_2j1t_%s",plotName); TH1F* histo_met_2j1t = new TH1F( title, " ", 100, 0, 200 ); histo_met_2j1t->Sumw2(); sprintf(title,"mll_2j1t_%s",plotName); TH1F* histo_mll_2j1t = new TH1F( title, " ", 100, 0, 200 ); histo_mll_2j1t->Sumw2(); sprintf(title,"ptsys_2j1t_%s",plotName); TH1F* histo_ptsys_2j1t = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_2j1t->Sumw2(); sprintf(title,"ht_2j1t_%s",plotName); TH1F* histo_ht_2j1t = new TH1F( title, " ", 300, 0, 600 ); histo_ht_2j1t->Sumw2(); sprintf(title,"pt_leading_2j1t_%s",plotName); TH1F* histo_pt_leading_2j1t = new TH1F( title, " ", 100, 0, 200 ); histo_pt_leading_2j1t->Sumw2(); sprintf(title,"nvertex_2j1t_%s",plotName); TH1F* histo_nvertex_2j1t = new TH1F( title, " ", 30, -0.5, 29.5 ); histo_nvertex_2j1t->Sumw2(); // 2j2t /// Classic plotmaker plots sprintf(title,"met_2j2t_%s",plotName); TH1F* histo_met_2j2t = new TH1F( title, " ", 100, 0, 200 ); histo_met_2j2t->Sumw2(); sprintf(title,"mll_2j2t_%s",plotName); TH1F* histo_mll_2j2t = new TH1F( title, " ", 100, 0, 200 ); histo_mll_2j2t->Sumw2(); sprintf(title,"ptsys_2j2t_%s",plotName); TH1F* histo_ptsys_2j2t = new TH1F( title, " ", 100, 0, 200 ); histo_ptsys_2j2t->Sumw2(); sprintf(title,"ht_2j2t_%s",plotName); TH1F* histo_ht_2j2t = new TH1F( title, " ", 300, 0, 600 ); histo_ht_2j2t->Sumw2(); sprintf(title,"pt_leading_2j2t_%s",plotName); TH1F* histo_pt_leading_2j2t = new TH1F( title, " ", 100, 0, 200 ); histo_pt_leading_2j2t->Sumw2(); sprintf(title,"nvertex_2j2t_%s",plotName); TH1F* histo_nvertex_2j2t = new TH1F( title, " ", 30, -0.5, 29.5 ); histo_nvertex_2j2t->Sumw2(); // all regions sprintf(title,"R_%s",plotName); TH1F* histo_R = new TH1F( title, " ", 40, 0, 40 ); histo_R->Sumw2(); // checking pu reweighting sprintf(title,"nvertex_final_%s",plotName); TH1F* histo_nvertex_final = new TH1F( title, " ", 70, -0.5, 69.5 ); histo_nvertex_final->Sumw2(); sprintf(title,"nvertex_final_3D_%s",plotName); TH1F* histo_nvertex_final_3D = new TH1F( title, " ", 70, -0.5, 69.5 ); histo_nvertex_final_3D->Sumw2(); sprintf(title,"nvertex_final_purw_%s",plotName); TH1F* histo_nvertex_final_purw = new TH1F( title, " ", 70, -0.5, 69.5 ); histo_nvertex_final_purw->Sumw2(); sprintf(title,"nvertex_2lep_%s",plotName); TH1F* histo_nvertex_2lep = new TH1F( title, " ", 70, -0.5, 69.5 ); histo_nvertex_2lep->Sumw2(); //<<<<<<< isis_looper.C //_________________________________________________________________________________ //added by Isis // -- Leading jet --- sprintf(title,"eta_jet_%s",plotName); TH1F* histo_eta_jet = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet->Sumw2(); sprintf(title,"eta_jet_110_%s",plotName); TH1F* histo_eta_jet_110 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet_110->Sumw2(); sprintf(title,"eta_jet_90_%s",plotName); TH1F* histo_eta_jet_90 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet_90->Sumw2(); sprintf(title,"eta_jet_70_%s",plotName); TH1F* histo_eta_jet_70 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet_70->Sumw2(); sprintf(title,"eta_jet_50_%s",plotName); TH1F* histo_eta_jet_50 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet_50->Sumw2(); sprintf(title,"eta_jet_30_%s",plotName); TH1F* histo_eta_jet_30 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet_30->Sumw2(); // -- Second Leading jet --- sprintf(title,"eta_jet1_%s",plotName); TH1F* histo_eta_jet1 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet1->Sumw2(); sprintf(title,"eta_jet1_110_%s",plotName); TH1F* histo_eta_jet1_110 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet1_110->Sumw2(); sprintf(title,"eta_jet1_90_%s",plotName); TH1F* histo_eta_jet1_90 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet1_90->Sumw2(); sprintf(title,"eta_jet1_70_%s",plotName); TH1F* histo_eta_jet1_70 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet1_70->Sumw2(); sprintf(title,"eta_jet1_50_%s",plotName); TH1F* histo_eta_jet1_50 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet1_50->Sumw2(); sprintf(title,"eta_jet1_30_%s",plotName); TH1F* histo_eta_jet1_30 = new TH1F( title, " ", 50,-5, 5 ); //#bins - begin - end histo_eta_jet1_30->Sumw2(); // ---- Z/gamma controlregion sprintf(title,"mll_zgamma_%s",plotName); TH1F* histo_mll_zgamma = new TH1F( title, " ", 50, 0, 200 ); histo_mll_zgamma->Sumw2(); sprintf(title,"met_zgamma_%s",plotName); TH1F* histo_met_zgamma= new TH1F( title, " ", 50, 0, 200 ); histo_met_zgamma->Sumw2(); //======= //>>>>>>> 1.1.2.3 //__________________________________________________ END HISTO DEF _________________________________________________________ if (fChain == 0) return; Long64_t nentries = fChain->GetEntriesFast(); Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentry<nentries;jentry++) { Long64_t ientry = LoadTree(jentry); if (ientry < 0) break; nb = fChain->GetEntry(jentry); nbytes += nb; if (lumi != lum && nsel != 666 && mode !=3){ if (jentry == 0)std::cout << "[Warning:] This tree was made with a different luminosity (" << lum << ") than " << lumi << std::endl; //xlWeight*=(lumi/lum); } // if(puweight > 5){ continue ;} if(ptLepton->size() != 2){ std::cout << "[Warning:] Something is wrong, your Tree is not correctly filled" << std::endl; break; } else { histo->Fill(0.,xlWeight); histo_nvertex_2lep->Fill(nvertex,xlWeight); TLorentzVector lepton0(pxLepton->at(0),pyLepton->at(0), pzLepton->at(0), eLepton->at(0)); TLorentzVector lepton1(pxLepton->at(1),pyLepton->at(1), pzLepton->at(1), eLepton->at(1)); TLorentzVector pair = lepton0+lepton1; double phipairmet_t = 0; double pi_m = 3.1416/2; phipairmet_t = pi_m; TVector3 vmet(metPx, metPy, 0); double promet = metPt*sin(phipairmet_t); TVector3 m0(pxLepton->at(0),pyLepton->at(0), pzLepton->at(0)); TVector3 m1(pxLepton->at(1),pyLepton->at(1), pzLepton->at(1)); if (fabs(m0.DeltaPhi(vmet)) < phipairmet_t) phipairmet_t = fabs(m0.DeltaPhi(vmet)); if (fabs(m1.DeltaPhi(vmet)) < phipairmet_t) phipairmet_t = fabs(m1.DeltaPhi(vmet)); if (phipairmet_t == pi_m) promet = metPt; if (pair.M() > 20){ histo->Fill(1, xlWeight); double SFval, SFerror; if ( nsel == 666 || nosf){ SFval = 1; SFerror = 0; } else if (nsel == 0){ SFval = 0.95; SFerror = 0.03; } else { SFval = 0.97; SFerror = 0.03; } int nJetsBT = 0; int nTightJetsBT = 0; int nJets = 0; bool bTagged = false; int iJetn[5]={-1, -1,-1,-1,-1}; int iJet = -5; int iSF; double tempSF = SFval; int SFvalue = int(tempSF*100); for (unsigned int i =0; i < ptJet->size(); i ++){ TLorentzVector tempJet(pxJet->at(i),pyJet->at(i), pzJet->at(i), eJet->at(i)); if (ptJet->at(i) > 30 && TMath::Min(fabs(lepton0.DeltaR(tempJet)), fabs(lepton1.DeltaR(tempJet))) > 0.3) { iJetn[nJets] = i; iJet = i; nJets++; if (btCSVBJet->at(i) > 0.679){ iSF = rand() % 100; if (iSF < SFvalue ){ bTagged = true; nJetsBT++; nTightJetsBT++; } } } else if (btCSVBJet->at(i) > 0.679){ iSF = rand() % 100; if (iSF < SFvalue ) nJetsBT++; } } if(nJets){ TLorentzVector jet(pxJet->at(iJetn[0]),pyJet->at(iJetn[0]), pzJet->at(iJetn[0]), eJet->at(iJetn[0])); // TLorentzVector jet1(pxJet->at(iJetn[1]),pyJet->at(iJetn[1]), pzJet->at(iJetn[1]), eJet->at(iJetn[1])); //2e jet erbij nemen histo_eta_jet->Fill(jet.Eta(),xlWeight); //histo_eta_jet1->Fill(jet1.Eta(),xlWeight); // 2e jet in dezelfde plot steken , misschien beter om aparte plot te maken? if( ptJet->at(iJet) > 110 ){ histo_eta_jet_110->Fill(jet.Eta(),xlWeight); // histo_eta_jet1_110->Fill(jet1.Eta(),xlWeight); } if (ptJet->at(iJet) > 90){ histo_eta_jet_90->Fill(jet.Eta(),xlWeight); // histo_eta_jet1_90->Fill(jet1.Eta(),xlWeight); } if (ptJet->at(iJet) > 70){ histo_eta_jet_70->Fill(jet.Eta(),xlWeight); // histo_eta_jet1_70->Fill(jet1.Eta(),xlWeight); } if(ptJet->at(iJet) > 50){ histo_eta_jet_50->Fill(jet.Eta(),xlWeight); // histo_eta_jet1_50->Fill(jet1.Eta(),xlWeight); } if (ptJet->at(iJet) > 30){ histo_eta_jet_30->Fill(jet.Eta(),xlWeight); // histo_eta_jet1_30->Fill(jet1.Eta(),xlWeight); } } histo_pt_max->Fill(TMath::Max(lepton0.Pt(), lepton1.Pt()), xlWeight); histo_pt_min->Fill(TMath::Min(lepton0.Pt(), lepton1.Pt()), xlWeight); histo_njets->Fill(nJets, xlWeight); histo_njetsbt->Fill(nJetsBT, xlWeight); histo_mll->Fill(pair.M(), xlWeight); histo_met->Fill(metPt, xlWeight); histo_promet->Fill(promet, xlWeight); if (nvertex > 5){ histo_met_high->Fill(metPt, xlWeight); histo_njets_high->Fill(nJets, xlWeight); histo_njetsbt_high->Fill(nJetsBT, xlWeight); } else { histo_met_low->Fill(metPt, xlWeight); histo_njets_low->Fill(nJets, xlWeight); histo_njetsbt_low->Fill(nJetsBT, xlWeight); } if (nJets) histo_pt_leading->Fill(ptJet->at(0), xlWeight); if (nJets){ TLorentzVector jet_aux(pxJet->at(0),pyJet->at(0), pzJet->at(0), eJet->at(0)); histo_eta_leading->Fill(jet_aux.Eta(), xlWeight); } if (nJets == 1){ histo_etalepton->Fill(lepton0.Eta(), xlWeight); TLorentzVector jet(pxJet->at(iJet),pyJet->at(iJet), pzJet->at(iJet), eJet->at(iJet)); double ptSysPx1 = lepton0.Px() + lepton1.Px() + jet.Px() + metPx; double ptSysPy1 = lepton0.Py() + lepton1.Py() + jet.Py() + metPy; double ptSystem1 = sqrt(ptSysPx1*ptSysPx1 + ptSysPy1*ptSysPy1); double ht1 = lepton0.Pt() + lepton1.Pt() + jet.Pt() + metPt; histo_ptsys_bf->Fill(ptSystem1, xlWeight); histo_ht_bf->Fill(ht1, xlWeight); } bool invMass = false; if (mode == 0) invMass = true; else if (mode == 1 && (pair.M() > invMax || pair.M() < invMin)) invMass = true; else if (mode == 2 && (pair.M() > invMax || pair.M() < invMin)) invMass = true; //____________________________ //Z/gamma control region //if (pair.M() > 81 || pair.M() < 101) if(!invMass || (mode == 0 && (pair.M() > 81 || pair.M() < 101) )) { histo_mll_zgamma->Fill(pair.M(), xlWeight); histo_met_zgamma->Fill(metPt, xlWeight); } //______________________________________ if (invMass){ histo->Fill(2, xlWeight); histo_mll_after->Fill(pair.M(), xlWeight); histo_met_cut->Fill(metPt, xlWeight); if (metPt >= metCut || mode ==0){ histo->Fill(3, xlWeight); histo_njets_cut->Fill(nJets, xlWeight); if (nJets == 1){ histo->Fill(4, xlWeight); histo_njetsbt_cut->Fill(nJetsBT, xlWeight); TLorentzVector jet(pxJet->at(iJet),pyJet->at(iJet), pzJet->at(iJet), eJet->at(iJet)); double ptSysPx = lepton0.Px() + lepton1.Px() + jet.Px() + metPx; double ptSysPy = lepton0.Py() + lepton1.Py() + jet.Py() + metPy; double ptSystem = sqrt(ptSysPx*ptSysPx + ptSysPy*ptSysPy); double ht = lepton0.Pt() + lepton1.Pt() + jet.Pt() + metPt; histo_mll_1j->Fill(pair.M(), xlWeight); histo_met_1j->Fill(metPt, xlWeight); histo_ptsys_1j->Fill(ptSystem, xlWeight); histo_ht_1j->Fill(ht, xlWeight); histo_pt_leading_1j->Fill(jet.Pt(), xlWeight); if (nJets == 1 && nTightJetsBT == 1 && bTagged && nJetsBT == 1){ histo->Fill(5, xlWeight); histo_mll_1j1t->Fill(pair.M(), xlWeight); histo_met_1j1t->Fill(metPt, xlWeight); histo_ptsys_1j1t->Fill(ptSystem, xlWeight); histo_ht_1j1t->Fill(ht, xlWeight); histo_pt_leading_1j1t->Fill(jet.Pt(), xlWeight); histo_ptsys->Fill(ptSystem, xlWeight); histo_ht->Fill(ht, xlWeight); histo_met_bt->Fill(metPt, xlWeight); histo_nvertex->Fill(nvertex, xlWeight); histo_npu->Fill(npu, xlWeight); if (nvertex > 5) { histo_ptsys_high->Fill(ptSystem, xlWeight); histo_ht_high->Fill(ht, xlWeight); } else { histo_ptsys_low->Fill(ptSystem, xlWeight); histo_ht_low->Fill(ht, xlWeight); } if (ht > htMin || mode !=0){ histo->Fill(6, xlWeight); histo_ht_cut->Fill(ht, xlWeight); //Example to access the pu reweighting! histo_nvertex_final->Fill(nvertex, rawWeight); histo_nvertex_final_3D->Fill(nvertex, rawWeight*puweight3D); histo_nvertex_final_purw->Fill(nvertex, rawWeight*puweight); } } } } //Filling of all region from here if (metPt >= metCut || mode ==0){ if (nJets != 0){ TLorentzVector jet(pxJet->at(iJet),pyJet->at(iJet), pzJet->at(iJet), eJet->at(iJet)); double ptSysPx = lepton0.Px() + lepton1.Px() + jet.Px() + metPx; double ptSysPy = lepton0.Py() + lepton1.Py() + jet.Py() + metPy; double ptSystem = sqrt(ptSysPx*ptSysPx + ptSysPy*ptSysPy); double ht = lepton0.Pt() + lepton1.Pt() + jet.Pt() + metPt; if (nJets == 2 && nTightJetsBT == 1 && nJetsBT == 1) { histo_mll_2j1t->Fill(pair.M(), xlWeight); histo_met_2j1t->Fill(metPt, xlWeight); histo_ptsys_2j1t->Fill(ptSystem, xlWeight); histo_ht_2j1t->Fill(ht, xlWeight); histo_pt_leading_2j1t->Fill(jet.Pt(), xlWeight); } else if (nJets == 2 && nTightJetsBT == 2 && nJetsBT == 2) { histo_mll_2j2t->Fill(pair.M(), xlWeight); histo_met_2j2t->Fill(metPt, xlWeight); histo_ptsys_2j2t->Fill(ptSystem, xlWeight); histo_ht_2j2t->Fill(ht, xlWeight); histo_pt_leading_2j2t->Fill(jet.Pt(), xlWeight); } //All possible regions if (nJets == 1 && nTightJetsBT == 1 && bTagged && nJetsBT == 1 && ptSystem <= ptsysCut && (ht > htMin || mode !=0))histo_R->Fill(1, xlWeight); //signal if (nJets == 1 && nTightJetsBT == 2) histo_R->Fill(2, xlWeight); if (nJets == 1 && nTightJetsBT > 0) histo_R->Fill(3, xlWeight); if (nJets == 1 && nTightJetsBT > 1) histo_R->Fill(4, xlWeight); if (nJets == 2 && nTightJetsBT == 0) histo_R->Fill(5, xlWeight); if (nJets == 2 && nTightJetsBT == 1) histo_R->Fill(6, xlWeight); //CR1 no ht no ptsys if (nJets == 2 && nTightJetsBT == 2) histo_R->Fill(7, xlWeight); //CR2 no ht no ptsys if (nJets == 2 && nTightJetsBT > 0) histo_R->Fill(8, xlWeight); if (nJets == 2 && nTightJetsBT > 1) histo_R->Fill(9, xlWeight); if (nJets > 1 && nTightJetsBT == 0) histo_R->Fill(10, xlWeight); if (nJets > 1 && nTightJetsBT == 1) histo_R->Fill(11, xlWeight); if (nJets > 1 && nTightJetsBT == 2) histo_R->Fill(12, xlWeight); if (nJets > 1 && nTightJetsBT !=0 ) histo_R->Fill(13, xlWeight); if (nJets > 1 && nTightJetsBT > 1 ) histo_R->Fill(14, xlWeight); if (nJets == 3 && nTightJetsBT ==3 ) histo_R->Fill(15, xlWeight); if (nJets == 1 && nTightJetsBT ==1 && bTagged && nJetsBT == 1) histo_R->Fill(16, xlWeight); if (nJets == 2 && nTightJetsBT == 1 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(17, xlWeight); //CR 1 regular if (nJets == 2 && nTightJetsBT == 2 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(18, xlWeight); //CR 2 regular if (nJets == 2 && nTightJetsBT == 1 && nJetsBT == 1 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(19, xlWeight); if (nJets == 2 && nTightJetsBT == 2 && nJetsBT == 2 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(20, xlWeight); if (nJets == 2 && nJetsBT == 1 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(21, xlWeight); //CR 1 another way if (nJets == 2 && nJetsBT == 2 && ptSystem <= ptsysCut && (ht > htMin || mode !=0)) histo_R->Fill(22, xlWeight); //CR 2 another way if (nJets == 2 && nTightJetsBT == 1 && nJetsBT == 1) histo_R->Fill(23, xlWeight); //CR1 no ht no ptsys tighter if (nJets == 2 && nTightJetsBT == 2 && nJetsBT == 2) histo_R->Fill(24, xlWeight); //CR2 no ht no ptsys tighter if (nJets == 2 && nJetsBT == 1) histo_R->Fill(25, xlWeight); //CR1 no ht no ptsys another flavor if (nJets == 2 && nJetsBT == 2) histo_R->Fill(26, xlWeight); //CR2 no ht no ptsys another flavor if (nJets == 1 && nTightJetsBT == 1 && bTagged && nJetsBT == 1 && (ht > htMin || mode !=0))histo_R->Fill(27, xlWeight); //signal no ptsys if (nJets == 1 && nTightJetsBT == 1 && bTagged && nJetsBT == 1 && ptSystem <= ptsysCut)histo_R->Fill(28, xlWeight); //signal no ht if (nJets == 2 && nTightJetsBT == 1 && (ht > htMin || mode !=0)) histo_R->Fill(29, xlWeight); //CR 1 if (nJets == 2 && nTightJetsBT == 2 && (ht > htMin || mode !=0)) histo_R->Fill(30, xlWeight); //CR 2 } //jets in the event } //all CR } // mll } //mll pre } // 2 leptons }// event loop. if (!silent){ cout << "------------------------------------------" << endl; cout << "[Results:] " << plotName << endl; cout << "------------------------------------------" << endl; for (int i = 2; i < 9; i++){ if (i == 2) cout << " leptons: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; if (i == 3) cout << " inv. mass: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; if (i == 4) cout << " met: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; if (i == 5) cout << " jet: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; if (i == 6) cout << " jet_bt: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; if (i == 7) cout << " ht: " << histo->GetBinContent(i) << " +/- " << histo->GetBinError(i) << endl; } cout << "------------------------------------------" << endl; cout << "[eta values:]" << plotName << endl; cout << "------------------------------------------" << endl; for (int j =1 ; j<7; j++){ if(j == 1) { double amount = 0; //double amounterror = 0; for(int k = 0; k< 50; k++) { amount = amount + histo_eta_jet_30->GetBinContent(k); // amounterror = sqrt(amounterror^2 + (histo_eta_jet_30->GetBinError(k))^2); //cout << "pt higher then 30: " << histo_eta_jet_30->GetBinContent(k) << " +/- " << histo_eta_jet_30->GetBinError(k) << endl; } cout << "pt higher then 30: " << amount << endl; } if(j == 2) { double amount = 0; //double amounterror = 0; for(int k = 0; k< 50; k++) { amount = amount + histo_eta_jet_50->GetBinContent(k); // amounterror = sqrt(amounterror^2 + (histo_eta_jet_30->GetBinError(k))^2); //cout << "pt higher then 50: " << histo_eta_jet_30->GetBinContent(k) << " +/- " << histo_eta_jet_30->GetBinError(k) << endl; } cout << "pt higher then 50: " << amount << endl; } if(j == 3) { double amount = 0; //double amounterror = 0; for(int k = 0; k< 50; k++) { amount = amount + histo_eta_jet_70->GetBinContent(k); // amounterror = sqrt(amounterror^2 + (histo_eta_jet_30->GetBinError(k))^2); //cout << "pt higher then 30: " << histo_eta_jet_30->GetBinContent(k) << " +/- " << histo_eta_jet_30->GetBinError(k) << endl; } cout << "pt higher then 70: " << amount << endl; } if(j == 4) { double amount = 0; //double amounterror = 0; for(int k = 0; k< 50; k++) { amount = amount + histo_eta_jet_70->GetBinContent(k); // amounterror = sqrt(amounterror^2 + (histo_eta_jet_30->GetBinError(k))^2); //cout << "pt higher then 30: " << histo_eta_jet_30->GetBinContent(k) << " +/- " << histo_eta_jet_30->GetBinError(k) << endl; } cout << "pt higher then 70: " << amount << endl; } if(j == 5) { double amount = 0; //double amounterror = 0; for(int k = 0; k< 50; k++) { amount = amount + histo_eta_jet_90->GetBinContent(k); // amounterror = sqrt(amounterror^2 + (histo_eta_jet_30->GetBinError(k))^2); //cout << "pt higher then 30: " << histo_eta_jet_30->GetBinContent(k) << " +/- " << histo_eta_jet_30->GetBinError(k) << endl; } cout << "pt higher then 90: " << amount << endl; } if(j == 6) { double amount = 0; //double amounterror = 0; for(int k = 0; k< 50; k++) { amount = amount + histo_eta_jet_110->GetBinContent(k); // amounterror = sqrt(amounterror^2 + (histo_eta_jet_30->GetBinError(k))^2); //cout << "pt higher then 30: " << histo_eta_jet_30->GetBinContent(k) << " +/- " << histo_eta_jet_30->GetBinError(k) << endl; } cout << "pt higher then 110: " << amount << endl; } } } f_var.Write(); f_var.Close(); }