CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 36 of file geometryXMLtoCSV.py.

Member Function Documentation

◆ endElement()

def geometryXMLtoCSV.ContentHandler.endElement (   self,
  tag 
)

Definition at line 74 of file geometryXMLtoCSV.py.

References print().

74  def endElement(self, tag):
75  if tag == "operation":
76  print("") # end current line (note: no comma)
77 
78 # Actually make it and use it on "stdin" (a file object)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ startElement()

def geometryXMLtoCSV.ContentHandler.startElement (   self,
  tag,
  attrib 
)

Definition at line 38 of file geometryXMLtoCSV.py.

References print().

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, end=' ') # 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]), end=' ')
49  else:
50  print(", ", end=' ')
51 
52  # <CSC...>: print endcap/station/ring/chamber/layer
53  elif tag[0:3] == "CSC":
54  print(tag, end=' ')
55  for a in "endcap", "station", "ring", "chamber", "layer":
56  if a in attrib:
57  print((", %s" % attrib[a]), end=' ')
58  else:
59  print(", ", end=' ')
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), end=' ')
64  if "phix" in attrib:
65  print((", phixyz, %(phix)s, %(phiy)s, %(phiz)s" % attrib), end=' ')
66  else:
67  print((", Euler, %(alpha)s, %(beta)s, %(gamma)s" % attrib), end=' ')
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), end=' ')
72 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47