~vpec/maus/tof_calib_read

« back to all changes in this revision

Viewing changes to workers/CIS/CompareCIStoDQ.py

  • Committer: tunnell
  • Date: 2010-09-20 10:52:02 UTC
  • Revision ID: tunnell@itchy-20100920105202-ce4w9jm59zvgnsxq
moving stuff from tucs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Author: Christopher Tunnell <tunnell@hep.uchicago.edu>
 
2
#
 
3
# March 04, 2009
 
4
#
 
5
 
 
6
from src.GenericWorker import *
 
7
import src.MakeCanvas
 
8
 
 
9
class CompareCIStoDQ(GenericWorker):
 
10
    "Compare CIS to DQ"
 
11
 
 
12
    c1 = src.MakeCanvas.MakeCanvas()
 
13
 
 
14
    def __init__(self, runType = 'CIS'):
 
15
        self.runType = runType
 
16
        self.nFailCisOnly = 0
 
17
        self.nFailDQOnly = 0
 
18
        self.nFailBoth = 0
 
19
 
 
20
    def ProcessStart(self):
 
21
        self.c1.Print("plots/compare_cis_dq.ps[")
 
22
 
 
23
    def ProcessStop(self):
 
24
        self.c1.Print("plots/compare_cis_dq.ps]")
 
25
        
 
26
        print 'Fail CIS Only: ', self.nFailCisOnly
 
27
        print 'Fail DQ Only: ', self.nFailDQOnly
 
28
        print 'Fail Both: ', self.nFailBoth
 
29
    
 
30
    def ProcessRegion(self, region):
 
31
        if 'gain' not in region.GetHash():
 
32
            return
 
33
 
 
34
        failcis = False
 
35
        faildq = False
 
36
 
 
37
#        scan = None
 
38
 
 
39
        for event in region.events:
 
40
            if event.runType == 'CIS' and event.data.has_key('isCalibrated'):
 
41
                failcis = not event.data['isCalibrated']
 
42
 
 
43
#            if event.runType == 'CIS' and event.data.has_key('isBad'):
 
44
#                if not event.data['isBad'] and event.data.has_key('scan'):
 
45
#                    scan = event.data['scan']
 
46
            if event.runType == 'DQ' and event.data.has_key('isBad'):
 
47
                faildq = event.data['isBad']
 
48
 
 
49
        x,y,z,w = region.GetNumber()
 
50
        y -= 1
 
51
        if failcis and faildq:
 
52
            self.nFailBoth += 1
 
53
            #print 'DQandCIS', region.GetHash(), region.GetHash(True)
 
54
            print './PyCisInfoADC.py -s -c 102009', x,y,z,w, '# both'
 
55
        elif faildq:
 
56
            self.nFailDQOnly += 1
 
57
            #print 'DQ      ', region.GetHash(), region.GetHash(True
 
58
            print './PyCisInfoADC.py -s -c 102009', x,y,z,w, '# dq'
 
59
        elif failcis:
 
60
            self.nFailCisOnly += 1
 
61
            #print '     CIS', region.GetHash(), region.GetHash(True)
 
62
            print './PyCisInfoADC.py -s -c 102009', x,y,z,w, '# cis'
 
63
 
 
64
        if failcis:
 
65
            x, y, z, w = region.GetNumber()
 
66
            h = region.GetHash()
 
67
            hs = h.split('_')
 
68
            print '%s\t%d\t%d\t%s' % (hs[1], y, z, hs[4]), '\tProbCIS', '\t%s'%region.GetHash(True)
 
69
 
 
70
        """
 
71
        if failcis or faildq:
 
72
            if not scan:
 
73
                return
 
74
 
 
75
            scan.Draw("ALP")
 
76
            pt = ROOT.TPaveText(0.8, 0.8, 1, 1)
 
77
            if failcis:
 
78
                pt.AddText('BAD-CIS')
 
79
            if faildq:
 
80
                pt.AddText('BAD-DQ')
 
81
 
 
82
            pt.Draw()
 
83
 
 
84
            self.c1.Print('plots/compare_cis_dq.ps')
 
85
            self.c1.Print('blah.C')
 
86
        """
 
87
        
 
88