~vpec/maus/tof_calib_read

« back to all changes in this revision

Viewing changes to workers/Example/.svn/text-base/ExampleCompare.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
from src.GenericWorker import *
 
2
 
 
3
# Define your worker class here, and be sure to change the name
 
4
class ExampleCompare(GenericWorker):
 
5
    "An example worker for showing how to compare constants"
 
6
 
 
7
    # This function gets called for every region (ie. channel, drawer, etc.) in
 
8
    # TileCal.  Define what you want to do with constants for a certain region
 
9
    # here.
 
10
    def ProcessRegion(self, region):
 
11
        # If there are no events for this region, do nothing
 
12
        if region.GetEvents() == set():
 
13
            return
 
14
        
 
15
        # Print out the region so the user knows.  The function GetHash()
 
16
        # returns the unique name of the region in the form:
 
17
        #
 
18
        #     TILECAL_LBA_m32_c03_highgain
 
19
        #
 
20
        # where this is LBA32 channel 3, highgain. One can also do:
 
21
        # region.GetHash(1) if one wants the PMT number instead.
 
22
        print "Constants for %s" % region.GetHash()
 
23
        
 
24
        # Loop over all events associated with this region
 
25
        for event in region.GetEvents():
 
26
            # and only look at laser runs
 
27
            if event.runType == 'Laser':
 
28
                # Make sure the calibration constant exists to avoid crashes
 
29
                if event.data.has_key("calib_const"):
 
30
                    # then print the calibration constants
 
31
                    print "\tLaser:",event.data['calib_const']
 
32
 
 
33
        for event in region.GetEvents():
 
34
            if event.runType == 'CIS':
 
35
                if event.data.has_key("calibration"):
 
36
                    print "\tCIS:",event.data['calibration']
 
37
 
 
38
        
 
39
                    
 
40
                                       
 
41