Go to the documentation of this file.00001 from tools import loadCmsProcess,writeCfg,dqmWorkflowName
00002 from CmsswTask import *
00003 import os
00004
00005 class DTDqm:
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 = 'dtDQMClient_cfg.py'
00014 self.pset_template = 'CalibMuon.DTCalibration.dtDQMClient_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 self.process.dqmSaver.dirName = os.path.abspath(self.result_dir)
00026 if self.config:
00027 label = 'dtCalibration'
00028 if hasattr(self.config,'label') and self.config.label: label = self.config.label
00029 workflowName = dqmWorkflowName(self.config.datasetpath,label,self.config.trial)
00030 self.process.dqmSaver.workflow = workflowName
00031 if self.process.DQMStore.collateHistograms == True: self.process.dqmSaver.forceRunNumber = self.runnumber
00032
00033 def writeCfg(self):
00034 writeCfg(self.process,self.dir,self.pset_name)
00035
00036
00037 def run(self):
00038 self.task.run()
00039 return
00040
00041 def runDQM(run,castor_dir,result_dir):
00042 from CalibMuon.DTCalibration.Workflow.tools import listFilesInCastor
00043 dqm_files = listFilesInCastor(castor_dir,'DQM')
00044 runDir = '.'
00045
00046 dtDqmFinal = DTDqm(run,runDir,dqm_files,result_dir)
00047 dtDqmFinal.writeCfg()
00048 dtDqmFinal.run()