CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
helpers Namespace Reference

Classes

class  CloneSequenceVisitor
 
struct  CompositeCandidateMaker
 
struct  CompositePtrCandidateMaker
 
class  GatherAllModulesVisitor
 
class  MassSearchParamVisitor
 
class  MassSearchReplaceAnyInputTagVisitor
 
class  MassSearchReplaceParamVisitor
 
struct  MCTruthPairSelector
 
struct  NamedCompositeCandidateMaker
 
class  TestModuleCommand
 

Functions

def __labelsInSequence
 
def addESProducers
 Helpers to perform some technically boring tasks like looking for all modules with a given parameter and replacing that to a given value. More...
 
def addKeepStatement
 
def applyPostfix
 
def cloneProcessingSnippet
 
def contains
 
def extendWithPrePostfix
 
def get_path
 
def get_vars
 
def jetCollectionString
 
def listDependencyChain
 
def listModules
 
def listSequences
 
def loadWithPostfix
 
def loadWithPrefix
 
def loadWithPrePostfix
 
def massSearchReplaceAnyInputTag
 
def massSearchReplaceParam
 
def removeIfInSequence
 

Function Documentation

def helpers.__labelsInSequence (   process,
  sequenceLabel,
  postfix = "" 
)
private

Definition at line 91 of file helpers.py.

def helpers.addESProducers (   process,
  config 
)

Helpers to perform some technically boring tasks like looking for all modules with a given parameter and replacing that to a given value.

Definition at line 7 of file helpers.py.

def helpers.addKeepStatement (   process,
  oldKeep,
  newKeeps,
  verbose = False 
)
Add new keep statements to any PoolOutputModule of the process that has the old keep statements

Definition at line 427 of file helpers.py.

def helpers.applyPostfix (   process,
  label,
  postfix 
)

Definition at line 76 of file helpers.py.

def helpers.cloneProcessingSnippet (   process,
  sequence,
  postfix,
  removePostfix = "",
  noClones = [] 
)
------------------------------------------------------------------
copy a sequence plus the modules and sequences therein
both are renamed by getting a postfix
input tags are automatically adjusted
------------------------------------------------------------------

Definition at line 315 of file helpers.py.

Referenced by boostedHPSPFTaus_cfi.addBoostedTaus(), pfIsolation.setupPFIso(), and pfIsolation.setupPFIsoPhoton().

def helpers.contains (   sequence,
  moduleName 
)
------------------------------------------------------------------
return True if a module with name 'module' is contained in the
sequence with name 'sequence' and False otherwise. This version
is not so nice as it also returns True for any substr of the name
of a contained module.

sequence : sequence [e.g. process.patDefaultSequence]
module   : module name as a string
------------------------------------------------------------------

Definition at line 299 of file helpers.py.

def helpers.extendWithPrePostfix (   process,
  other,
  prefix,
  postfix,
  items = () 
)
Look in other and find types which we can use

Definition at line 30 of file helpers.py.

def helpers.get_path (   file_in_path)

Definition at line 6 of file helpers.py.

Referenced by get_vars().

6 
7 def get_path(file_in_path):
8  'mimics edm.FileInPath behavior'
9  search_env = os.environ.get('CMSSW_SEARCH_PATH', '')
10  if not search_env:
11  raise RuntimeError('The environmental variable CMSSW_SEARCH_PATH must be set')
12  search_paths = search_env.split(':')
13  for spath in search_paths:
14  full_path = os.path.join(spath, file_in_path)
15  if os.path.isfile(full_path):
16  return full_path
17  raise RuntimeError('No suitable path found for %s' % file_in_path)
def get_path
Definition: helpers.py:6
def helpers.get_vars (   xml_path,
  useFileInPath = True 
)

Definition at line 18 of file helpers.py.

References get_path(), and trainingvars.get_var_pset().

18 
19 def get_vars(xml_path, useFileInPath=True):
20  full_path = get_path(xml_path) if useFileInPath else xml_path
21  xml_tree = ET.parse(full_path)
22  root = xml_tree.getroot()
23  variables = None
24  for i in root:
25  if i.tag == 'Variables':
26  variables = i
27 
28  if i is None:
29  raise RuntimeError('Could not find Variables inside the xml weights')
30 
31  var_names = [i.attrib['Title'] for i in variables]
32  return [get_var_pset(i) for i in var_names]
33 
def get_path
Definition: helpers.py:6
def get_vars
Definition: helpers.py:18
def helpers.jetCollectionString (   prefix = '',
  algo = '',
  type = '' 
)
------------------------------------------------------------------
return the string of the jet collection module depending on the
input vaules. The default return value will be 'patAK5CaloJets'.

algo   : indicating the algorithm type of the jet [expected are
         'AK5', 'IC5', 'SC7', ...]
type   : indicating the type of constituents of the jet [expec-
         ted are 'Calo', 'PFlow', 'JPT', ...]
prefix : prefix indicating the type of pat collection module (ex-
         pected are '', 'selected', 'clean').
------------------------------------------------------------------

Definition at line 275 of file helpers.py.

def helpers.listDependencyChain (   process,
  module,
  sources,
  verbose = False 
)
Walk up the dependencies of a module to find any that depend on any of the listed sources

Definition at line 330 of file helpers.py.

def helpers.listModules (   sequence)

Definition at line 261 of file helpers.py.

def helpers.listSequences (   sequence)

Definition at line 266 of file helpers.py.

def helpers.loadWithPostfix (   process,
  moduleName,
  postfix = '' 
)

Definition at line 21 of file helpers.py.

def helpers.loadWithPrefix (   process,
  moduleName,
  prefix = '' 
)

Definition at line 18 of file helpers.py.

def helpers.loadWithPrePostfix (   process,
  moduleName,
  prefix = '',
  postfix = '' 
)

Definition at line 24 of file helpers.py.

def helpers.massSearchReplaceAnyInputTag (   sequence,
  oldInputTag,
  newInputTag,
  verbose = False,
  moduleLabelOnly = False,
  skipLabelTest = False 
)
Replace InputTag oldInputTag with newInputTag, at any level of nesting within PSets, VPSets, VInputTags...

Definition at line 271 of file helpers.py.

Referenced by boostedHPSPFTaus_cfi.addBoostedTaus(), and customiseForPremixingInput.customiseForPreMixingInput().

def helpers.massSearchReplaceParam (   sequence,
  paramName,
  paramOldValue,
  paramValue,
  verbose = False 
)

Definition at line 258 of file helpers.py.

def helpers.removeIfInSequence (   process,
  target,
  sequenceLabel,
  postfix = "" 
)

Definition at line 84 of file helpers.py.