CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
DTVdriftWorkflow.DTvdriftWorkflow Class Reference
Inheritance diagram for DTVdriftWorkflow.DTvdriftWorkflow:
DTWorkflow.DTWorkflow CLIHelper.CLIHelper CrabHelper.CrabHelper

Public Member Functions

def __init__ (self, options)
 
def add_parser_options (cls, subparser_container)
 CLI creation #. More...
 
def prepare_segment_all (self)
 
def prepare_segment_check (self)
 
def prepare_segment_dump (self)
 
def prepare_segment_submit (self)
 
def prepare_segment_write (self)
 
def prepare_workflow (self)
 
- Public Member Functions inherited from DTWorkflow.DTWorkflow
def __init__ (self, options)
 
def add_local_calib_db (self, local=False)
 
def add_local_custom_db (self)
 
def add_local_t0_db (self, local=False)
 
def add_local_vdrift_db (self, local=False)
 
def add_preselection (self)
 
def add_raw_option (self)
 
def all (self)
 
def check (self)
 
def check_missing_options (self, requirements_dict)
 
def correction (self)
 
def dump (self)
 
def dump_options (self)
 
def get_config_name (self, command="")
 
def get_output_files (self, crabtask, output_path)
 
def load_options (self, config_file_path)
 
def load_options_command (self, command)
 
def local_path (self)
 
def outpath_workflow_mode_tag (self)
 
def prepare_common_dump (self, db_path)
 
def prepare_common_submit (self)
 
def prepare_common_write (self, do_hadd=True)
 
def prepare_workflow (self)
 
def pset_path (self)
 
def pset_template_base_bath (self)
 
def remote_out_path (self)
 
def result_path (self)
 
def run (self)
 
def runCMSSWtask (self, pset_path="")
 
def submit (self)
 
def tag (self)
 
def user (self)
 
def write (self)
 
def write_pset_file (self)
 
- Public Member Functions inherited from CLIHelper.CLIHelper
def add_parser_options (cls, parser)
 
def fill_required_options_dict (self)
 
def fill_required_options_prepare_dict (self)
 
def get_check_options_parser (cls)
 
def get_common_options_parser (cls)
 
def get_dump_options_parser (cls)
 
def get_input_db_options_parser (cls)
 
def get_local_input_db_options_parser (cls)
 
def get_submission_options_parser (cls)
 
def get_write_options_parser (cls)
 
- Public Member Functions inherited from CrabHelper.CrabHelper
def __init__ (self)
 
def cert_info (self)
 
def check_crabtask (self)
 
def crab (self)
 
def crab_config_filename (self)
 
def crab_config_filepath (self)
 
def crab_taskname (self)
 
def create_crab_config (self)
 
def fill_options_from_crab_config (self)
 
def submit_crab_task (self)
 
def voms_proxy_create (self, passphrase=None)
 
def voms_proxy_time_left (self)
 
def write_crabConfig (self)
 

Public Attributes

 all_commands
 
 outpath_command_tag
 
 outpath_workflow_mode_dict
 
 output_file
 
 output_files
 
 process
 
 pset_name
 
 pset_template
 
- Public Attributes inherited from DTWorkflow.DTWorkflow
 digilabel
 
 files_reveived
 
 input_files
 
 options
 
 outpath_command_tag
 
 output_files
 
 process
 
 pset_name
 
 required_options_dict
 
 required_options_prepare_dict
 
 run_all_command
 
- Public Attributes inherited from CrabHelper.CrabHelper
 crab_config
 
 crabFunctions
 

Additional Inherited Members

- Static Public Member Functions inherited from DTWorkflow.DTWorkflow
def addPoolDBESSource (process, moduleName, record, tag, connect='sqlite_file:', label='')
 

Detailed Description

This class creates and performce / submits vdrift workflow jobs

Definition at line 10 of file DTVdriftWorkflow.py.

Constructor & Destructor Documentation

