Functions | |
def | run |
def mymod::run | ( | app | ) |
Definition at line 1 of file mymod.py.
00001 : 00002 from GaudiPython.GaudiAlgs import GaudiAlgo 00003 from GaudiPython import SUCCESS, FAILURE 00004 00005 class MyAlg(GaudiAlgo): 00006 def __init__(self,name="MyAlg"): 00007 print "Making MyAlg",name 00008 GaudiAlgo.__init__(self,name) 00009 return 00010 00011 def initialize(self): 00012 status = GaudiAlgo.initialize(self) 00013 # just example, could do stuff here too. 00014 return status 00015 00016 def execute(self): 00017 00018 print "Init MyAlg",self.name 00019 00020 # Get a volume from the TDS 00021 oil = self.getDet('/dd/Geometry/AD/lvOIL') 00022 print 'oil=',oil.name() 00023 print 'material=',oil.materialName() 00024 00025 de_name = "/dd/Structure/DayaBay/db-rock/db-ows" \ 00026 + "/db-curtain/db-iws/db-ade1/db-sst1/db-oil1" 00027 dboil1 = self.getDet(de_name) 00028 gi = dboil1.geometry() 00029 00030 top_name = "/dd/Structure/DayaBay" 00031 top = self.getDet(top_name) 00032 top_gi = top.geometry() 00033 00034 import PyCintex 00035 Gaudi = PyCintex.makeNamespace('Gaudi') 00036 00037 # convert origin of oil into global coordinates 00038 point = Gaudi.XYZPoint(0.0,0.0,0.0) 00039 gpoint = gi.toGlobal(point) 00040 print 'Global point: (',gpoint.x(),gpoint.y(),gpoint.z(),')' 00041 00042 # Starting from the top, find what the smalled DE 00043 # that holds point is 00044 s = top_gi.belongsToPath(gpoint,-1) 00045 print 'belongsToPath:',s 00046 de = self.getDet(s) 00047 while de: 00048 print 's_de.name():',de.name() 00049 de = de.parentIDetectorElement() 00050 continue 00051 00052 00053 return SUCCESS 00054 pass 00055 00056 ma = MyAlg("myalg") 00057 app.addAlgorithm(ma) app.addAlgorithm(ma)