CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTNoiseCalibration.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, config):
8  self.pset_name = 'dtNoiseCalibration_cfg.py'
9  self.outputROOT = 'dtNoiseCalib.root'
10  self.outputDB = 'noise.db'
11  self.config = config
12  self.dir = dir
13 
14  self.pset_template = 'CalibMuon.DTCalibration.dtNoiseCalibration_cfg'
15  #if hasattr(self.config,'runOnCosmics') and self.config.runOnCosmics:
16  # self.pset_template = 'CalibMuon.DTCalibration.dtNoiseCalibration_cosmics_cfg'
17 
18  self.process = None
19  self.crab_cfg = None
20  self.initProcess()
21  self.initCrab()
22  self.task = CrabTask(self.dir,self.crab_cfg)
23 
24  def initProcess(self):
26  self.process.GlobalTag.globaltag = self.config.globaltag
27  self.process.dtNoiseCalibration.rootFileName = self.outputROOT
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  loadCrabDefault(crab_cfg_parser,self.config)
52  crab_cfg_parser.set('CMSSW','pset',self.pset_name)
53  crab_cfg_parser.set('CMSSW','output_file','%s,%s' % (self.outputDB,self.outputROOT))
54  crab_cfg_parser.remove_option('USER','additional_input_files')
55 
56  self.crab_cfg = crab_cfg_parser
57 
58  def writeCfg(self):
59  writeCfg(self.process,self.dir,self.pset_name)
60  #writeCfgPkl(self.process,self.dir,self.pset_name)
61 
62  def run(self):
63  self.project = self.task.run()
64  return self.project
def loadCrabDefault
Definition: tools.py:195
def loadCmsProcess
Definition: tools.py:144
def loadCrabCfg
Definition: tools.py:178
def prependPaths
Definition: tools.py:154