Skip to content

Commit

Permalink
adding code for NLO weights
Browse files Browse the repository at this point in the history
  • Loading branch information
awhitbeck committed May 15, 2017
1 parent bec9087 commit 2d1e9bf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Binary file added data/kfactors.root
Binary file not shown.
33 changes: 32 additions & 1 deletion src/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,43 @@
#include "TH1F.h"
#include "TFile.h"

// ==============================================
// class for loading and retrieving GJets NLO
// weights
// ----------------------------------------------
enum NLO_weight_type {kLO,kNLO,kUpVar,kDnVar};

class NLO_weights{
public:
TFile* inputFile;
TH1F *LO,*NLO,*UpVar,*DnVar;
vector<TH1F*> histo;

NLO_weights(){
inputFile = new TFile("../data/kfactors.root");
LO = (TH1F*) inputFile->Get("GJets_LO/inv_pt_G");
NLO = (TH1F*) inputFile->Get("GJets_1j_NLO/nominal_G");
UpVar = (TH1F*) inputFile->Get("GJets_1j_NLO/ren_up_G");
DnVar = (TH1F*) inputFile->Get("GJets_1j_NLO/ren_down_G");
histo.push_back(LO);
histo.push_back(NLO);
histo.push_back(UpVar);
histo.push_back(DnVar);
}

double get(double pt, NLO_weight_type weightType=kLO){
return histo[weightType]->GetBinContent(histo[weightType]->FindBin(pt));
}
};

// ==============================================

// constants
// ==============================================
double bbtagCut = 0.4;
TFile* puWeightFile = new TFile("../data/PileupHistograms_0121_69p2mb_pm4p6.root");
TH1F* puWeightHist = (TH1F*) puWeightFile->Get("pu_weights_central");
NLO_weights NLOw;
// ==============================================

double CalcdPhi( double phi1 , double phi2 ){
Expand All @@ -21,7 +53,6 @@ double CalcdPhi( double phi1 , double phi2 ){

}


template<typename ntupleType>void ntupleBranchStatus(ntupleType* ntuple){
ntuple->fChain->SetBranchStatus("*",0);
ntuple->fChain->SetBranchStatus("Jets",1);
Expand Down

0 comments on commit 2d1e9bf

Please sign in to comment.