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 467 of file runTheMatrix.py.

Constructor & Destructor Documentation

◆ __init__()

def runTheMatrix.TheMatrix.__init__ (   self,
  opt 
)

Definition at line 471 of file runTheMatrix.py.

471  def __init__(self, opt):
472  cmd.Cmd.__init__(self)
473  self.opt_ = opt
474  self.matrices_ = {}
475  tmp = MatrixReader(self.opt_)
476  for what in tmp.files:
477  what = what.replace('relval_','')
478  self.opt_.what = what
479  self.matrices_[what] = MatrixReader(self.opt_)
480  self.matrices_[what].prepare(self.opt_.useInput, self.opt_.refRel,
481  self.opt_.fromScratch)
482  os.system("clear")
483 
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 507 of file runTheMatrix.py.

507  def complete_predefined(self, text, line, start_idx, end_idx):
508  if text and len(text) > 0:
509  return [t for t in predefinedSet.keys() if t.startswith(text)]
510  else:
511  return predefinedSet.keys()
512 

◆ complete_searchInWorkflow()

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

Definition at line 559 of file runTheMatrix.py.

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

559  def complete_searchInWorkflow(self, text, line, start_idx, end_idx):
560  if text and len(text) > 0:
561  return [t for t in self.matrices_.keys() if t.startswith(text)]
562  else:
563  return self.matrices_.keys()
564 

◆ complete_showWorkflow()

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

Definition at line 531 of file runTheMatrix.py.

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

531  def complete_showWorkflow(self, text, line, start_idx, end_idx):
532  if text and len(text) > 0:
533  return [t for t in self.matrices_.keys() if t.startswith(text)]
534  else:
535  return self.matrices_.keys()
536 

◆ default()

def runTheMatrix.TheMatrix.default (   self,
  inp 
)

Definition at line 492 of file runTheMatrix.py.

References runTheMatrix.TheMatrix.do_exit(), and print().

492  def default(self, inp):
493  if inp == 'x' or inp == 'q':
494  return self.do_exit(inp)
495  else:
496  is_pipe = not isatty(sys.stdin.fileno())
497  print(Fore.RED + "Error: " + Fore.RESET + "unrecognized command.")
498  # Quit only if given a piped command.
499  if is_pipe:
500  sys.exit(1)
501 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ do_clear()

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

Definition at line 484 of file runTheMatrix.py.

484  def do_clear(self, arg):
485  """Clear the screen, put prompt at the top"""
486  os.system("clear")
487 

◆ do_dumpWorkflowId()

def runTheMatrix.TheMatrix.do_dumpWorkflowId (   self,
  arg 
)

Definition at line 606 of file runTheMatrix.py.

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

606  def do_dumpWorkflowId(self, arg):
607  wflids = arg.split()
608  if len(wflids) == 0:
609  print("dumpWorkflowId [wfl-id1 [...]]")
610  return
611 
612  fmt = "[%s]: %s\n"
613  maxLen = 100
614  for wflid in wflids:
615  dump = True
616  for key, mrd in self.matrices_.items():
617  for wfl in mrd.workFlows:
618  if wfl.numId == float(wflid):
619  if dump:
620  dump = False
621  print(Fore.GREEN + str(wfl.numId) + Fore.RESET + " " + Fore.YELLOW + wfl.nameId + Fore.RESET)
622  for i,s in enumerate(wfl.cmds):
623  print(fmt % (Fore.RED + str(i+1) + Fore.RESET,
624  (str(s)+' ')))
625  print("\nWorkflow found in %s." % key)
626  else:
627  print("Workflow also found in %s." % key)
628 
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 488 of file runTheMatrix.py.

References print().

Referenced by runTheMatrix.TheMatrix.default().

488  def do_exit(self, arg):
489  print("Leaving the Matrix")
490  return True
491 
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 513 of file runTheMatrix.py.

References join(), print(), and str.

513  def do_predefined(self, arg):
514  """Print the list of predefined workflows"""
515  print("List of predefined workflows")
516  if arg:
517  for w in arg.split():
518  if w in predefinedSet.keys():
519  print("Predefined Set: %s" % w)
520  print(predefinedSet[w])
521  else:
522  print("Unknown Set: %s" % w)
523  else:
524  print("[ " + Fore.RED + ", ".join([str(k) for k in predefinedSet.keys()]) + Fore.RESET + " ]")
525 
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
#define str(s)

◆ do_search()

def runTheMatrix.TheMatrix.do_search (   self,
  arg 
)

