1 from __future__
import absolute_import
6 import FWCore.ParameterSet.Config
as cms
7 from .DTWorkflow
import DTWorkflow
9 log = logging.getLogger(__name__)
12 """ This class creates and performce / submits vdrift workflow jobs""" 15 super( DTvdriftWorkflow, self ).
__init__( options )
18 output_file_dict = {
"segment" :
"DTVDriftHistos.root",
19 "meantimer" :
"DTTMaxHistos.root",
22 "meantimer" :
"MeanTimer",
24 self.
output_file = output_file_dict[self.options.workflow_mode]
28 """ Generalized function to prepare workflow dependent on workflow mode""" 29 function_name =
"prepare_" + self.options.workflow_mode +
"_" + self.options.command
32 fill_function = getattr(self, function_name)
33 except AttributeError:
34 errmsg =
"Class `{}` does not implement `{}`" 35 raise NotImplementedError( errmsg.format(self.__class__.__name__,
37 log.debug(
"Preparing workflow with function %s" % function_name)
42 self.
pset_name =
'dtVDriftSegmentCalibration_cfg.py' 43 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftSegmentCalibration_cfg' 44 if self.options.datasettype ==
"Cosmics":
45 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftSegmentCalibration_cosmics_cfg' 48 self.process.GlobalTag.globaltag = self.options.globaltag
49 self.process.dtVDriftSegmentCalibration.rootFileName = self.
output_file 51 if self.options.inputCalibDB:
52 err =
"Option inputCalibDB not available for segment." 53 err +=
"Maybe you want to use option inputTtrigDB" 56 if self.options.inputTtrigDB:
58 if self.options.datasettype ==
"Cosmics":
60 connect = os.path.basename(self.options.inputTtrigDB)
62 moduleName =
'tTrigDB',
63 record =
'DTTtrigRcd',
65 connect =
str(
"sqlite_file:%s" % connect),
68 self.input_files.append( os.path.abspath(self.options.inputTtrigDB) )
75 self.
pset_name =
'dtVDriftSegmentWriter_cfg.py' 76 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftSegmentWriter_cfg' 81 if self.options.inputVDriftDB:
83 vdrift_db =
"vDrift_segment"+ tag +
".db" 84 vdrift_db = os.path.join(self.
result_path, vdrift_db)
85 self.process.dtVDriftSegmentWriter.vDriftAlgoConfig.rootFileName =
"file:///" + merged_file
86 self.process.PoolDBOutputService.connect =
'sqlite_file:%s' % vdrift_db
87 self.process.source.firstRun = cms.untracked.uint32(self.options.run)
88 self.process.GlobalTag.globaltag = cms.string(
str(self.options.globaltag))
92 self.
pset_name =
'dumpDBToFile_vdrift_cfg.py' 93 self.
pset_template =
'CalibMuon.DTCalibration.dumpDBToFile_vdrift_cfg' 94 if self.options.input_dumpDB:
100 dbpath = os.path.abspath(self.options.input_dumpDB)
104 tag = crabtask.crabConfig.Data.outputDatasetTag
105 dbpath = os.path.abspath( os.path.join(self.
result_path,
106 "vDrift_segment"+ tag +
".db"))
119 self.
pset_name =
'dtVDriftMeanTimerCalibration_cfg.py' 120 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftMeanTimerCalibration_cfg' 121 if self.options.datasettype ==
"Cosmics":
122 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftMeanTimerCalibration_cosmics_cfg' 125 self.process.GlobalTag.globaltag = self.options.globaltag
126 self.process.dtVDriftMeanTimerCalibration.rootFileName = self.
output_file 128 if self.options.inputCalibDB:
129 err =
"Option inputCalibDB not available for meantimer." 130 err +=
"Maybe you want to use option inputTtrigDB" 131 raise ValueError(err)
133 if self.options.inputTtrigDB:
135 if self.options.datasettype ==
"Cosmics":
137 connect = os.path.basename(self.options.inputTtrigDB)
139 moduleName =
'tTrigDB',
140 record =
'DTTtrigRcd',
142 connect =
str(
"sqlite_file:%s" % connect),
145 self.input_files.append( os.path.abspath(self.options.inputTtrigDB) )
152 self.
pset_name =
'dtVDriftMeanTimerWriter_cfg.py' 153 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftMeanTimerWriter_cfg' 158 if self.options.inputVDriftDB:
160 vdrift_db =
"vDrift_meantimer" + tag +
".db" 161 vdrift_db = os.path.join(self.
result_path, vdrift_db)
162 self.process.dtVDriftMeanTimerWriter.vDriftAlgoConfig.rootFileName =
"file:///" + merged_file
163 self.process.PoolDBOutputService.connect =
'sqlite_file:%s' % vdrift_db
164 self.process.source.firstRun = cms.untracked.uint32(self.options.run)
165 self.process.GlobalTag.globaltag = cms.string(
str(self.options.globaltag))
169 self.
pset_name =
'dumpDBToFile_vdrift_cfg.py' 170 self.
pset_template =
'CalibMuon.DTCalibration.dumpDBToFile_vdrift_cfg' 171 if self.options.input_dumpDB:
177 dbpath = os.path.abspath(self.options.input_dumpDB)
181 tag = crabtask.crabConfig.Data.outputDatasetTag
182 dbpath = os.path.abspath( os.path.join(self.
result_path,
183 "vDrift_meantimer" + tag +
".db"))
197 vdrift_parser = subparser_container.add_parser(
"vdrift",
204 vdrift_subparsers = vdrift_parser.add_subparsers( dest=
"workflow_mode",
205 help=
"Possible workflow modes",)
207 vdrift_segment_subparser = vdrift_subparsers.add_parser(
"segment",
210 vdrift_meantimer_subparser = vdrift_subparsers.add_parser(
"meantimer",
216 vdrift_segment_subparsers = vdrift_segment_subparser.add_subparsers( dest=
"command",
217 help=
"Possible commands for segments")
218 vdrift_segment_submit_parser = vdrift_segment_subparsers.add_parser(
224 help =
"Submit job to the GRID via crab3")
225 vdrift_segment_submit_parser.add_argument(
"--inputTtrigDB",
226 help=
"Local alternative calib ttrig db")
228 vdrift_segment_check_parser = vdrift_segment_subparsers.add_parser(
232 help =
"Check status of submitted jobs")
234 vdrift_segment_write_parser = vdrift_segment_subparsers.add_parser(
239 help =
"Write result from root output to text file")
241 vdrift_segment_dump_parser = vdrift_segment_subparsers.add_parser(
245 help =
"Dump database to text file")
247 vdrift_segment_all_parser = vdrift_segment_subparsers.add_parser(
257 help =
"Perform all steps: submit, check, write, dump in this order")
258 vdrift_segment_all_parser.add_argument(
"--inputTtrigDB",
259 help=
"Local alternative calib ttrig db")
263 vdrift_meantimer_subparsers = vdrift_meantimer_subparser.add_subparsers( dest=
"command",
264 help=
"Possible commands for meantimers")
265 vdrift_meantimer_submit_parser = vdrift_meantimer_subparsers.add_parser(
271 help =
"Submit job to the GRID via crab3")
272 vdrift_meantimer_submit_parser.add_argument(
"--inputTtrigDB",
273 help=
"Local alternative calib ttrig db")
275 vdrift_meantimer_check_parser = vdrift_meantimer_subparsers.add_parser(
279 help =
"Check status of submitted jobs")
281 vdrift_meantimer_write_parser = vdrift_meantimer_subparsers.add_parser(
286 help =
"Write result from root output to text file")
288 vdrift_meantimer_dump_parser = vdrift_meantimer_subparsers.add_parser(
292 help =
"Dump database to text file")
294 vdrift_meantimer_all_parser = vdrift_meantimer_subparsers.add_parser(
304 help =
"Perform all steps: submit, check, write, dump in this order")
305 vdrift_meantimer_all_parser.add_argument(
"--inputTtrigDB",
306 help=
"Local alternative calib ttrig db")
def add_local_vdrift_db(self, local=False)
def addPoolDBESSource(process, moduleName, record, tag, connect='sqlite_file:', label='')
def prepare_meantimer_write(self)
def __init__(self, options)
def prepare_segment_write(self)
def prepare_segment_dump(self)
def load_options_command(self, command)
def prepare_segment_all(self)
def prepare_segment_check(self)
def get_common_options_parser(cls)
def get_dump_options_parser(cls)
def prepare_common_write(self, do_hadd=True)
def get_input_db_options_parser(cls)
def prepare_meantimer_dump(self)
def crab_config_filepath(self)
def get_local_input_db_options_parser(cls)
def prepare_meantimer_submit(self)
Mean Timer #.
def prepare_workflow(self)
def add_parser_options(cls, subparser_container)
CLI creation #.
def prepare_common_submit(self)
def prepare_common_dump(self, db_path)
def prepare_meantimer_check(self)
def prepare_meantimer_all(self)
def write_pset_file(self)
def get_submission_options_parser(cls)
outpath_workflow_mode_dict
def prepare_segment_submit(self)
def get_write_options_parser(cls)
def get_check_options_parser(cls)