1
# Author: Christopher Tunnell <tunnell@hep.uchicago.edu>
6
from src.GenericWorker import *
7
from src.oscalls import *
11
class ShowResiduals(GenericWorker):
12
"Make a plot of the CIS fit residuals"
15
self.c1 = src.MakeCanvas.MakeCanvas()
17
self.dir = getPlotDirectory() + "/cis"
18
createDir('%s/residuals' % self.dir)
19
self.dir = '%s/residuals' % self.dir
21
def ProcessRegion(self, region):
22
# Only look at each gain within some channel
23
if 'gain' not in region.GetHash():
28
for event in region.GetEvents():
29
if event.runType == 'CIS' and event.data.has_key('scan'):
30
scan = event.data['scan']
31
gnln = ROOT.TGraphErrors()
33
for i in range(scan.GetN()):
34
if 'high' in region.GetHash() and not 3.<scan.GetX()[i]<10.:
36
elif 'low' in region.GetHash() and not 300.<scan.GetX()[i]<700.:
39
gnln.SetPoint(gnlni, scan.GetX()[i], scan.GetY()[i] - event.data['calibration']*scan.GetX()[i])
40
gnln.SetPointError(gnlni, 0, scan.GetErrorY(i))
45
gnln.GetXaxis().SetTitle("Injected Charge (pC)")
46
gnln.GetYaxis().SetTitle("Data - Fit (ADC counts)")
47
gnln.GetYaxis().SetLabelSize(0.05)
48
gnln.GetYaxis().SetTitleSize(0.05)
49
gnln.GetXaxis().SetLabelOffset(0.02)
50
gnln.GetXaxis().SetLabelOffset(0.01)
51
gnln.GetXaxis().SetLabelSize(0.05)
52
gnln.GetXaxis().SetTitleSize(0.05)
53
gnln.GetXaxis().SetTitleOffset(0.93)
55
gnln.SetMarkerSize(1.6)
56
gnln.SetMarkerStyle(20)
58
self.c1.Print("%s/uncalib_%s.ps" % (self.dir, region.GetHash()))