CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
runTheMatrix.TheMatrix Class Reference
Inheritance diagram for runTheMatrix.TheMatrix:

Public Member Functions

def __init__ (self, opt)
 
def complete_predefined (self, text, line, start_idx, end_idx)
 
def complete_searchInWorkflow (self, text, line, start_idx, end_idx)
 
def complete_showWorkflow (self, text, line, start_idx, end_idx)
 
def default (self, inp)
 
def do_clear (self, arg)
 
def do_dumpWorkflowId (self, arg)
 
def do_exit (self, arg)
 
def do_predefined (self, arg)
 
def do_search (self, arg)
 
def do_searchInWorkflow (self, arg)
 
def do_showWorkflow (self, arg)
 
def help_dumpWorkflowId (self)
 
def help_predefined (self)
 
def help_search (self)
 
def help_searchInWorkflow (self)
 
def help_showWorkflow (self)
 

Public Attributes

 matrices_
 
 opt_
 

Static Public Attributes

 do_EOF
 
 intro
 
 prompt
 

Detailed Description

Definition at line 460 of file runTheMatrix.py.

Constructor & Destructor Documentation

◆ __init__()

def runTheMatrix.TheMatrix.__init__ (   self,
  opt 
)

Definition at line 464 of file runTheMatrix.py.

464  def __init__(self, opt):
465  cmd.Cmd.__init__(self)
466  self.opt_ = opt
467  self.matrices_ = {}
468  tmp = MatrixReader(self.opt_)
469  for what in tmp.files:
470  what = what.replace('relval_','')
471  self.opt_.what = what
472  self.matrices_[what] = MatrixReader(self.opt_)
473  self.matrices_[what].prepare(self.opt_.useInput, self.opt_.refRel,
474  self.opt_.fromScratch)
475  os.system("clear")
476 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ complete_predefined()

def runTheMatrix.TheMatrix.complete_predefined (   self,
  text,
  line,
  start_idx,
  end_idx 
)

Definition at line 494 of file runTheMatrix.py.

494  def complete_predefined(self, text, line, start_idx, end_idx):
495  if text and len(text) > 0:
496  return [t for t in predefinedSet.keys() if t.startswith(text)]
497  else:
498  return predefinedSet.keys()
499 

◆ complete_searchInWorkflow()

def runTheMatrix.TheMatrix.complete_searchInWorkflow (   self,
  text,
  line,
  start_idx,
  end_idx 
)

Definition at line 545 of file runTheMatrix.py.

References relativeConstraints.keys, and runTheMatrix.TheMatrix.matrices_.

545  def complete_searchInWorkflow(self, text, line, start_idx, end_idx):
546  if text and len(text) > 0:
547  return [t for t in self.matrices_.keys() if t.startswith(text)]
548  else:
549  return self.matrices_.keys()
550 

◆ complete_showWorkflow()

def runTheMatrix.TheMatrix.complete_showWorkflow (   self,
  text,
  line,
  start_idx,
  end_idx 
)

Definition at line 518 of file runTheMatrix.py.

References relativeConstraints.keys, and runTheMatrix.TheMatrix.matrices_.

518  def complete_showWorkflow(self, text, line, start_idx, end_idx):
519  if text and len(text) > 0:
520  return [t for t in self.matrices_.keys() if t.startswith(text)]
521  else:
522  return self.matrices_.keys()
523 

◆ default()

def runTheMatrix.TheMatrix.default (   self,
  inp 
)

Definition at line 485 of file runTheMatrix.py.

References runTheMatrix.TheMatrix.do_exit().

485  def default(self, inp):
486  if inp == 'x' or inp == 'q':
487  return self.do_exit(inp)
488 

◆ do_clear()

def runTheMatrix.TheMatrix.do_clear (   self,
  arg 
)
Clear the screen, put prompt at the top

Definition at line 477 of file runTheMatrix.py.

477  def do_clear(self, arg):
478  """Clear the screen, put prompt at the top"""
479  os.system("clear")
480 

◆ do_dumpWorkflowId()

def runTheMatrix.TheMatrix.do_dumpWorkflowId (   self,
  arg 
)

Definition at line 591 of file runTheMatrix.py.

References dqmMemoryStats.float, mps_monitormerge.items, runTheMatrix.TheMatrix.matrices_, print(), and str.

591  def do_dumpWorkflowId(self, arg):
592  wflids = arg.split()
593  if len(wflids) == 0:
594  print("dumpWorkflowId [wfl-id1 [...]]")
595  return
596 
597  fmt = "[%d]: %s\n"
598  maxLen = 100
599  for wflid in wflids:
600  dump = True
601  for key, mrd in self.matrices_.items():
602  for wfl in mrd.workFlows:
603  if wfl.numId == float(wflid):
604  wfName, stepNames = wfl.nameId.split('+',1)
605  if dump:
606  dump = False
607  print(wfl.numId, stepNames)
608  for i,s in enumerate(wfl.cmds):
609  print(fmt % (i+1, (str(s)+' ')))
610  print("\nWorkflow found in %s." % key)
611  else:
612  print("Workflow also found in %s." % key)
613 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

◆ do_exit()

def runTheMatrix.TheMatrix.do_exit (   self,
  arg 
)

Definition at line 481 of file runTheMatrix.py.

References print().

Referenced by runTheMatrix.TheMatrix.default().

481  def do_exit(self, arg):
482  print("Leaving the Matrix")
483  return True
484 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ do_predefined()

def runTheMatrix.TheMatrix.do_predefined (   self,
  arg 
)
Print the list of predefined workflows

Definition at line 500 of file runTheMatrix.py.

References print().

