def main(): file_names = glob.glob( '/Users/liberulo/kek/csibpm/data/20170825/hot_pixel/L_foc/*.root') # file_names += glob.glob('/Users/liberulo/kek/csibpm/data/20170828/hot_pixel/*.root') print '{} files are found.'.format(len(file_names)) # hx = [] mean = [] for fname in file_names: hx.append( itst.get_projection(fname, 250, 700, isDraw=False, isRoundAndCenterd=False)) mean.append(get_mean(fname)) for h in hx: h[0].Rebin(16) ymin = min([x[0].GetMinimum() for x in hx]) ymax = max([x[0].GetMaximum() for x in hx]) # Fitting ff = itst.get_gausses(file_names, mean=mean) for i, f in enumerate(ff): hx[i][0].Fit(f, 'r', 'goff') ff2 = itst.get_2gausses(file_names, ff) for i, f in enumerate(ff2): hx[i][0].Fit(f, 'r +', 'goff') # Tree production Fout = r.TFile('~/kek/csibpm/data/diff_L.root', 'recreate') tout = itst.get_tree(hx, ff, ff2) print 'The tree contains {} entries.'.format(tout.GetEntries()) tout.Write() Fout.Close()
def main(): sett = 'one' sett = 'all' if sett == 'one': file_names = glob.glob('data/2017081?/hot_pixel/*min*40cm2.root') elif sett == 'all': file_names = glob.glob('data/201708[12]?/hot_pixel/*min*.root') file_names.remove( 'data/20170817/hot_pixel/5min1pic40cm.root') # light leak file_names.remove( 'data/20170817/hot_pixel/10min1pic40cm.root') # light leak else: return 1 # hx = [] for fname in file_names: hx.append(itst.get_projection(fname, 400, 800, isDraw=False)) for h in hx: h[0].Rebin(16) ymin = min([x[0].GetMinimum() for x in hx]) ymax = max([x[0].GetMaximum() for x in hx]) # Fitting ff = itst.get_gausses(file_names) for i, f in enumerate(ff): hx[i][0].Fit(f, 'r', 'goff') # subtract_baseline(hx[i][0], f.GetParameter(3)) # f.SetParameter(3, 0.) ff2 = itst.get_2gausses(file_names, ff) for i, f in enumerate(ff2): hx[i][0].Fit(f, 'r +', 'goff') # Drawing c1 = r.TCanvas('c1', 'x projections', 800, 600) hx[0][0].Draw('e') for h in hx[1:]: h[0].Draw('e same') lat = r.TLatex() lat.SetTextSize(.025) for i, hh in enumerate(hx): lat.SetTextColor(itst.clrs[i]) lat.DrawLatexNDC(.65, .95 - .04 * i, hh[0].GetName()) ax, ay = hx[0][0].GetXaxis(), hx[0][0].GetYaxis() ay.SetRangeUser(ymin, ymax * 1.05) for f in ff: f.Draw('same') for f in ff2: f.Draw('same') c1.Update() # Print results # c2 = itst.get_trend_plot(ff, 1, 'mean') # c3 = itst.get_trend_plot(ff, 2, 'sigma') # c4 = itst.get_trend_plot(ff, 0, 'Amplitude') # I vs L c_I_vs_L = itst.get_intensity_vs_distance(hx) raw_input('Press ENTER to continue, please.')
def main(): file_names = glob.glob('data/20170823/hot_pixel/*min*.root') # hx = [] for fname in file_names: hx.append( itst.get_projection(fname, 350, 800, isDraw=False) ) for h in hx: h[0].Rebin(16) ymin = min([x[0].GetMinimum() for x in hx]) ymax = max([x[0].GetMaximum() for x in hx]) # Fitting ff = itst.get_gausses(file_names) for i, f in enumerate(ff): hx[i][0].Fit(f, 'r', 'goff') ff2 = itst.get_2gausses(file_names, ff) for i, f in enumerate(ff2): hx[i][0].Fit(f, 'r +', 'goff') # Tree production Fout = r.TFile('data/kinetic_alpha.root', 'recreate') tout = itst.get_tree(hx, ff, ff2) tout.Write() Fout.Close()
def main(): # file_names = glob.glob('/Users/liberulo/kek/csibpm/data/20170808/hot_pixel/*.root') # file_names += glob.glob('/Users/liberulo/kek/csibpm/data/20170809/hot_pixel/*.root') file_names = glob.glob('data/20170821/hot_pixel/*_s*.root') print '{} files are found.'.format(len(file_names)) # hx = [] mean = [] for fname in file_names: # hx.append( itst.get_projection(fname, 500, 1100, isDraw=False, hx.append( itst.get_projection( fname, 550, 800, isDraw=False, # isRoundAndCenterd=True) ) isRoundAndCenterd=False)) mean.append(get_mean(fname)) for h in hx: h[0].Rebin(16) ymin = min([x[0].GetMinimum() for x in hx]) ymax = max([x[0].GetMaximum() for x in hx]) # Fitting ff = itst.get_gausses(file_names, mean=mean) for i, f in enumerate(ff): print bcolors.HEADER + 'Fit', f.GetName(), bcolors.ENDC hx[i][0].Fit(f, 'r', 'goff') ff2 = itst.get_2gausses(file_names, ff) for i, f in enumerate(ff2): hx[i][0].Fit(f, 'r +', 'goff') # Tree production # Fout = r.TFile('~/kek/csibpm/data/diff_exp_time.root', 'recreate') Fout = r.TFile('data/stat_error.root', 'recreate') tout = itst.get_tree(hx, ff, ff2) print 'The tree contains {} entries.'.format(tout.GetEntries()) tout.Write() Fout.Close()
def main(): if len(sys.argv) > 1: file_names = sys.argv[1:] else: file_names = glob.glob('data/2017081?/hot_pixel/*min*.root') file_names.remove('data/20170817/hot_pixel/5min1pic40cm.root')# light leak file_names += glob.glob('data/20170821/hot_pixel/*min*.root') file_names += glob.glob('data/20170808/hot_pixel/*min*cm*.root') # hx = [] for fname in file_names: hx.append( itst.get_projection(fname, 400, 800, isDraw=False) ) for h in hx: h[0].Rebin(16) ymin = min([x[0].GetMinimum() for x in hx]) ymax = max([x[0].GetMaximum() for x in hx]) # Fitting ff = itst.get_gausses(file_names) for i, f in enumerate(ff): hx[i][0].Fit(f, 'r', 'goff') # subtract_baseline(hx[i][0], f.GetParameter(3)) # f.SetParameter(3, 0.) ff2 = itst.get_2gausses(file_names, ff) for i, f in enumerate(ff2): hx[i][0].Fit(f, 'r +', 'goff') # Drawing c1 = r.TCanvas('c1', 'x projections', 800, 600) hx[0][0].Draw('e') for h in hx[1:]: h[0].Draw('e same') lat = r.TLatex() lat.SetTextSize(.03) for i, hh in enumerate(hx): lat.SetTextColor(itst.clrs[i]) lat.DrawLatexNDC(.75, .95-.04*i, hh[0].GetName()) ax, ay = hx[0][0].GetXaxis(), hx[0][0].GetYaxis() ay.SetRangeUser(ymin, ymax*1.05) ay.SetTitle('Number of CCD electrons') ax.SetTitle('X direction, pixels') line = r.TLine() line.SetLineWidth(1) # Drawing constant lines for i, f in enumerate(ff): f.Draw('same') ff2[i].Draw('same') line.SetLineColor(itst.clrs[i]) line.SetLineStyle(1) p = f.GetParameters() line.DrawLine(p[1]-3*p[2], p[3], p[1]+3*p[2], p[3]) line.SetLineStyle(2) p = ff2[i].GetParameters() line.DrawLine(p[1]-3*(p[2]+p[5]), p[6], p[1]+3*(p[2]+p[5]), p[6]) # itst.time_stamp() c1.Update() # Print results # c2 = itst.get_trend_plot(ff, 1, 'mean') # c3 = itst.get_trend_plot(ff, 2, 'sigma') c4 = itst.get_trend_plot(ff, 0, 'Amplitude') c5 = itst.get_trend_plot(ff2, [0, 3], 'Amplitude2') # I vs L # c_I_vs_L = itst.get_intensity_vs_distance(hx) c_I_vs_t = itst.get_intensity_vs_time(hx) c_bl_vs_t = itst.get_baseline_vs_time(hx) Fout = r.TFile('data/signal_rms.root', 'recreate') tout = itst.get_tree(hx, ff, ff2) tout.Write() Fout.Close() raw_input('Press ENTER to continue, please.')