diff --git a/interface/FRWeights.h b/interface/FRWeights.h new file mode 100644 index 000000000..34ec16174 --- /dev/null +++ b/interface/FRWeights.h @@ -0,0 +1,23 @@ +#ifndef FRWEIGHTS_H +#define FRWEIGHTS_H + +#include +#include "TFile.h" +#include "TGraphErrors.h" + +class FRWeights +{ + public: + FRWeights(); + ~FRWeights(); + + bool init(const std::string& WeightsFileName); + double getWeight(const std::string& cat ,const std::string& bin, const std::string& var,const std::string& wrt ,const double& pT); + + private: + TFile* WeightsFile; + +}; + +#endif + diff --git a/src/FRWeights.cc b/src/FRWeights.cc new file mode 100644 index 000000000..f10645998 --- /dev/null +++ b/src/FRWeights.cc @@ -0,0 +1,49 @@ +#include "UserCode/llvv_fwk/interface/FRWeights.h" +#include +#include +#include +#include +#include + +using namespace std; + +/*****************************************************************/ +FRWeights::FRWeights() +/*****************************************************************/ +{ +} + +/*****************************************************************/ +FRWeights::~FRWeights() +/*****************************************************************/ +{ +} + +/*****************************************************************/ +bool FRWeights::init(const string& WeightsFileName) +/*****************************************************************/ +{ + WeightsFile = TFile::Open(WeightsFileName.c_str()); + if(!WeightsFile) { + cout<<"ERROR: Cannot open weights file "<Get((cat+"FRWeights"+var+bin+wrt).c_str()); + double result=-1.; + if(graph){ + result=(1 - graph->Eval(pT)); + } else { + result = 1; + } + + return result; +}