7 |
|
#include "FWCore/ParameterSet/interface/ParameterSet.h" |
8 |
|
#include "MitPhysics/Utils/interface/TauIsoMVA.h" |
9 |
|
#include "MitCommon/MathTools/interface/MathUtils.h" |
10 |
+ |
#include "CondFormats/EgammaObjects/interface/GBRForest.h" |
11 |
+ |
#include "Cintex/Cintex.h" |
12 |
+ |
#include <utility> |
13 |
|
|
14 |
|
ClassImp(mithep::TauIsoMVA) |
15 |
|
|
67 |
|
fReader->AddSpectator("jet_pt", (Float_t *)0); |
68 |
|
fReader->AddSpectator("pv", (Float_t *)0); |
69 |
|
fReader->BookMVA ("BDTG", iWeightFile); |
70 |
+ |
fGBR = false; |
71 |
+ |
} |
72 |
+ |
void TauIsoMVA::InitializeGBR( TString iWeightFile) { |
73 |
+ |
ROOT::Cintex::Cintex::Enable(); |
74 |
+ |
TFile *lForest = new TFile(iWeightFile,"READ"); |
75 |
+ |
fGBRReader = (GBRForest*)lForest->Get("gbrfTauIso"); |
76 |
+ |
lForest->Close(); |
77 |
+ |
fGBR = true; |
78 |
|
} |
79 |
|
double TauIsoMVA::MVAValue(const PFTau *iTau,double iRho) { |
80 |
|
IsoRings lRings = computeIsoRings(iTau); |
81 |
|
std::vector<float> mvainput = lRings.getVector(); |
82 |
|
mvainput.push_back( iRho); |
83 |
< |
mvainput.insert(mvainput.end(), 6, 0); |
84 |
< |
return fReader->EvaluateMVA(mvainput, "BDTG"); |
83 |
> |
if(!fGBR) mvainput.insert(mvainput.end(), 6, 0); |
84 |
> |
if(!fGBR) return fReader->EvaluateMVA(mvainput, "BDTG"); |
85 |
> |
return fGBRReader->GetClassifier(&mvainput[0]); |
86 |
|
} |
87 |
|
TauIsoMVA::IsoRings TauIsoMVA::computeIsoRings(const PFTau *iTau) { |
88 |
|
std::vector<int> niso (3); |