00001
00002
00003 class AdViewer:
00004 '''
00005 Display output plots in ROOT
00006 '''
00007 def __init__(self):
00008 self.canvases = []
00009 self.files = []
00010
00011 def drawPlots(self,filename):
00012 from ROOT import TFile, TCanvas, TH1F, TH2F, gStyle
00013
00014 gStyle.SetPalette(1)
00015
00016
00017 plotFile = TFile(filename)
00018 if not plotFile.IsOpen():
00019 print "drawPlots: Can't open file ",filename
00020 self.files.append(plotFile)
00021 path = "adplotter/DayaBayAD1/"
00022
00023
00024 hitPmts = plotFile.Get(path+"DayaBayAD1_HitPmts")
00025 c1 = TCanvas("c1")
00026 hitPmts.Draw()
00027 self.canvases.append(c1)
00028
00029 dtReadout = plotFile.Get(path+"DayaBayAD1_DtReadout")
00030 c2 = TCanvas("c2")
00031 dtReadout.Draw()
00032 self.canvases.append(c2)
00033
00034 dtReadoutShort = plotFile.Get(path+"DayaBayAD1_DtReadoutShort")
00035 c3 = TCanvas("c3")
00036 dtReadoutShort.Draw()
00037 self.canvases.append(c3)
00038
00039 adc = plotFile.Get(path+"DayaBayAD1_AdcSpectrum")
00040 c4 = TCanvas("c4")
00041 adc.Draw()
00042 self.canvases.append(c4)
00043
00044 tdc = plotFile.Get(path+"DayaBayAD1_TdcSpectrum")
00045 c5 = TCanvas("c5")
00046 tdc.Draw()
00047 self.canvases.append(c5)
00048
00049 chargeSum = plotFile.Get(path+"DayaBayAD1_ChargeSum")
00050 c6 = TCanvas("c6")
00051 chargeSum.Draw()
00052 self.canvases.append(c6)
00053
00054 hitVsCharge = plotFile.Get(path+"DayaBayAD1_HitPmtVsChargeSum")
00055 c7 = TCanvas("c7")
00056 hitVsCharge.Draw("colz")
00057 self.canvases.append(c7)
00058
00059 vertexZRho = plotFile.Get(path+"DayaBayAD1_GenVertexZRho")
00060 c8 = TCanvas("c8")
00061 vertexZRho.Draw("colz")
00062 self.canvases.append(c8)
00063 return
00064
00065 def drawCoincidence(self,filename):
00066 from ROOT import TFile, TCanvas, TH1F, TH2F, gStyle, TLine
00067
00068 gStyle.SetPalette(1)
00069
00070
00071 plotFile = TFile(filename)
00072 if not plotFile.IsOpen():
00073 print "drawCoincidence: Can't open file ",filename
00074 self.files.append(plotFile)
00075 path = "adplotter/DayaBayAD1/"
00076
00077
00078 chargeSum = plotFile.Get(path+"DayaBayAD1_ChargeSum")
00079 c1 = TCanvas("c1")
00080 chargeSum.SetTitle("AD charge singles spectrum for DayaBayAD1")
00081 chargeSum.Draw()
00082 self.canvases.append(c1)
00083
00084
00085 dtNeutron = plotFile.Get(path+"DayaBayAD1_DtNeutronCapture")
00086 c2 = TCanvas("c2")
00087 dtNeutron.Draw()
00088 dtNeutron.Fit("expo","LL")
00089 self.canvases.append(c2)
00090
00091
00092 promptE = plotFile.Get(path+"DayaBayAD1_PromptEnergy")
00093 c3 = TCanvas("c3")
00094 promptE.Draw()
00095 self.canvases.append(c3)
00096
00097
00098 delayedE = plotFile.Get(path+"DayaBayAD1_DelayedEnergy")
00099 c4 = TCanvas("c4")
00100 delayedE.Draw()
00101 self.canvases.append(c4)
00102
00103
00104 delayedVsPromptE = plotFile.Get(path+"DayaBayAD1_DelayedVsPromptEnergy")
00105 c5 = TCanvas("c5")
00106 self.canvases.append(c5)
00107 delayedVsPromptE.SetMarkerStyle(8)
00108 delayedVsPromptE.SetMarkerColor(4)
00109 delayedVsPromptE.SetMarkerSize(0.5)
00110 delayedVsPromptE.Draw()
00111
00112 line = TLine()
00113 line.SetLineWidth(2)
00114 line.SetLineColor(2)
00115 line.SetLineStyle(2)
00116 line.DrawLine(0.7,6.,0.7,10.)
00117 line.DrawLine(8.0,6.,8.0,10.)
00118 line.DrawLine(0.7,6.,8.0,6.)
00119 line.DrawLine(0.7,10.,8.0,10.)
00120