コード例 #1
0
    def __init__(self,
                 signame,
                 bkgname,
                 variables,
                 cuts,
                 label,
                 treeName,
                 weightloc='weights',
                 MVAMethod="BDTG"):

        self._f_sig = ROOT.TFile(signame)
        self._f_bkg = ROOT.TFile(bkgname)
        self._t_sig = self._f_sig.Get(treeName)
        self._t_bkg = self._f_bkg.Get(treeName)

        self._discVariables = variables
        #,"MHT","nJets_30"];

        #tmva cut
        self._cutstring = "("
        cutctr = 0
        for cut in cuts:
            self._cutstring += "(" + cut[0] + " > " + str(
                cut[1]) + ") && (" + cut[0] + " < " + str(cut[2]) + ")"
            if cutctr < len(cuts) - 1: self._cutstring += "&&"
            cutctr += 1
        self._cutstring += ")"
        print "cutstring = ", self._cutstring

        # self._spectatorVariables = ["lheWeight"];
        self._spectatorVariables = []
        self._trees = [self._t_sig, self._t_bkg]
        self._bdt = TMVAhelper("MVA_" + label, self._discVariables,
                               self._trees, self._spectatorVariables,
                               weightloc)
        print ";;weightloc = ", weightloc