Go to the documentation of this file.00001 from tools import loadCmsProcess,writeCfg,dqmWorkflowName,getDatasetStr
00002 from CmsswTask import *
00003 import os
00004
00005 class DTDQMMerge:
00006 def __init__(self, run, dir, dqm_files, result_dir, config=None):
00007 self.runnumber = int(run)
00008 self.dir = dir
00009 self.result_dir = result_dir
00010 self.config = config
00011 self.dqm_files = dqm_files
00012
00013 self.pset_name = 'dtDQMMerge_cfg.py'
00014 self.pset_template = 'CalibMuon.DTCalibration.dtDQMMerge_cfg'
00015
00016 self.process = None
00017 self.initProcess()
00018 self.configFiles = []
00019 self.configFiles.append(self.pset_name)
00020 self.task = CmsswTask(self.dir,self.configFiles)
00021
00022 def initProcess(self):
00023 self.process = loadCmsProcess(self.pset_template)
00024 self.process.source.fileNames = self.dqm_files
00025
00026 outputFileName = 'DQM.root'
00027 if self.config:
00028 label = 'dtDQMValidation'
00029 if hasattr(self.config,'label') and self.config.label: label = self.config.label
00030
00031 datasetStr = getDatasetStr(self.config.datasetpath)
00032
00033 outputFileName = 'DQM_%s-%s.root' % (datasetStr,label)
00034
00035 self.process.output.fileName = '%s/%s' % (os.path.abspath(self.result_dir),outputFileName)
00036
00037
00038
00039 def writeCfg(self):
00040 writeCfg(self.process,self.dir,self.pset_name)
00041
00042
00043 def run(self):
00044 self.task.run()
00045 return
00046
00047 def runDQM(run,castor_dir,result_dir):
00048 from CalibMuon.DTCalibration.Workflow.tools import listFilesInCastor
00049 dqm_files = listFilesInCastor(castor_dir,'DQM')
00050 runDir = '.'
00051
00052 dtDqm = DTDQMMerge(run,runDir,dqm_files,result_dir)
00053 dtDqm.writeCfg()
00054 dtDqm.run()