CMS 3D CMS Logo

List of all members | Public Member Functions
geometryXMLtoCSV.ContentHandler Class Reference
Inheritance diagram for geometryXMLtoCSV.ContentHandler:

Public Member Functions

def endElement (self, tag)
 
def startElement (self, tag, attrib)
 

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  def endElement(self, tag):
74  if tag == "operation":
75  print "" # end current line (note: no comma)
76 
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 cmsPerfStripChart.dict.

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