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