00001
00002
00003 def configure():
00004
00005
00006
00007
00008 return
00009
00010
00011 def run(app):
00012 from GaudiPython.GaudiAlgs import GaudiAlgo
00013 from GaudiPython import SUCCESS, FAILURE
00014
00015 class MyAlg(GaudiAlgo):
00016 def __init__(self,name="MyAlg"):
00017 print "Making MyAlg",name
00018 GaudiAlgo.__init__(self,name)
00019 return
00020
00021 def initialize(self):
00022 return GaudiAlgo.initialize(self)
00023
00024 def execute(self):
00025
00026 print "Init MyAlg",self.name
00027
00028 oil = self.getDet('/dd/Geometry/AD/lvOIL')
00029 print 'oil=',oil.name()
00030 print 'material=',oil.materialName()
00031
00032
00033 de_name = '/dd/Structure/AD/db-ade1/db-sst1/db-oil1'
00034 dboil1 = self.getDet(de_name)
00035 print 'dboil1=',dboil1.name()
00036
00037 top_name = "/dd/Structure/DayaBay"
00038 top = self.getDet(top_name)
00039 top_gi = top.geometry()
00040
00041 gi = dboil1.geometry()
00042 print 'dboil1.gi.lvolumename=',gi.lvolumeName()
00043
00044 print 'types = %s, %s, %s'%(type(oil),type(dboil1),type(gi))
00045
00046 import PyCintex
00047 Gaudi = PyCintex.makeNamespace('Gaudi')
00048
00049 gbl = PyCintex.makeNamespace('')
00050
00051 loc = gi.parentIGeometryInfo().parentIGeometryInfo()
00052
00053 ret = gbl.ILVolume.ReplicaPath()
00054 print ret
00055 stat = gi.location(loc,ret)
00056 print stat
00057 print ret,'of size',ret.size()
00058 for ind in range(0,ret.size()):
00059 print ret[ind]
00060
00061 point = Gaudi.XYZPoint(0.0,0.0,0.0)
00062 gpoint = gi.toGlobal(point)
00063 path = gbl.std.vector("unsigned int")()
00064
00065 top_gi.fullGeoInfoForPoint(gpoint,10,loc,path)
00066 print gi.lvolumeName()
00067 print loc.lvolumeName()
00068 print 'path=',path.size()
00069
00070 s = top_gi.belongsToPath(gpoint,-1)
00071 print 'belongsToPath:',s
00072 de = self.getDet(s)
00073 while de:
00074 print 's_de.name():',de.name()
00075 de = de.parentIDetectorElement()
00076 continue
00077
00078
00079 return SUCCESS
00080 pass
00081
00082
00083
00084
00085 ma = MyAlg("myalg")
00086 app.addAlgorithm(ma)
00087