From 3a9887c0053c538f3ab45b14abb9fcea5c5c1559 Mon Sep 17 00:00:00 2001 From: amagnan Date: Thu, 14 Oct 2021 19:28:58 +0200 Subject: [PATCH] remove top and VV --- makeWS_percategory.C | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/makeWS_percategory.C b/makeWS_percategory.C index d72bd00..380487a 100644 --- a/makeWS_percategory.C +++ b/makeWS_percategory.C @@ -31,7 +31,10 @@ enum PROCESS{ WH = 10, qqZH = 11, ggZH = 12, - ttH = 13 + ttH = 13, + TOP = 14, + VV = 15, + }; @@ -45,6 +48,10 @@ int makeWS_percategory(std::string year="2017", std::string cat="MTR"){ // As usual, load the combine library to get access to the RooParametricHist gSystem->Load("libHiggsAnalysisCombinedLimit.so"); + + std::ofstream ltestout; + ltestout.open((cat+"_"+year+"_ratioCors.txt").c_str()); + /////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// //Hardcoded input parameters @@ -67,12 +74,12 @@ int makeWS_percategory(std::string year="2017", std::string cat="MTR"){ //!! SAME ORDER AS IN ENUM PROCESS ABOVE !!!! //use same order: data= process 0, signal = process 1, QCD Z+Jets in SR = 2, etc.... const unsigned nP = 14; - std::string lProcs[14] = {"data_obs","VBFHtoInv","GluGluHtoInv", + std::string lProcs[16] = {"data_obs","VBFHtoInv","GluGluHtoInv", "ZJETS","EWKZNUNU", "WJETS","EWKW", "DY","EWKZll","QCD", "WH","qqZH","ggZH", - "ttH"}; + "ttH","TOP","VV"}; const unsigned nNLO = 4; std::string lNLOname[4] = { @@ -213,7 +220,7 @@ int makeWS_percategory(std::string year="2017", std::string cat="MTR"){ TFile *finput[nR]; TFile *finput_sam; - TH1F *histos[nR][nP][nS]; + TH1F *histos[nR][nP+2][nS]; //to get the fNLO factors variations TH1F *histosNLO[nP][nNLO]; @@ -262,7 +269,7 @@ int makeWS_percategory(std::string year="2017", std::string cat="MTR"){ } - for (unsigned iP(0); iP0 && iR<3 && !isCRWsyst[iS]) || (iR>2 && !isCRZsyst[iS]) ) histos[iR][iP][iS] = (TH1F*)gDirectory->Get(lProcs[iP].c_str()); - else if (iP>0) { + else if (iP>0 && iPGet((lProcs[iP]+"_"+lSysts[iS]).c_str()); } if (!histos[iR][iP][iS]) { @@ -501,11 +508,21 @@ int makeWS_percategory(std::string year="2017", std::string cat="MTR"){ std::cout<<"Test EWK corr "<GetBinContent(iB)+histos[4][PROCESS::QCDDYll][0]->GetBinContent(iB)+histos[3][PROCESS::EWKZll][0]->GetBinContent(iB)+histos[4][PROCESS::EWKZll][0]->GetBinContent(iB)); + double ratioZCR = totMCCR>0? (histos[3][PROCESS::data][0]->GetBinContent(iB)+histos[4][PROCESS::data][0]->GetBinContent(iB)-histos[3][PROCESS::TOP][0]->GetBinContent(iB)-histos[4][PROCESS::TOP][0]->GetBinContent(iB)-histos[3][PROCESS::VV][0]->GetBinContent(iB)-histos[4][PROCESS::VV][0]->GetBinContent(iB)) / totMCCR : 1.; + ltestout << "Z cor " << iB << " " << ratioZCR << std::endl; + + if (!(is2017 && cat=="MTR")) ratioZCR = 1.; + if (iT==0) { - ratio = histos[0][PROCESS::QCDW][0]->GetBinContent(iB) / histos[0][PROCESS::QCDZnunu][0]->GetBinContent(iB); + //ratio = histos[0][PROCESS::QCDW][0]->GetBinContent(iB) / histos[0][PROCESS::QCDZnunu][0]->GetBinContent(iB); + ratio = ratioZCR>0 ? histos[0][PROCESS::QCDW][0]->GetBinContent(iB) / (histos[0][PROCESS::QCDZnunu][0]->GetBinContent(iB) * ratioZCR) : histos[0][PROCESS::QCDW][0]->GetBinContent(iB) / histos[0][PROCESS::QCDZnunu][0]->GetBinContent(iB); ratiostat = 1+sqrt(pow(histos[0][PROCESS::QCDW][0]->GetBinError(iB)/histos[0][PROCESS::QCDW][0]->GetBinContent(iB),2)+pow(histos[0][PROCESS::QCDZnunu][0]->GetBinError(iB)/histos[0][PROCESS::QCDZnunu][0]->GetBinContent(iB),2)); } else{ - ratio = histos[0][PROCESS::EWKW][0]->GetBinContent(iB) / histos[0][PROCESS::EWKZnunu][0]->GetBinContent(iB); + //ratio = histos[0][PROCESS::EWKW][0]->GetBinContent(iB) / histos[0][PROCESS::EWKZnunu][0]->GetBinContent(iB); + double totMCCR = (histos[3][PROCESS::QCDDYll][0]->GetBinContent(iB)+histos[4][PROCESS::QCDDYll][0]->GetBinContent(iB)+histos[3][PROCESS::EWKZll][0]->GetBinContent(iB)+histos[4][PROCESS::EWKZll][0]->GetBinContent(iB)); + double ratioZCR = totMCCR>0? (histos[3][PROCESS::data][0]->GetBinContent(iB)+histos[4][PROCESS::data][0]->GetBinContent(iB)-histos[3][PROCESS::TOP][0]->GetBinContent(iB)-histos[4][PROCESS::TOP][0]->GetBinContent(iB)-histos[3][PROCESS::VV][0]->GetBinContent(iB)-histos[4][PROCESS::VV][0]->GetBinContent(iB)) / totMCCR : 1.; + ratio = ratioZCR>0? histos[0][PROCESS::EWKW][0]->GetBinContent(iB) / (histos[0][PROCESS::EWKZnunu][0]->GetBinContent(iB) * ratioZCR) : histos[0][PROCESS::EWKW][0]->GetBinContent(iB) / histos[0][PROCESS::EWKZnunu][0]->GetBinContent(iB); ratiostat = 1+sqrt(pow(histos[0][PROCESS::EWKW][0]->GetBinError(iB)/histos[0][PROCESS::EWKW][0]->GetBinContent(iB),2)+pow(histos[0][PROCESS::EWKZnunu][0]->GetBinError(iB)/histos[0][PROCESS::EWKZnunu][0]->GetBinContent(iB),2)); } lFormula << ratio; @@ -762,6 +779,8 @@ int makeWS_percategory(std::string year="2017", std::string cat="MTR"){ fOut->Close(); fOut->Delete(); + ltestout.close(); + return 0; }