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",
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'
52 err =
"Option inputCalibDB not available for segment."
53 err +=
"Maybe you want to use option 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),
75 self.
pset_name =
'dtVDriftSegmentWriter_cfg.py'
76 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftSegmentWriter_cfg'
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)
92 self.
pset_name =
'dumpDBToFile_vdrift_cfg.py'
93 self.
pset_template =
'CalibMuon.DTCalibration.dumpDBToFile_vdrift_cfg'
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'
129 err =
"Option inputCalibDB not available for meantimer."
130 err +=
"Maybe you want to use option inputTtrigDB"
131 raise ValueError(err)
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),
152 self.
pset_name =
'dtVDriftMeanTimerWriter_cfg.py'
153 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftMeanTimerWriter_cfg'
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)
169 self.
pset_name =
'dumpDBToFile_vdrift_cfg.py'
170 self.
pset_template =
'CalibMuon.DTCalibration.dumpDBToFile_vdrift_cfg'
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")