diff --git a/TopAnalysis/.gitignore b/TopAnalysis/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..6c983e14b1b333c3920517f4a21ac6ce7d70ba7a
--- /dev/null
+++ b/TopAnalysis/.gitignore
@@ -0,0 +1,5 @@
+**/macro
+**/test/analysis/VBFVectorBoson/
+**/grid
+ajafari.cc
+**/../CTPPSAnalysisTools
diff --git a/TopAnalysis/README.md b/TopAnalysis/README.md
index 5a6693bbc08ae7bb01e5aacb6e19273ceac054df..7768d3ae89563dadc0b71f3da9e3211849c58343 100644
--- a/TopAnalysis/README.md
+++ b/TopAnalysis/README.md
@@ -172,6 +172,26 @@ To plot the output of the local analysis you can run the following:
 ```
 python scripts/plotter.py -i analysis/   -j data/era2017/samples.json  -l 12870
 ```
+# BDT training
+This part currently works only for the VBF analysis. The signal and background trees must have been produced in the previous session by enabling "--mvatree" with "SEL" option.
+The training is done per category with the following command:
+```
+python scripts/trainVbfBDT --vbf nt=50:mns=5:md=3:abb=0.6:nc=1 --ext LowVPtHighMJJ --sig signal.root --bkg backgrounds.root --cat A:VBF --card LowVPtHighMJJCard
+```
+The example above is for "LowVPtHighMJJ" category. Once happy with the training, 
+```
+cp vbf/weights/LowVPtHighMJJ_BDT_VBF0LowVPtHighMJJ* test/analysis/VBF_weights
+```
+Update src/VBFVectorBoson.cc accordingly and compile.
+
+## Transformed BDT
+To make the background BDT distribution flat, following steps must be followed:
+   * Produce plots with the compiled version of the code including new BDT weights (see Local analysis) and
+     ```
+     cd test/analysis/VBF_weights
+     python getInverseCDFFromPlotter.py PATH_TO_plotter.root
+     ```
+   * Reproduce the plots to have the proper flat BDT distribution of background
 
 # Preparation of the data cards and workspaces
 
