Public Member Functions | |
def | __init__ |
def | initialize |
def | execute |
def | do_point |
Public Attributes | |
npoints | |
target_de_name | |
css | |
ExecuteOnce |
Definition at line 6 of file TestCoordSysSvc.py.
def DetHelpers::TestCoordSysSvc::TesterAlg::__init__ | ( | self, | ||
myname, | ||||
npoints, | ||||
target_de_name | ||||
) |
Definition at line 8 of file TestCoordSysSvc.py.
00008 : 00009 GaudiAlgo.__init__(self,myname) 00010 self.npoints = npoints 00011 self.target_de_name = target_de_name 00012 return 00013 def initialize(self):
def DetHelpers::TestCoordSysSvc::TesterAlg::initialize | ( | self | ) |
Definition at line 14 of file TestCoordSysSvc.py.
00014 : 00015 sc = GaudiAlgo.initialize(self) 00016 if sc.isFailure(): 00017 print 'Failed to initialize GaudiAlgo base class' 00018 return sc 00019 self.css = self.svc('ICoordSysSvc','CoordSysSvc') 00020 if not self.css: 00021 print 'Failed to get CoordSysSvc' 00022 return FAILURE 00023 self.ExecuteOnce = True 00024 return sc; 00025 def execute(self):
def DetHelpers::TestCoordSysSvc::TesterAlg::execute | ( | self | ) |
Definition at line 26 of file TestCoordSysSvc.py.
00026 : 00027 00028 import GaudiKernel.SystemOfUnits as units 00029 00030 import time 00031 start = time.time() 00032 for x in range(0,self.npoints): 00033 print x 00034 for y in range(0,self.npoints): 00035 for z in range(0,self.npoints): 00036 pt = [x*units.mm,y*units.mm,z*units.mm] 00037 self.do_point(pt) 00038 if x+y+z == 0: first = time.time() 00039 continue 00040 continue 00041 continue 00042 stop = time.time() 00043 00044 print "\nFirst in %f seconds, remaining %d points in %f seconds"%\ 00045 (first-start,pow(self.npoints,3)-1,stop-first) 00046 00047 00048 return SUCCESS 00049 def do_point(self,pt):
def DetHelpers::TestCoordSysSvc::TesterAlg::do_point | ( | self, | ||
pt | ||||
) |
Definition at line 50 of file TestCoordSysSvc.py.
00050 : 00051 00052 00053 # Get underlying DE object 00054 de = self.getDet(self.target_de_name) 00055 if not de: 00056 print 'Failed to get DE',self.target_de_name 00057 return FAILURE 00058 00059 # Make a point at the center of the target DE 00060 import PyCintex 00061 Gaudi = PyCintex.makeNamespace('Gaudi') 00062 point = Gaudi.XYZPoint(pt[0],pt[1],pt[2]) 00063 gpoint = de.geometry().toGlobal(point) 00064 00065 # Sanity check 00066 btde = self.css.belongsToDE(gpoint) 00067 while btde: 00068 if btde.name() != de.name(): break 00069 btde = btde.parentIDetectorElement() 00070 continue 00071 if not btde: 00072 print 'Bogus: center of target DE is not in target DE',\ 00073 self.target_de_name 00074 return FAILURE 00075 00076 # Find coord system 00077 csde = self.css.coordSysDE(gpoint) 00078 if not csde: 00079 print 'Failed to find coordinate system DE for '\ 00080 '[',gpoint.x(),gpoint.y(),gpoint.z(),']' 00081 return FAILURE 00082 00083 #print 'Found coordinate system DE for target',self.target_de_name,\ 00084 # 'as:',csde.name() 00085 00086 return SUCCESS 00087 class TesterAlg2(GaudiAlgo):
Definition at line 10 of file TestCoordSysSvc.py.
Definition at line 11 of file TestCoordSysSvc.py.
Definition at line 19 of file TestCoordSysSvc.py.
Definition at line 23 of file TestCoordSysSvc.py.