CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
geometryXMLtoCSV.ContentHandler Class Reference
Inheritance diagram for geometryXMLtoCSV.ContentHandler:

Public Member Functions

def endElement
 
def startElement
 

Detailed Description

Definition at line 35 of file geometryXMLtoCSV.py.

Member Function Documentation

def geometryXMLtoCSV.ContentHandler.endElement (   self,
  tag 
)

Definition at line 73 of file geometryXMLtoCSV.py.

73 
74  def endElement(self, tag):
75  if tag == "operation":
76  print "" # end current line (note: no comma)
77 
# Actually make it and use it on "stdin" (a file object)
def geometryXMLtoCSV.ContentHandler.startElement (   self,
  tag,
  attrib 
)

Definition at line 37 of file geometryXMLtoCSV.py.

References python.multivaluedict.dict.

37 
38  def startElement(self, tag, attrib):
39  attrib = dict(attrib.items())
40  if "rawId" in attrib: raise Exception, "Please use \"rawIds = false\""
41  if "aa" in attrib: raise Exception, "Please use \"survey = false\""
42 
43  # <DT...>: print wheel/station/sector/superlayer/layer
44  if tag[0:2] == "DT":
45  print tag, # ending with a comma means "don't print end-of-line character"
46  for a in "wheel", "station", "sector", "superlayer", "layer":
47  if a in attrib:
48  print (", %s" % attrib[a]),
49  else:
50  print ", ",
51 
52  # <CSC...>: print endcap/station/ring/chamber/layer
53  elif tag[0:3] == "CSC":
54  print tag,
55  for a in "endcap", "station", "ring", "chamber", "layer":
56  if a in attrib:
57  print (", %s" % attrib[a]),
58  else:
59  print ", ",
60 
61  # <setposition>: print x, y, z and phix, phiy, phiz or alpha, beta, gamma
62  elif tag == "setposition":
63  print (", %(relativeto)s, %(x)s, %(y)s, %(z)s" % attrib),
64  if "phix" in attrib:
65  print (", phixyz, %(phix)s, %(phiy)s, %(phiz)s" % attrib),
66  else:
67  print (", Euler, %(alpha)s, %(beta)s, %(gamma)s" % attrib),
68 
69  # <setape>: print xx, xy, xz, yy, yz, zz
70  elif tag == "setape":
71  print (", %(xx)s, %(xy)s, %(xz)s, %(yy)s, %(yz)s, %(zz)s" % attrib),