| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

dump.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # =============================================================================
00003 # minimal test of det desc based on VolumeCheck.py
00004 import os 
00005 import gaudimodule as gaudi
00006 
00007 def init(loc) :
00008 
00009     #gaudi.loaddict('DetDict')
00010     g=gaudi.AppMgr()
00011     #g.DLLs   += [ "XmlTools"   , "DetDescCnv"    ,
00012     #              "DetDescSvc" , "DetDescChecks" , "RootHistCnv" ]
00013 
00014     ##g.HistogramPersistency = "ROOT"
00015     ##g.config()
00016 
00017     ##hsvc = g.service('HistogramPersistencySvc')
00018     ##hsvc.OutputFile = "test.root"
00019 
00020 
00021     ##g.DLLs += [ "RootHistCnv" ]
00022     g.ExtSvc += [ "XmlCnvSvc" , "XmlParserSvc" ] 
00023     g.EvtSel = "NONE"
00024     
00025     det = g.service('DetectorPersistencySvc')
00026     det.CnvServices = ["XmlCnvSvc"]
00027 
00028     det = g.service('XmlCnvSvc')
00029     det.AllowGenericConversion = True
00030 
00031     #XmlParserSvc = g.service('XmlParserSvc')
00032     #XmlParserSvc.EntityResolverSvc = "CondDBEntityResolverSvc"
00033 
00034     det = g.service('DetectorDataSvc')
00035     det.UsePersistency = True
00036     det.DetDbRootName  = "dd"
00037     det.DetStorageType = 7
00038     #det.DetDbLocation  = '/home/bviren/work/dayabay/code/lhcb/Det/XmlDDDB/DDDB/lhcb.xml'
00039     #det.DetDbLocation  = '/home/bviren/work/dayabay/code/dddb/dayabay.xml'
00040     det.DetDbLocation  = loc
00041     
00042 def _dir_ ( self , node = None , level = -1 ) :
00043     """
00044     The simple tool to perform the inspection fo Data Store
00045     
00046     Usage:
00047     
00048     evtSvc = gaudi.evtSvc()
00049     evtSvc.dir('MC')
00050     data = evtSvc['Rec/Calo']
00051     evtSvc.dir( data)
00052     
00053     """
00054     if 0 == level          : return gaudi.SUCCESS ;
00055     if   str is type(node) : node = self.retrieveObject( node )
00056     elif  not node         : return self.dir('', level )
00057     if not node            : return gaudi.FAILURE
00058     if     hasattr ( node , 'registry'   ) : node = node.registry()
00059     if     hasattr ( node , 'identifier' ) :
00060         obj = node.object ()
00061         if not obj :
00062             obj = self.retrieveObject( node.identifier() ) 
00063             print  node.identifier()
00064         else :
00065             if hasattr( obj , 'size'    ) :
00066                 size = obj.size()
00067                 if 0 == size : print "%s (empty) %s" % (  node.identifier() , type( obj ) )
00068                 elif hasattr ( obj , 'containedObjects' ) :
00069                     c = obj.containedObjects()[0]
00070                     print "%s container of %d %s objects " % ( node.identifier() , obj.size() , type(c))
00071                 else : 
00072                     print  "%s %s " % (  node.identifier() , type( node.object()) )
00073             else :
00074                 print  "%s %s " % (  node.identifier() , type( node.object()) )
00075     else : print "The node has no 'identifier'"
00076     # start the recursion 
00077     for l in self.leaves( node ) :
00078         if l : self.dir( l , level - 1 )  
00079     return gaudi.SUCCESS 
00080 
00081 def _get_( self , node = None , cut = lambda x : True ) :
00082     if   str is type(node) : node = self.retrieveObject( node )
00083     elif  not node         : return _get_( self , '' , cut  )
00084     if not node            : return []
00085     if     hasattr ( node , 'registry'   ) : node = node.registry()
00086     result = []
00087     if     hasattr ( node , 'identifier' ) :
00088         obj = node.object()
00089         if cut( obj ) : result += [ obj ]
00090     for l in self.leaves ( node ) :
00091         if l : result += _get_( self , l , cut )
00092     return result 
00093     
00094 gaudi.iDataSvc.dir = _dir_ 
00095 gaudi.iDataSvc.DIR = _get_ 
00096 
00097 
00098 
00099 if "__main__" == __name__  :
00100     import sys
00101 
00102     try: 
00103         loc = sys.argv[1]
00104     except:
00105         loc='/home/bviren/work/dayabay/code/dddb/dayabay.xml'
00106         print "Using default XML file:\n",loc
00107 
00108     init(loc)
00109     g=gaudi.AppMgr()
00110     det = g.detSvc()
00111 
00112     det.dir('/dd')
00113     det.dump()
00114 
00115 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:05:13 2011 for DetDescChecks by doxygen 1.4.7