1
from src.GenericWorker import *
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"
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
10
def ProcessRegion(self, region):
11
# If there are no events for this region, do nothing
12
if region.GetEvents() == set():
15
# Print out the region so the user knows. The function GetHash()
16
# returns the unique name of the region in the form:
18
# TILECAL_LBA_m32_c03_highgain
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()
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']
33
for event in region.GetEvents():
34
if event.runType == 'CIS':
35
if event.data.has_key("calibration"):
36
print "\tCIS:",event.data['calibration']