def DTVdriftWorkflow.DTvdriftWorkflow.__init__ (   self,
  options 
)

Definition at line 12 of file DTVdriftWorkflow.py.

12  def __init__(self, options):
13  # call parent constructor
14  super( DTvdriftWorkflow, self ).__init__( options )
15 
16  self.outpath_command_tag = "VdriftCalibration"
17  output_file_dict ={ "segment" : "DTVDriftHistos.root",
18  }
19  self.outpath_workflow_mode_dict = { "segment" : "Segments"
20  }
21  self.output_file = output_file_dict[self.options.workflow_mode]
22  self.output_files = [self.output_file]
23 

Member Function Documentation

def DTVdriftWorkflow.DTvdriftWorkflow.add_parser_options (   cls,
  subparser_container 
)

CLI creation #.

Definition at line 116 of file DTVdriftWorkflow.py.

References CLIHelper.CLIHelper.get_check_options_parser(), CLIHelper.CLIHelper.get_common_options_parser(), CLIHelper.CLIHelper.get_dump_options_parser(), CLIHelper.CLIHelper.get_input_db_options_parser(), CLIHelper.CLIHelper.get_local_input_db_options_parser(), CLIHelper.CLIHelper.get_submission_options_parser(), and CLIHelper.CLIHelper.get_write_options_parser().

