def make_2d_histo(self, tmin = None, tmax = None): # get data a_data = analysis_data(self) # time slice the data dt = self.par['time_slice_width']*us # step width # good data tg = a_data.tg Ag = a_data.Ag # all pos. data tp = a_data.tp Ap = a_data.Ap # 2d histogram setup # y - aaxis hy_min = self.par['h_min'] hy_max = self.par['h_max'] hy_bins = self.par['h_bins'] # x - axis if tmin is None: tmin = tp.min() if tmax is None: tmax = tp.max() hx_bins = int((tmax - tmin)/dt) + 1 h_title = f'shot {self.par["shot"]}, channel = {self.par["channel"]}' self.h2 = B.histo2d(tg, Ag, range = [[tmin,tmax],[hy_min,hy_max]], bins = [hx_bins, hy_bins], title = h_title, xlabel = r't[$\mu$ s]', ylabel = 'fitted PH [V]') self.h2p = B.histo2d(tp, Ap, range = [[tmin,tmax],[hy_min,hy_max]], bins = [hx_bins, hy_bins], title = h_title, xlabel = r't[$\mu$ s]', ylabel = 'raw PH [V]')
#%% cost_min = -1.0 cost_max = 1.0 bins_cost = 20 metappi0_min = 1.0 metappi0_max = 2.5 metappi0_binwidth = 50e-3 # bin width in GeV bins_metappi0 = int((metappi0_max - metappi0_min) / metappi0_binwidth) h2_ep_cost_weighted = B.histo2d(metappi0[sel][:], cos_theta_etap_gj[sel][:], bins=(bins_metappi0, bins_cost), range=[[metappi0_min, metappi0_max], [cost_min, cost_max]], title="Angular distribution in GJ Frame", weights=qf) #%% np.savez( '/Users/rupeshdotel/analysis/work/pi0pippimeta/data/qfactor_data/qweights.npz', qf=qf) #%% np.savez( '/Users/rupeshdotel/analysis/work/pi0pippimeta/data/qfactor_data/qweights_2d.npz', qf=qf)
#cost_pi0 = d['cost_pi0'] #pi0phiGJ = d['pi0phiGJ'] #etaprimephiGJ = d['etaprimephiGJ'] #%% mep_bins = 18 # bins etaprime invariant mass mp_bins = 12 # bins pi0 invariant mass mep_min = 0.86 # left edge of etaprime invariant mass mep_max = 1.05 # right edge of etaprime invariant mass mp_min = 0.12 # left edge of pi0 invariant mass mp_max = 0.15 # right edge of pi0 invariant mass h_epi0 = B.histo2d(metap, mpi0, bins=(mep_bins, mp_bins), range=np.array([(mep_min, mep_max), (mp_min, mp_max)]), title='2D_prompt', xlabel="$M(\pi^{+}\pi^{-}\eta)$", ylabel="$M(\gamma\gamma)$") epm = h_epi0.x_bin_center pi0m = h_epi0.y_bin_center def fit_histo(h2d): #define empty lists for parameters and their errors from fits A_a, x0_a, sigma_a, c0_a, b0_a = [], [], [], [], [] for i in range(h2d.nbins_y): # looping over pi0mass bins h = h2d.project_x(bins=[i])
m_etappi0_gen = d['metaprimepi0'] cost_etap_gen = d['cos_theta'] #%% cost_min = -1.0 cost_max = 1.0 bins_cost = 20 metappi0_min = 1.0 metappi0_max = 2.0 metappi0_binwidth = 50e-3 # bin width in GeV bins_metappi0 = int((metappi0_max - metappi0_min) / metappi0_binwidth) h2_ep_cost_ac = B.histo2d(m_etappi0_ac, cost_etap_ac, bins=(bins_metappi0, bins_cost), range=[[metappi0_min, metappi0_max], [cost_min, cost_max]], title="Angular distribution in GJ Frame") h2_ep_cost_gen = B.histo2d(m_etappi0_gen, cost_etap_gen, bins=(bins_metappi0, bins_cost), range=[[metappi0_min, metappi0_max], [cost_min, cost_max]], title="Angular distribution in GJ Frame") #%% m_gen = B.histo(m_etappi0_gen, bins=100) m_ac = B.histo(m_etappi0_ac, bins=100) m_acceptance = m_ac / m_gen
selm = sel_winm & vetom """ #%% h_mm2m = B.histo(mm2m, bins=30, title="missing mass squared") h_etap = B.histo(metap[sel], bins=24, title="$\eta^{'}$", xlabel="$M(\pi^{+}\pi^{-}\eta)") h_etap_pi0 = B.histo2d(metap[sel], mpi0[sel], bins=24, title=" pi0 vs etaprime Kinfit variables", xlabel="$M(\pi^{+}\pi^{-}\eta)$", ylabel="$M(\gamma\gamma)$") h_etappi0 = B.histo(metappi0[sel], bins=40, title="$\eta'\pi^{0}$", xlabel="$M(\eta^{'}\pi^{0})$") h2_ep_cost = B.histo2d(metappi0[sel], cost_etap[sel], bins=(25, 25), title="Angular distribution in GJ Frame", xlabel="$M(\eta^{'}\pi^{0})$", ylabel="$\cos\\theta_{GJ}$")
t_max = 0.7 bins_t = 15 be_min = 8.2 be_max = 8.8 bins_be = 15 metap_min = 0.85 metap_max = 1.05 metap_binwidth = 7e-3 # bin width in GeV bins_metap = int((metap_max - metap_min) / metap_binwidth) h2_etap_cost = B.histo2d(metap, cost_etap_gj, bins=(bins_metap, bins_cost), range=[[metap_min, metap_max], [cost_min, cost_max]], title="Angular dependence of etaprime signal", xlabel="$M(\pi^{+}\pi^{-}\eta)$", ylabel="$\cos\\theta_{GJ}$") h2_etap_phi = B.histo2d(metap, phi_etap_gj, bins=(bins_metap, bins_phi), range=[[metap_min, metap_max], [phi_min, phi_max]], title="Angular dependence of etaprime signal", xlabel="$M(\pi^{+}\pi^{-}\eta)$", ylabel="$\\phi_{GJ}$") h2_etap_mant = B.histo2d(metap, mant, bins=(bins_metap, bins_t),
mpi0p = d['pi0p_unique'] mpipp = d['pipp_unique'] num_combos = d['num_combos_unique'] combo_num = d['combo_number_unique'] dt = d['dt_unique'] event_num = d['event_num_unique'] kinfit_CL = d['kinfit_CL_unique'] chisq_ndf = d['chisq_ndf_unique'] #%% xbin = 30 ybin = 18 h_epi0 = B.histo2d(metap, mpi0, bins=(xbin, ybin), range=np.array([(0.86, 1.06), (0.12, 0.15)]), title='2D_prompt', xlabel="$M(\pi^{+}\pi^{-}\eta)$", ylabel="$M(\gamma\gamma)$") epm = h_epi0.x_bin_center pi0m = h_epi0.y_bin_center def fit_histo(epm=True): #define empty lists for parameters and their errors from fits Aa = [] Aa_err = [] X0 = [] X0_err = []
#%% metap = d['metap'] metappi0 = d['metappi0'] cost_etap = d['cost_etap'] h_etap = B.histo(metap, bins = 32, title = "$M(\pi^{+}\pi^{-}\eta)$ Kinfit Variables (Mass constrained trees)") h_etappi0 = B.histo(metappi0, bins = 40, title = "$M(\eta^{'}\pi^{0})$ Kinfit Variables (Mass constrianed trees) ") h2_ep_cost = B.histo2d(metappi0, cost_etap, bins = ( 25, 25 ), title = "Angular distribution in GJ Frame", xlabel = "$M(\eta^{'}\pi^{0})$", ylabel = "$\cos\\theta_{GJ}$" ) #%% #read the ASCII data file par = B.LT.parameterfile.pfile('/Users/rupeshdotel/analysis/work/gluexgit/data_files/data/sideband.data') # load the parameters values la = par.get_value('la'); lb = par.get_value('lb') # left sideband edges ma = par.get_value('ma'); mb = par.get_value('mb') # edges for middle region ra = par.get_value('ra'); rb = par.get_value('rb') # right sideband edges #left band center
xlabel = "$M(\gamma\gamma)$") # for etamass hb_eta = B.histo(meta[sel], range = (0.48, 0.60), bins = 50, weights = qbe, title = 'bkg', xlabel = "$M(\gamma\gamma)$") hs_eta = B.histo(meta[sel], range = (0.48, 0.60), bins = 50, weights = qse, title = 'sig', xlabel = "$M(\gamma\gamma)$") ht_eta = B.histo(meta[sel], range = (0.48, 0.60), bins = 50, title = 'All', xlabel = "$M(\gamma\gamma)$") hs2 = B.histo2d(metap[sel], mpi0[sel], range = [[0.86, 1.06], [0.12, 0.15]], bins = (20, 10), title = '2d_sig', weights = qsep*qsp*qse, xlabel = "$M(\pi^{+}\pi^{-}\eta)$", ylabel = "$M(\gamma\gamma)$") hb2 = B.histo2d(metap[sel], mpi0[sel], range = [[0.86, 1.06], [0.12, 0.15]], bins = (20, 10), title = '2d_bkg', weights = qbep*qbp, xlabel = "$M(\pi^{+}\pi^{-}\eta)$", ylabel = "$M(\gamma\gamma)$") ht2 = B.histo2d(metap[sel], mpi0[sel], range = [[0.86, 1.06], [0.12, 0.15]], bins = (20, 10), title = '2d_total', xlabel = "$M(\pi^{+}\pi^{-}\eta)$", ylabel = "$M(\gamma\gamma)$") hs2_X_GJ = B.histo2d(metap_pi0[sel], cos_GJ_etap[sel], range = [[1.3, 3], [-1, 1]], bins = (50, 40), title = '2d_sig_X_GJ', weights = qsep*qsp*qse, xlabel = "$M(\eta^{'}\pi^{0})$", ylabel = "$cos\\theta_{GJ}$") hb2_X_GJ = B.histo2d(metap_pi0[sel], cos_GJ_etap[sel], range = [[1.3, 3], [-1, 1]], bins = (50, 40), title = '2d_bkg_X_GJ', weights = qbep*qbp, xlabel = "$M(\eta^{'}\pi^{0})$", ylabel = "$cos\\theta_{GJ}$")