CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
geometryXMLparser Namespace Reference

Classes

class  Alignable
 
class  CSCAlignable
 
class  DTAlignable
 
class  MuonGeometry
 
class  Operation
 

Functions

def cscorder
 
def dtorder
 

Function Documentation

def geometryXMLparser.cscorder (   a,
  b 
)

Definition at line 36 of file geometryXMLparser.py.

References ComparisonHelper.zip().

36 
37 def cscorder(a, b):
38  for ai, bi, name in zip(list(a) + [0]*(5 - len(a)), \
39  list(b) + [0]*(5 - len(b)), \
40  ("endcap", "station", "ring", "chamber", "layer")):
41  exec("a%s = %d" % (name, ai))
42  exec("b%s = %d" % (name, bi))
43 
44  if astation == 1 and aring == 3: return cmp(a, b)
45 
46  elif aendcap == bendcap and astation == bstation and aring == bring and achamber != bchamber:
47  if achamber == 0: return -1 # upper hierarchy comes first
48  if bchamber == 0: return 1 # upper hierarchy comes first
49  if achamber % 2 == 1 and bchamber % 2 == 0: return -1 # odds come first
50  elif achamber % 2 == 0 and bchamber % 2 == 1: return 1 # evens come after
51 
52  return cmp(a, b)
53 
# External libraries (standard in Python >= 2.4, at least)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def geometryXMLparser.dtorder (   a,
  b 
)

Definition at line 15 of file geometryXMLparser.py.

References ComparisonHelper.zip().

15 
16 def dtorder(a, b):
17  for ai, bi, name in zip(list(a) + [0]*(5 - len(a)), \
18  list(b) + [0]*(5 - len(b)), \
19  ("wheel", "station", "sector", "superlayer", "layer")):
20  exec("a%s = %d" % (name, ai))
21  exec("b%s = %d" % (name, bi))
22 
23  if awheel == bwheel and astation == bstation:
24 
25  if asector != bsector:
26  if astation == 4: sectororder = [0, 1, 2, 3, 4, 13, 5, 6, 7, 8, 9, 10, 14, 11, 12]
27  elif awheel == 0: sectororder = [0, 1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8, 12]
28  else: sectororder = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
29  return cmp(sectororder.index(asector), sectororder.index(bsector))
30 
31  elif asuperlayer != bsuperlayer:
32  superlayerorder = [0, 1, 3, 2]
33  return cmp(superlayerorder.index(asuperlayer), superlayerorder.index(bsuperlayer))
34 
35  return cmp(a, b)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)