CMS 3D CMS Logo

DTDQMMerge.py
Go to the documentation of this file.
1 from tools import loadCmsProcess,writeCfg,dqmWorkflowName,getDatasetStr
2 from CmsswTask import *
3 import os
4 
5 class DTDQMMerge:
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 = 'dtDQMMerge_cfg.py'
14  self.pset_template = 'CalibMuon.DTCalibration.dtDQMMerge_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 
26  outputFileName = 'DQM.root'
27  if self.config:
28  label = 'dtDQMValidation'
29  if hasattr(self.config,'label') and self.config.label: label = self.config.label
30  #workflowName = dqmWorkflowName(self.config.datasetpath,label,self.config.trial)
31  datasetStr = getDatasetStr(self.config.datasetpath)
32 
33  outputFileName = 'DQM_%s-%s.root' % (datasetStr,label)
34 
35  self.process.output.fileName = '%s/%s' % (os.path.abspath(self.result_dir),outputFileName)
36 
37  #if self.process.DQMStore.collateHistograms:
38 
39  def writeCfg(self):
40  writeCfg(self.process,self.dir,self.pset_name)
41  #writeCfgPkl(self.process,self.dir,self.pset_name)
42 
43  def run(self):
44  self.task.run()
45  return
46 
47 def runDQM(run,castor_dir,result_dir):
48  from CalibMuon.DTCalibration.Workflow.tools import listFilesInCastor
49  dqm_files = listFilesInCastor(castor_dir,'DQM')
50  runDir = '.'
51 
52  dtDqm = DTDQMMerge(run,runDir,dqm_files,result_dir)
53  dtDqm.writeCfg()
54  dtDqm.run()
def getDatasetStr(datasetpath)
Definition: tools.py:15
def initProcess(self)
Definition: DTDQMMerge.py:22
def listFilesInCastor(castor_dir, type='root', prefix='rfio:')
Definition: tools.py:30
def loadCmsProcess(psetPath)
Definition: tools.py:144
def runDQM(run, castor_dir, result_dir)
Definition: DTDQMMerge.py:47
def __init__(self, run, dir, dqm_files, result_dir, config=None)
Definition: DTDQMMerge.py:6