CMS 3D CMS Logo

DTDqm.py
Go to the documentation of this file.
1 from tools import loadCmsProcess,writeCfg,dqmWorkflowName
2 from CmsswTask import *
3 import os
4 
5 class DTDqm:
6  def __init__(self, run, dir, dqm_files, result_dir, config=None):
7  self.runnumber = int(run)
8  self.dir = dir
9  self.result_dir = result_dir
10  self.config = config
11  self.dqm_files = dqm_files
12 
13  self.pset_name = 'dtDQMClient_cfg.py'
14  self.pset_template = 'CalibMuon.DTCalibration.dtDQMClient_cfg'
15 
16  self.process = None
17  self.initProcess()
18  self.configFiles = []
19  self.configFiles.append(self.pset_name)
20  self.task = CmsswTask(self.dir,self.configFiles)
21 
22  def initProcess(self):
24  self.process.source.fileNames = self.dqm_files
25  self.process.dqmSaver.dirName = os.path.abspath(self.result_dir)
26  if self.config:
27  label = 'dtCalibration'
28  if hasattr(self.config,'label') and self.config.label: label = self.config.label
29  workflowName = dqmWorkflowName(self.config.datasetpath,label,self.config.trial)
30  self.process.dqmSaver.workflow = workflowName
31  if self.process.DQMStore.collateHistograms == True: self.process.dqmSaver.forceRunNumber = self.runnumber
32 
33  def writeCfg(self):
34  writeCfg(self.process,self.dir,self.pset_name)
35  #writeCfgPkl(self.process,self.dir,self.pset_name)
36 
37  def run(self):
38  self.task.run()
39  return
40 
41 def runDQM(run,castor_dir,result_dir):
42  from CalibMuon.DTCalibration.Workflow.tools import listFilesInCastor
43  dqm_files = listFilesInCastor(castor_dir,'DQM')
44  runDir = '.'
45 
46  dtDqmFinal = DTDqm(run,runDir,dqm_files,result_dir)
47  dtDqmFinal.writeCfg()
48  dtDqmFinal.run()
result_dir
Definition: DTDqm.py:9
def __init__(self, run, dir, dqm_files, result_dir, config=None)
Definition: DTDqm.py:6
def initProcess(self)
Definition: DTDqm.py:22
pset_template
Definition: DTDqm.py:14
def listFilesInCastor(castor_dir, type='root', prefix='rfio:')
Definition: tools.py:30
def writeCfg(self)
Definition: DTDqm.py:33
def loadCmsProcess(psetPath)
Definition: tools.py:144
runnumber
Definition: DTDqm.py:7
configFiles
Definition: DTDqm.py:18
def run(self)
Definition: DTDqm.py:37
def runDQM(run, castor_dir, result_dir)
Definition: DTDqm.py:41
def dqmWorkflowName(datasetpath, type, rev=1)
Definition: tools.py:23