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,'inputDBTag') and self.config.inputDBTag:
28  tag = self.config.inputDBTag
29  record = self.config.inputDBRcd
30  connect = self.config.connectStrDBTag
31  moduleName = 'customDB%s' % record
32  addPoolDBESSource(process = self.process,
33  moduleName = moduleName,record = record,tag = tag,
34  connect = connect)
35 
36  if hasattr(self.config,'inputTTrigDB') and self.config.inputTTrigDB:
37  label = ''
38  if hasattr(self.config,'runOnCosmics') and self.config.runOnCosmics: label = 'cosmics'
39  addPoolDBESSource(process = self.process,
40  moduleName = 'tTrigDB',record = 'DTTtrigRcd',tag = 'ttrig',label = label,
41  connect = 'sqlite_file:%s' % os.path.abspath(self.config.inputTTrigDB))
42 
43  if hasattr(self.config,'inputVDriftDB') and self.config.inputVDriftDB:
44  addPoolDBESSource(process = self.process,
45  moduleName = 'vDriftDB',record = 'DTMtimeRcd',tag = 'vDrift',
46  connect = 'sqlite_file:%s' % os.path.abspath(self.config.inputVDriftDB))
47 
48  if hasattr(self.config,'inputT0DB') and self.config.inputT0DB:
49  addPoolDBESSource(process = self.process,
50  moduleName = 't0DB',record = 'DTT0Rcd',tag = 't0',
51  connect = 'sqlite_file:%s' % os.path.basename(self.config.inputT0DB))
52 
53  self.process.source.fileNames = self.dqm_files
54  self.process.dqmSaver.dirName = os.path.abspath(self.result_dir)
55  if self.config:
56  label = 'dtDQMValidation'
57  if hasattr(self.config,'label') and self.config.label: label = self.config.label
58  workflowName = dqmWorkflowName(self.config.datasetpath,label,self.config.trial)
59  self.process.dqmSaver.workflow = workflowName
60  if self.process.DQMStore.collateHistograms == True: self.process.dqmSaver.forceRunNumber = self.runnumber
61 
62  def writeCfg(self):
63  writeCfg(self.process,self.dir,self.pset_name)
64  #writeCfgPkl(self.process,self.dir,self.pset_name)
65 
66  def run(self):
67  self.task.run()
68  return
69 
70 def runDQM(run,dqmFile,result_dir):
71  dqm_files = [dqmFile]
72  runDir = '.'
73 
74  dtDqm = DTDQMHarvesting(run,runDir,dqm_files,result_dir)
75  dtDqm.writeCfg()
76  dtDqm.run()
def loadCmsProcess
Definition: tools.py:144
def dqmWorkflowName
Definition: tools.py:23