CMS 3D CMS Logo

DTTTrigProd.py
Go to the documentation of this file.
1 from tools import loadCmsProcess,loadCrabCfg,loadCrabDefault,writeCfg,prependPaths
2 from CrabTask import *
3 import os
4 
5 class DTTTrigProd:
6  def __init__(self, run, dir, config):
7  self.pset_name = 'dtTTrigCalibration_cfg.py'
8  self.outputfile = 'DTTimeBoxes.root'
9  self.config = config
10  self.dir = dir
11  self.pset_template = 'CalibMuon.DTCalibration.dtTTrigCalibration_cfg'
12  self.process = None
13  self.crab_cfg = None
14 
15  self.pset_template = 'CalibMuon.DTCalibration.dtTTrigCalibration_cfg'
16  if hasattr(self.config,'runOnCosmics') and self.config.runOnCosmics:
17  self.pset_template = 'CalibMuon.DTCalibration.dtTTrigCalibration_cosmics_cfg'
18 
19  self.initProcess()
20  self.initCrab()
21  self.task = CrabTask(self.dir,self.crab_cfg)
22 
23  def initProcess(self):
25  self.process.GlobalTag.globaltag = self.config.globaltag
26  self.process.dtTTrigCalibration.rootFileName = self.outputfile
27  self.process.dtTTrigCalibration.digiLabel = self.config.digilabel
28 
29  if hasattr(self.config,'inputDBTag') and self.config.inputDBTag:
30  tag = self.config.inputDBTag
31  record = self.config.inputDBRcd
32  connect = self.config.connectStrDBTag
33  moduleName = 'customDB%s' % record
34  addPoolDBESSource(process = self.process,
35  moduleName = moduleName,record = record,tag = tag,
36  connect = connect)
37 
38  if hasattr(self.config,'runOnRAW') and self.config.runOnRAW:
39  if hasattr(self.config,'runOnMC') and self.config.runOnMC:
40  getattr(self.process,self.config.digilabel).inputLabel = 'rawDataCollector'
41  prependPaths(self.process,self.config.digilabel)
42 
43  if hasattr(self.config,'preselection') and self.config.preselection:
44  pathsequence = self.config.preselection.split(':')[0]
45  seqname = self.config.preselection.split(':')[1]
46  self.process.load(pathsequence)
47  prependPaths(self.process,seqname)
48 
49  def initCrab(self):
50  crab_cfg_parser = loadCrabCfg()
51  crab_cfg_parser = loadCrabDefault(crab_cfg_parser,self.config)
52  crab_cfg_parser.set('CMSSW','pset',self.pset_name)
53  crab_cfg_parser.set('CMSSW','output_file',self.outputfile)
54  self.crab_cfg = crab_cfg_parser
55 
56  def writeCfg(self):
57  writeCfg(self.process,self.dir,self.pset_name)
58  #writeCfgPkl(self.process,self.dir,self.pset_name)
59 
60  def run(self):
61  self.project = self.task.run()
62  return self.project
def __init__(self, run, dir, config)
Definition: DTTTrigProd.py:6
def loadCrabCfg(cfgName=None)
Definition: tools.py:178
def loadCrabDefault(crabCfg, config)
Definition: tools.py:195
def prependPaths(process, seqname)
Definition: tools.py:154
def loadCmsProcess(psetPath)
Definition: tools.py:144