CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTTTrigTimeBoxesWriter.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, result_dir, config):
8  self.runnumber = int(run)
9  self.config = config
10  self.dir = dir
11  self.result_dir = result_dir
12 
13  """
14  self.configs = ['dtTTrigWriter_cfg.py',
15  'dumpDBToFile_first_cfg.py',
16  'dtTTrigCorrection_cfg.py',
17  'dumpDBToFile_second_cfg.py']
18 
19  self.pset_templates = {'dtTTrigWriter_cfg.py':'CalibMuon.DTCalibration.dtTTrigWriter_cfg',
20  'dumpDBToFile_first_cfg.py':'CalibMuon.DTCalibration.dumpDBToFile_ttrig_cfg',
21  'dtTTrigCorrection_cfg.py':'CalibMuon.DTCalibration.dtTTrigCorrection_cfg',
22  'dumpDBToFile_second_cfg.py':'CalibMuon.DTCalibration.dumpDBToFile_ttrig_cfg'}
23  """
24  self.configs = ['dtTTrigWriter_cfg.py',
25  'dtTTrigCorrection_cfg.py',
26  'dumpDBToFile_ttrig_cfg.py']
27 
28  self.pset_templates = {'dtTTrigWriter_cfg.py':'CalibMuon.DTCalibration.dtTTrigWriter_cfg',
29  'dtTTrigCorrection_cfg.py':'CalibMuon.DTCalibration.dtTTrigCorrection_cfg',
30  'dumpDBToFile_ttrig_cfg.py':'CalibMuon.DTCalibration.dumpDBToFile_ttrig_cfg'}
31 
32 
33  self.initProcess()
34  self.task = CmsswTask(self.dir,self.configs)
35 
36  def initProcess(self):
37  timeBoxes = os.path.abspath( self.result_dir + '/' + 'DTTimeBoxes_' + str(self.runnumber) + '.root' )
38  ttrig_uncorrected_db = os.path.abspath( self.result_dir + '/' + 'ttrig_uncorrected_' + str(self.runnumber) + '.db' )
39  ttrig_timeboxes_db = os.path.abspath( self.result_dir + '/' + 'ttrig_timeboxes_' + str(self.runnumber) + '.db' )
40  ttrig_timeboxes_txt = os.path.abspath( self.result_dir + '/' + 'ttrig_timeboxes_' + str(self.runnumber) + '.txt' )
41 
42  self.process = {}
43  # dtTTrigWriter_cfg.py
44  self.process['dtTTrigWriter_cfg.py'] = loadCmsProcess(self.pset_templates['dtTTrigWriter_cfg.py'])
45  self.process['dtTTrigWriter_cfg.py'].dtTTrigWriter.rootFileName = timeBoxes
46  self.process['dtTTrigWriter_cfg.py'].PoolDBOutputService.connect = 'sqlite_file:%s' % ttrig_uncorrected_db
47 
48  # dtTTrigCorrection_cfg.py
49  self.process['dtTTrigCorrection_cfg.py'] = loadCmsProcess(self.pset_templates['dtTTrigCorrection_cfg.py'])
50  self.process['dtTTrigCorrection_cfg.py'].GlobalTag.globaltag = self.config.globaltag
51  self.process['dtTTrigCorrection_cfg.py'].source.firstRun = self.runnumber
52  addPoolDBESSource(process = self.process['dtTTrigCorrection_cfg.py'],
53  moduleName = 'calibDB',record = 'DTTtrigRcd',tag = 'ttrig',
54  connect = 'sqlite_file:%s' % ttrig_uncorrected_db)
55 
56  self.process['dtTTrigCorrection_cfg.py'].PoolDBOutputService.connect = 'sqlite_file:%s' % ttrig_timeboxes_db
57 
58  # dumpDBToFile_ttrig_cfg.py
59  self.process['dumpDBToFile_ttrig_cfg.py'] = loadCmsProcess(self.pset_templates['dumpDBToFile_ttrig_cfg.py'])
60  self.process['dumpDBToFile_ttrig_cfg.py'].calibDB.connect = 'sqlite_file:%s' % ttrig_timeboxes_db
61  self.process['dumpDBToFile_ttrig_cfg.py'].dumpToFile.outputFileName = ttrig_timeboxes_txt
62 
63  def writeCfg(self):
64  for cfg in self.configs:
65  writeCfg(self.process[cfg],self.dir,cfg)
66  #writeCfgPkl(self.process[cfg],self.dir,cfg)
67 
68  def run(self):
69  self.task.run()
70  return
def loadCmsProcess
Definition: tools.py:144