def get_fractions(self, file_name): if os.path.exists(self.hist_input): return f1 = ROOT.TFile.Open(file_name) tree = f1.Get("smeared") met_xbins = [250, 300, 350, 400, 500, 600, 700, 800, 900, 2000] h_met = tools.make_hist(self.hist_name, met_xbins) cuts = ROOT.TCut("weight*(njets < 5 && met_et > 250 && leading_jet_pt > 250 && min_dphi > 0.4)") tree.Draw("met_et>>" + h_met.GetName(), cuts) fout = ROOT.TFile.Open(self.hist_input, "recreate") h_met.Scale(1.0 / h_met.Integral()) h_met.Write() fout.Close() f1.Close()