/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

autoPositionerTest.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # An example script showing how to add a volume to the detector geometry
00003 #
00004 #
00005 # dandwyer@caltech.edu 2008-11-25
00006 
00007 import GaudiKernel.SystemOfUnits as units
00008 
00009 # Add simple positioner algorithm to list of algs 
00010 from GaudiPython.GaudiAlgs import GaudiAlgo
00011 from GaudiPython import SUCCESS, FAILURE
00012 
00013 class PositionerAlg(GaudiAlgo):
00014     """An algorithm that places a volume in the detector geometry"""
00015     def __init__(self,name):
00016         GaudiAlgo.__init__(self,name)
00017         print "Making PositionerAlg",name
00018         self.posToolConf = None
00019         
00020     def initialize(self):
00021         status = GaudiAlgo.initialize(self)
00022         print "getFullName = ",self.posToolConf.getFullName()
00023         self.posTool = self.tool('IPositionerTool',
00024                                  self.posToolConf.getFullName())
00025         # Place volume
00026         status = self.posTool.placeVolume()
00027         return status
00028     
00029     def execute(self):
00030         # Print some output to look at result of placement
00031         de_name = "/dd/Structure/AD/db-gds1"
00032         dbSupport = self.getDet(de_name)
00033         dbSupportGeo = dbSupport.geometry()
00034         nPVolumes = dbSupportGeo.lvolume().pvolumes().size()
00035         print "pvolumes: ", nPVolumes
00036         for pvol in dbSupportGeo.lvolume().pvolumes():
00037             print pvol.name(), pvol
00038             print pvol.lvolumeName(), pvol.name()
00039             print pvol.lvolume().name(), pvol.name()
00040             print "\n"
00041             for cde in dbSupport.childIDetectorElements():
00042                 print cde.name()
00043                 print cde.geometry().lvolume().name()
00044                 print "\n"
00045         return SUCCESS
00046         
00047 diffBallPositioner = None
00048 myAlgName = "posAlg"
00049 
00050 def configure(): 
00051     # Configure the placement of the LED diffuser ball
00052     from DetHelpers.DetHelpersConf import AutoPositionerTool
00053     global diffBallPositioner, myAlgName
00054     diffBallPositioner = AutoPositionerTool( myAlgName+".diffBallPositioner" )
00055     diffBallPositioner.PhysicalVolume = "pvDiffuserBall"
00056     diffBallPositioner.LogicalVolume = "/dd/Geometry/CalibrationSources/lvLedSourceAssy"
00057     diffBallPositioner.CoordinateDetElem = "/dd/Structure/AD/db-oil1"
00058     diffBallPositioner.Position = [0., 0., 0.]
00059     #diffBallPositioner.Position = [0., 0., -175.0*units.cm]
00060     diffBallPositioner.Rotation = [1., 0., 0.,
00061                                    0., 1., 0.,
00062                                    0., 0., 1.]
00063     diffBallPositioner.Element = "db-diffuserBallCenter1"
00064     diffBallPositioner.ElementPath = "/dd/Structure/CalibrationSources"
00065     return
00066 
00067 def run(app):
00068     # Add PositionerAlg to alg list
00069     global diffBallPositioner, myAlgName
00070     posAlg = PositionerAlg( myAlgName )
00071     posAlg.posToolConf = diffBallPositioner
00072     app.addAlgorithm(posAlg)
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:56:27 for DetHelpers by doxygen 1.7.4