histSP.GetXaxis().SetTitle('ToF') histSP.GetYaxis().SetTitle('counts per pulse') hist_photons.SetFillStyle(3244) hist_neutrons.SetLineColorAlpha(ROOT.kWhite, 0) hist_photons.SetLineColorAlpha(ROOT.kWhite, 0) hist_neutrons.SetFillStyle(3350) hist_photons.SetFillColor(ROOT.kBlack) hist_neutrons.SetFillColor(ROOT.kBlack) histSP.Draw('histE') hist_photons.Draw('hist same') hist_neutrons.Draw('hist same') ROOT.gPad.SetLogy() mt2.thesis_plot([histSP], True, canvii=TH1F.tcanvii_refs) leg = ROOT.TLegend() leg.AddEntry(hist_photons, 'Gammas', 'f') leg.AddEntry(hist_neutrons, 'Neutrons', 'f') leg.Draw() if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os def input_thread(q, stdin): while True: print 'ROOT: ' cmd = stdin.readline()
hist_p.__update_hist_from_containers__() for i in range(10000): hist.Fill(hist_p.GetRandom() + np.random.randn() * 0.9) hist /= hist.bin_width hist.GetXaxis().SetTitle("mean PMT #Deltat [ns]") hist.GetYaxis().SetTitle("total counts [s^{-1}]") hist.Draw('E') ROOT.gStyle.SetOptStat('rm') hist.SetTitle('') hist.SetLineWidth(2) ROOT.TGaxis.SetMaxDigits(3) print(hist) mt2.thesis_plot(hist, True) if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os def input_thread(q, stdin): while True: print('ROOT: ') cmd = stdin.readline() q.put(cmd) def root(char): assert isinstance(char, str), "Argument must be string!" ROOT.gROOT.ProcessLine(char)
import mytools2 as mt2 bin_width = 2 tree_SP, n_pulses_SP = mt2.NCorrRun('SP','DU', Forward=True).neutrons_doubles_tree hist = TH1F(24,180,binwidths=bin_width) hist.Project(tree_SP, "180/3.1415*neutrons.coinc_hits.coinc_theta",weight=1.0/n_pulses_SP/bin_width) hist.Draw("hist E") hist.SetLineWidth(2) hist.GetXaxis().SetTitle("#theta_{nn} [deg]") hist.GetYaxis().SetTitle("counts per pulse [deg^{-1}]") mt2.thesis_plot(hist, big_font=0.055, Ytitle__offset=1) hist.SetStats(0) tb = ROOT.TBrowser() if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os def input_thread(q, stdin): while True: print ('ROOT: ')
gr2.Draw("* same ") gr2.SetMarkerStyle(23) gr1.GetXaxis().SetTitle("ToF of coincident events [ns]") gr1.GetYaxis().SetTitle("coincidences per pulse") ROOT.gPad.SetLogy() leg = ROOT.TLegend() leg.AddEntry(gr1, r"same pulse yield", "p") leg.AddEntry(gr2, r"0.5 #times (different pulse yield)", "p") leg.Draw() leg.SetTextSize(0.05) mt2.thesis_plot([gr1], big_font=0.05) gr1.GetYaxis().SetTitleOffset(1) # tb = ROOT.TBrowser() if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os def input_thread(q, stdin): while True: print('ROOT: ') cmd = stdin.readline() q.put(cmd) def root(char):
histAl.Draw('same hist') histMT.SetStats(0) histMT.GetXaxis().SetTitle('ToF') histMT.GetYaxis().SetTitle('counts per pulse') # histDU.Draw('hist') histMT.SetMaximum(max(histAl.binvalues) * 1.15) if neutron_target == 'D2O': neutron_target = 'D_{2}0' leg1 = ROOT.TLegend() leg1.AddEntry(histMT, 'Empty', 'f') leg1.AddEntry(histAl, 'Al', 'l') leg1.Draw() mt2.thesis_plot([histMT], big_font=1) histDU.Draw('hist') histAl.Draw('hist same') histDU.GetXaxis().SetTitle('ToF') histDU.GetYaxis().SetTitle('counts per pulse') histDU.SetStats(0) leg2 = ROOT.TLegend() leg2.AddEntry(histDU, neutron_target, 'f') leg2.AddEntry(histAl, 'Al', 'f') leg2.Draw() mt2.thesis_plot([histDU], big_font=1)
# histSP_90 = histSP_90.Rebin(bin_factor) # histDP_90 = histDP_90.Rebin(bin_factor) histSP_90 /= (0.5 * histDP_90) # histSP_90.SetMarkerStyle(33) # histSP_90.SetMarkerSize(1.5) var = '#theta_{abs}_{1,2}' title_90 = ([ '#theta_{{abs}}_{{1}} *or* #theta_{{abs}}_{{2}} #in {rng}'.format( rng=range_90) ] * 2 + [''])[case] # histSP_90.SetTitle(title_90) # histSP_90.SetLineStyle(7) histSP_90.SetLineWidth(5) mt2.thesis_plot([histSP_90], big_font=0.065) # pad1.SetGrid(); histSP_90.SetStats(0) histSP_90.GetXaxis().SetNdivisions(6, 5, 0, 0) # c1.Modified() # c1.Update() pad2 = c1.cd(2) pad2.SetTopMargin(0.1) # pad2.SetGrid(); histSP_90.SetStats(0) histSP_not_90.Project(tree_SP, '180/3.1415*neutrons.coinc_hits[0].coinc_theta',
histcorrLego = histcorrLego/histDPLegomultihit # histcorrLego /= denom histcorrLego += histcorrLego.transpose() histSPLego_w += histSPLego_w.transpose() histcorrLego /= 2 histSPLego_w /= 2 # histcorrLego *= .8 histcorrLego.Draw("lego") histcorrLego.GetZaxis().SetTitleOffset(1.2) histcorrLego.SetLineWidth(2) mt2.thesis_plot(histcorrLego, big_font=0.05) histcorrLego.GetXaxis().SetTitle("E_{1} [MeV]") histcorrLego.GetYaxis().SetTitle("E_{2} [MeV]") histcorrLego.GetZaxis().SetTitle("nn_{corr}/nn_{uncorr}") histcorrLego.SetStats(0) histSP_theta = TH1F(20,180,theta_nbins) histDP_theta = TH1F(20,180,theta_nbins) histDP_w_theta = TH1F(20,180,theta_nbins) histSP_theta.Project(tree_SP, "180/3.1415*neutrons.coinc_hits[].coinc_theta", weight=1.0/n_pulses_SP) histDP_theta.Project(tree_DP, "180/3.1415*neutrons.coinc_hits[].coinc_theta", weight=1.0/n_pulses_DP) histSP_w_theta = histSP_theta.__copy__() for evt in tree_DP:
for i in range(len(hist)): x = hist.bincenters[0][i] hist.binvalues[i] = np.e**(-0.54) * xs.Eval(x) hist.__update_hist_from_containers__() hist.normalize() hist.GetXaxis().SetTitle("Energy of fission inducing photon [MeV]") hist.GetYaxis().SetTitle("rel. rate [arb. units]") hist.Draw() hist.SetLineWidth(2) hist.SetLineColor(ROOT.kBlack) mt2.thesis_plot([hist], big_font=0.07) ROOT.gStyle.SetOptStat('m') path = "/Users/jeffreyburggraf/FREYA/MyFREYA/2nCorr/G_ergs.txt" f = open(path, "w") for i in range(1000000): if i: f.write("\n") f.write("{:.2f}".format(hist.GetRandom())) f.close() if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue
x_SP = histSP.bincenters[0][np.argmax(histSP.binvalues)] x_DP = histDP.bincenters[0][np.argmax(histDP.binvalues)] histSP.SetMaximum(1.15 * max([max(histSP), max(histDP)])) print(1 / np.sqrt(2) * np.sqrt( np.sum([(np.sqrt(p) - np.sqrt(q))**2 for q, p in zip(histDP.binvalues, histSP.binvalues)]))) leg = ROOT.TLegend() leg.AddEntry(histSP, 'Same pulse') leg.AddEntry(histDP, 'Different pulse') leg.Draw() mt2.thesis_plot([histSP], big_font=True) print(np.outer(histSP.binvalues, histDP.binvalues)) np.outer(histSP.binvalues, histDP.binvalues) if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os def input_thread(q, stdin): while True: print('ROOT: ') cmd = stdin.readline() q.put(cmd)
leg.AddEntry(gr_SP, "{}".format(["D2O same pulse", "same pulse"][index])) leg.AddEntry( gr_DP, "{}".format( ["1/2#times(D2O different pulse)", "1/2#times(different pulse)"][index])) pad.SetLogy(1) leg.SetTextSize(0.04) leg.Draw() legs.append(leg) gr_SP.SetMarkerStyle(32) gr_DP.SetMarkerStyle(33) ROOT.gPad.Update() mt2.thesis_plot(gr_SP, big_font=0.05) gr_SP.GetHistogram().SetMinimum(1E-8) gr_SP.GetHistogram().SetMaximum(1.5) gr_SP.GetYaxis().SetTitleOffset(1.6) gr_SP.GetXaxis().SetNdivisions(6) ROOT.gStyle.SetOptFit(1111) # TB = ROOT.TBrowser() if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os
histDU_n.SetLineWidth(3) histDU_n.SetStats(0) histDU_n.GetXaxis().SetTitle('ToF [ns]') histDU_n.GetYaxis().SetTitle('counts/pulse') histDU_n.Draw('hist') histAl.Draw('hist same') leg = ROOT.TLegend() leg.AddEntry(histDU_n, 'DU', 'fl') leg.AddEntry(histAl, 'Al', 'f') leg.Draw() ROOT.gPad.SetLogy() mt2.thesis_plot([histDU_n], big_font=True) if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os def input_thread(q, stdin): while True: print 'ROOT: ' cmd = stdin.readline() q.put(cmd) def root(char): assert isinstance(char, str), "Argument must be string!" ROOT.gROOT.ProcessLine(char)
scale = DU_events/pulses_DU/(AL_events/pulses_Al) print('{1} scale is: {0:.2f}'.format(scale,target)) histAL *= scale histAL.Draw('hist') histAL.SetLineColor(ROOT.kRed) histDU.Draw('hist same') leg = ROOT.TLegend() leg.AddEntry(histAL, target) leg.AddEntry(histDU, 'DU') leg.Draw() mt2.thesis_plot([histAL]) treeAl, pulses_Al = mt2.NCorrRun("SP", target, generate_dictionary=False, Forward=True).photons_doubles_tree treeDU, pulses_DU = mt2.NCorrRun("SP", 'DU', generate_dictionary=False, Forward=True).photons_doubles_tree histAL_th = TH1F(0, 180, binwidths=1) histDU_th = TH1F(0, 180, binwidths=1) histAL_th.GetXaxis().SetTitle('#theta_{abs}') histAL_th.GetYaxis().SetTitle('counts per pulse') histAL_th.Project(treeAl, '180/3.1415*photons.coinc_hits.theta_abs', weight=1.0/pulses_Al) histDU_th.Project(treeDU, '180/3.1415*photons.coinc_hits.theta_abs', weight=1.0/pulses_DU) histAL_th *= scale
np.random.seed(1) errs = 0.025 * np.random.randn(len(histSP)) # errs[-1]=0.05 histSP.binvalues += errs histSP.binerrors += 0.04 * histSP.binvalues histSP.__update_hist_from_containers__() histSP.GetXaxis().SetTitle("cos(#theta_{nn})") histSP.GetYaxis().SetTitle("#frac{nn_{SP}}{0.5 #times nn_{DP}}") histSP.SetMarkerStyle(32) histSP.SetMinimum(0) histSP.SetStats(0) histSP.Draw("E") mt2.thesis_plot([histSP], big_font=0.05) if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os def input_thread(q, stdin): while True: print('ROOT: ') cmd = stdin.readline() q.put(cmd) def root(char): assert isinstance(char, str), "Argument must be string!" ROOT.gROOT.ProcessLine(char)
hist_ph.Project(tree_ph, "photons.hits.tof", max_events=1E5) hist_n *= 1.0/hist_n.bin_width/n_pulses_n hist_ph += hist_fuck hist_ph *= hist_n.binvalues[hist_n.FindBin(30)] /hist_ph.binvalues[-1] hist_n += np.concatenate([hist_ph.binvalues, np.zeros(len(hist_n) - len(hist_ph))]) hist_n.Draw() hist_ph.Draw() mt2.thesis_plot([hist_n]) if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os def input_thread(q, stdin): while True: print ('ROOT: ') cmd = stdin.readline() q.put(cmd)
erg_hist_diff_DP_dale.normalize() c1 = ROOT.TCanvas() c1.Divide(2) c1_1 = c1.cd(1) ROOT.TGaxis.SetMaxDigits(3) erg_hist_avg_SP.Draw("hist E", make_new_canvas=False) erg_hist_avg_SP.GetXaxis().SetTitle("mean neutron energy [MeV]") erg_hist_avg_SP.GetYaxis().SetTitle("probability") erg_hist_avg_DP.Draw("same E") erg_hist_avg_DP_dale.Draw("same E ") mt2.thesis_plot([erg_hist_avg_SP], big_font=0.05, Ytitle__offset=1.4) c1.cd(2) erg_hist_diff_SP.Draw("hist E", make_new_canvas=False) erg_hist_diff_SP.GetXaxis().SetTitle( "absolute neutron energy difference [MeV]") erg_hist_diff_SP.GetYaxis().SetTitle("probability") erg_hist_diff_DP.Draw("same E") erg_hist_diff_DP_dale.Draw("same E") for (hist1, hist2, hist3) in [(erg_hist_avg_SP, erg_hist_avg_DP, erg_hist_avg_DP_dale), (erg_hist_diff_SP, erg_hist_diff_DP, erg_hist_diff_DP_dale)]:
err = (get_error(x1, y1, z1, x2, y2, z2, ex1, ey1, ez1, ex2, ey2, ez2)) theta = (180 * np.arccos((x1 * x2 + y1 * y2 + z1 * z2) / np.sqrt( (x1**2 + y1**2 + z1**2) * (x2**2 + y2**2 + z2**2)))) / np.pi print theta, err err_hist.Fill(theta, err) n_fills.Fill(theta) err_hist /= n_fills print(list(err_hist.binvalues)) print(list(err_hist.__binLeftEdges__)) err_hist.Draw("hist p") err_hist.SetStats(0) mt2.thesis_plot([err_hist], big_font=0.045) err_hist.GetXaxis().SetTitle("Reconstructed opening angle [degrees]") err_hist.GetYaxis().SetTitle("Mean uncertainty in opening angle [degrees]") err_hist.SetMarkerStyle(22) n_fills.Draw() if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os def input_thread(q, stdin): while True: print 'ROOT: ' cmd = stdin.readline()
gr.Draw('A*') gr.GetYaxis().SetRangeUser(-0.7, 6) gr_bot.Draw('*same') gr_top.Draw('*same') # gr.SetRange(0) gr.GetXaxis().SetTitle('Distance from detector center [cm]') gr.GetYaxis().SetTitle('PMT #Deltat [ns]') gr.SetMarkerStyle(24) gr_top.SetMarkerStyle(22) gr_bot.SetMarkerStyle(21) mt2.thesis_plot(gr, True) leg = ROOT.TLegend() leg.AddEntry(gr_top, 'Top', 'p') leg.AddEntry(gr_bot, 'Bottom', 'p') leg.AddEntry(gr, 'Mean', 'p') leg.SetTextSize(0.06) leg.Draw() # leg.SetBorderSize(0); if __name__ == "__main__": import ROOT as ROOT from multiprocessing import Process, Queue import time, sys, os