Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-25 02:29:03

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