5 import FWCore.ParameterSet.Config
as cms
6 from DTWorkflow
import DTWorkflow
8 log = logging.getLogger(__name__)
11 """ This class creates and performce / submits vdrift workflow jobs""" 14 super( DTvdriftWorkflow, self ).
__init__( options )
17 output_file_dict ={
"segment" :
"DTVDriftHistos.root",
21 self.
output_file = output_file_dict[self.options.workflow_mode]
25 """ Generalized function to prepare workflow dependent on workflow mode""" 26 function_name =
"prepare_" + self.options.workflow_mode +
"_" + self.options.command
29 fill_function = getattr(self, function_name)
30 except AttributeError:
31 errmsg =
"Class `{}` does not implement `{}`" 32 raise NotImplementedError( errmsg.format(my_cls.__class__.__name__,
34 log.debug(
"Preparing workflow with function %s" % function_name)
39 self.
pset_name =
'dtVDriftSegmentCalibration_cfg.py' 40 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftSegmentCalibration_cfg' 41 if self.options.datasettype ==
"Cosmics":
42 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftSegmentCalibration_cosmics_cfg' 45 self.process.GlobalTag.globaltag = self.options.globaltag
46 self.process.dtVDriftSegmentCalibration.rootFileName = self.
output_file 48 if self.options.inputCalibDB:
49 err =
"Option inputCalibDB not available for segment." 50 err +=
"Maybe you want to use option inputTtrigDB" 53 if self.options.inputTtrigDB:
55 if self.options.datasettype ==
"Cosmics":
57 connect = os.path.basename(self.options.inputTtrigDB)
59 moduleName =
'tTrigDB',
60 record =
'DTTtrigRcd',
62 connect =
str(
"sqlite_file:%s" % connect),
65 self.input_files.append( os.path.abspath(self.options.inputTtrigDB) )
72 self.
pset_name =
'dtVDriftSegmentWriter_cfg.py' 73 self.
pset_template =
'CalibMuon.DTCalibration.dtVDriftSegmentWriter_cfg' 78 if self.options.inputVDriftDB:
80 vdrift_db =
"vDrift_segment"+ tag +
".db" 81 vdrift_db = os.path.join(self.
result_path, vdrift_db)
82 self.process.dtVDriftSegmentWriter.vDriftAlgoConfig.rootFileName =
"file:///" + merged_file
83 self.process.PoolDBOutputService.connect =
'sqlite_file:%s' % vdrift_db
84 self.process.source.firstRun = cms.untracked.uint32(self.options.run)
85 self.process.GlobalTag.globaltag = cms.string(
str(self.options.globaltag))
89 self.
pset_name =
'dumpDBToFile_vdrift_cfg.py' 90 self.
pset_template =
'CalibMuon.DTCalibration.dumpDBToFile_vdrift_cfg' 91 if self.options.input_dumpDB:
97 dbpath = os.path.abspath(self.options.input_dumpDB)
101 tag = crabtask.crabConfig.Data.outputDatasetTag
102 dbpath = os.path.abspath( os.path.join(self.
result_path,
103 "vDrift_segment"+ tag +
".db"))
117 vdrift_parser = subparser_container.add_parser(
"vdrift",
124 vdrift_subparsers = vdrift_parser.add_subparsers( dest=
"workflow_mode",
125 help=
"Possible workflow modes",)
127 vdrift_segment_subparser = vdrift_subparsers.add_parser(
"segment",
133 vdrift_segment_subparsers = vdrift_segment_subparser.add_subparsers( dest=
"command",
134 help=
"Possible commands for segments")
135 vdrift_segment_submit_parser = vdrift_segment_subparsers.add_parser(
141 help =
"Submit job to the GRID via crab3")
142 vdrift_segment_submit_parser.add_argument(
"--inputTtrigDB",
143 help=
"Local alternative calib ttrig db")
145 vdrift_segment_check_parser = vdrift_segment_subparsers.add_parser(
149 help =
"Check status of submitted jobs")
151 vdrift_segment_write_parser = vdrift_segment_subparsers.add_parser(
156 help =
"Write result from root output to text file")
158 vdrift_segment_dump_parser = vdrift_segment_subparsers.add_parser(
162 help =
"Dump database to text file")
164 vdrift_segment_all_parser = vdrift_segment_subparsers.add_parser(
174 help =
"Perform all steps: submit, check, write, dump in this order")
175 vdrift_segment_all_parser.add_argument(
"--inputTtrigDB",
176 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 __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 crab_config_filepath(self)
def get_local_input_db_options_parser(cls)
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 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)