~vpec/maus/tof_calib_read

« back to all changes in this revision

Viewing changes to workers/.svn/text-base/IsEntireModuleBad.py.svn-base

  • 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 IsEntireModuleBad(GenericWorker):
 
10
    "Checks to see if isBad is true for an entire module"
 
11
 
 
12
    def __init__(self, runType = 'CIS'):
 
13
        self.runType = runType
 
14
 
 
15
    def ProcessStart(self):
 
16
        self.nBad = 0
 
17
 
 
18
    def ProcessStop(self):
 
19
        print 'There are', self.nBad, 'modules with only bad events'
 
20
 
 
21
    def ProcessRegion(self, region):
 
22
        if 'c' in region.GetHash() or 'm' not in region.GetHash(): 
 
23
            return
 
24
 
 
25
        found = False
 
26
        good = False
 
27
        for event in region.RecursiveGetEvents():
 
28
            if event.runType == self.runType and event.data.has_key('goodRegion'):
 
29
                found = True
 
30
                if event.data['goodRegion']:
 
31
                    good = True
 
32
 
 
33
        if found and not good:
 
34
            print 'No good events within: ', region.GetHash()
 
35
            self.nBad += 1
 
36
                    
 
37
                    
 
38