# configuration fechost = 'localhost' fecport = 2001 fedslot = 99 fed=0 # not used pxfec=2000 caen=0 # not used fedport = 2006 ######################################################## # connect print "connecting to pxfec,", pxfec=SimpleSocket( 'localhost', 2015) print " done" print "connecting to ccu,", ccu=SimpleSocket( 'localhost', 2005) print " done" print "connecting to digitalfed,", digfed=SimpleSocket( 'localhost', 2060) print " done" #import actual time
base, ext = os.path.splitext(filename) f = base + "_" + date.today().isoformat() if os.path.exists(f + ext): template = f + "-%03d" for n in range(1, 100): if not os.path.exists(template % n + ext): return template % n + ext print "no valid filename found for ", filename return "temp" + ext else: return f + ext ######################################################## print "connecting to fed,", fed = SimpleSocket('localhost', 2003) print " done" ccu = None caen = None # not needed pxfec = None # not needed def showRMSAOHTestCCU(sector, aoh, wait=True, filename=None): gStyle.SetOptStat(0) gStyle.SetCanvasColor(0) gStyle.SetTitleFillColor(0) sector.aoh[aoh].biasGraphs = [] sector.aoh[aoh].rmsGraphs = [] sector.aoh[aoh].slopeGraphs = []
import sys, time, os, re from datetime import date from time import sleep sockdir = "/home/cmspixel/TriDAS/pixel/BPixelTools/tools/python" if not sockdir in sys.path: sys.path.append(sockdir) from SimpleSocket import SimpleSocket import ROOT from ROOT import * ######################################################## # connect print "connecting to pxfec,", pxfec = SimpleSocket('localhost', 2000) print " done" print "connecting to digfed,", digfed = SimpleSocket('localhost', 2006) print " done" digfed.send("initFitelS").readlines() digfed.send("piggyS").readlines() digfed.send("fiber 3").readlines() pxfec.send("module 28") pxfec.send("tbm tbmadelay 93") pxfec.send("tbm tbmbdelay 93") pxfec.send("tbm tbmplldelay 208") time.sleep(0.1) pxfec.send("roc 0:15") pxfec.send("mask")
f = base + "_" + date.today().isoformat() if os.path.exists(f + ext): template = f + "-%03d" for n in range(1, 100): if not os.path.exists(template % n + ext): return template % n + ext print "no valid filename found for ", filename return "temp" + ext else: return f + ext ######################################################## print "connecting to ccu,", ccu = SimpleSocket('localhost', 2001) print " done " print "connecting to fed,", fed = SimpleSocket('localhost', 2005) print " done" caen = None # not needed pxfec = None # not needed def showRMSAOHTestCCU(sector, aoh, wait=True, filename=None): gStyle.SetOptStat(0) gStyle.SetCanvasColor(0) gStyle.SetTitleFillColor(0)
fechost = 'localhost' fecport = 2002 fedslot = 99 fed=0 # not used pxfec=0 # not used caen=0 # not used ######################################################## # connect print "connecting to ccu,",fechost, fecport ccu=SimpleSocket( fechost, fecport) print " done" log=Logger() # choose an arbitray sector in that shell and get ring and slot from the server ccu.send("cratereset").readlines() ccu.send("reset").readlines() ccu.send("piareset all").readlines() fecring = 7 #fecring = 8 fecslot = 9 print "fecring=",fecring print "fecslot=",fecslot tag="FEC %d ring 0x%i :"%(fecslot,fecring) print 'tag is', tag
gCanvases=[] ######################################################## # port fechost = 'localhost' pxfechost = 'localhost' caenhost ='localhost' fedhost = 'localhost' fecport = 2001 fedport= 2004 dfedport= 2006 pxfecport= 2000 caenport= 2005 caenslot =4 ######################################################## ccu=SimpleSocket( fechost, fecport) pxfec=SimpleSocket(fechost, pxfecport) caen=SimpleSocket(caenhost,caenport) fed=SimpleSocket(fedhost, fedport) digfed=SimpleSocket( 'localhost', dfedport) timer.append("Connection to simplesocket") timer.append(time.time()-start_time) ######################################################## # print "sector and groups names definition" log=Logger() name= "+6P" ccu.send("sector" + name ).readlines() out=( ccu.send( "which fec").readlines()) fecslot =int(out[1][-2:]) out=(ccu.send("which ring").readlines()) fecring =int(out[1][-2:])
fechost = 'localhost' fecport = 2001 fedslot = 99 fed=0 # not used pxfec=2000 caen=0 # not used dfedport= 2006 ######################################################## # connect print "connecting to ccu,",fechost, fecport ccu=SimpleSocket( fechost, fecport) print " done" print "connecting to pxfec,", pxfec=SimpleSocket( 'localhost', 2000) print " done" print "connecting to digital fed,", digfed=SimpleSocket( 'localhost', dfedport) print " done" log=Logger() # choose an arbitray sector in that shell and get ring and slot from the server #s=SECTOR("-6P",fed,17,ccu,pxfec,caen) s=GROUP(fed, ccu, pxfec, caen, "+6PL12", 0x11, log) verbose = True
""" console client for connection to multiple SimpleServer(Sockets) """ # read the server list from mclient.conf # one line per server: key host port, e.g. "d pc4226 2000" serverlist = [] try: for l in open("mclient.conf").readlines(): serverlist.append(l.split()) except: serverlist = [("d", "localhost", 2000), ("caen", "localhost", 2001), ("ccu", "localhost", 2002), ("fed", "localhost", 2003)] servers = {} for key, host, port in serverlist: #if SimpleSocket.acceptsConnections(host,int(port)): servers[key] = SimpleSocket(host, int(port), timeout=2) print "connected to ", key try: readline.read_history_file(".history") except: pass defaultServer = "" prompt = ">" while len(servers) > 0: # user input of the form [serverKey] [request] # example: "d module 23 roc 5 Vcal 120" sends request module... to d # "d" makes d the default
from SimpleSocket import SimpleSocket import sys, readline """ console client for SimpleSocket servers or SimpleServer applications""" if not len(sys.argv) == 3: print "usage: python client.py <host> <port>" sys.exit(1) host, port = sys.argv[1], int(sys.argv[2]) try: readline.read_history_file(".history") except: pass mySocket = SimpleSocket(host, port) while mySocket.isOpen(): cmd = raw_input("%s " % (mySocket.prompt)) mySocket.send(cmd) for l in mySocket.readline(): print l mySocket.close() readline.write_history_file(".history")
sockdir = "/home/cmspixel/TriDAS/pixel/BPixelTools/tools/python" from SimpleSocket import SimpleSocket from SystemTests import GROUP, SECTOR, TestRedundancy, TestTriggerStatusFED, tDOH, AOH, DELAY25, PLL, MODULE, TestDCDCEnable, DCDCDisable, POH from Logger import Logger from ROOT import * from array import array from contextlib import contextmanager fechost = 'localhost' pxfechost = 'localhost' caenhost = 'localhost' fecport = 2001 pxfecport = 2000 caenport = 2005 caenslot = 4 fed = "dummyfed" ccu = SimpleSocket(fechost, fecport) pxfec = SimpleSocket(fechost, pxfecport) caen = SimpleSocket(caenhost, caenport) ######################################################## ######################################################## c1 = TCanvas('c1', 'c1', 200, 10, 800, 800) ######################################################## redundancytest = False # True resettest = False inittest = False # True dcdctest = True #True vanatest = False dcdcianatest = True ######################################################## ######################################################## ########################################################
# configuration fechost = 'localhost' fecport = 2001 fedslot = 99 fed = 0 # not used pxfec = 2000 caen = 0 # not used ######################################################## # connect print "connecting to ccu,", fechost, fecport ccu = SimpleSocket(fechost, fecport) print " done" print "connecting to pxfec,", pxfec = SimpleSocket('localhost', 2000) print " done" log = Logger() # choose an arbitray sector in that shell and get ring and slot from the server #s=SECTOR("-6P",fed,17,ccu,pxfec,caen) s = GROUP(fed, ccu, pxfec, caen, "+6PL12", 0x11, log) # print "FED slot ",s.fedslot verbose = True
# configuration fechost = 'localhost' fecport = 2001 fedslot = 99 fed = 0 # not used pxfec = 2000 caen = 0 # not used fedport = 2006 fecport = 2001 ######################################################## # connect print "connecting to pxfec,", pxfec = SimpleSocket('localhost', 2000) print " done" # port print "connecting to ccu,", ######################################################## ccu = SimpleSocket('localhost', fecport) print " done" # port pxfec.send("cn +6PL12").readlines() pxfec.send("module 28").readlines() pxfec.send("roc 0:15").readlines() #ccu.send("channel 0x11").readlines() for i in range(30, 600000): print "Setting Delay=%i" % (i)