500  def do_predefined(self, arg):
501  """Print the list of predefined workflows"""
502  print("List of predefined workflows")
503  if arg:
504  for w in arg.split():
505  if w in predefinedSet.keys():
506  print("Predefined Set: %s" % w)
507  print(predefinedSet[w])
508  else:
509  print("Unknown Set: %s" % w)
510  else:
511  print(predefinedSet.keys())
512 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ do_search()

def runTheMatrix.TheMatrix.do_search (   self,
  arg 
)

Definition at line 579 of file runTheMatrix.py.

References runTheMatrix.TheMatrix.do_searchInWorkflow(), join(), relativeConstraints.keys, runTheMatrix.TheMatrix.matrices_, and print().

579  def do_search(self, arg):
580  args = arg.split()
581  if len(args) < 1:
582  print("search regexp")
583  return
584  for wfl in self.matrices_.keys():
585  self.do_searchInWorkflow(' '.join([wfl, args[0]]))
586 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ do_searchInWorkflow()

def runTheMatrix.TheMatrix.do_searchInWorkflow (   self,
  arg 
)

Definition at line 551 of file runTheMatrix.py.

References relativeConstraints.keys, runTheMatrix.TheMatrix.matrices_, and print().

Referenced by runTheMatrix.TheMatrix.do_search().

551  def do_searchInWorkflow(self, arg):
552  args = arg.split()
553  if len(args) < 2:
554  print("searchInWorkflow name regexp")
555  return
556  if args[0] not in self.matrices_.keys():
557  print("Unknown workflow")
558  return
559  import re
560  pattern = None
561  try:
562  pattern = re.compile(args[1])
563  except:
564  print("Failed to compile regexp %s" % args[1])
565  return
566  counter = 0
567  for wfl in self.matrices_[args[0]].workFlows:
568  wfName, stepNames = wfl.nameId.split('+',1)
569  if re.match(pattern, wfName) or re.match(pattern, stepNames):
570  print("%s %s %s" % (wfl.numId, wfName, stepNames))
571  counter += 1
572  print("Found %d compatible workflows inside %s" % (counter, args[0]))
573 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ do_showWorkflow()

def runTheMatrix.TheMatrix.do_showWorkflow (   self,
  arg 
)

Definition at line 524 of file runTheMatrix.py.

References relativeConstraints.keys, runTheMatrix.TheMatrix.matrices_, and print().

524  def do_showWorkflow(self, arg):
525  if arg == '':
526  print("Available workflows:")
527  for k in self.matrices_.keys():
528  print(k)
529  else:
530  selected = arg.split()
531  for k in selected:
532  if k not in self.matrices_.keys():
533  print("Unknown workflow %s: skipping" % k)
534  else:
535  for wfl in self.matrices_[k].workFlows:
536  wfName, stepNames = wfl.nameId.split('+',1)
537  print("%s %s %s" % (wfl.numId, wfName, stepNames))
538  print("%s contains %d workflows" % (k, len(self.matrices_[k].workFlows)))
539 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ help_dumpWorkflowId()

def runTheMatrix.TheMatrix.help_dumpWorkflowId (   self)

Definition at line 587 of file runTheMatrix.py.

References join(), and print().

587  def help_dumpWorkflowId(self):
588  print("\n".join(["dumpWorkflowId [wfl-id1 [...]]\n",
589  "Dumps the details (cmsDriver commands for all steps) of the space-separated workflow-ids in input."]))
590 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ help_predefined()

def runTheMatrix.TheMatrix.help_predefined (   self)

Definition at line 489 of file runTheMatrix.py.

References join(), and print().

489  def help_predefined(self):
490  print("\n".join(["predefined [predef1 [...]]\n",
491  "Run w/o argument, it will print the list of known predefined workflows.",
492  "Run with space-separated predefined workflows, it will print the workflow-ids registered to them"]))
493 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ help_search()

def runTheMatrix.TheMatrix.help_search (   self)

Definition at line 574 of file runTheMatrix.py.

References join(), and print().

574  def help_search(self):
575  print("\n".join(["search search_regexp\n",
576  "This command will search for a match within all workflows registered.",
577  "The search is done on both the workflow name and the names of steps registered to it."]))
578 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ help_searchInWorkflow()

def runTheMatrix.TheMatrix.help_searchInWorkflow (   self)

Definition at line 540 of file runTheMatrix.py.

References join(), and print().

540  def help_searchInWorkflow(self):
541  print("\n".join(["searchInWorkflow wfl_name search_regexp\n",
542  "This command will search for a match within all workflows registered to wfl_name.",
543  "The search is done on both the workflow name and the names of steps registered to it."]))
544 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ help_showWorkflow()

def runTheMatrix.TheMatrix.help_showWorkflow (   self)

Definition at line 513 of file runTheMatrix.py.

References join(), and print().

513  def help_showWorkflow(self):
514  print("\n".join(["showWorkflow [workflow1 [...]]\n",
515  "Run w/o arguments, it will print the list of registered macro-workflows.",
516  "Run with space-separated workflows, it will print the full list of workflow-ids registered to them"]))
517 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

Member Data Documentation

◆ do_EOF

runTheMatrix.TheMatrix.do_EOF
static

Definition at line 614 of file runTheMatrix.py.

◆ intro

runTheMatrix.TheMatrix.intro
static

Definition at line 461 of file runTheMatrix.py.

◆ matrices_

runTheMatrix.TheMatrix.matrices_

◆ opt_

runTheMatrix.TheMatrix.opt_

Definition at line 466 of file runTheMatrix.py.

◆ prompt

runTheMatrix.TheMatrix.prompt
static

Definition at line 462 of file runTheMatrix.py.