#!/usr/bin/python # This script fixes an issue with the numbering of the TAGM channels. # The changes were sent to me from Richard Jones on 11/21/2014 in the # form on an XML file containing just the TAGM channel definitions. # The cabling was apparently done in some way that has every group # of 3 cables into the fADC250 flipped w.r.t. how it currently is # defined. This also affects which column numbers have multiple rows. # # Previously, these columns had 5 rows outfitted for readout: # # BEFORE: col = 7, 25, 79, 97 # # After this fix, these columns have 5 rows outfitted for readout: # # AFTER: col = 9, 27, 81, 99 # # We do this update by brute force in that Richard's XML was copied into # here and then global search and replace done to turn it into calls to # update functions that do the appropriate queries. # # Note one change that was needed to Richard's XML is that it had the # old rocid values. These were changed according to the comments in # tt_fix_tagger2.py # # The original XML from the e-mail is copied to the bottom of this # file for easy reference. (n.b. two e-mails were sent. The second # corrected some issues in the first. This implements the second.) # import sqlite3 as lite import sys import os import getpass import socket import itertools import csv import re from time import gmtime, localtime, strftime if len(sys.argv) != 2: print "You must supply a sqlite file (e.g. tt.db)" sys.exit(0); con = lite.connect(sys.argv[1]) #------------------------ # SwapColumnValues #------------------------ def SwapColumnValues(col1, col2): global cur # First check that col1 has 6 entries while col2 has only 1 cur.execute("SELECT * FROM TAGM WHERE col=%s" % (col1)) Nrows1 = len( cur.fetchall() ) cur.execute("SELECT * FROM TAGM WHERE col=%s" % (col2)) Nrows2 = len( cur.fetchall() ) if Nrows1!=6 or Nrows2!=1: print 'It appears that the number of entries for col=%s or col=%d is not correct' % (col1, col2) print 'The first should have 6 entries and has %d' % Nrows1 print 'The second should have 1 entry and has %d' % Nrows2 print 'This probably means this file was already updated.' print 'Quitting now without applying any further changes' # NOTE: By calling sys.exit(0) here, we are bypassing the implicit # conn.commit() call that actually applies any changes to the SQLite # file. This generally means NO changes will have been made to the # file and it is left untouched, even if several UPDATE queries # have been made. sys.exit(0) print 'Updating TAGM col %s --> %s' % (col1, col2) query = "UPDATE TAGM SET col=%s000 WHERE col=%s;" % (col1, col2) cur.execute(query) query = "UPDATE TAGM SET col=%s000 WHERE col=%s;" % (col2, col1) cur.execute(query) query = "UPDATE TAGM SET col=%s WHERE col=%s000;" % (col1, col1) cur.execute(query) query = "UPDATE TAGM SET col=%s WHERE col=%s000;" % (col2, col2) cur.execute(query) #------------------------ # UpdatefADC #------------------------ def UpdatefADC(rocid, slot, channel, detector, col, row): global cur print 'Updating fADC crate=%s,slot=%s,chan=%s to col=%s,row=%s' % (rocid, slot, channel, col, row) subselect = "SELECT Channel.chanid FROM Crate,Module,Channel WHERE Crate.crateid=Module.crateid AND Module.moduleid=Channel.moduleid AND Crate.rocid=%s AND Module.slot=%s AND Channel.channel=%s" % (rocid, slot, channel) query = "UPDATE TAGM SET adc_chanid=(%s) WHERE col=%s AND row=%s" % (subselect,col,row) print query cur.execute(query) #------------------------ # UpdateTDC #------------------------ def UpdateTDC(rocid, slot, channel, detector, col, row): global cur print 'Updating TDC crate=%s,slot=%s,chan=%s to col=%s,row=%s' % (rocid, slot, channel, col, row) subselect = "SELECT Channel.chanid FROM Crate,Module,Channel WHERE Crate.crateid=Module.crateid AND Module.moduleid=Channel.moduleid AND Crate.rocid=%s AND Module.slot=%s AND Channel.channel=%s" % (rocid, slot, channel) query = "UPDATE TAGM SET tdc_chanid=(%s) WHERE col=%s AND row=%s" % (subselect,col,row) cur.execute(query) #------------------------ # UpdateDISC #------------------------ def UpdateDISC(rocid, slot, channel, detector, col, row): global cur print 'Updating DISC crate=%s,slot=%s,chan=%s to col=%s,row=%s' % (rocid, slot, channel, col, row) subselect = "SELECT Channel.chanid FROM Crate,Module,Channel WHERE Crate.crateid=Module.crateid AND Module.moduleid=Channel.moduleid AND Crate.rocid=%s AND Module.slot=%s AND Channel.channel=%s" % (rocid, slot, channel) query = "UPDATE TAGM SET disc_chanid=(%s) WHERE col=%s AND row=%s" % (subselect,col,row) cur.execute(query) #------------------------ # main #------------------------ with con: global cur # Specify that next cursor should be "dictionary" # (i.e. python's hash map) so columns can be indexed # by name con.row_factory = lite.Row # Create Cursor cur = con.cursor() # The first thing we need to do is change over the col values for the # groups of 5 as noted in the comments at the top of this script. e.g. # all entries in TAGM with col=7 need to be changed to have col=9 and # vice versa. Do this by first changing all "9"s to "7000"s and # then all "7000"s to "7"s. SwapColumnValues( 7, 9) SwapColumnValues(25,27) SwapColumnValues(79,81) SwapColumnValues(97,99) rocid="71" slot="3" UpdatefADC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="3", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="2", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="1", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="6", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="5", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="4", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="9", row="1") UpdatefADC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="9", row="2") UpdatefADC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="9", row="3") UpdatefADC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="9", row="4") UpdatefADC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="9", row="5") UpdatefADC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="9", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="8", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="7", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="12", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="11", row="0") slot="4" UpdatefADC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="10", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="15", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="14", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="13", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="18", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="17", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="16", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="21", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="20", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="19", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="24", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="23", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="22", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="27", row="1") UpdatefADC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="27", row="2") UpdatefADC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="27", row="3") slot="5" UpdatefADC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="27", row="4") UpdatefADC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="27", row="5") UpdatefADC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="27", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="26", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="25", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="30", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="29", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="28", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="33", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="32", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="31", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="36", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="35", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="34", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="39", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="38", row="0") slot="6" UpdatefADC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="37", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="42", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="41", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="40", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="45", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="44", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="43", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="48", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="47", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="46", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="51", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="50", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="49", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="54", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="53", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="52", row="0") slot="7" UpdatefADC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="57", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="56", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="55", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="60", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="59", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="58", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="63", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="62", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="61", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="66", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="65", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="64", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="69", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="68", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="67", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="72", row="0") slot="8" UpdatefADC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="71", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="70", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="75", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="74", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="73", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="78", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="77", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="76", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="81", row="1") UpdatefADC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="81", row="2") UpdatefADC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="81", row="3") UpdatefADC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="81", row="4") UpdatefADC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="81", row="5") UpdatefADC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="81", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="80", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="79", row="0") slot="9" UpdatefADC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="84", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="83", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="82", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="87", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="86", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="85", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="90", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="89", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="88", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="93", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="92", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="91", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="96", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="95", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="94", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="99", row="1") slot="10" UpdatefADC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="99", row="2") UpdatefADC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="99", row="3") UpdatefADC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="99", row="4") UpdatefADC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="99", row="5") UpdatefADC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="99", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="98", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="97", row="0") UpdatefADC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="100", row="0") rocid="75" slot="3" UpdateTDC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="3", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="2", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="1", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="6", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="5", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="4", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="9", row="1") UpdateTDC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="9", row="2") UpdateTDC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="9", row="3") UpdateTDC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="9", row="4") UpdateTDC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="9", row="5") UpdateTDC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="9", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="8", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="7", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="12", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="11", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="10", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="17", detector="TAGM", col="15", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="18", detector="TAGM", col="14", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="19", detector="TAGM", col="13", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="20", detector="TAGM", col="18", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="21", detector="TAGM", col="17", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="22", detector="TAGM", col="16", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="23", detector="TAGM", col="21", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="24", detector="TAGM", col="20", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="25", detector="TAGM", col="19", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="26", detector="TAGM", col="24", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="27", detector="TAGM", col="23", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="28", detector="TAGM", col="22", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="29", detector="TAGM", col="27", row="1") UpdateTDC(rocid=rocid, slot=slot, channel="30", detector="TAGM", col="27", row="2") UpdateTDC(rocid=rocid, slot=slot, channel="31", detector="TAGM", col="27", row="3") slot="4" UpdateTDC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="27", row="4") UpdateTDC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="27", row="5") UpdateTDC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="27", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="26", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="25", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="30", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="29", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="28", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="33", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="32", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="31", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="36", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="35", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="34", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="39", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="38", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="37", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="17", detector="TAGM", col="42", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="18", detector="TAGM", col="41", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="19", detector="TAGM", col="40", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="20", detector="TAGM", col="45", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="21", detector="TAGM", col="44", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="22", detector="TAGM", col="43", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="23", detector="TAGM", col="48", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="24", detector="TAGM", col="47", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="25", detector="TAGM", col="46", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="26", detector="TAGM", col="51", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="27", detector="TAGM", col="50", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="28", detector="TAGM", col="49", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="29", detector="TAGM", col="54", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="30", detector="TAGM", col="53", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="31", detector="TAGM", col="52", row="0") slot="5" UpdateTDC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="57", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="56", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="55", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="60", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="59", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="58", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="63", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="62", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="61", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="66", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="65", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="64", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="69", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="68", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="67", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="72", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="71", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="17", detector="TAGM", col="70", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="18", detector="TAGM", col="75", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="19", detector="TAGM", col="74", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="20", detector="TAGM", col="73", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="21", detector="TAGM", col="78", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="22", detector="TAGM", col="77", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="23", detector="TAGM", col="76", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="24", detector="TAGM", col="81", row="1") UpdateTDC(rocid=rocid, slot=slot, channel="25", detector="TAGM", col="81", row="2") UpdateTDC(rocid=rocid, slot=slot, channel="26", detector="TAGM", col="81", row="3") UpdateTDC(rocid=rocid, slot=slot, channel="27", detector="TAGM", col="81", row="4") UpdateTDC(rocid=rocid, slot=slot, channel="28", detector="TAGM", col="81", row="5") UpdateTDC(rocid=rocid, slot=slot, channel="29", detector="TAGM", col="81", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="30", detector="TAGM", col="80", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="31", detector="TAGM", col="79", row="0") slot="6" UpdateTDC(rocid=rocid, slot=slot, channel="0", detector="TAGM", col="84", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="83", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="82", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="87", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="86", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="85", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="90", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="89", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="88", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="93", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="92", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="91", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="96", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="95", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="94", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="99", row="1") UpdateTDC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="99", row="2") UpdateTDC(rocid=rocid, slot=slot, channel="17", detector="TAGM", col="99", row="3") UpdateTDC(rocid=rocid, slot=slot, channel="18", detector="TAGM", col="99", row="4") UpdateTDC(rocid=rocid, slot=slot, channel="19", detector="TAGM", col="99", row="5") UpdateTDC(rocid=rocid, slot=slot, channel="20", detector="TAGM", col="99", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="21", detector="TAGM", col="98", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="22", detector="TAGM", col="97", row="0") UpdateTDC(rocid=rocid, slot=slot, channel="23", detector="TAGM", col="100", row="0") rocid="72" slot="4" UpdateDISC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="3", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="2", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="1", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="6", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="5", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="4", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="9", row="1") UpdateDISC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="9", row="2") UpdateDISC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="9", row="3") UpdateDISC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="9", row="4") UpdateDISC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="9", row="5") UpdateDISC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="9", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="8", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="7", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="12", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="11", row="0") slot="5" UpdateDISC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="10", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="15", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="14", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="13", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="18", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="17", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="16", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="21", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="20", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="19", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="24", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="23", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="22", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="27", row="1") UpdateDISC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="27", row="2") UpdateDISC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="27", row="3") slot="6" UpdateDISC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="27", row="4") UpdateDISC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="27", row="5") UpdateDISC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="27", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="26", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="25", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="30", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="29", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="28", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="33", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="32", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="31", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="36", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="35", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="34", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="39", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="38", row="0") slot="7" UpdateDISC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="37", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="42", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="41", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="40", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="45", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="44", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="43", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="48", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="47", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="46", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="51", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="50", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="49", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="54", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="53", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="52", row="0") slot="8" UpdateDISC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="57", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="56", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="55", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="60", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="59", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="58", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="63", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="62", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="61", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="66", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="65", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="64", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="69", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="68", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="67", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="72", row="0") slot="9" UpdateDISC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="71", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="70", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="75", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="74", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="73", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="78", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="77", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="76", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="81", row="1") UpdateDISC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="81", row="2") UpdateDISC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="81", row="3") UpdateDISC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="81", row="4") UpdateDISC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="81", row="5") UpdateDISC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="81", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="80", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="79", row="0") slot="10" UpdateDISC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="84", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="83", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="82", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="87", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="86", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="85", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="90", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="89", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="9", detector="TAGM", col="88", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="10", detector="TAGM", col="93", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="11", detector="TAGM", col="92", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="12", detector="TAGM", col="91", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="13", detector="TAGM", col="96", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="14", detector="TAGM", col="95", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="15", detector="TAGM", col="94", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="16", detector="TAGM", col="99", row="1") slot="11" UpdateDISC(rocid=rocid, slot=slot, channel="1", detector="TAGM", col="99", row="2") UpdateDISC(rocid=rocid, slot=slot, channel="2", detector="TAGM", col="99", row="3") UpdateDISC(rocid=rocid, slot=slot, channel="3", detector="TAGM", col="99", row="4") UpdateDISC(rocid=rocid, slot=slot, channel="4", detector="TAGM", col="99", row="5") UpdateDISC(rocid=rocid, slot=slot, channel="5", detector="TAGM", col="99", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="6", detector="TAGM", col="98", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="7", detector="TAGM", col="97", row="0") UpdateDISC(rocid=rocid, slot=slot, channel="8", detector="TAGM", col="100", row="0") print "Done." # The following is from an e-mail sent to me from Richard Jones on Nov. 21, 2014 # (the second one with some corrections) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #