Go to the documentation of this file.00001 from tools import loadCmsProcess,loadCrabCfg,loadCrabDefault,addCrabInputFile,writeCfg,prependPaths
00002 from addPoolDBESSource import addPoolDBESSource
00003 from CrabTask import *
00004 import os
00005
00006 class DTVDriftMeanTimerCalibration:
00007 def __init__(self, run, dir, config):
00008 self.pset_name = 'dtVDriftMeanTimerCalibration_cfg.py'
00009 self.outputfile = 'DTTMaxHistos.root'
00010 self.config = config
00011 self.dir = dir
00012
00013 self.pset_template = 'CalibMuon.DTCalibration.dtVDriftMeanTimerCalibration_cfg'
00014 if hasattr(self.config,'runOnCosmics') and self.config.runOnCosmics:
00015 self.pset_template = 'CalibMuon.DTCalibration.dtVDriftMeanTimerCalibration_cosmics_cfg'
00016
00017 self.process = None
00018 self.crab_cfg = None
00019 self.initProcess()
00020 self.initCrab()
00021 self.task = CrabTask(self.dir,self.crab_cfg)
00022
00023 def initProcess(self):
00024 self.process = loadCmsProcess(self.pset_template)
00025 self.process.GlobalTag.globaltag = self.config.globaltag
00026 self.process.dtVDriftMeanTimerCalibration.rootFileName = self.outputfile
00027
00028 if hasattr(self.config,'inputTTrigDB') and self.config.inputTTrigDB:
00029 label = ''
00030 if hasattr(self.config,'runOnCosmics') and self.config.runOnCosmics: label = 'cosmics'
00031 addPoolDBESSource(process = self.process,
00032 moduleName = 'tTrigDB',record = 'DTTtrigRcd',tag = 'ttrig',label = label,
00033 connect = 'sqlite_file:%s' % os.path.basename(self.config.inputTTrigDB))
00034
00035 if hasattr(self.config,'inputVdriftDB') and self.config.inputVdriftDB:
00036 addPoolDBESSource(process = self.process,
00037 moduleName = 'vDriftDB',record = 'DTMtimeRcd',tag = 'vDrift',
00038 connect = 'sqlite_file:%s' % os.path.basename(self.config.inputVdriftDB))
00039
00040
00041 if hasattr(self.config,'runOnRAW') and self.config.runOnRAW:
00042 prependPaths(self.process,self.config.digilabel)
00043
00044
00045 if hasattr(self.config,'preselection') and self.config.preselection:
00046 pathsequence = self.config.preselection.split(':')[0]
00047 seqname = self.config.preselection.split(':')[1]
00048 self.process.load(pathsequence)
00049 prependPaths(self.process,seqname)
00050
00051 def initCrab(self):
00052 crab_cfg_parser = loadCrabCfg()
00053 loadCrabDefault(crab_cfg_parser,self.config)
00054 crab_cfg_parser.set('CMSSW','pset',self.pset_name)
00055 crab_cfg_parser.set('CMSSW','output_file',self.outputfile)
00056 crab_cfg_parser.remove_option('USER','additional_input_files')
00057 if hasattr(self.config,'inputTTrigDB') and self.config.inputTTrigDB:
00058 addCrabInputFile(crab_cfg_parser,self.config.inputTTrigDB)
00059
00060 if hasattr(self.config,'inputVdriftDB') and self.config.inputVdriftDB:
00061 addCrabInputFile(crab_cfg_parser,self.config.inputVdriftDB)
00062
00063 self.crab_cfg = crab_cfg_parser
00064
00065 def writeCfg(self):
00066 writeCfg(self.process,self.dir,self.pset_name)
00067
00068
00069 def run(self):
00070 self.project = self.task.run()
00071 return self.project