Definition at line 594 of file runTheMatrix.py.

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

594  def do_search(self, arg):
595  args = arg.split()
596  if len(args) < 1:
597  print("search regexp")
598  return
599  for wfl in self.matrices_.keys():
600  self.do_searchInWorkflow(' '.join([wfl, args[0]]))
601 
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 565 of file runTheMatrix.py.

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

Referenced by runTheMatrix.TheMatrix.do_search().

565  def do_searchInWorkflow(self, arg):
566  args = arg.split()
567  if len(args) < 2:
568  print("searchInWorkflow name regexp")
569  return
570  if args[0] not in self.matrices_.keys():
571  print("Unknown workflow")
572  return
573  import re
574  pattern = None
575  try:
576  pattern = re.compile(args[1])
577  except:
578  print("Failed to compile regexp %s" % args[1])
579  return
580  counter = 0
581  for wfl in self.matrices_[args[0]].workFlows:
582  if re.match(pattern, wfl.nameId):
583  print("%s %s" % (Fore.BLUE + str(wfl.numId) + Fore.RESET,
584  Fore.GREEN + wfl.nameId + Fore.RESET))
585  counter +=1
586  print("Found %s compatible workflows inside %s" % (Fore.RED + str(counter) + Fore.RESET,
587  Fore.YELLOW + str(args[0])) + Fore.RESET)
588 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

◆ do_showWorkflow()

def runTheMatrix.TheMatrix.do_showWorkflow (   self,
  arg 
)

Definition at line 537 of file runTheMatrix.py.

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

537  def do_showWorkflow(self, arg):
538  if arg == '':
539  print("Available workflows:")
540  for k in self.matrices_.keys():
541  print(Fore.RED + Style.BRIGHT + k)
542  print(Style.RESET_ALL)
543  else:
544  selected = arg.split()
545  for k in selected:
546  if k not in self.matrices_.keys():
547  print("Unknown workflow %s: skipping" % k)
548  else:
549  for wfl in self.matrices_[k].workFlows:
550  print("%s %s" % (Fore.BLUE + str(wfl.numId) + Fore.RESET,
551  Fore.GREEN + wfl.nameId + Fore.RESET))
552  print("%s contains %d workflows" % (Fore.RED + k + Fore.RESET, len(self.matrices_[k].workFlows)))
553 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

◆ help_dumpWorkflowId()

def runTheMatrix.TheMatrix.help_dumpWorkflowId (   self)

Definition at line 602 of file runTheMatrix.py.

References join(), and print().

602  def help_dumpWorkflowId(self):
603  print("\n".join(["dumpWorkflowId [wfl-id1 [...]]\n",
604  "Dumps the details (cmsDriver commands for all steps) of the space-separated workflow-ids in input."]))
605 
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 502 of file runTheMatrix.py.

References join(), and print().

502  def help_predefined(self):
503  print("\n".join(["predefined [predef1 [...]]\n",
504  "Run w/o argument, it will print the list of known predefined workflows.",
505  "Run with space-separated predefined workflows, it will print the workflow-ids registered to them"]))
506 
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 589 of file runTheMatrix.py.

References join(), and print().

589  def help_search(self):
590  print("\n".join(["search search_regexp\n",
591  "This command will search for a match within all workflows registered.",
592  "The search is done on both the workflow name and the names of steps registered to it."]))
593 
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 554 of file runTheMatrix.py.

References join(), and print().

554  def help_searchInWorkflow(self):
555  print("\n".join(["searchInWorkflow wfl_name search_regexp\n",
556  "This command will search for a match within all workflows registered to wfl_name.",
557  "The search is done on both the workflow name and the names of steps registered to it."]))
558 
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 526 of file runTheMatrix.py.

References join(), and print().

526  def help_showWorkflow(self):
527  print("\n".join(["showWorkflow [workflow1 [...]]\n",
528  "Run w/o arguments, it will print the list of registered macro-workflows.",
529  "Run with space-separated workflows, it will print the full list of workflow-ids registered to them"]))
530 
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 629 of file runTheMatrix.py.

◆ intro

runTheMatrix.TheMatrix.intro
static

Definition at line 468 of file runTheMatrix.py.

◆ matrices_

runTheMatrix.TheMatrix.matrices_

◆ opt_

runTheMatrix.TheMatrix.opt_

Definition at line 473 of file runTheMatrix.py.

◆ prompt

runTheMatrix.TheMatrix.prompt
static

Definition at line 469 of file runTheMatrix.py.