Example #1
0
    def plot_hist(self):


            dev_path = os.environ['DNN_PATH']

            if os.path.isfile("%s/hist/%s" % (dev_path, self.rt_name )):

                if self.score['test'] == 0: self.ams_hist()

                f0 = ROOT.TFile("%s/hist/%s" % (dev_path, self.rt_name ) )
                hSig_test = f0.Get(self.his_descr+"_sig_test")
                hBg_test = f0.Get(self.his_descr+"_bg_test")            


                tams = TAMS(hSig = hSig_test, hBg = hBg_test)

                fname = self.modelname.replace('.pkl','')

                #tams.savePlot(fname= '%s_raw.png' % fname)
                tams.rebinEqui()
                tams.savePlot(fname= '%s_rebin.png' % fname )
                f0.Close()
                del tams
Example #2
0
    def ams_hist(self):

            """
            Calculates the AMS value from a given Histogram

            RETURN:
            String containing the AMS value from 'test' and 'train'
            set and the corresponding model parameters.
            """

            dev_path = os.environ['DNN_PATH']


            strAMS = ""



            if os.path.isfile("%s/hist/%s" % (dev_path, self.rt_name)):

                try:
                    f0 = ROOT.TFile("%s/hist/%s" % (dev_path, self.rt_name))
                    hSig_test = f0.Get(self.his_descr+"_sig_test")
                    #hSig_train = f0.Get(self.his_descr+"_sig_train")

                    hBg_test = f0.Get(self.his_descr+"_bg_test")            
                    #hBg_train = f0.Get(self.his_descr+"_bg_train")

                    tams = TAMS(hSig = hSig_test, hBg = hBg_test)

                    tams.br = 1
                    self.score["test"] = tams.ams_syst_stat(0)
                    tams.br = 0.001
                    self.score["test_reg"] = tams.ams_syst_stat(0)
                    tams.rebin()
                    tams.br = 1
                    self.score["test_rb"] = tams.ams_syst_stat(0)
                    tams.br = 0.0
                    self.score["test_rb_reg"] = tams.ams_syst_stat(0)


                    # tams.seth(hSig = hSig_train, hBg = hBg_train)
                    # tams.br = 1
                    # self.score["train"] = tams.ams_syst_stat(0)
                    # tams.br = 0.001
                    # self.score["train_reg"] = tams.ams_syst_stat(0)
                    # tams.rebin()
                    # tams.br = 1
                    # self.score["train_rb"] = tams.ams_syst_stat(0)
                    # tams.br = 0.0
                    # self.score["train_rb_reg"] = tams.ams_syst_stat(0)

                    f0.Close()
                    del tams
                except:
                    pass

                strAMS += "%.5f,%.5f," % (self.score["test_rb"],self.score["test_rb_reg"])
                strAMS += "%.5f,%.5f," % (self.score["test"],self.score["test_reg"])


                strAMS += self.rt_name.replace(".root","").replace("_",",")

                return strAMS