Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:45:14

0001 ##########################################################################
0002 # Parse the alignment_merge.py file for additional information
0003 #
0004 
0005 import logging
0006 import Alignment.MillePedeAlignmentAlgorithm.mpslib.tools as mps_tools
0007 
0008 
0009 class AdditionalData:
0010     """ stores the additional information of the alignment_merge.py file
0011     """
0012 
0013     def __init__(self):
0014         self.pede_steerer_method  = ""
0015         self.pede_steerer_options = []
0016         self.pede_steerer_command = ""
0017 
0018         self.selectors = {}
0019         self.iov_definition = ""
0020 
0021 
0022     def parse(self, config, path):
0023         logger = logging.getLogger("mpsvalidate")
0024 
0025         # extract process object from aligment_merge.py file
0026         try:
0027             process = mps_tools.get_process_object(path)
0028         except ImportError:
0029             logger.error("AdditionalData: {0} does not exist".format(path))
0030             return
0031 
0032         # find alignable selectors
0033         param_builder = process.AlignmentProducer.ParameterBuilder
0034         for index,sel in enumerate(param_builder.parameterTypes):
0035             selector_name = sel.split(",")[0].strip()
0036             self.selectors[index] = {
0037                 "name": selector_name,
0038                 "selector": getattr(param_builder, selector_name),
0039                 }
0040 
0041         # find IOV definition
0042         if len(process.AlignmentProducer.RunRangeSelection) > 0:
0043             self.iov_definition = \
0044                 process.AlignmentProducer.RunRangeSelection.dumpPython()
0045 
0046         # find pede steerer configuration
0047         pede_steerer = process.AlignmentProducer.algoConfig.pedeSteerer
0048         self.pede_steerer_method  = pede_steerer.method.value()
0049         self.pede_steerer_options = pede_steerer.options.value()
0050         self.pede_steerer_command = pede_steerer.pedeCommand.value()