CMS 3D CMS Logo

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.

00037                   :
00038   for ai, bi, name in zip(list(a) + [0]*(5 - len(a)), \
00039                           list(b) + [0]*(5 - len(b)), \
00040                           ("endcap", "station", "ring", "chamber", "layer")):
00041     exec("a%s = %d" % (name, ai))
00042     exec("b%s = %d" % (name, bi))
00043 
00044   if astation == 1 and aring == 3: return cmp(a, b)
00045 
00046   elif aendcap == bendcap and astation == bstation and aring == bring and achamber != bchamber:
00047     if achamber == 0: return -1 # upper hierarchy comes first
00048     if bchamber == 0: return  1 # upper hierarchy comes first
00049     if achamber % 2 == 1 and bchamber % 2 == 0: return -1  # odds come first
00050     elif achamber % 2 == 0 and bchamber % 2 == 1: return 1 # evens come after
00051 
00052   return cmp(a, b)
00053 
# External libraries (standard in Python >= 2.4, at least)
def geometryXMLparser::dtorder (   a,
  b 
)

Definition at line 15 of file geometryXMLparser.py.

00016                  :
00017   for ai, bi, name in zip(list(a) + [0]*(5 - len(a)), \
00018                           list(b) + [0]*(5 - len(b)), \
00019                           ("wheel", "station", "sector", "superlayer", "layer")):
00020     exec("a%s = %d" % (name, ai))
00021     exec("b%s = %d" % (name, bi))
00022 
00023   if awheel == bwheel and astation == bstation:
00024 
00025     if asector != bsector:
00026       if astation == 4: sectororder = [0, 1, 2, 3, 4, 13, 5, 6, 7, 8, 9, 10, 14, 11, 12]
00027       elif awheel == 0: sectororder = [0, 1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8, 12]
00028       else: sectororder = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
00029       return cmp(sectororder.index(asector), sectororder.index(bsector))
00030 
00031     elif asuperlayer != bsuperlayer:
00032       superlayerorder = [0, 1, 3, 2]
00033       return cmp(superlayerorder.index(asuperlayer), superlayerorder.index(bsuperlayer))
00034 
00035   return cmp(a, b)