00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 import os
00012 isDryAd = False
00013 calibrationOutputFile = "pmtCalibTable.txt"
00014
00015 def configure(argv = []):
00016
00017 import sys, getopt
00018 opts,args = getopt.getopt(argv, "i:o:", ["dry-ad"])
00019 statsInputFile = None
00020 global calibrationOutputFile
00021 global isDryAd
00022 for opt,arg in opts:
00023 if opt == "-i":
00024 statsInputFile = arg
00025 if opt == "-o":
00026 calibrationOutputFile = arg
00027 if opt == "--dry-ad":
00028 isDryAd = True
00029
00030
00031 from DetHelpers.DetHelpersConf import PmtGeomInfoSvc
00032 pgiSvc = PmtGeomInfoSvc()
00033 pgiSvc.StreamItems = ["/dd/Structure/DayaBay"]
00034 if statsInputFile != None:
00035 from StatisticsSvc.StatisticsSvcConf import StatisticsSvc
00036 statsSvc = StatisticsSvc()
00037 statsSvc.Input = {'file0':statsInputFile}
00038 import DataSvc
00039 dataSvc = DataSvc.Configure()
00040
00041 from DataSvc.DataSvcConf import StaticCableSvc
00042 CableSvc = StaticCableSvc()
00043
00044 CableMapFile = os.getenv("DATASVCROOT") + "/share/DryRun/feeCableMap_DryRun.txt"
00045 CableSvc.FeeCableMap = CableMapFile
00046
00047 return
00048
00049 def run(app):
00050 '''
00051 Configure and add an algorithm to job
00052 '''
00053 global calibrationOutputFile
00054 global isDryAD
00055 app.ExtSvc += ["StaticCableSvc", "StatisticsSvc", "PmtGeomInfoSvc"]
00056
00057 from CalibParam.Tools import PmtTableWriterAlg
00058 twAlg = PmtTableWriterAlg("MyPmtTableWriterAlg")
00059 twAlg.StatsPath = '/file0/pmtCalibLeadingEdge'
00060 twAlg.OutputFileName = calibrationOutputFile
00061 twAlg.IsDryAd = isDryAd
00062 twAlg.SetDefaultCalib = True
00063 twAlg.SourcePosition = [0.,0.,0.]
00064 app.addAlgorithm(twAlg)
00065 pass