Public Member Functions | |
def | __init__ |
def | detid |
def | refframe |
def | write |
Definition at line 581 of file gen.py.
def gen::Structure::__init__ | ( | self | ) |
def gen::Structure::detid | ( | self, | ||
loc, | ||||
adn | ||||
) |
Definition at line 585 of file gen.py.
00585 : 00586 # All hard coded numbers from Conventions/DetectorId.h 00587 if loc.lower() == 'db': 00588 iloc = 0x01 00589 elif loc.lower() == 'la': 00590 iloc = 0x02 00591 elif loc.lower() == 'far': 00592 iloc = 0x04 00593 else: 00594 iloc = 0x00 00595 detid = ((iloc<<24)|(adn<<16)) 00596 from XmlDetDescGen.structure import UserParameter 00597 return UserParameter("DetectorID","int", ['0x%x'%detid], 00598 desc="Packed Detector ID") 00599 def refframe(self,loc,adn):
def gen::Structure::refframe | ( | self, | ||
loc, | ||||
adn | ||||
) |
Definition at line 600 of file gen.py.
00600 : 00601 'Return parameter indicating a coordinate system' 00602 from XmlDetDescGen.structure import UserParameter 00603 return UserParameter("CoordinateSystem","int",[0], 00604 desc="Indicate this is a user coordinate system, value indicates the level of localness of the coordinate sytem") 00605 00606 def write(self,outdir):
def gen::Structure::write | ( | self, | ||
outdir | ||||
) |
Definition at line 607 of file gen.py.
00607 : 00608 from XmlDetDescGen.util import XmlFile, Comment,ExternalEntity 00609 from XmlDetDescGen.structure import DetElem 00610 from XmlDetDescGen.catalog import Catalog 00611 from XmlDetDescGen.reference import Reference 00612 00613 topcat = Catalog('Structure'); 00614 adcat = Catalog('AD'); 00615 # Clear our refs because some how this is filled with the 00616 # contents of the /Geometry/Pool catalog! Python bug??? 00617 adcat.refs = [] 00618 topcat.refs = [ adcat ] 00619 00620 base = "/dd/Structure/AD/" 00621 00622 ees = [] 00623 nf="Near" 00624 nads=2 00625 for loc in ["db","la","far"]: 00626 if loc == "far": 00627 nf="Far" 00628 nads=4 00629 00630 adcat.things.append(Comment("\n%s %s site AD things\n"%(loc.upper(),nf))) 00631 00632 last_support = "/dd/Structure/Pool/%s-iws"%loc 00633 00634 ithing = -1 00635 things = ['ade','sst','oil','oav','lso'] 00636 for thing in things: 00637 ithing += 1 00638 if thing == 'ade': 00639 npath = 'pv'+nf+thing.upper()+'%(adn)d' 00640 else: 00641 npath = 'pv'+thing.upper() 00642 for adn in range(1,nads+1): 00643 de = DetElem("%s-%s%d"%(loc,thing,adn), 00644 "/dd/Geometry/AD/lv%s"%thing.upper(), 00645 npath=npath%{'adn':adn}, 00646 support=last_support%{'adn':adn}) 00647 de.refs = [] 00648 if thing != 'lso' and thing != 'iav' and thing != 'gds': 00649 href="#%s-%s%d"%(loc,things[ithing+1],adn) 00650 de.refs.append(Reference(href,de)) 00651 if thing == 'oil': 00652 eename = '%s%dpmts'%(loc,adn) 00653 ees.append((eename,'../AdPmtStructure/%s%d.xml'%(loc,adn))) 00654 de.refs.append(ExternalEntity(eename)) 00655 00656 adrefname = '%s%dreflectors'%(loc,adn) 00657 ees.append((adrefname,'../AdReflectorStructure/%s%d.xml'%(loc,adn))) 00658 de.refs.append(ExternalEntity(adrefname)) 00659 00660 de.refs.append(self.detid(loc,adn)) 00661 de.refs.append(self.refframe(loc,adn)) 00662 adcat.things.append(de) 00663 continue 00664 last_support=base+loc+"-"+thing+"%(adn)d" 00665 continue 00666 continue 00667 file = XmlFile(dtd="../DTD/structure.dtd", 00668 external_entities=ees) 00669 file.objects = [ adcat ] 00670 file.write(outdir+"/structure.xml") 00671 return 00672 class AD: