CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
additionalparser.py
Go to the documentation of this file.
1 ##########################################################################
2 # Parse the alignment_merge.py file for additional information
3 #
4 
5 import logging
6 import Alignment.MillePedeAlignmentAlgorithm.mpslib.tools as mps_tools
7 
8 
10  """ stores the additional information of the alignment_merge.py file
11  """
12 
13  def __init__(self):
17 
18  self.selectors = {}
19  self.iov_definition = ""
20 
21 
22  def parse(self, config, path):
23  logger = logging.getLogger("mpsvalidate")
24 
25  # extract process object from aligment_merge.py file
26  try:
27  process = mps_tools.get_process_object(path)
28  except ImportError:
29  logger.error("AdditionalData: {0} does not exist".format(path))
30  return
31 
32  # find alignable selectors
33  param_builder = process.AlignmentProducer.ParameterBuilder
34  for index,sel in enumerate(param_builder.parameterTypes):
35  selector_name = sel.split(",")[0].strip()
36  self.selectors[index] = {
37  "name": selector_name,
38  "selector": getattr(param_builder, selector_name),
39  }
40 
41  # find IOV definition
42  if len(process.AlignmentProducer.RunRangeSelection) > 0:
43  self.iov_definition = \
44  process.AlignmentProducer.RunRangeSelection.dumpPython()
45 
46  # find pede steerer configuration
47  pede_steerer = process.AlignmentProducer.algoConfig.pedeSteerer
48  self.pede_steerer_method = pede_steerer.method.value()
49  self.pede_steerer_options = pede_steerer.options.value()
50  self.pede_steerer_command = pede_steerer.pedeCommand.value()