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

In This Package:

dumper.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 """
00003 Dumps the detector data service.  
00004 """
00005 
00006 def dress_idatasvc():
00007     import GaudiPython as gaudi
00008 
00009     def _dir_ ( self , node = None , level = -1 ) :
00010         """
00011         The simple tool to perform the inspection fo Data Store
00012         
00013         Usage:
00014         
00015         evtSvc = gaudi.evtSvc()
00016         evtSvc.dir('MC')
00017         data = evtSvc['Rec/Calo']
00018         evtSvc.dir( data)
00019         
00020         """
00021         if 0 == level          : return gaudi.SUCCESS ;
00022         if   str is type(node) : node = self.retrieveObject( node )
00023         elif  not node         : return self.dir('', level )
00024         if not node            : return gaudi.FAILURE
00025         if     hasattr ( node , 'registry'   ) : node = node.registry()
00026         if     hasattr ( node , 'identifier' ) :
00027             obj = node.object ()
00028             if not obj :
00029                 obj = self.retrieveObject( node.identifier() ) 
00030                 print  node.identifier()
00031                 pass
00032             else :
00033                 if hasattr( obj , 'size'    ) :
00034                     size = obj.size()
00035                     if 0 == size : print "%s (empty) %s" % (  node.identifier() , type( obj ) )
00036                     elif hasattr ( obj , 'containedObjects' ) :
00037                         c = obj.containedObjects()[0]
00038                         print "%s container of %d %s objects " % ( node.identifier() , obj.size() , type(c))
00039                         pass
00040                     else : 
00041                         print  "%s %s " % (  node.identifier() , type( node.object()) )
00042                         pass
00043                 else :
00044                     print  "%s %s " % (  node.identifier() , type( node.object()) )
00045                     pass
00046         else : print "The node has no 'identifier'"
00047         # start the recursion 
00048         for l in self.leaves( node ) :
00049             if l : self.dir( l , level - 1 )  
00050             continue
00051         return gaudi.SUCCESS 
00052         
00053     def _get_( self , node = None , cut = lambda x : True ) :
00054         if   str is type(node) : node = self.retrieveObject( node )
00055         elif  not node         : return _get_( self , '' , cut  )
00056         if not node            : return []
00057         if     hasattr ( node , 'registry'   ) : node = node.registry()
00058         result = []
00059         if     hasattr ( node , 'identifier' ) :
00060             obj = node.object()
00061             if cut( obj ) : result += [ obj ]
00062             pass
00063         for l in self.leaves ( node ) :
00064             if l : result += _get_( self , l , cut )
00065             continue
00066         return result 
00067     
00068     gaudi.iDataSvc.dir = _dir_ 
00069     gaudi.iDataSvc.DIR = _get_ 
00070 
00071 
00072 def detsvc():
00073     dress_idatasvc()
00074     import GaudiPython as gp
00075     g = gp.AppMgr()
00076     dsv = g.detSvc()
00077     return dsv  
00078 
00079 def dump():
00080     dress_idatasvc()
00081     import GaudiPython as gaudi
00082     app = gaudi.AppMgr()
00083     det = app.detSvc()
00084     det.dir("/dd")
00085     det.dump()
00086 
00087     return
00088 
00089 if '__main__' == __name__:
00090     import XmlDetDesc
00091     XmlDetDesc.configure()
00092     dump()
00093 
00094 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:56:07 for XmlDetDesc by doxygen 1.7.4