Functions | |
def | config |
def | dress_idatasvc |
def | detsvc |
def | dump |
def xmldetdesc::config | ( | xmlfile = None |
) |
Definition at line 43 of file xmldetdesc.py.
00043 : 00044 00045 if not xmlfile: 00046 import sys, os 00047 loc = os.getenv("XMLDETDESCROOT") 00048 if not loc: 00049 print "Warning: no XMLDETDESCROOT variable, no detector description" 00050 sys.exit(1) 00051 else: 00052 loc += "/DDDB/dayabay.xml" 00053 pass 00054 xmlfile = loc 00055 pass 00056 00057 00058 00059 from XmlTools.XmlToolsConf import XmlCnvSvc, XmlParserSvc 00060 xmlcnv = XmlCnvSvc() 00061 xmlcnv.AllowGenericConversion = True 00062 xmlparser = XmlParserSvc() 00063 00064 app = ApplicationMgr() 00065 app.ExtSvc += [ xmlcnv , xmlparser ] 00066 00067 detper = DetectorPersistencySvc() 00068 detper.CnvServices.append(xmlcnv) 00069 00070 detdat = DetectorDataSvc() 00071 detdat.UsePersistency = True 00072 detdat.DetDbRootName = "dd" 00073 detdat.DetStorageType = 7 00074 detdat.DetDbLocation = xmlfile 00075 return 00076 00077 00078 def dress_idatasvc():
def xmldetdesc::dress_idatasvc | ( | ) |
Definition at line 79 of file xmldetdesc.py.
00079 : 00080 import GaudiPython as gaudi 00081 00082 def _dir_ ( self , node = None , level = -1 ) : 00083 """ 00084 The simple tool to perform the inspection fo Data Store 00085 00086 Usage: 00087 00088 evtSvc = gaudi.evtSvc() 00089 evtSvc.dir('MC') 00090 data = evtSvc['Rec/Calo'] 00091 evtSvc.dir( data) 00092 00093 """ 00094 if 0 == level : return gaudi.SUCCESS ; 00095 if str is type(node) : node = self.retrieveObject( node ) 00096 elif not node : return self.dir('', level ) 00097 if not node : return gaudi.FAILURE 00098 if hasattr ( node , 'registry' ) : node = node.registry() 00099 if hasattr ( node , 'identifier' ) : 00100 obj = node.object () 00101 if not obj : 00102 obj = self.retrieveObject( node.identifier() ) 00103 print node.identifier() 00104 pass 00105 else : 00106 if hasattr( obj , 'size' ) : 00107 size = obj.size() 00108 if 0 == size : print "%s (empty) %s" % ( node.identifier() , type( obj ) ) 00109 elif hasattr ( obj , 'containedObjects' ) : 00110 c = obj.containedObjects()[0] 00111 print "%s container of %d %s objects " % ( node.identifier() , obj.size() , type(c)) 00112 pass 00113 else : 00114 print "%s %s " % ( node.identifier() , type( node.object()) ) 00115 pass 00116 else : 00117 print "%s %s " % ( node.identifier() , type( node.object()) ) 00118 pass 00119 else : print "The node has no 'identifier'" 00120 # start the recursion 00121 for l in self.leaves( node ) : 00122 if l : self.dir( l , level - 1 ) 00123 continue 00124 return gaudi.SUCCESS 00125 00126 def _get_( self , node = None , cut = lambda x : True ) : 00127 if str is type(node) : node = self.retrieveObject( node ) 00128 elif not node : return _get_( self , '' , cut ) 00129 if not node : return [] 00130 if hasattr ( node , 'registry' ) : node = node.registry() 00131 result = [] 00132 if hasattr ( node , 'identifier' ) : 00133 obj = node.object() 00134 if cut( obj ) : result += [ obj ] 00135 pass 00136 for l in self.leaves ( node ) : 00137 if l : result += _get_( self , l , cut ) 00138 continue 00139 return result 00140 00141 gaudi.iDataSvc.dir = _dir_ 00142 gaudi.iDataSvc.DIR = _get_ 00143 00144 def detsvc():
def xmldetdesc::detsvc | ( | ) |
Definition at line 145 of file xmldetdesc.py.
00145 : 00146 config() 00147 dress_idatasvc() 00148 import GaudiPython as gp 00149 g = gp.AppMgr() 00150 dsv = g.detSvc() 00151 return dsv 00152 def dump():
def xmldetdesc::dump | ( | ) |
Definition at line 153 of file xmldetdesc.py.
00153 : 00154 dress_idatasvc() 00155 import GaudiPython as gaudi 00156 app = gaudi.AppMgr() 00157 det = app.detSvc() 00158 det.dir("/dd") 00159 det.dump() 00160 00161 return 00162 if '__main__' == __name__: