CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTDQMValidation.py
Go to the documentation of this file.
1 from tools import loadCmsProcess,loadCrabCfg,loadCrabDefault,addCrabInputFile,writeCfg,prependPaths
2 from addPoolDBESSource import addPoolDBESSource
3 from CrabTask import *
4 import os
5 
7  #def __init__(self, run, dir, input_db, config):
8  def __init__(self, run, dir, config):
9  self.outputfile = 'DQM.root'
10  self.config = config
11  self.dir = dir
12  #self.inputdb = input_db
13 
14  self.pset_name = 'dtDQM_cfg.py'
15  self.pset_template = 'CalibMuon.DTCalibration.dtDQMAlca_cfg'
16  if hasattr(self.config,'runOnCosmics') and self.config.runOnCosmics:
17  self.pset_template = 'CalibMuon.DTCalibration.dtDQMAlca_cosmics_cfg'
18 
19  self.process = None
20  self.crab_cfg = None
21  self.initProcess()
22  self.initCrab()
23  self.task = CrabTask(self.dir,self.crab_cfg)
24 
25  def initProcess(self):
27  self.process.GlobalTag.globaltag = self.config.globaltag
28 
29  if hasattr(self.config,'inputTTrigDB') and self.config.inputTTrigDB:
30  label = ''
31  if hasattr(self.config,'runOnCosmics') and self.config.runOnCosmics: label = 'cosmics'
32  addPoolDBESSource(process = self.process,
33  moduleName = 'tTrigDB',record = 'DTTtrigRcd',tag = 'ttrig',label = label,
34  connect = 'sqlite_file:%s' % os.path.basename(self.config.inputTTrigDB))
35 
36  if hasattr(self.config,'inputVDriftDB') and self.config.inputVDriftDB:
37  addPoolDBESSource(process = self.process,
38  moduleName = 'vDriftDB',record = 'DTMtimeRcd',tag = 'vDrift',
39  connect = 'sqlite_file:%s' % os.path.basename(self.config.inputVDriftDB))
40 
41  if hasattr(self.config,'inputDBTag') and self.config.inputDBTag:
42  tag = self.config.inputDBTag
43  record = self.config.inputDBRcd
44  connect = self.config.connectStrDBTag
45  moduleName = 'customDB%s' % record
46  addPoolDBESSource(process = self.process,
47  moduleName = moduleName,record = record,tag = tag,
48  connect = connect)
49 
50  if hasattr(self.config,'runOnRAW') and self.config.runOnRAW:
51  if hasattr(self.config,'runOnMC') and self.config.runOnMC:
52  getattr(self.process,self.config.digilabel).inputLabel = 'rawDataCollector'
53  prependPaths(self.process,self.config.digilabel)
54 
55  if hasattr(self.config,'preselection') and self.config.preselection:
56  pathsequence = self.config.preselection.split(':')[0]
57  seqname = self.config.preselection.split(':')[1]
58  self.process.load(pathsequence)
59  prependPaths(self.process,seqname)
60 
61  def initCrab(self):
62  crab_cfg_parser = loadCrabCfg()
63  loadCrabDefault(crab_cfg_parser,self.config)
64  crab_cfg_parser.set('CMSSW','pset',self.pset_name)
65  crab_cfg_parser.set('CMSSW','output_file',self.outputfile)
66  crab_cfg_parser.remove_option('USER','additional_input_files')
67  #if self.inputdb:
68  # addCrabInputFile(crab_cfg_parser,self.inputdb)
69  if hasattr(self.config,'inputTTrigDB') and self.config.inputTTrigDB:
70  addCrabInputFile(crab_cfg_parser,self.config.inputTTrigDB)
71 
72  if hasattr(self.config,'inputVDriftDB') and self.config.inputVDriftDB:
73  addCrabInputFile(crab_cfg_parser,self.config.inputVDriftDB)
74 
75  self.crab_cfg = crab_cfg_parser
76 
77  def writeCfg(self):
78  writeCfg(self.process,self.dir,self.pset_name)
79  #writeCfgPkl(self.process,self.dir,self.pset_name)
80 
81  def run(self):
82  self.project = self.task.run()
83  return self.project
def addCrabInputFile
Definition: tools.py:183
def loadCrabDefault
Definition: tools.py:195
def loadCmsProcess
Definition: tools.py:144
def loadCrabCfg
Definition: tools.py:178
def prependPaths
Definition: tools.py:154