CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/CalibMuon/DTCalibration/python/Workflow/DTDqm.py

Go to the documentation of this file.
00001 from tools import loadCmsProcess,writeCfg
00002 from CmsswTask import *
00003 import os
00004 
00005 class DTDqm:
00006     def __init__(self, run, dir, dqm_files, result_dir, config):
00007         #basedir = 'Run%s/Ttrig' % run
00008         #self.dir = basedir + '/' + 'Exec'
00009         #self.result_dir = basedir + '/' + 'Results'
00010         self.runnumber = int(run)
00011         self.dir = dir
00012         self.result_dir = result_dir
00013         self.dqm_files = dqm_files
00014 
00015         self.pset_name = 'DTkFactValidation_2_DQM_cfg.py'
00016         self.pset_template = config.templatepath + '/config/DTkFactValidation_2_DQM_cfg.py'
00017 
00018         self.initProcess()
00019         self.configs = []
00020         self.configs.append(self.pset_name)
00021         self.task = CmsswTask(self.dir,self.configs)
00022 
00023     def initProcess(self):
00024         self.process = loadCmsProcess(self.pset_template)
00025         self.process.source.fileNames = self.dqm_files
00026         self.process.dqmSaver.dirName = os.path.abspath(self.result_dir)
00027         if self.process.DQMStore.collateHistograms: self.process.dqmSaver.forceRunNumber = self.runnumber
00028 
00029     def writeCfg(self):
00030         writeCfg(self.process,self.dir,self.pset_name) 
00031     
00032     def run(self):
00033         self.task.run()
00034         return
00035 
00036 def runDQM(run,castor_dir,result_dir,template_path):
00037     from CalibMuon.DTCalibration.Workflow.tools import listFilesInCastor
00038     dqm_files = listFilesInCastor(castor_dir,'DQM')
00039     runDir = '.'
00040     class config: pass
00041     config.templatepath = template_path
00042 
00043     dtDqmFinal = DTDqm(run,runDir,dqm_files,result_dir,config)
00044     dtDqmFinal.writeCfg()
00045     dtDqmFinal.run()