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

Constructor & Destructor Documentation

◆ __init__()

def runTheMatrix.TheMatrix.__init__ (   self,
  opt 
)

Definition at line 448 of file runTheMatrix.py.

448  def __init__(self, opt):
449  cmd.Cmd.__init__(self)
450  self.opt_ = opt
451  self.matrices_ = {}
452  tmp = MatrixReader(self.opt_)
453  for what in tmp.files:
454  what = what.replace('relval_','')
455  self.opt_.what = what
456  self.matrices_[what] = MatrixReader(self.opt_)
457  self.matrices_[what].prepare(self.opt_.useInput, self.opt_.refRel,
458  self.opt_.fromScratch)
459  os.system("clear")
460 
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 478 of file runTheMatrix.py.

478  def complete_predefined(self, text, line, start_idx, end_idx):
479  if text and len(text) > 0:
480  return [t for t in predefinedSet.keys() if t.startswith(text)]
481  else:
482  return predefinedSet.keys()
483 

◆ complete_searchInWorkflow()

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

Definition at line 529 of file runTheMatrix.py.

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

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

◆ complete_showWorkflow()

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

Definition at line 502 of file runTheMatrix.py.

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

502  def complete_showWorkflow(self, text, line, start_idx, end_idx):
503  if text and len(text) > 0:
504  return [t for t in self.matrices_.keys() if t.startswith(text)]
505  else:
506  return self.matrices_.keys()
507 

◆ default()

def runTheMatrix.TheMatrix.default (   self,
  inp 
)

Definition at line 469 of file runTheMatrix.py.

References runTheMatrix.TheMatrix.do_exit().

469  def default(self, inp):
470  if inp == 'x' or inp == 'q':
471  return self.do_exit(inp)
472 

◆ do_clear()

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

Definition at line 461 of file runTheMatrix.py.

461  def do_clear(self, arg):
462  """Clear the screen, put prompt at the top"""
463  os.system("clear")
464 

◆ do_dumpWorkflowId()

def runTheMatrix.TheMatrix.do_dumpWorkflowId (   self,
  arg 
)

Definition at line 575 of file runTheMatrix.py.

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

575  def do_dumpWorkflowId(self, arg):
576  wflids = arg.split()
577  if len(wflids) == 0:
578  print("dumpWorkflowId [wfl-id1 [...]]")
579  return
580 
581  fmt = "[%d]: %s\n"
582  maxLen = 100
583  for wflid in wflids:
584  dump = True
585  for key, mrd in self.matrices_.items():
586  for wfl in mrd.workFlows:
587  if wfl.numId == float(wflid):
588  wfName, stepNames = wfl.nameId.split('+',1)
589  if dump:
590  dump = False
591  print(wfl.numId, stepNames)
592  for i,s in enumerate(wfl.cmds):
593  print(fmt % (i+1, (str(s)+' ')))
594  print("\nWorkflow found in %s." % key)
595  else:
596  print("Workflow also found in %s." % key)
597 
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 465 of file runTheMatrix.py.

References print().

Referenced by runTheMatrix.TheMatrix.default().

465  def do_exit(self, arg):
466  print("Leaving the Matrix")
467  return True
468 
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 484 of file runTheMatrix.py.

References print().

484  def do_predefined(self, arg):
485  """Print the list of predefined workflows"""
486  print("List of predefined workflows")
487  if arg:
488  for w in arg.split():
489  if w in predefinedSet.keys():
490  print("Predefined Set: %s" % w)
491  print(predefinedSet[w])
492  else:
493  print("Unknown Set: %s" % w)
494  else:
495  print(predefinedSet.keys())
496 
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 563 of file runTheMatrix.py.

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

563  def do_search(self, arg):
564  args = arg.split()
565  if len(args) < 1:
566  print("search regexp")
567  return
568  for wfl in self.matrices_.keys():
569  self.do_searchInWorkflow(' '.join([wfl, args[0]]))
570 
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 535 of file runTheMatrix.py.

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

Referenced by runTheMatrix.TheMatrix.do_search().

535  def do_searchInWorkflow(self, arg):
536  args = arg.split()
537  if len(args) < 2:
538  print("searchInWorkflow name regexp")
539  return
540  if args[0] not in self.matrices_.keys():
541  print("Unknown workflow")
542  return
543  import re
544  pattern = None
545  try:
546  pattern = re.compile(args[1])
547  except:
548  print("Failed to compile regexp %s" % args[1])
549  return
550  counter = 0
551  for wfl in self.matrices_[args[0]].workFlows:
552  wfName, stepNames = wfl.nameId.split('+',1)
553  if re.match(pattern, wfName) or re.match(pattern, stepNames):
554  print("%s %s %s" % (wfl.numId, wfName, stepNames))
555  counter += 1
556  print("Found %d compatible workflows inside %s" % (counter, args[0]))
557 
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 508 of file runTheMatrix.py.

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

508  def do_showWorkflow(self, arg):
509  if arg == '':
510  print("Available workflows:")
511  for k in self.matrices_.keys():
512  print(k)
513  else:
514  selected = arg.split()
515  for k in selected:
516  if k not in self.matrices_.keys():
517  print("Unknown workflow %s: skipping" % k)
518  else:
519  for wfl in self.matrices_[k].workFlows:
520  wfName, stepNames = wfl.nameId.split('+',1)
521  print("%s %s %s" % (wfl.numId, wfName, stepNames))
522  print("%s contains %d workflows" % (k, len(self.matrices_[k].workFlows)))
523 
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 571 of file runTheMatrix.py.

References join(), and print().

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

References join(), and print().

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

References join(), and print().

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

References join(), and print().

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

References join(), and print().

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

◆ intro

runTheMatrix.TheMatrix.intro
static

Definition at line 445 of file runTheMatrix.py.

◆ matrices_

runTheMatrix.TheMatrix.matrices_

◆ opt_

runTheMatrix.TheMatrix.opt_

Definition at line 450 of file runTheMatrix.py.

◆ prompt

runTheMatrix.TheMatrix.prompt
static

Definition at line 446 of file runTheMatrix.py.