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

In This Package:

MakePmtTable.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Generate a PMT Calibration Table from the current PMT raw data statistics 
00004 # 
00005 # Usage:
00006 # % nuwa.py -m "CalibParam.MakePmtTable -i calibStats.root -o pmtCalibTable.txt"
00007 #
00008 # dandwyer@caltech.edu   2009/05/12
00009 #
00010 
00011 import os
00012 isDryAd = False
00013 calibrationOutputFile = "pmtCalibTable.txt"
00014 
00015 def configure(argv = []):
00016     # Process module options
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     # Setup services
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     # For dry run, This must be specified, because the query later is not based on time
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     # Add PMT Calibration table writing algorithm
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
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:29:39 2011 for CalibParam by doxygen 1.4.7