Go to the documentation of this file.00001 from tools import loadCmsProcess,writeCfg
00002 from addPoolDBESSource import addPoolDBESSource
00003 from CmsswTask import CmsswTask
00004 import os
00005
00006 class DTVDriftSegmentWriter:
00007 def __init__(self, run, dir, input_file, output_dir, config):
00008 self.runnumber = int(run)
00009 self.config = config
00010 self.dir = dir
00011 self.input_file = input_file
00012 self.output_dir = output_dir
00013
00014 self.configs = ['dtVDriftSegmentWriter_cfg.py',
00015 'dumpDBToFile_vdrift_cfg.py']
00016
00017 self.pset_templates = {}
00018 self.pset_templates['dtVDriftSegmentWriter_cfg.py'] = 'CalibMuon.DTCalibration.dtVDriftSegmentWriter_cfg'
00019 self.pset_templates['dumpDBToFile_vdrift_cfg.py'] = 'CalibMuon.DTCalibration.dumpDBToFile_vdrift_cfg'
00020
00021 self.initProcess()
00022 self.task = CmsswTask(self.dir,self.configs)
00023
00024 def initProcess(self):
00025 vDrift_segment = self.output_dir + '/' + 'vDrift_segment_' + str(self.runnumber)
00026 vDrift_segment_db = os.path.abspath(vDrift_segment + '.db')
00027 vDrift_segment_txt = os.path.abspath(vDrift_segment + '.txt')
00028
00029 self.process = {}
00030
00031 self.process['dtVDriftSegmentWriter_cfg.py'] = loadCmsProcess(self.pset_templates['dtVDriftSegmentWriter_cfg.py'])
00032 self.process['dtVDriftSegmentWriter_cfg.py'].source.firstRun = self.runnumber
00033 self.process['dtVDriftSegmentWriter_cfg.py'].GlobalTag.globaltag = self.config.globaltag
00034
00035
00036 if hasattr(self.config,'inputVdriftDB') and self.config.inputVdriftDB:
00037 addPoolDBESSource(process = self.process['dtVDriftSegmentWriter_cfg.py'],
00038 moduleName = 'vDriftDB',record = 'DTMtimeRcd',tag = 'vDrift',
00039 connect = 'sqlite_file:%s' % self.config.inputVdriftDB)
00040
00041 self.process['dtVDriftSegmentWriter_cfg.py'].PoolDBOutputService.connect = 'sqlite_file:%s' % vDrift_segment_db
00042 self.process['dtVDriftSegmentWriter_cfg.py'].dtVDriftSegmentWriter.vDriftAlgoConfig.rootFileName = self.input_file
00043
00044
00045 self.process['dumpDBToFile_vdrift_cfg.py'] = loadCmsProcess(self.pset_templates['dumpDBToFile_vdrift_cfg.py'])
00046 self.process['dumpDBToFile_vdrift_cfg.py'].calibDB.connect = 'sqlite_file:%s' % vDrift_segment_db
00047 self.process['dumpDBToFile_vdrift_cfg.py'].dumpToFile.outputFileName = vDrift_segment_txt
00048
00049 def writeCfg(self):
00050 for cfg in self.configs:
00051 writeCfg(self.process[cfg],self.dir,cfg)
00052
00053
00054 def run(self):
00055 self.task.run()
00056 return