Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:40

0001 #!/usr/bin/env python
0002 
0003 # External libraries (standard in Python >= 2.4, at least)
0004 from __future__ import print_function
0005 from sys import stdin
0006 from re import split, sub
0007 
0008 # Skip the first two lines (headers)
0009 next(stdin)
0010 next(stdin)
0011 
0012 print("<MuonAlignment>")
0013 print("")
0014 
0015 for line in stdin:
0016     line = sub("[ \t\n]+$", "", line)
0017     Alignable, struct1, struct2, struct3, struct4, struct5, \
0018                relativeto, x, y, z, angletype, angle1, angle2, angle3, \
0019                xx, xy, xz, yy, yz, zz = split("[ \t]*,[ \t]", line)
0020     
0021     print("<operation>")
0022     if Alignable[0:2] == "DT":
0023       print(("  <%s " % Alignable), end=' ')
0024       if struct1 != "":
0025         print(("wheel=\"%s\" " % struct1), end=' ')
0026       if struct2 != "":
0027         print(("station=\"%s\" " % struct2), end=' ')
0028       if struct3 != "":
0029         print(("sector=\"%s\" " % struct3), end=' ')
0030       if struct4 != "":
0031         print(("superlayer=\"%s\" " % struct4), end=' ')
0032       if struct5 != "":
0033         print(("layer=\"%s\" " % struct5), end=' ')
0034       print("/>")
0035 
0036     if Alignable[0:3] == "CSC":
0037       print(("  <%s " % Alignable), end=' ')
0038       if struct1 != "":
0039         print(("endcap=\"%s\" " % struct1), end=' ')
0040       if struct2 != "":
0041         print(("station=\"%s\" " % struct2), end=' ')
0042       if struct3 != "":
0043         print(("ring=\"%s\" " % struct3), end=' ')
0044       if struct4 != "":
0045         print(("chamber=\"%s\" " % struct4), end=' ')
0046       if struct5 != "":
0047         print(("layer=\"%s\" " % struct5), end=' ')
0048       print("/>")
0049 
0050     if angletype == "phixyz":
0051       print("  <setposition relativeto=\"%s\" x=\"%s\" y=\"%s\" z=\"%s\" phix=\"%s\" phiy=\"%s\" phiz=\"%s\" />" \
0052             % (relativeto, x, y, z, angle1, angle2, angle3))
0053     else:
0054       print("  <setposition relativeto=\"%s\" x=\"%s\" y=\"%s\" z=\"%s\" alpha=\"%s\" beta=\"%s\" gamma=\"%s\" />" \
0055             % (relativeto, x, y, z, angle1, angle2, angle3))
0056       
0057     print("  <setape xx=\"%s\" xy=\"%s\" xz=\"%s\" yy=\"%s\" yz=\"%s\" zz=\"%s\" />" \
0058           % (xx, xy, xz, yy, yz, zz))
0059 
0060     print("</operation>")
0061     print("")
0062 
0063 print("</MuonAlignment>")
0064