Skip to content

Commit

Permalink
Bugs fixes. All years should run under new format.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Loeliger committed Oct 6, 2019
1 parent b0111e6 commit 8da392a
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 28 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*~
\#*\#
*.root
*.pdf
14 changes: 8 additions & 6 deletions FFcode/bin/Set1_correction_et.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ int main(int argc, char** argv) {

Int_t nentries_wtn = (Int_t) arbre->GetEntries();
for (Int_t i = 0; i < nentries_wtn; i++) {
arbre->GetEntry(i);
arbre->GetEntry(i);
if (i % 10000 == 0) fprintf(stdout, "\r Processed events: %8d of %8d ", i, nentries_wtn);
fflush(stdout);

Expand Down Expand Up @@ -470,7 +470,7 @@ int main(int argc, char** argv) {
trigger25=(passEle25 && matchEle25_1 && filterEle25_1 && pt_1>26);
if (!trigger25) continue;
}



// Change here to change the ID!!
Expand Down Expand Up @@ -602,6 +602,7 @@ int main(int argc, char** argv) {

if (sample=="data_obs") aweight=1.0;


// Top pT reweighting
float topfactor=1.0;
if (name=="TT" or name=="TTMC"){
Expand All @@ -625,7 +626,8 @@ int main(int argc, char** argv) {
if (trigger32 or trigger35) aweight=aweight*myScaleFactor_trgEle3235->get_ScaleFactor(pt_1,eta_1);
else aweight=aweight*myScaleFactor_trgEle24->get_ScaleFactor(pt_1,eta_1)*etsf->getTriggerScaleFactor(mytau.Pt(), mytau.Eta(), mytau.Phi(), mydm);
aweight=aweight*bweight;
}
}

if (year=="2017" && sample!="embedded" && sample!="data_obs"){
wmc->var("e_pt")->setVal(myele.Pt());
wmc->var("e_eta")->setVal(myele.Eta());
Expand Down Expand Up @@ -676,12 +678,12 @@ int main(int argc, char** argv) {

if (name=="TTMC"){
ff_tt=get_raw_FF(mytau.Pt(),ff_ttmc_0jet);
}
}

if (name=="WMC2"){
if (name=="WMC2"){
ff_w=get_raw_FF(mytau.Pt(),ff_wmc_0jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_wmc);
if (njets>0) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_1jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_wmc);
}
}

if (!is_includedInEmbedded){

Expand Down
12 changes: 6 additions & 6 deletions FFcode/python/Draw_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ def Draw_raw(step,year,channel):
new_idx=ROOT.gROOT.GetListOfColors().GetSize() + 1
trans=ROOT.TColor(new_idx, adapt.GetRed(), adapt.GetGreen(),adapt.GetBlue(), "",0.5)

file=ROOT.TFile("raw_FF_mt.root","r")
categories=["mt_0jet_qcd_iso","mt_0jet_qcd_anti","mt_1jet_qcd_anti","mt_1jet_qcd_iso","mt_0jet_w_anti","mt_0jet_w_iso","mt_1jet_w_anti","mt_1jet_w_iso","mt_0jet_tt_iso","mt_0jet_tt_anti","mt_0SSloose_qcd_anti","mt_0SSloose_qcd_iso","mt_1SSloose_qcd_anti","mt_1SSloose_qcd_iso"]
file=ROOT.TFile("raw_FF_"+channel+".root","r")
categories=[channel+"_0jet_qcd_iso",channel+"_0jet_qcd_anti",channel+"_1jet_qcd_anti",channel+"_1jet_qcd_iso",channel+"_0jet_w_anti",channel+"_0jet_w_iso",channel+"_1jet_w_anti",channel+"_1jet_w_iso",channel+"_0jet_tt_iso",channel+"_0jet_tt_anti",channel+"_0SSloose_qcd_anti",channel+"_0SSloose_qcd_iso",channel+"_1SSloose_qcd_anti",channel+"_1SSloose_qcd_iso"]
ncat=14

if step=="mvisclosure":
categories=["mt_0jet_qcd_iso","mt_0jet_qcd_anti","mt_0jet_w_anti","mt_0jet_w_iso","mt_0jet_tt_iso","mt_0jet_tt_anti"]
categories=[channel+"_0jet_qcd_iso",channel+"_0jet_qcd_anti",channel+"_0jet_w_anti",channel+"_0jet_w_iso",channel+"_0jet_tt_iso",channel+"_0jet_tt_anti"]
ncat=6
file=ROOT.TFile("mvisclosure_mt.root","r")
file=ROOT.TFile("mvisclosure_"+channel+".root","r")

if step=="osss":
categories=["mt_0jet_qcd_iso","mt_0jet_qcd_anti"]
categories=[channel+"_0jet_qcd_iso",channel+"_0jet_qcd_anti"]
ncat=2
file=ROOT.TFile("OSSScorr_mt.root","r")
file=ROOT.TFile("OSSScorr_"+channel+".root","r")

for i in range (0,ncat):
Data=file.Get(categories[i]).Get("data_obs")
Expand Down
13 changes: 9 additions & 4 deletions FFcode/python/FFOSSScorrection.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,12 @@ def FFOSSScorrection(args):
[executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year],
[executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year],
[executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year],
[executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year],
[executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year],
[executable,path+'W.root',outputPath+'Wincl.root','W','W',args.year],
#[executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year],
[executable,path+'W1.root',outputPath+'W1.root','W','W',args.year],
[executable,path+'W2.root',outputPath+'W2.root','W','W',args.year],
[executable,path+'W3.root',outputPath+'W3.root','W','W',args.year],
[executable,path+'W4.root',outputPath+'W4.root','W','W',args.year],
[executable,path+'TT.root',outputPath+'TT.root','TT','TT',args.year],
[executable,path+'W4.root',outputPath+'W4.root','W','W',args.year],
[executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year],
[executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year],
[executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year],
Expand All @@ -121,6 +118,14 @@ def FFOSSScorrection(args):
#[executable,path+'Wall.root',outputPath+'WMC2.root','W','WMC',args.year],
[executable,path+'ggH125.root',outputPath+'ggH_htt125.root','ggH_htt125','ggH_htt125',args.year],
]
if args.channel == "mt":
commandParams.append([executable,'/data/aloeliger/SMHTT/smhmt2016_svfitted_25aug/DY3.root',outputPath+'DY3.root','DY','DY',args.year])
commandParams.append([executable,'/data/aloeliger/SMHTT/smhmt2016_svfitted_25aug/DY4.root',outputPath+'DY4.root','DY','DY',args.year])
commandParams.append([executable,'/data/aloeliger/SMHTT/smhmt2016_svfitted_25aug/TT.root',outputPath+'TT.root','TT','TT',args.year])
elif args.channel == "et":
commandParams.append([executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year])
commandParams.append([executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year])
commandParams.append([executable,path+'TT.root',outputPath+'TT.root','TT','TT',args.year])
haddFiles ={
'Data.root': [outputPath+'DataB.root',outputPath+'DataC.root',outputPath+'DataD.root',outputPath+'DataE.root',outputPath+'DataF.root',outputPath+'DataG.root',outputPath+'DataH.root'],
"DY.root": [outputPath+"DY.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"],
Expand Down
23 changes: 16 additions & 7 deletions FFcode/python/FFmvisclosure.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,26 +111,31 @@ def FFmvisclosure(args):
[executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year],
[executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year],
[executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year],
[executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year],
[executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year],
[executable,path+'W.root',outputPath+'Wincl.root','W','W',args.year],
[executable,path+'W1.root',outputPath+'W1.root','W','W',args.year],
[executable,path+'W2.root',outputPath+'W2.root','W','W',args.year],
[executable,path+'W3.root',outputPath+'W3.root','W','W',args.year],
[executable,path+'W4.root',outputPath+'W4.root','W','W',args.year],
[executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year],
[executable,path+'TT.root',outputPath+'TT.root','TT','TT',args.year],
[executable,path+'TT.root',outputPath+'TTMC.root','TT','TTMC',args.year],
[executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year],
[executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year],
[executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year],
[executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year],
[executable,path+'ST_t_antitop.root',outputPath+'ST_t_antitop.root','ST_t_antitop','ST',args.year],
[executable,path+'ST_t_top.root',outputPath+'ST_t_top.root','ST_t_top','ST',args.year],
[executable,path+'ST_tW_antitop.root',outputPath+'ST_tW_antitop.root','ST_tW_antitop','ST',args.year],
[executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year],
[executable,path+'Wall.root',outputPath+'WMC2.root','W','WMC2',args.year],
[executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year],
[executable,path+'ggH125.root',outputPath+'ggH_htt125.root','ggH_htt125','ggH_htt125',args.year],
]
if args.channel == "mt":
commandParams.append([executable,'/data/aloeliger/SMHTT/smhmt2016_svfitted_25aug/DY3.root',outputPath+'DY3.root','DY','DY',args.year])
commandParams.append([executable,'/data/aloeliger/SMHTT/smhmt2016_svfitted_25aug/DY4.root',outputPath+'DY4.root','DY','DY',args.year])
commandParams.append([executable,'/data/aloeliger/SMHTT/smhmt2016_svfitted_25aug/TT.root',outputPath+'TT.root','TT','TT',args.year])
commandParams.append([executable,'/data/aloeliger/SMHTT/smhmt2016_svfitted_25aug/TT.root',outputPath+'TT.root','TT','TTMC',args.year])
elif args.channel == "et":
commandParams.append([executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year])
commandParams.append([executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year])
commandParams.append([executable,path+'TT.root',outputPath+'TT.root','TT','TT',args.year])
commandParams.append([executable,path+'TT.root',outputPath+'TTMC.root','TT','TTMC',args.year])
haddFiles = {
"Data.root": [outputPath+"DataB.root",outputPath+"DataC.root",outputPath+"DataD.root",outputPath+"DataE.root",outputPath+"DataF.root"],
"DY.root": [outputPath+"DY.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"],
Expand All @@ -152,6 +157,10 @@ def FFmvisclosure(args):
#do our subtractions, and our fitting.
Subtract_prompt.Subtract_prompt(outputPath,args.channel)
os.system("root -l -b -q \'Fit_FFclosure_"+args.channel+".cc("+args.year+")\'")

#this one has to specifically be done here because the file for weighting doesn't even exist until the fits are done.
os.system(executable+" "+path+"Wall.root"+" "+outputPath+"WMC2.root W WMC2 "+args.year)

#make the final mvisclosure file
finalMvisClosureCommand = "hadd -f mvisclosure_"+args.channel+".root "
finalMvisClosureCommand+=outputPath+"Data.root "
Expand Down
13 changes: 9 additions & 4 deletions FFcode/python/RawFF.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,11 @@ def RawFF(args):
[executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year],
[executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year],
[executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year],
[executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year],
[executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year],
[executable,path+'W.root',outputPath+'Wincl.root','W','W',args.year],
[executable,path+'W1.root',outputPath+'W1.root','W','W',args.year],
[executable,path+'W2.root',outputPath+'W2.root','W','W',args.year],
[executable,path+'W3.root',outputPath+'W3.root','W','W',args.year],
[executable,path+'W4.root',outputPath+'W4.root','W','W',args.year],
[executable,path+'TT.root',outputPath+'TT.root','TT','TT',args.year],
[executable,path+'W4.root',outputPath+'W4.root','W','W',args.year],
[executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year],
[executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year],
[executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year],
Expand All @@ -118,6 +115,14 @@ def RawFF(args):
[executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year],
[executable,path+'ggH125.root',outputPath+'ggH_htt125.root','ggH_htt125','ggH_htt125',args.year],
]
if args.channel == "mt":
commandParams.append([executable,'/data/aloeliger/SMHTT/smhmt2016_svfitted_25aug/DY3.root',outputPath+'DY3.root','DY','DY',args.year])
commandParams.append([executable,'/data/aloeliger/SMHTT/smhmt2016_svfitted_25aug/DY4.root',outputPath+'DY4.root','DY','DY',args.year])
commandParams.append([executable,'/data/aloeliger/SMHTT/smhmt2016_svfitted_25aug/TT.root',outputPath+'TT.root','TT','TT',args.year])
elif args.channel == "et":
commandParams.append([executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year])
commandParams.append([executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year])
commandParams.append([executable,path+'TT.root',outputPath+'TT.root','TT','TT',args.year])
haddFiles ={
'Data.root': [outputPath+'DataB.root',outputPath+'DataC.root',outputPath+'DataD.root',outputPath+'DataE.root',outputPath+'DataF.root',outputPath+'DataG.root',outputPath+'DataH.root'],
"DY.root": [outputPath+"DY.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"],
Expand Down
4 changes: 4 additions & 0 deletions FFcode/scripts/MakeFFs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
if not os.path.isdir(os.environ['CMSSW_BASE']+"/src/ComputeFF2018/files_corr1FF_"+args.channel):
os.mkdir(os.environ['CMSSW_BASE']+"/src/ComputeFF2018/files_corr1FF_"+args.channel)

os.system("rm "+os.environ["CMSSW_BASE"]+"/src/ComputeFF2018/files_corrOSSSFF_"+args.channel+"/*.root")
os.system("rm "+os.environ["CMSSW_BASE"]+"/src/ComputeFF2018/files_rawFF_"+args.channel+"/*.root")
os.system("rm "+os.environ["CMSSW_BASE"]+"/src/ComputeFF2018/files_corr1FF_"+args.channel+"/*.root")

RawFF.RawFF(args)
FFmvisclosure.FFmvisclosure(args)
FFOSSScorrection.FFOSSScorrection(args)
Expand Down

0 comments on commit 8da392a

Please sign in to comment.