CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTDQMHarvesting.py
Go to the documentation of this file.
1 from tools import loadCmsProcess,writeCfg,dqmWorkflowName
2 from addPoolDBESSource import addPoolDBESSource
3 from CmsswTask import *
4 import os
5 
7  def __init__(self, run, dir, dqm_files, result_dir, config=None):
8  self.runnumber = int(run)
9  self.dir = dir
10  self.result_dir = result_dir
11  self.config = config
12  self.dqm_files = dqm_files
13 
14  self.pset_name = 'dtDQMClient_cfg.py'
15  self.pset_template = 'CalibMuon.DTCalibration.dtDQMClientAlca_cfg'
16 
17  self.process = None
18  self.initProcess()
19  self.configFiles = []
20  self.configFiles.append(self.pset_name)
21  self.task = CmsswTask(self.dir,self.configFiles)
22 
23  def initProcess(self):
25  self.process.GlobalTag.globaltag = self.config.globaltag
26 
27  if hasattr(self.config,'inputTTrigDB') and self.config.inputTTrigDB:
28  label = ''
29  if hasattr(self.config,'runOnCosmics') and self.config.runOnCosmics: label = 'cosmics'
30  addPoolDBESSource(process = self.process,
31  moduleName = 'tTrigDB',record = 'DTTtrigRcd',tag = 'ttrig',label = label,
32  connect = 'sqlite_file:%s' % os.path.abspath(self.config.inputTTrigDB))
33 
34  if hasattr(self.config,'inputVDriftDB') and self.config.inputVDriftDB:
35  addPoolDBESSource(process = self.process,
36  moduleName = 'vDriftDB',record = 'DTMtimeRcd',tag = 'vDrift',
37  connect = 'sqlite_file:%s' % os.path.abspath(self.config.inputVDriftDB))
38 
39  if hasattr(self.config,'inputDBTag') and self.config.inputDBTag:
40  tag = self.config.inputDBTag
41  record = self.config.inputDBRcd
42  connect = self.config.connectStrDBTag
43  moduleName = 'customDB%s' % record
44  addPoolDBESSource(process = self.process,
45  moduleName = moduleName,record = record,tag = tag,
46  connect = connect)
47 
48  self.process.source.fileNames = self.dqm_files
49  self.process.dqmSaver.dirName = os.path.abspath(self.result_dir)
50  if self.config:
51  label = 'dtDQMValidation'
52  if hasattr(self.config,'label') and self.config.label: label = self.config.label
53  workflowName = dqmWorkflowName(self.config.datasetpath,label,self.config.trial)
54  self.process.dqmSaver.workflow = workflowName
55  if self.process.DQMStore.collateHistograms == True: self.process.dqmSaver.forceRunNumber = self.runnumber
56 
57  def writeCfg(self):
58  writeCfg(self.process,self.dir,self.pset_name)
59  #writeCfgPkl(self.process,self.dir,self.pset_name)
60 
61  def run(self):
62  self.task.run()
63  return
64 
65 def runDQM(run,dqmFile,result_dir):
66  dqm_files = [dqmFile]
67  runDir = '.'
68 
69  dtDqm = DTDQMHarvesting(run,runDir,dqm_files,result_dir)
70  dtDqm.writeCfg()
71  dtDqm.run()
def loadCmsProcess
Definition: tools.py:144
def dqmWorkflowName
Definition: tools.py:23