Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!WIP:remove top and VV #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions makeWS_percategory.C
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ enum PROCESS{
WH = 10,
qqZH = 11,
ggZH = 12,
ttH = 13
ttH = 13,
TOP = 14,
VV = 15,

};


Expand All @@ -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
Expand All @@ -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] = {
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -262,7 +269,7 @@ int makeWS_percategory(std::string year="2017", std::string cat="MTR"){

}

for (unsigned iP(0); iP<nP; ++iP){
for (unsigned iP(0); iP<nP+2; ++iP){

for (unsigned iS(0); iS < nS; ++iS){
histos[iR][iP][iS] = 0;
Expand All @@ -274,7 +281,7 @@ int makeWS_percategory(std::string year="2017", std::string cat="MTR"){
(iR>0 && 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 && iP<nP) {
histos[iR][iP][iS] = (TH1F*)gDirectory->Get((lProcs[iP]+"_"+lSysts[iS]).c_str());
}
if (!histos[iR][iP][iS]) {
Expand Down Expand Up @@ -501,11 +508,21 @@ int makeWS_percategory(std::string year="2017", std::string cat="MTR"){
std::cout<<"Test EWK corr "<<ratio_EWK_corr_on_Strong_proc<<std::endl;


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.;
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;
Expand Down Expand Up @@ -762,6 +779,8 @@ int makeWS_percategory(std::string year="2017", std::string cat="MTR"){
fOut->Close();
fOut->Delete();

ltestout.close();

return 0;

}