CMS 3D CMS Logo

Classes | Functions
geometryXMLparser Namespace Reference

Classes

class  Alignable
 
class  CSCAlignable
 
class  DTAlignable
 
class  MuonGeometry
 
class  Operation
 

Functions

def cscorder (a, b)
 
def dtorder (a, b)
 

Function Documentation

◆ cscorder()

def geometryXMLparser.cscorder (   a,
  b 
)

Definition at line 36 of file geometryXMLparser.py.

References fileCollector.cmp, and ComparisonHelper.zip().

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

◆ dtorder()

def geometryXMLparser.dtorder (   a,
  b 
)

Definition at line 15 of file geometryXMLparser.py.

References fileCollector.cmp, and ComparisonHelper.zip().

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