1 |
dkralph |
1.2 |
#ifndef BDTIFACE
|
2 |
|
|
#define BDTIFACE
|
3 |
|
|
|
4 |
khahn |
1.1 |
#include <TFile.h> // file handle class
|
5 |
|
|
#include <TString.h>
|
6 |
|
|
#include <TTree.h> // class to access ntuples
|
7 |
|
|
#include <TChain.h> // class to access ntuples
|
8 |
dkralph |
1.2 |
#include <TRegexp.h>
|
9 |
|
|
#include <stdio.h>
|
10 |
khahn |
1.1 |
#include <iostream> // standard I/O
|
11 |
|
|
#include <iomanip> // functions to format standard I/O
|
12 |
|
|
#include <fstream> // functions for file I/O
|
13 |
|
|
#include <sstream> // class for parsing strings
|
14 |
|
|
#include <math.h>
|
15 |
|
|
#include <cassert>
|
16 |
|
|
#include <map>
|
17 |
|
|
|
18 |
|
|
#include "TMVA/Reader.h"
|
19 |
|
|
using namespace std;
|
20 |
|
|
|
21 |
|
|
class bdtiface
|
22 |
|
|
{
|
23 |
|
|
public:
|
24 |
dkralph |
1.2 |
bdtiface(TString weightDir="", TString cutfile="", TString method="BDTG", TString varfile="");
|
25 |
khahn |
1.1 |
void readBDTCuts(TString file);
|
26 |
dkralph |
1.2 |
void getxmlvars(); // get list of variables declared in the xml files
|
27 |
|
|
void readbins(TString varfile);
|
28 |
|
|
void readvars(TString varfile);
|
29 |
|
|
void readlimits(TString varfile);
|
30 |
|
|
TString getBinName(double pt, double eta, TString era="");
|
31 |
|
|
double getBDTCut(double pt, double eta, TString tightness, TString era="");
|
32 |
|
|
double getBDTCut(TString binname, TString tightness);
|
33 |
|
|
double getBDTval(Double_t pt, Double_t eta, TString era, TString method="BDTG");
|
34 |
|
|
Bool_t passBDT(Double_t pt, Double_t eta, TString tightness, TString era="", TString method="BDTG");
|
35 |
|
|
void setVals(map<TString,Float_t> floatvals);
|
36 |
|
|
void print();
|
37 |
khahn |
1.1 |
|
38 |
|
|
private:
|
39 |
dkralph |
1.2 |
TString weightdir_,varfile_;
|
40 |
|
|
map<TString,TMVA::Reader*> readers_; // one tmva reader for each pt/eta/era bin
|
41 |
|
|
map<TString,TString> xml_names_; // weight file name for each bin
|
42 |
|
|
unsigned max_nfloats; // maximum number of variables used in any one bin
|
43 |
|
|
map<TString,Float_t> floatvals_; // value for each input float variable (includes spectators)
|
44 |
|
|
vector<TString> binnamev_; // pt/eta/era bin names
|
45 |
|
|
vector<float> ptbin_highs_,etabin_highs_; // high edges for each pt/eta bin
|
46 |
|
|
map<TString,double> loosecuts_,mediumcuts_,tightcuts_; // cut values
|
47 |
|
|
// variables names: a vector of names for each bin
|
48 |
|
|
map<TString,vector<TString> > floatvar_names_,floatvar_expressions_,floatspec_names_;
|
49 |
|
|
map<TString,double> minima_,maxima_;
|
50 |
|
|
};
|
51 |
khahn |
1.1 |
|
52 |
dkralph |
1.2 |
#endif
|