CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTTTrigValid.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  self.pset_name = 'dtCalibValidation_cfg.py'
9  #self.outputfile = 'residuals.root,DQM.root'
10  self.outputfile = 'DQM.root'
11  self.config = config
12  self.dir = dir
13  self.inputdb = input_db
14 
15  self.pset_template = 'CalibMuon.DTCalibration.dtCalibValidation_cfg'
16  if hasattr(self.config,'runOnCosmics') and self.config.runOnCosmics:
17  self.pset_template = 'CalibMuon.DTCalibration.dtCalibValidation_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  #self.process.dtCalibValidation.OutputMEsInRootFile = True
29 
30  if hasattr(self.config,'inputDBTag') and self.config.inputDBTag:
31  tag = self.config.inputDBTag
32  record = self.config.inputDBRcd
33  connect = self.config.connectStrDBTag
34  moduleName = 'customDB%s' % record
35  addPoolDBESSource(process = self.process,
36  moduleName = moduleName,record = record,tag = tag,
37  connect = connect)
38 
39  if hasattr(self.config,'inputVDriftDB') and self.config.inputVDriftDB:
40  addPoolDBESSource(process = self.process,
41  moduleName = 'vDriftDB',record = 'DTMtimeRcd',tag = 'vDrift',
42  connect = 'sqlite_file:%s' % os.path.basename(self.config.inputVDriftDB))
43 
44  if hasattr(self.config,'inputT0DB') and self.config.inputT0DB:
45  addPoolDBESSource(process = self.process,
46  moduleName = 't0DB',record = 'DTT0Rcd',tag = 't0',
47  connect = 'sqlite_file:%s' % os.path.basename(self.config.inputT0DB))
48 
49  if(self.inputdb):
50  label = ''
51  if hasattr(self.config,'runOnCosmics') and self.config.runOnCosmics: label = 'cosmics'
52  addPoolDBESSource(process = self.process,
53  moduleName = 'calibDB',record = 'DTTtrigRcd',tag = 'ttrig',label=label,
54  connect = 'sqlite_file:%s' % os.path.basename(self.inputdb))
55 
56  if hasattr(self.config,'runOnRAW') and self.config.runOnRAW:
57  if hasattr(self.config,'runOnMC') and self.config.runOnMC:
58  getattr(self.process,self.config.digilabel).inputLabel = 'rawDataCollector'
59  prependPaths(self.process,self.config.digilabel)
60 
61  if hasattr(self.config,'preselection') and self.config.preselection:
62  pathsequence = self.config.preselection.split(':')[0]
63  seqname = self.config.preselection.split(':')[1]
64  self.process.load(pathsequence)
65  prependPaths(self.process,seqname)
66 
67  def initCrab(self):
68  crab_cfg_parser = loadCrabCfg()
69  loadCrabDefault(crab_cfg_parser,self.config)
70  crab_cfg_parser.set('CMSSW','pset',self.pset_name)
71  crab_cfg_parser.set('CMSSW','output_file',self.outputfile)
72  crab_cfg_parser.remove_option('USER','additional_input_files')
73  if self.inputdb:
74  addCrabInputFile(crab_cfg_parser,self.inputdb)
75 
76  if hasattr(self.config,'inputVDriftDB') and self.config.inputVDriftDB:
77  addCrabInputFile(crab_cfg_parser,self.config.inputVDriftDB)
78 
79  if hasattr(self.config,'inputT0DB') and self.config.inputT0DB:
80  addCrabInputFile(crab_cfg_parser,self.config.inputT0DB)
81 
82  self.crab_cfg = crab_cfg_parser
83 
84  def writeCfg(self):
85  writeCfg(self.process,self.dir,self.pset_name)
86  #writeCfgPkl(self.process,self.dir,self.pset_name)
87 
88  def run(self):
89  self.project = self.task.run()
90  return self.project
def addCrabInputFile
Definition: tools.py:183
def loadCrabDefault
Definition: tools.py:195
def loadCmsProcess
Definition: tools.py:144
if(c.getParameter< edm::InputTag >("puppiValueMap").label().size()!=0)
def loadCrabCfg
Definition: tools.py:178
def prependPaths
Definition: tools.py:154