CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTVDriftMeanTimerWriter.py
Go to the documentation of this file.
1 from tools import loadCmsProcess,writeCfg
2 from addPoolDBESSource import addPoolDBESSource
3 from CmsswTask import CmsswTask
4 import os
5 
7  def __init__(self, run, dir, input_file, output_dir, config):
8  self.runnumber = int(run)
9  self.config = config
10  self.dir = dir
11  self.input_file = input_file
12  self.output_dir = output_dir
13 
14  self.configs = ['dtVDriftMeanTimerWriter_cfg.py',
15  'dumpDBToFile_vdrift_cfg.py']
16 
17  self.pset_templates = {}
18  self.pset_templates['dtVDriftMeanTimerWriter_cfg.py'] = 'CalibMuon.DTCalibration.dtVDriftMeanTimerWriter_cfg'
19  self.pset_templates['dumpDBToFile_vdrift_cfg.py'] = 'CalibMuon.DTCalibration.dumpDBToFile_vdrift_cfg'
20 
21  self.initProcess()
22  self.task = CmsswTask(self.dir,self.configs)
23 
24  def initProcess(self):
25  vDrift_meantimer = self.output_dir + '/' + 'vDrift_meantimer_' + str(self.runnumber)
26  vDrift_meantimer_db = os.path.abspath(vDrift_meantimer + '.db')
27  vDrift_meantimer_txt = os.path.abspath(vDrift_meantimer + '.txt')
28 
29  self.process = {}
30  # dtVDriftMeanTimerWriter
31  self.process['dtVDriftMeanTimerWriter_cfg.py'] = loadCmsProcess(self.pset_templates['dtVDriftMeanTimerWriter_cfg.py'])
32  self.process['dtVDriftMeanTimerWriter_cfg.py'].source.firstRun = self.runnumber
33  self.process['dtVDriftMeanTimerWriter_cfg.py'].GlobalTag.globaltag = self.config.globaltag
34 
35  # Input vDrift db
36  if hasattr(self.config,'inputVDriftDB') and self.config.inputVDriftDB:
37  addPoolDBESSource(process = self.process['dtVDriftMeanTimerWriter_cfg.py'],
38  moduleName = 'vDriftDB',record = 'DTMtimeRcd',tag = 'vDrift',
39  connect = 'sqlite_file:%s' % self.config.inputVDriftDB)
40 
41  self.process['dtVDriftMeanTimerWriter_cfg.py'].PoolDBOutputService.connect = 'sqlite_file:%s' % vDrift_meantimer_db
42  self.process['dtVDriftMeanTimerWriter_cfg.py'].dtVDriftMeanTimerWriter.vDriftAlgoConfig.rootFileName = self.input_file
43 
44  # dumpDBToFile
45  self.process['dumpDBToFile_vdrift_cfg.py'] = loadCmsProcess(self.pset_templates['dumpDBToFile_vdrift_cfg.py'])
46  self.process['dumpDBToFile_vdrift_cfg.py'].calibDB.connect = 'sqlite_file:%s' % vDrift_meantimer_db
47  self.process['dumpDBToFile_vdrift_cfg.py'].dumpToFile.outputFileName = vDrift_meantimer_txt
48 
49  def writeCfg(self):
50  for cfg in self.configs:
51  writeCfg(self.process[cfg],self.dir,cfg)
52  #writeCfgPkl(self.process[cfg],self.dir,cfg)
53 
54  def run(self):
55  self.task.run()
56  return
def loadCmsProcess
Definition: tools.py:144