CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
iterativeTkUtils.py
Go to the documentation of this file.
1 # This file provides additional helpers for getting information of
2 # iterations in automated way.
3 import RecoTracker.IterativeTracking.iterativeTkConfig as _cfg
4 import RecoTracker.IterativeTracking.iterativeTk_cff as _iterativeTk_cff
5 
6 def getMVASelectors(postfix):
7  # assume naming convention that the iteration name (when first
8  # letter in lower case) is the selector name
9 
10  ret = {}
11 
12  for iterName, seqName in _cfg.iterationAlgos(postfix, includeSequenceName=True):
13  if hasattr(_iterativeTk_cff, iterName):
14  mod = getattr(_iterativeTk_cff, iterName)
15  seq = getattr(_iterativeTk_cff, seqName)
16 
17  # Ignore iteration if the MVA selector module is not in the sequence
18  if not seq.contains(mod):
19  continue
20 
21  typeName = mod._TypedParameterizable__type
22  classifiers = []
23  if typeName == "ClassifierMerger":
24  classifiers = mod.inputClassifiers.value()
25  elif "TrackMVAClassifier" in typeName or "TrackLwtnnClassifier" or "TrackTfClassifier" in typeName:
26  classifiers = [iterName]
27  if len(classifiers) > 0:
28  ret[iterName] = (iterName+"Tracks", classifiers)
29 
30  return ret