116  def add_parser_options(cls, subparser_container):
117  vdrift_parser = subparser_container.add_parser( "vdrift",
118  #parents=[mutual_parent_parser, common_parent_parser],
119  help = "" ) # What does ttrig
120 
121  ################################################################
122  # Sub parser options for workflow modes #
123  ################################################################
124  vdrift_subparsers = vdrift_parser.add_subparsers( dest="workflow_mode",
125  help="Possible workflow modes",)
126  ## Add all workflow modes for ttrig
127  vdrift_segment_subparser = vdrift_subparsers.add_parser( "segment",
128  #parents=[mutual_parent_parser, common_parent_parser],
129  help = "" )
130  ################################################################
131  # Sub parser options for workflow mode segment #
132  ################################################################
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(
136  "submit",
137  parents=[super(DTvdriftWorkflow,cls).get_common_options_parser(),
138  super(DTvdriftWorkflow,cls).get_submission_options_parser(),
139  super(DTvdriftWorkflow,cls).get_local_input_db_options_parser(),
140  super(DTvdriftWorkflow,cls).get_input_db_options_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")
144 
145  vdrift_segment_check_parser = vdrift_segment_subparsers.add_parser(
146  "check",
147  parents=[super(DTvdriftWorkflow,cls).get_common_options_parser(),
148  super(DTvdriftWorkflow,cls).get_check_options_parser()],
149  help = "Check status of submitted jobs")
150 
151  vdrift_segment_write_parser = vdrift_segment_subparsers.add_parser(
152  "write",
153  parents=[super(DTvdriftWorkflow,cls).get_common_options_parser(),
154  super(DTvdriftWorkflow,cls).get_write_options_parser()
155  ],
156  help = "Write result from root output to text file")
157 
158  vdrift_segment_dump_parser = vdrift_segment_subparsers.add_parser(
159  "dump",
160  parents=[super(DTvdriftWorkflow,cls).get_common_options_parser(),
161  super(DTvdriftWorkflow,cls).get_dump_options_parser()],
162  help = "Dump database to text file")
163 
164  vdrift_segment_all_parser = vdrift_segment_subparsers.add_parser(
165  "all",
166  parents=[super(DTvdriftWorkflow,cls).get_common_options_parser(),
167  super(DTvdriftWorkflow,cls).get_submission_options_parser(),
168  super(DTvdriftWorkflow,cls).get_check_options_parser(),
169  super(DTvdriftWorkflow,cls).get_input_db_options_parser(),
170  super(DTvdriftWorkflow,cls).get_local_input_db_options_parser(),
171  super(DTvdriftWorkflow,cls).get_write_options_parser(),
172  super(DTvdriftWorkflow,cls).get_dump_options_parser()
173  ],
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")
177 
def get_common_options_parser(cls)
Definition: CLIHelper.py:5
def get_dump_options_parser(cls)
Definition: CLIHelper.py:133
def get_input_db_options_parser(cls)
Definition: CLIHelper.py:50
def get_local_input_db_options_parser(cls)
Definition: CLIHelper.py:65
def add_parser_options(cls, subparser_container)
CLI creation #.
def get_submission_options_parser(cls)
Definition: CLIHelper.py:79
def get_write_options_parser(cls)
Definition: CLIHelper.py:123
def get_check_options_parser(cls)
Definition: CLIHelper.py:111
def DTVdriftWorkflow.DTvdriftWorkflow.prepare_segment_all (   self)

Definition at line 107 of file DTVdriftWorkflow.py.

108  # individual prepare functions for all tasks will be called in
109  # main implementation of all
110  self.all_commands=["submit", "check", "write", "dump"]
111 
def DTVdriftWorkflow.DTvdriftWorkflow.prepare_segment_check (   self)

Definition at line 68 of file DTVdriftWorkflow.py.

References DTWorkflow.DTWorkflow.load_options_command().

69  self.load_options_command("submit")
70 
def load_options_command(self, command)
Definition: DTWorkflow.py:403
def DTVdriftWorkflow.DTvdriftWorkflow.prepare_segment_dump (   self)

Definition at line 88 of file DTVdriftWorkflow.py.

References CrabHelper.CrabHelper.crab_config_filepath(), DTWorkflow.DTWorkflow.load_options_command(), DTWorkflow.DTWorkflow.prepare_common_dump(), DTVdriftWorkflow.DTvdriftWorkflow.pset_name, DTTtrigWorkflow.DTttrigWorkflow.pset_name, DTVdriftWorkflow.DTvdriftWorkflow.pset_template, DTTtrigWorkflow.DTttrigWorkflow.pset_template, DTWorkflow.DTWorkflow.result_path(), and DTWorkflow.DTWorkflow.write_pset_file().

89  self.pset_name = 'dumpDBToFile_vdrift_cfg.py'
90  self.pset_template = 'CalibMuon.DTCalibration.dumpDBToFile_vdrift_cfg'
91  if self.options.input_dumpDB:
92  try:
93  test = self.result_path
94  self.load_options_command("write")
95  except:
96  pass
97  dbpath = os.path.abspath(self.options.input_dumpDB)
98  else:
99  crabtask = self.crabFunctions.CrabTask(crab_config = self.crab_config_filepath,
100  initUpdate = False)
101  tag = crabtask.crabConfig.Data.outputDatasetTag
102  dbpath = os.path.abspath( os.path.join(self.result_path,
103  "vDrift_segment"+ tag + ".db"))
104  self.prepare_common_dump(dbpath)
105  self.write_pset_file()
106 
def load_options_command(self, command)
Definition: DTWorkflow.py:403
def crab_config_filepath(self)
Definition: CrabHelper.py:225
def prepare_common_dump(self, db_path)
Definition: DTWorkflow.py:228
def write_pset_file(self)
Definition: DTWorkflow.py:376
def DTVdriftWorkflow.DTvdriftWorkflow.prepare_segment_submit (   self)

Definition at line 38 of file DTVdriftWorkflow.py.

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'
43 
45  self.process.GlobalTag.globaltag = self.options.globaltag
46  self.process.dtVDriftSegmentCalibration.rootFileName = self.output_file
47 
48  if self.options.inputCalibDB:
49  err = "Option inputCalibDB not available for segment."
50  err += "Maybe you want to use option inputTtrigDB"
51  raise ValueError(err)
53  if self.options.inputTtrigDB:
54  label = ''
55  if self.options.datasettype == "Cosmics":
56  label = 'cosmics'
57  connect = os.path.basename(self.options.inputTtrigDB)
58  self.addPoolDBESSource( process = self.process,
59  moduleName = 'tTrigDB',
60  record = 'DTTtrigRcd',
61  tag = 'ttrig',
62  connect = str("sqlite_file:%s" % connect),
63  label = label
64  )
65  self.input_files.append( os.path.abspath(self.options.inputTtrigDB) )
66  self.write_pset_file()
67 
def addPoolDBESSource(process, moduleName, record, tag, connect='sqlite_file:', label='')
Definition: DTWorkflow.py:247
def loadCmsProcess(psetPath)
Definition: tools.py:56
def prepare_common_submit(self)
Definition: DTWorkflow.py:193
def write_pset_file(self)
Definition: DTWorkflow.py:376
#define str(s)
def DTVdriftWorkflow.DTvdriftWorkflow.prepare_segment_write (   self)

Definition at line 71 of file DTVdriftWorkflow.py.

References DTWorkflow.DTWorkflow.add_local_vdrift_db(), tools.loadCmsProcess(), DTVdriftWorkflow.DTvdriftWorkflow.output_file, DTTtrigWorkflow.DTttrigWorkflow.output_file, DTWorkflow.DTWorkflow.prepare_common_write(), DTVdriftWorkflow.DTvdriftWorkflow.process, DTTtrigWorkflow.DTttrigWorkflow.process, DTVdriftWorkflow.DTvdriftWorkflow.pset_name, DTTtrigWorkflow.DTttrigWorkflow.pset_name, DTVdriftWorkflow.DTvdriftWorkflow.pset_template, DTTtrigWorkflow.DTttrigWorkflow.pset_template, DTWorkflow.DTWorkflow.result_path(), str, and DTWorkflow.DTWorkflow.write_pset_file().

72  self.pset_name = 'dtVDriftSegmentWriter_cfg.py'
73  self.pset_template = 'CalibMuon.DTCalibration.dtVDriftSegmentWriter_cfg'
74  tag = self.prepare_common_write()
75  merged_file = os.path.join(self.result_path, self.output_file)
77 
78  if self.options.inputVDriftDB:
79  self.add_local_vdrift_db(self)
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))
86  self.write_pset_file()
87 
def add_local_vdrift_db(self, local=False)
Definition: DTWorkflow.py:147
def prepare_common_write(self, do_hadd=True)
Definition: DTWorkflow.py:211
def loadCmsProcess(psetPath)
Definition: tools.py:56
def write_pset_file(self)
Definition: DTWorkflow.py:376
#define str(s)
def DTVdriftWorkflow.DTvdriftWorkflow.prepare_workflow (   self)
Generalized function to prepare workflow dependent on workflow mode

Definition at line 24 of file DTVdriftWorkflow.py.

Referenced by DTWorkflow.DTWorkflow.run().

24  def prepare_workflow(self):
25  """ Generalized function to prepare workflow dependent on workflow mode"""
26  function_name = "prepare_" + self.options.workflow_mode + "_" + self.options.command
27 
28  try:
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__,
33  method_name))
34  log.debug("Preparing workflow with function %s" % function_name)
35  # call chosen function
36  fill_function()
37 

Member Data Documentation

DTVdriftWorkflow.DTvdriftWorkflow.all_commands

Definition at line 110 of file DTVdriftWorkflow.py.

Referenced by DTWorkflow.DTWorkflow.all().

DTVdriftWorkflow.DTvdriftWorkflow.outpath_command_tag
DTVdriftWorkflow.DTvdriftWorkflow.outpath_workflow_mode_dict

Definition at line 19 of file DTVdriftWorkflow.py.

Referenced by DTWorkflow.DTWorkflow.outpath_workflow_mode_tag().

DTVdriftWorkflow.DTvdriftWorkflow.output_file
DTVdriftWorkflow.DTvdriftWorkflow.output_files

Definition at line 22 of file DTVdriftWorkflow.py.

DTVdriftWorkflow.DTvdriftWorkflow.pset_template