00001 __all__ = [ 'dumper', 'Configure' ]
00002
00003 class Configure:
00004
00005 """
00006 Configure XmlDetDesc package.
00007
00008 Use like:
00009
00010 from XmlDetDesc import Config as xmldetdesc
00011 xmldetdesc()
00012
00013 or
00014
00015 xmldetdesc("/Path/to/dayabay.xml")
00016
00017 With no file name given it is assumed you have set up your
00018 environment for the XmlDetDesc package.
00019 """
00020
00021 def __init__(self,xmlfile=None):
00022
00023 if not xmlfile:
00024 import sys, os
00025 loc = os.getenv("XMLDETDESCROOT")
00026 if not loc:
00027 print "Warning: no XMLDETDESCROOT variable, no detector description"
00028 sys.exit(1)
00029 else:
00030 loc += "/DDDB/dayabay.xml"
00031 pass
00032 xmlfile = loc
00033 pass
00034
00035
00036 from XmlTools.XmlToolsConf import XmlCnvSvc, XmlParserSvc
00037 xmlcnv = XmlCnvSvc()
00038 xmlcnv.AllowGenericConversion = True
00039 xmlparser = XmlParserSvc()
00040
00041 from Gaudi.Configuration import ApplicationMgr, DetectorPersistencySvc, DetectorDataSvc
00042
00043 app = ApplicationMgr()
00044 app.ExtSvc += [ xmlcnv , xmlparser ]
00045
00046 detper = DetectorPersistencySvc()
00047 detper.CnvServices.append(xmlcnv)
00048
00049 detdat = DetectorDataSvc()
00050 detdat.UsePersistency = True
00051 detdat.DetDbRootName = "dd"
00052 detdat.DetStorageType = 7
00053 detdat.DetDbLocation = xmlfile