#!/bin/env python import os, sys from icecube.daq.domconfig import process_domcals, mkxml, db_connect import icecube.daq.domconfig def load_doms(f): doms = list() while 1: s = f.readline() if len(s) == 0: return doms doms.append(s.split()) domlist = sys.argv.pop(1) doms = load_doms(file(domlist)) domcals = sys.argv[1:] db_connect('fat-dbs.icecube.wisc.edu', 'penguin') print icecube.daq.domconfig.db # Strip out the MBID - call DOM communicating domcal_ok = [ x[-16:-4] for x in domcals ] hvpar = process_domcals(domcals) # ID communicating DOMs - some are not attached - by presence of DOMCal info comm_doms = [ x for x in doms if x[0] in domcal_ok ] # Find the strings inice = dict() icetop = dict() for s in range(1, 81): inice = [ x for x in comm_doms if int(x[3][0:2]) == s and int(x[3][3:5]) < 61 ] icetop = [ x for x in comm_doms if int(x[3][0:2]) == s and int(x[3][3:5]) > 60 ] if len(inice) > 0: print "String", s, "found", len(inice), "inice DOMs." mkxml(hvpar, 'string%2.2d-pedestal.xml' % s, 1, inice) mkxml(hvpar, 'string%2.2d-dark.xml' % s, 2, inice) mkxml(hvpar, 'string%2.2d-lc.xml' % s, 3, inice) if len(icetop) > 0: print "String", s, "found", len(icetop), "icetop DOMs." mkxml(hvpar, 'icetop%2.2d-pedestal.xml' % s, 1, icetop) mkxml(hvpar, 'icetop%2.2d-dark.xml' % s, 2, icetop) mkxml(hvpar, 'icetop%2.2d-lc.xml' % s, 3, icetop)