ROOT.RAT.DB.Get().LoadDefaults() ROOT.RAT.DB.Get().Load("pmt/airfill2.ratdb") ROOT.RAT.DB.Get().Load("geo/snoplus.geo") ROOT.RAT.DU.Utility.Get().BeginOfRun() fibre_pos = ROOT.RAT.DB.Get().GetLink("FIBRE", "FT035A") fibre_pos_reflec = ROOT.RAT.DB.Get().GetLink("FIBRE", "FT003A") # File stuff fibre = "FT055A" run = 8911 data_file = "%s%s/0.root" % (data_path, fibre) print data_file save_path = check_dir("%s/dark_count_plots/" % results_path) count = 0 r = sf.create_root_file("%s%s.root" % (save_path, fibre)) # Analysis begins # Create hit projections pmt_hits = sf.get_PMT_hits(data_file) tmp_title = "Total nHits: Fibre %s, Run %i" % (fibre, run) hitHist = psup_map.proj_pmts(pmt_hits, tmp_title) hitHist.Draw("colz") ROOT.gStyle.SetOptStat(0) c1.Update() c1.SetLogz() c1.Print("%s%s_%s.pdf" % (save_path, run, fibre)) hitHist.Write() # Plot hits in direct cone pmt_hits = sf.get_PMT_hits_cone(data_file, fibre_pos, 25.) tmp_title = "Cone nHits projected from Fibre %s: Run %s" % (fibre, run)
# Make canvas and TFile c1 = ROOT.TCanvas("c1", "c1", 600, 400) # Load rat defualts for fibre pos stuff ROOT.RAT.DB.Get().LoadDefaults() ROOT.RAT.DB.Get().Load("pmt/airfill2.ratdb") ROOT.RAT.DB.Get().Load("geo/snoplus.geo") ROOT.RAT.DU.Utility.Get().BeginOfRun() fibre_pos = ROOT.RAT.DB.Get().GetLink("FIBRE", "FT035A") fibre_pos_reflec = ROOT.RAT.DB.Get().GetLink("FIBRE", "FT003A") count = 0 for run in runDict: # Create or open ROOT file for results. if runDict.values().count(runDict[run]) == 1: r = sf.create_root_file("%s%s.root" % (results_path, runDict[run])) elif runDict.values().count( runDict[run]) != 1 and runDict.values().index( runDict[run]) == count: r = sf.create_root_file("%s%s.root" % (results_path, runDict[run])) else: r = sf.create_root_file("%s%s.root" % (results_path, runDict[run]), option="UPDATE") print "Updating file..." # File stuff data_dir = "%s%s/" % (data_path, runDict[run]) data_file = "%sR%s*.root" % (data_dir, run) #data_file = "%sR%s_0.root" % (data_dir, run) print data_file time_plots_path = check_dir("%s/time_plots/" % results_path)
################################################## import rat import ROOT from core import stability_funcs as sf import time import sys if __name__ == "__main__": # Reset all roor stuff ROOT.gROOT.Reset() # Make canvas and TFile c1 = ROOT.TCanvas("c1","c1",600,400); run = "100Hz" r = sf.create_root_file("results/%s_triggers.root" % run) # File stuff file_name = "/home/el230/SNO+/rat_data_scripts/stability/%s/*.root" % (run) print file_name # Analysis begins utils = rat.utility() #print utils.GetTrigBits().DumpNames() sys.exit() trig_hist= sf.plot_trigger_int(file_name) trig_hist.Draw("") trig_hist.Write() c1.Update()
# Load rat defualts for fibre pos stuff ROOT.RAT.DB.Get().LoadDefaults() ROOT.RAT.DB.Get().Load("pmt/airfill2.ratdb") ROOT.RAT.DB.Get().Load("geo/snoplus.geo") ROOT.RAT.DU.Utility.Get().BeginOfRun() fibre_pos = ROOT.RAT.DB.Get().GetLink("FIBRE", fibre) pmt_info = rat.utility().GetPMTInfo() f = ROOT.TFile(fname) hists, graphs = {}, {} for key in f.GetListOfKeys(): pmt_no = int(''.join(x for x in key.GetName() if x.isdigit())) if len(key.GetName().split("_")) == 2: hists[pmt_no] = f.Get(key.GetName()) graph_name = "%s_ordered" % key.GetName() print key.GetName(), graph_name graphs[pmt_no] = f.Get(graph_name) #plot_slices(hists, 1., fibre_pos) savePath = "./results/pmt_plots/%s/" % fibre r1 = sf.create_root_file("%s/pmts.root" % (savePath)) plot_interesting_pmts(hists, graphs, r1, savePath, c1) #x,y = convert_hists_to_xy(hists) #calc.plot_eg_pulses(x,y,10, scale=1, show=True) #savePath = "./results/pmt_plots/%s/analysis/" % fibre #r2 = sf.create_root_file("%s/results.root" % (savePath)) #pulse_shape_calcs(hists, r2, savePath, c1)
# 9091 : "10Hz", # 9093 : "10Hz" } runDict = { 8843 : "1000Hz" } fibre = "FT044A" # Results and data paths results_path = "/epp/scratch/neutrino/el230/ftbAnalysis/stability/" data_path = "/epp/scratch/neutrino/el230/rat_data_scripts/stability/" data_path = "/epp/scratch/neutrino/el230/rat_data_scripts/reflections/" # Make canvas and TFile cT = ROOT.TCanvas("cT","cT",600,400); count = 0 for run in runDict: r = sf.create_root_file("testStuff.root") # File stuff data_dir = "%s%s/" % (data_path, runDict[run]) data_file = "%sR%s*.root" % (data_dir, run) # data_file = "%s%s/*.root" % (data_path, fibre) pmts = sf.get_PMT_hits(data_file) h,p = [],[] for pmt, hits in pmts.iteritems(): p.append(pmt) h.append(hits) print pmt, hits print "" print h.index(max(h)), max(h)
# 9093 : "10Hz" } runDict = {9093: "10Hz"} # Results and data paths results_path = "/epp/scratch/neutrino/el230/ftbAnalysis/stability/" data_path = "/epp/scratch/neutrino/el230/rat_data_scripts/stability/" # Make canvas and TFile cT = ROOT.TCanvas("cT", "cT", 600, 400) count = 0 for run in runDict: # File stuff r = sf.create_root_file( "/home/el230/SNO+/ftbAnalysis/stability/test/results/clock_ticks.root" ) data_dir = "%s%s/" % (data_path, runDict[run]) data_file = "%sR%s*.root" % (data_dir, run) graph, sort_graph = plot_ticks_vs_events(data_file) graph.Draw("AP") graph.SetName("%s_%s" % (runDict[run], run)) graph.Write() sort_graph.Draw("AP") sort_graph.SerName("%s_%s_SORTED" % (runDict[run], run)) sort_graph.Write() cT.Update() save_str = "/home/el230/SNO+/ftbAnalysis/stability/test/results/clock/R%s_%s.pdf" % ( run, runDict[run]) cT.Print(save_str)