#from ROOT import TTree, TFile, Double import numpy as np from pdg_const import pdg import Tkinter import matplotlib matplotlib.use("agg") import matplotlib.pyplot as plt import pickle as pkl import sys import time from helperfunctions import display_time import cmath as c import raremodel as rm import ROOT modl = rm.model() load_set = True draw = False mode = "true_data" modl.mode = mode set_size = 1e5 nonres_set_size = 43882 # nonres_set_size = 1000 modl.reco_steps = 10000 nr_of_toys = 1 x_min = 3150.0 x_max= 3650.0 # # x_min = modl.x_min # x_max = modl.x_max modl.add_nonres() jpsi_mass, jpsi_width, jpsi_phase, jpsi_scale = pdg["jpsi"] modl.add_resonance(jpsi_mass, jpsi_width, jpsi_phase, jpsi_scale, "jpsi") psi2s_mass, psi2s_width, psi2s_phase, psi2s_scale = pdg["psi2s"] modl.add_resonance(psi2s_mass, psi2s_width, psi2s_phase, psi2s_scale, "psi2s") modl.add_cusp(3550, 6e-7, 200, 7) def func(q2): return 1.0 # modl.param_val[0] = 1e7 modl.normalize_pdf() # print(integrate.quad(modl.total_pdf, modl.x_min**2, modl.x_max**2, limit = 250)) modl.param_list() # print(modl.total_scale_amp) if load_set: if mode == "true_data": with open(r"./data/true_data/true_data_toy_{0}_range({1}-{2}).pkl".format(0, int(x_min), int(x_max)), "rb") as input_file: part_set = pkl.load(input_file) else: with open(r"./data/set_{0}_range({1}-{2}).pkl".format(int(set_size), int(x_min), int(x_max)), "rb") as input_file: part_set = pkl.load(input_file) counter = set_dic["counter_tot"] else: part_set = modl.generate_points(set_size, x_min = x_min, x_max = x_max, mode = mode, verbose = 1, nr_of_toys = nr_of_toys, nonres_set_size = nonres_set_size) if draw: modl.draw_plots(part_set = part_set, x_min = x_min, x_max = x_max, mode = mode, unbinned_data = True) modl.fit_pdf_to_data(part_set) print("Run finished")