00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 from xml.sax import handler, make_parser
00028 from sys import stdin
00029
00030
00031 print "Alignable, wheel, station, sector, superlayer, layer, relativeto, x, y, z, angletype, phix, phiy, phiz, xx, xy, xz, yy, yz, zz"
00032 print ", endcap, station, ring, chamber, layer, , , , , , alpha, beta, gamma, , , , , , "
00033
00034
00035 class ContentHandler(handler.ContentHandler):
00036
00037 def startElement(self, tag, attrib):
00038 attrib = dict(attrib.items())
00039 if "rawId" in attrib: raise Exception, "Please use \"rawIds = false\""
00040 if "aa" in attrib: raise Exception, "Please use \"survey = false\""
00041
00042
00043 if tag[0:2] == "DT":
00044 print tag,
00045 for a in "wheel", "station", "sector", "superlayer", "layer":
00046 if a in attrib:
00047 print (", %s" % attrib[a]),
00048 else:
00049 print ", ",
00050
00051
00052 elif tag[0:3] == "CSC":
00053 print tag,
00054 for a in "endcap", "station", "ring", "chamber", "layer":
00055 if a in attrib:
00056 print (", %s" % attrib[a]),
00057 else:
00058 print ", ",
00059
00060
00061 elif tag == "setposition":
00062 print (", %(relativeto)s, %(x)s, %(y)s, %(z)s" % attrib),
00063 if "phix" in attrib:
00064 print (", phixyz, %(phix)s, %(phiy)s, %(phiz)s" % attrib),
00065 else:
00066 print (", Euler, %(alpha)s, %(beta)s, %(gamma)s" % attrib),
00067
00068
00069 elif tag == "setape":
00070 print (", %(xx)s, %(xy)s, %(xz)s, %(yy)s, %(yz)s, %(zz)s" % attrib),
00071
00072
00073 def endElement(self, tag):
00074 if tag == "operation":
00075 print ""
00076
00077
00078 parser = make_parser()
00079 parser.setContentHandler(ContentHandler())
00080 parser.parse(stdin)