@@ -180,3 +200,20 @@ This part currently works only for the VBF analysis. It assumes that there are r
 python scripts/makeWorkspace.py --Chan LowVPtHighMJJ --Hist vbfmva --nBin 20 --year 2016 --shapeOnly --doSignalPH
 ```
 The input histogram will be rebinned to have five bins. If you remove "--doSignalPH", the signal process in the signal and control region will NOT be connected via the transfer function (TF). Note that the TF part is not developed fully since it is statistics limited. "--shapeOnly" is to disentangle the shape and rate systematics for non-TF version.
+# Photon fake rate estimation and distributions
+The method is explained in AN-18-046. The FR is measured in bins of mjj separately for photons in the barrel and endcap. It is measured in a control region (CR) which has the same selection as the signal region except the 2nd jet that is required to ```fail``` the loose pileup identification.
+## Input data for FR measurement
+   * Photon data (HighVPt categories): add ```--CR``` to the SEL option in steerVBFVectorBoson.sh
+   * Jet data (LowVPt category): run steerVBFVectorBoson.sh with SELJETHT in which ```--CR``` is a default input
+## Input templates for FR measurement
+   * Tight template: the output of running default SEL option in steerVBFVectorBoson.sh on GJet samples
+   * Fake template: the output of running SELJETHT option with ```-q QCDTemp``` argument in steerVBFVectorBoson.sh
+## Fake rate estimation
+   * Run the command below on the output of the aforementioned steps:
+```
+python scripts/createFakeRatio.py --fGdata PHOTON-DATA --fJdata JETHT-DATA --fJQCD JETHT-DATA-QCDTEMP --fGMC GJET-MC --cats HighVPtHighMJJA:HighVPtLowMJJA:LowVPtHighMJJA
+```
+   * Copy the output ```fakeRatios.root``` to data/eraYEAR
+## Fake rate application
+Here the distributions of not-tight photons are scaled by the estimated FR. The distributions can be used then in plotting. Need to activate ```--SRfake``` for the SEL option in steerVBFVectorBoson.sh and run on SinglePhoton data
+
diff --git a/TopAnalysis/bin/runFRcalculation.cc b/TopAnalysis/bin/runFRcalculation.cc
index d6ccd4815a1ae2b12eaa1da55030345fc73bb989..97400ecfef8118cfa1b4865b773956eeafd5aea0 100644
--- a/TopAnalysis/bin/runFRcalculation.cc
+++ b/TopAnalysis/bin/runFRcalculation.cc
@@ -1,7 +1,22 @@
 #include "TopLJets2015/TopAnalysis/interface/FRcalculationVBF.h"
+#include "TChain.h"
+#include "TFile.h"
+#include "TTree.h"
+#include "TString.h"
+#include "TObjString.h"
+#include "TSystem.h"
+#include "TROOT.h"
+#include "TMVA/Tools.h"
+#include "TMVA/Factory.h"
+#include "TMVA/DataLoader.h"
+#include "TMVA/TMVARegGui.h"
+ 
+using namespace std;
+using namespace TMVA;
 int main( int argc, char** argv )
 {
   TString fGammaData("Data13TeV_SinglePhoton_2017.root"), fJetData("Data13TeV_JetHT_2017.root"), fJetQCD("Data13TeV_JetHTQCD_2017.root"), fGammaMC("MC13TeV_GJets.root");
+  std::string categories;
   for (int i=1; i<argc; i++) {
     TString input(argv[i]);
     if ( input=="--fGdata"){
@@ -20,15 +35,23 @@ int main( int argc, char** argv )
       i++;
       fGammaMC = TString(argv[i]);
       continue;
-    } 
+    } else if( input == "--cats"){
+      i++;
+      categories = std::string(argv[i]);
+    }
+  }
+  std::vector<TString> cats = TMVA::gTools().SplitString( categories, ':' );
+  for(unsigned int icat = 0; icat < cats.size(); icat++){
+    cout << cats[icat]<<endl;
+    //HighMJJ: bias from VBF trigger --> use jet data
+    if(cats[icat].Contains("LowVPtHighMJJ")){ 
+      promptEstimator(fJetData,cats[icat], "EB", fGammaMC, fJetQCD);
+      continue;
+    }
+    promptEstimator(fGammaData,cats[icat], "EB", fGammaMC, fJetQCD);
+    promptEstimator(fGammaData,cats[icat], "EE", fGammaMC, fJetQCD);
   }
-  //HighMJJ: bias from VBF trigger --> use jet data
-  promptEstimator(fJetData,"HighMJJA", "EB", fGammaMC, fJetQCD);
 
-  //LowMJJ: barrel
-  promptEstimator(fGammaData,"LowMJJA", "EB", fGammaMC, fJetQCD);
-  //LowMJJ: endcap
-  promptEstimator(fGammaData,"LowMJJA", "EE", fGammaMC, fJetQCD);
 
   makeFile();
   return 0;
diff --git a/TopAnalysis/bin/runWorkspaceProvider.cc b/TopAnalysis/bin/runWorkspaceProvider.cc
index c7ab793198780c223b7a9bf886fd47c4020f8ad1..0484473463072eb50907ff4cf57c7b184519ddf7 100644
--- a/TopAnalysis/bin/runWorkspaceProvider.cc
+++ b/TopAnalysis/bin/runWorkspaceProvider.cc
@@ -64,6 +64,6 @@ int main( int argc, char** argv )
   // wsp.makeCard(YE, TString("A"), doSignalPH, sigEff, bkgEff);
   // wsp.makeCard(YE, TString("MM"), doSignalPH, sigEff, bkgEff);
   wsp.makeCardNLO(YE, TString("A"));
-  wsp.plotSystSig();
+  //wsp.plotSystSig();
   return 0;
 }
diff --git a/TopAnalysis/data/era2017/fakeRatios.root b/TopAnalysis/data/era2017/fakeRatios.root
index bcc9eb977c7ee5a63dfaebd544e64335f7bffc2a..f54c9e86e19a7e48ca48d06290a63cffd1a4b9eb 100644
Binary files a/TopAnalysis/data/era2017/fakeRatios.root and b/TopAnalysis/data/era2017/fakeRatios.root differ
diff --git a/TopAnalysis/interface/FRcalculationVBF.h b/TopAnalysis/interface/FRcalculationVBF.h
index 9d12a2a4595abb8315fff4d5209a5c05fa0dc4ea..fdb25212f1151c591eec40cd840d40da8474b87a 100644
--- a/TopAnalysis/interface/FRcalculationVBF.h
+++ b/TopAnalysis/interface/FRcalculationVBF.h
@@ -15,13 +15,22 @@
 #include <vector>
 #include <iostream>
 #include <sstream>
-
-
+#include <string>
 
 using namespace RooFit;
 using namespace std;
+
+TString corrCat(TString dataset, TString cat){
+  if(dataset.Contains("JetHT") && cat.Contains("HighVPt")){
+    cat = "HighVPtHighMJJA";
+  }
+  return cat;
+}
+
 void fixZeroBins(TH1D * h){
+  cout<<h->GetName()<<endl;
   for(int i = 0; i < h->GetXaxis()->GetNbins(); i++){
+    cout<<h->GetBinContent(i+1) <<endl;
     if(h->GetBinContent(i+1) == 0) h->SetBinContent(i+1, 0.1);
   }
 }
@@ -41,8 +50,17 @@ TH1D* mergeBin(TH1D * h){
 
 TH1D*  rawFRMaker(TH1D& Num1, TH1D& Den1, TString fname = "Data13TeV_SinglePhoton_2017.root", TString catName = "LowMJJA", TString det = "EB"){
   TFile * f = TFile::Open(fname);
-  TH2D * Num = (TH2D*)f->Get(catName+"_tightMjj"+det);
-  TH2D * Den = (TH2D*)f->Get(catName+"_looseMjj"+det);
+  TString tmpCat = corrCat(fname,catName);
+  TH2D * Num = (TH2D*)f->Get(tmpCat+"_tightMjj"+det);
+  TH2D * Den = (TH2D*)f->Get(tmpCat+"_looseMjj"+det);
+  if(tmpCat == catName && catName == "HighVPtA"){
+    Num = (TH2D*)f->Get("HighVPtHighMJJA_tightMjj"+det);
+    Den = (TH2D*)f->Get("HighVPtHighMJJA_looseMjj"+det);
+    TH2D * tmpNum = (TH2D*)f->Get("HighVPtLowMJJA_tightMjj"+det);
+    TH2D * tmpDen = (TH2D*)f->Get("HighVPtLowMJJA_looseMjj"+det);
+    Num->Add(tmpNum);
+    Den->Add(tmpDen);
+  }
 
   Num1 = *((TH1D*)Num->ProjectionY("rawNum"));
   Den1 = *((TH1D*)Den->ProjectionY("Den"));
@@ -52,20 +70,25 @@ TH1D*  rawFRMaker(TH1D& Num1, TH1D& Den1, TString fname = "Data13TeV_SinglePhoto
 }
 
 void makeFile(){
-  TFile * f1 = TFile::Open("LowMJJA_FR_EE.root");
-  TFile * f2 = TFile::Open("LowMJJA_FR_EB.root");
-  TFile * f3 = TFile::Open("HighMJJA_FR_EB.root");
-  TH1D * h1 = (TH1D*)f1->Get("fracRatio_Merged");
-  h1->SetName("LowMJJ_EE");
-  TH1D * h2 = (TH1D*)f2->Get("fracRatio_Merged");
-  h2->SetName("LowMJJ_EB");
-  TH1D * h3 = (TH1D*)f3->Get("fracRatio");
-  h3->SetName("HigMJJ_EB");
+  const int nCat = 4;
+  TString cats[nCat] = {"LowVPtHighMJJ","HighVPtHighMJJ","HighVPtLowMJJ","HighVPt"};
+  TString det[2] = {"EB","EE"};
+  std::vector<TH1D*> hists;
+  for(int iCat = 0; iCat < nCat; iCat++){
+    for(int iDet = 0; iDet < 2; iDet++){
+      TFile * f = TFile::Open(cats[iCat]+"A_FR_"+det[iDet]+".root");
+      if(f){
+	TH1D * h = (TH1D*) f->Get("fracRatio_Merged");
+	h->SetName(cats[iCat]+"_"+det[iDet]);
+	hists.push_back(h);
+      }
+    }
+  }
+
   TFile * f = new TFile("fakeRatios.root","recreate");
   f->cd();
-  h1->Write();
-  h2->Write();
-  h3->Write();
+  for(unsigned int iHist = 0; iHist < hists.size(); iHist++)
+    hists[iHist]->Write();
   f->Close();
 }
 
@@ -74,7 +97,21 @@ void promptEstimator(TString dataname = "Data13TeV_SinglePhoton_2017.root", TStr
   if (det == "EE")
     pHigh = 0.0271;
   TFile * fD = TFile::Open(dataname);
-  TH2D * data = (TH2D*)fD->Get(catName+"_relaxedTightMjj"+det);
+  TString tmpCat = corrCat(dataname,catName);
+  TH2D * data = 0;
+  TString gDataHist("relaxedTightMjj"),qcdDataHist("tmpQCDMjj"),gMCHist("tightMjj");
+  //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+  // tmpQCD <--> relaxedTight
+  //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+  if(tmpCat == catName && catName == "HighVPtA"){
+    data = (TH2D*)fD->Get("HighVPtHighMJJA_"+gDataHist+det);   
+    TH2D * tmpdata = (TH2D*)fD->Get("HighVPtLowMJJA_"+gDataHist+det);      
+    data->Add(tmpdata);
+  } else data = (TH2D*)fD->Get(tmpCat+"_"+gDataHist+det);
+  if(!data) {   
+    cout << "Wrong category name "<< catName<<endl;
+    return;
+  }
   std::vector<TH1D*> dataSihih;
   std::vector<double> trueNData;
   for(int i = 0; i<4; i++){
@@ -86,7 +123,12 @@ void promptEstimator(TString dataname = "Data13TeV_SinglePhoton_2017.root", TStr
   TH1D * tmpMJJ = (TH1D*)data->ProjectionY("DataMJJ");
   RooRealVar sihih("sihih","sihih",0,0.1);
   TFile * fP = TFile::Open(pname);
-  TH2D * prompt2 = (TH2D*)fP->Get(catName+"_tightMjj"+det);
+  TH2D * prompt2 = (TH2D*)fP->Get(catName+"_"+gMCHist+det);
+  if(catName == "HighVPtA"){
+    prompt2 = (TH2D*)fP->Get("HighVPtHighMJJA_"+gMCHist+det);
+    TH2D * tmpPrompt2 = (TH2D*)fP->Get("HighVPtLowMJJA_"+gMCHist+det);
+    prompt2->Add(tmpPrompt2);
+  }
   TH1D * prompt = (TH1D*)prompt2->ProjectionX("Prompt");  
   prompt->Scale(1/prompt->Integral());
   double pFrac = prompt->Integral(1,prompt->GetXaxis()->FindBin(pHigh)); 
@@ -95,8 +137,11 @@ void promptEstimator(TString dataname = "Data13TeV_SinglePhoton_2017.root", TStr
   RooDataHist dP("dP","dP",sihih,Import(*prompt));
   RooHistPdf promptPdf("promptPdf","promptPdf",sihih,dP,0) ;
   TFile * fQ = TFile::Open(qcd);
-  TH2D * QCD2 = (TH2D*)fQ->Get(catName+"_allMjj"+det);
-  //TH2D * QCD2 = (TH2D*)fD->Get(catName+"_tmpQCDMjj"+det);
+  tmpCat = corrCat(qcd,catName);
+  TH2D * QCD2 = (TH2D*)fQ->Get(tmpCat+"_"+qcdDataHist+det);
+
+  //  TH2D * QCD2 = (TH2D*)fD->Get(tmpCat+"_tmpQCDMjj"+det);
+
   TH1D * QCD = (TH1D*)QCD2->ProjectionX("QCD");
   QCD->Scale(1/QCD->Integral());
   double fFrac = QCD->Integral(1,QCD->GetXaxis()->FindBin(pHigh)); 
@@ -109,6 +154,7 @@ void promptEstimator(TString dataname = "Data13TeV_SinglePhoton_2017.root", TStr
   TH1D* nPrompt        = (TH1D*)tmpMJJ->Clone("nPrompt");
   TH1D* nFake          = (TH1D*)tmpMJJ->Clone("nFake");
   TH1D* fakeFraction   = (TH1D*)tmpMJJ->Clone("fakeFraction");
+
   for(unsigned int i =0; i<dataSihih.size();i++){
     cout <<"Number of entries: "<<dataSihih[i]->GetEntries()<<endl;
     dataSihih[i]->Rebin(4);
diff --git a/TopAnalysis/scripts/createFakeRatio.py b/TopAnalysis/scripts/createFakeRatio.py
old mode 100644
new mode 100755
index e0f2e94231d033d857729739332831364711cb11..a199ea320f2fa4e7a269a47c8129b3b37aeb44ab
--- a/TopAnalysis/scripts/createFakeRatio.py
+++ b/TopAnalysis/scripts/createFakeRatio.py
@@ -15,12 +15,14 @@ Wrapper to be used when run in parallel
 """
 def RunMethodPacked(args):
 
-
-    fGammaData, fJetData, fJetQCD, fGammaMC=args
+    gData,jData,jQCD,gMC,cats=args
     print args
-
+    print 'Running with photon data ',gData,' and photon MC ',gMC 
+    print 'The JetData is ', jData, ' and ', jQCD, ' has teh QCD template'
+    print 'Fake rates will be provided for these categories', cats
     try:
-        cmd='runFRcalculation --fGdata %s --fJdata %s --fJQCD %s --fGMC %s' %(fGammaData,fJetData,fJetQCD,fGammaMC)
+        cmd='runFRcalculation --fGdata %s --fJdata %s --fJQCD %s --fGMC %s --cats %s' %(gData,jData,jQCD,gMC,cats)        
+        print '>>>>>>'
         print(cmd)
         os.system(cmd)
     except :
@@ -37,10 +39,11 @@ def main():
     #configuration
     usage = 'usage: %prog [options]'
     parser = optparse.OptionParser(usage)
-    parser.add_option('', '--fGdata',      dest='fGammaData',        help='Photon data from CR [%default]',                                         default='Data13TeV_SinglePhoton_2017.root',                    type='string')
-    parser.add_option('', '--fJdata',      dest='fJetData',     help='Jet data from CR [%default]',                                    default='Data13TeV_JetHT_2017.root',                           type='string')
-    parser.add_option('', '--fJQCD',       dest='fJetQCD',       help='Data for QCD photon template  [%default]',                                         default='Data13TeV_JetHTQCD_2017.root',                            type='string')
-    parser.add_option('', '--fGMC',        dest='fGammaMC',         help='MC for prompt photon template  [%default]',             default='MC13TeV_GJets.root',       type='string')
+    parser.add_option(''  , '--fGdata',     dest='gData',        help='Photon data in signal region [%default]',      default='Data13TeV_SinglePhoton_2017.root',          type='string')
+    parser.add_option(''  , '--fJdata',     dest='jData',        help='Jet data from control region [%default]',      default='Data13TeV_JetHT_2017.root',                 type='string')
+    parser.add_option(''  , '--fJQCD',      dest='jQCD',         help='Jet data for QCD templates [%default]',        default='Data13TeV_JetHTQCD_2017.root',              type='string')
+    parser.add_option(''  , '--fGMC',       dest='gMC',          help='Photon MC in signal region [%default]',        default='MC13TeV_GJets.root',                        type='string')
+    parser.add_option(''  , '--cats',       dest='cats',         help='selection categories [%default]',              default='HighVPtA',                                  type='string')
 
 
 
@@ -48,7 +51,7 @@ def main():
     print opt
     print args
 
-    args = [opt.fGammaData,opt.fJetData,opt.fJetQCD,opt.fGammaMC]
+    args = [opt.gData,opt.jData,opt.jQCD,opt.gMC,opt.cats]
     RunMethodPacked(args)
     
 """
diff --git a/TopAnalysis/scripts/trainVbfBDT.py b/TopAnalysis/scripts/trainVbfBDT.py
new file mode 100755
index 0000000000000000000000000000000000000000..854764ffb2a2a9a11f93cd1d8a13be8bb16ecbf7
--- /dev/null
+++ b/TopAnalysis/scripts/trainVbfBDT.py
@@ -0,0 +1,62 @@
+
+import os
+import sys
+import optparse
+import ROOT
+import pickle
+from collections import OrderedDict
+import json
+import re
+import commands
+from TopLJets2015.TopAnalysis.storeTools import *
+from TopLJets2015.TopAnalysis.batchTools import *
+
+"""
+Wrapper to be used when run in parallel
+"""
+def RunMethodPacked(args):
+
+    options,extention,signal,background,category,card=args
+    print args
+    print 'Running with options ',options,' in ',category, ' category'
+    print 'The extention is ', extention, ' and the card is ', card
+    print 'Signal input is ',signal, ' and background input is ', background
+    try:
+        cmd='runTMVAClassification --vbf %s --ext %s --sig %s --bkg %s --cat %s --card %s' %(options,extention,signal,background,category,card)        
+        print '>>>>>>'
+        print(cmd)
+        os.system(cmd)
+    except :
+        print 50*'<'
+        print " Something is wrong! "
+        print 50*'<'
+        return False
+    return True
+
+"""
+"""
+def main():
+
+    #configuration
+    usage = 'usage: %prog [options]'
+    parser = optparse.OptionParser(usage)
+    parser.add_option(''  , '--vbf',        dest='options',      help='options for BDT training [%default]',                default='nt=50:mns=5:md=3:abb=0.6:nc=1',                       type='string')
+    parser.add_option(''  , '--ext',        dest='extention',    help='extention for the weight file [%default]',           default='LowVPtHighMJJ',                                       type='string')
+    parser.add_option(''  , '--sig',        dest='signal',       help='signal file name  [%default]',                       default='signal.root',                                         type='string')
+    parser.add_option(''  , '--bkg',        dest='background',  help='background file name [%default]',                    default='backgrounds.root',                                    type='string')
+    parser.add_option(''  , '--cat',        dest='category',     help='selection category [%default]',                      default='A:VBF',                                               type='string')
+    parser.add_option(''  , '--card',       dest='card',         help='card name including input variables [%default]',     default='LowVPtHighMJJCard',                                   type='string')
+
+
+    (opt, args) = parser.parse_args()
+    print opt
+    print args
+
+    args = [opt.options,opt.extention,opt.signal,opt.background,opt.category,opt.card]
+    RunMethodPacked(args)
+    
+"""
+for execution from another script
+"""
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/TopAnalysis/src/SelectionTools.cc b/TopAnalysis/src/SelectionTools.cc
index 47a8c94ccff6a66b60d576e7af709429fc918968..ee6ba382abbf6d145e86fa67c66449130a0e3c79 100644
--- a/TopAnalysis/src/SelectionTools.cc
+++ b/TopAnalysis/src/SelectionTools.cc
@@ -99,26 +99,20 @@ TString SelectionTool::flagFinalState(MiniEvent_t &ev, std::vector<Particle> pre
 	  if( ch==13*13 && fabs(mll-91)<15 && (tightLeptons[0].pt()>30 || tightLeptons[1].pt()>30)) chTag="MM";          
 	  leptons_=tightLeptons;
 	} else {
-	  if (!isSRfake) {
-	    if( tightPhotons.size()>=1){
-	      chTag="A";
-	      leptons_   =tightLeptons;
-	      photons_   =tightPhotons;
-	    }
-	  } else {
-	    if(fakePhotons.size()>=1){
-	      chTag="A";
-	      leptons_   =tightLeptons;
-	      photons_   =tightPhotons;
-	    }
+	  bool passPhoton = (!isSRfake && tightPhotons.size()>=1) || (isSRfake && fakePhotons.size()>=1);
+	  if(passPhoton){
+	    chTag="A";
+	    leptons_   =tightLeptons;
 	  }
+	  if(isSRfake) photons_   = fakePhotons;
+	  else         photons_   = tightPhotons;
 	}
       } else {
 	if(isSRfake) return "";
-	bool passPhoton = (!isSRfake && !isQCDTemp && inclusivePhotons.size()>=1) || (!isSRfake && isQCDTemp && tmpPhotons.size()>=1);
+	bool passPhoton = (!isQCDTemp && inclusivePhotons.size()>=1) || (isQCDTemp && tmpPhotons.size()>=1);
 	if(passPhoton) {
 	  chTag="A";
-	  if(!isQCDTemp) photons_   =inclusivePhotons;
+	  if(!isQCDTemp)      photons_   =inclusivePhotons;
 	  else                photons_   =tmpPhotons;
 	  //cout<< "Number of very loose photons: "<<photons_.size()<<endl;
 	  leptons_   =tightLeptons;
diff --git a/TopAnalysis/src/VBFVectorBoson.cc b/TopAnalysis/src/VBFVectorBoson.cc
index c94d52c51b30fb699e7bb6bbc49e2cfd0ebab7c3..b1d5167af68172ef6c9d9ce0f11df2b36638d398 100644
--- a/TopAnalysis/src/VBFVectorBoson.cc
+++ b/TopAnalysis/src/VBFVectorBoson.cc
@@ -259,8 +259,8 @@ void VBFVectorBoson::runAnalysis()
         
         //select photons
         photons_              = selector_->selPhotons(allPhotons, SelectionTool::TIGHT, leptons);   
-        relaxedTightPhotons_  = selector_->selPhotons(allPhotons,SelectionTool::QCDTEMP, leptons);
-        tmpPhotons_           = selector_->selPhotons(allPhotons,SelectionTool::RELAXEDTIGHT, leptons);     
+        relaxedTightPhotons_  = selector_->selPhotons(allPhotons,SelectionTool::RELAXEDTIGHT, leptons);
+        tmpPhotons_           = selector_->selPhotons(allPhotons,SelectionTool::QCDTEMP, leptons);     
 	inclusivePhotons_     = selector_->selPhotons(allPhotons,SelectionTool::CONTROL, leptons);
 	for(auto a : inclusivePhotons_) {
 	  int idx = a.originalReference();
@@ -280,7 +280,7 @@ void VBFVectorBoson::runAnalysis()
 	    if(fakePhotons_.size()>=1){
 	      chTag="A";
 	      photons_.clear();
-	      photons_   =fakePhotons_;
+	      photons_   = fakePhotons_;
 	    }
 	  }
 	} else {
@@ -290,7 +290,7 @@ void VBFVectorBoson::runAnalysis()
 	    chTag="A";
 	    photons_.clear();
 	    if(!QCDTemp_)      photons_   =inclusivePhotons_;
-	    else                photons_   =tmpPhotons_;
+	    else               photons_   =tmpPhotons_;
 	  }
 	}
 
@@ -315,18 +315,17 @@ void VBFVectorBoson::runAnalysis()
         }
         
         //MC truth for the selected photons
-        for(auto a : photons_) {
-          int idx=a.originalReference();
-          bool isPrompt(ev_.gamma_isPromptFinalState[idx]);
-          if (selector_->isFakePhoton(ev_,idx)) {
-            fakeACR.push_back(a);
-            mults[isPrompt ? "looseprompt" : "loosefake"]++;	 
-          } else if (a.hasQualityFlag(SelectionTool::TIGHT)){
-            tightACR.push_back(a);
-            mults[isPrompt ? "tightprompt" : "tightfake"]++;
-          }
-        }
-
+	for(auto a : photons_) {
+	  int idx=a.originalReference();
+	  bool isPrompt(ev_.gamma_isPromptFinalState[idx]);
+	  if (selector_->isFakePhoton(ev_,idx)){
+	    fakeACR.push_back(a);
+	    mults[isPrompt ? "looseprompt" : "loosefake"]++;
+	  } else if (selector_->isTight(ev_,idx)){
+	    tightACR.push_back(a);
+	    mults[isPrompt ? "tightprompt" : "tightfake"]++;
+	  }
+	}
       }
 
       //no interesting channel has been found
@@ -463,9 +462,11 @@ void VBFVectorBoson::runAnalysis()
       }
       
       //fake rate
-      if(ev_.isData && chTag=="A" && SRfake_ && (cat[4]||cat[5])) {
-        cout << "Fake Rate will be applied! " <<endl;
-        TString FRcat(cat[5] ? "LowMJJ" : "HighMJJ");
+      bool FRmeasured(chTags.size() > 1);
+      if(ev_.isData && chTag=="A" && SRfake_ && FRmeasured) {
+	TString FRcat( baseCategory);
+	FRcat.Remove(FRcat.First(chTag),1);
+        cout << "Fake Rate will be applied in "<<baseCategory<<" with FRcat of "<<FRcat <<endl;
         plotwgts[0]*=fr_->getWeight(FRcat, vbfVars_.mjj, photons_[0].Eta());
       }
 
diff --git a/TopAnalysis/test/analysis/steerVBFVectorBoson.sh b/TopAnalysis/test/analysis/steerVBFVectorBoson.sh
index a3c528077c2501fcee5c3a6c73234529395f457b..82f304160a432068f711a42f97e1ef927872e10d 100644
--- a/TopAnalysis/test/analysis/steerVBFVectorBoson.sh
+++ b/TopAnalysis/test/analysis/steerVBFVectorBoson.sh
@@ -67,7 +67,7 @@ case $WHAT in
 	python scripts/runLocalAnalysis.py \
             -i ${input} -o ${output} --tag ${tag} --only ${tag} --mvatree\
             --njobs 8 -q local --genWeights genweights_${githash}.root \
-            --era era${ERA} -m VBFVectorBoson::RunVBFVectorBoson --ch 0 --runSysts --debug;
+            --era era${ERA} -m VBFVectorBoson::RunVBFVectorBoson --ch 0 --runSysts --debug --SRfake ;
 
         #--debug --mvatree \
         ./scripts/mergeOutputs.py ${output};
@@ -105,11 +105,11 @@ case $WHAT in
         fi
 	echo ${json}
 	python scripts/runLocalAnalysis.py \
-	    -i ${eosdir}  \ #${json} \
+      	    -i ${eosdir}  \ #${json} \
             -o ${outdir}/${githash}/${EXTRA} \
             --farmappendix ${githash} \
             -q ${queue} --genWeights genweights_${githash}.root \
-            --era era${ERA} -m VBFVectorBoson::RunVBFVectorBoson --ch 0 --runSysts --skipexisting ${extraOpts};
+            --era era${ERA} -m VBFVectorBoson::RunVBFVectorBoson --ch 0 --runSysts --CR --skipexisting ${extraOpts};
 	;;
 
     SELTRIGEFF )
@@ -144,7 +144,7 @@ case $WHAT in
 
 
     MERGE )
-	./scripts/mergeOutputs.py ${outdir}/${githash}/${EXTRA};
+	./scripts/mergeOutputs.py ${outdir}/${githash}/${EXTRA}${QCD};
 	;;
 
     MERGETRIGEFF )