1
from src.GenericWorker import *
3
class CheckNoiseBounds(GenericWorker):
4
'''Check noise values against established bounds. Fails are reccomended for DB update.'''
6
c1 = src.MakeCanvas.MakeCanvas()
9
self.outFileName = 'errors.txt'
11
self.noiseThresholds = {}
12
self.noiseThresholds['ped'] = [20,100]
13
self.noiseThresholds['hfnHG'] = [0.1, 2.50, 26.]
14
self.noiseThresholds['hfnLG'] = [0.1, 1.25, 13.]
16
def ProcessStart(self):
17
self.outFile = open(self.outFileName,'w')
19
def ProcessStop(self):
22
def ProcessRegion(self, region):
23
hash = region.GetHash()
24
if 'gain' not in hash:
30
for event in region.events:
31
if event.runType != 'Ped':
36
if data['ped'] < self.noiseThresholds['ped'][0]:
37
self.outFile.write(hash+' pedestal under threshold. ped = '+str(data['ped'])+'\n')
38
elif data['ped'] > self.noiseThresholds['ped'][1]:
39
self.outFile.write(hash+' pedestal over threshold. ped = '+str(data['ped'])+'\n')
42
if data['hfn'] > self.noiseThresholds['hfn'+gain][2]:
43
self.outFile.write(hash+' hf noise over VeryLargeHfNoise threshold. hfn = '+str(data['hfn'])+'\n')
44
elif data['hfn'] > self.noiseThresholds['hfn'+gain][1]:
45
self.outFile.write(hash+' hf noise over LargeHfNoise threshold. hfn = '+str(data['hfn'])+'\n')
46
elif data['hfn'] < self.noiseThresholds['hfn'+gain][0]:
47
self.outFile.write(hash+' hf noise too low. hfn = '+str(data['hfn'])+'\n')