diff --git a/Trigger/TrigConfiguration/TrigConfOffline/CMakeLists.txt b/Trigger/TrigConfiguration/TrigConfOffline/CMakeLists.txt index 91dcf097d5bdc5dd20a14363ce978e573fda5af3..b8d5f2479245c9cf24bc0e1641c44871f621c18a 100644 --- a/Trigger/TrigConfiguration/TrigConfOffline/CMakeLists.txt +++ b/Trigger/TrigConfiguration/TrigConfOffline/CMakeLists.txt @@ -36,5 +36,3 @@ atlas_add_dictionary( TrigConfStorageDict # Install files from the package: atlas_install_headers( TrigConfOffline ) atlas_install_python_modules( python/*.py ) -atlas_install_scripts( share/LoadTriggerMenuFromXML.py ) - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTAlgorithm.py b/Trigger/TrigConfiguration/TrigConfOffline/python/HLTAlgorithm.py deleted file mode 100644 index ba7b1f442c1efe292d24a0cb2ef997f1517a0ebb..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTAlgorithm.py +++ /dev/null @@ -1,2723 +0,0 @@ -########################################################################### -# Copyright (C) 2008 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Package TrigConfOffline -# Python class HLTAlgorithm -# -########################################################################### - -import string -import weakref - -class HLTAlgorithm (object) : - def __init__(self, *args, **kwargs) : - # init logger - self.__initLogger__() - # Assign private attributes - self.__dict__['_children'] = {} - self.OutputLevel=3 - self.dbId=0 - - #self._setdefault() - for k,v in kwargs.items() : - self.__setattr__(k,v) - - def __initLogger__(self) : - from AthenaCommon.Logging import logging - self.__dict__['_log'] = logging.getLogger('HLTAlgorithm') - self._log.setLevel(3) - #import logging - #self.__dict__['_log']=logging.getLogger('HLTAlgorithm') - #self._log.setLevel(logging.INFO) - #ch = logging.StreamHandler() - #ch.setLevel(logging.INFO) - #formatter = logging.Formatter("%(name)s - %(levelname)s\t%(message)s") - #ch.setFormatter(formatter) - #self._log.addHandler(ch) - - def __setattr__(self, name, value): - _attributes=('name','alias','alg_type','py_name','py_package','OutputLevel','dbId','topAlg','parent','level') - if name in _attributes: - self._log.verbose('Set %s = %s' % (name, value)) - # Exception for setting the alias - possible renaming of references - if name == 'alias' : - self.setAlias(value) - else : - self.__dict__[name] = value - - # Setting the OutputLevel changes the _log - if name=='OutputLevel': - self._log.setLevel((value-1)*10) - - else: - self._log.warning('Unsupported attribute %s' % (name)) - - def __str__(self): - output='' - prepend ='' - output += self.algToStr(prepend) - return output - - def setlog(self): - if self.__dict__.has_key('OutputLevel'): - self._log.setLevel(self.OutputLevel) - origmessage = self._log.name - message = 'HLTAlgorithm ' - if self.__dict__.has_key('name'): - message += '%s/' % (self.name) - - if self.__dict__.has_key('alias'): - message += '%s' % (self.alias) - # If the logger message changed - if origmessage != message: - self._log.name = message - - ## Delete HLTAlgorithm and references to it - def delete(self) : - self.setlog() - # Delete itself and the reference from the parent - # Use with caution - if self.hasParent() : - self.getParent().removeChild(self.alias) - del self - - ## Convert the HLTAlgorithm for pretty print to string - # @param self The object pointer - # @param prepend The string to be prepended to the output - # @param printChildren Flag to print algorithm children too - # @return string - def algToStr(self,prepend,printChildren=True): - self.setlog() - name = '' - if self.__dict__.has_key('name'): - name=self.name - alias = '' - if self.__dict__.has_key('alias'): - alias=self.alias - alg_type = 'Algorithm' - if self.__dict__.has_key('alg_type'): - alg_type=self.alg_type - py_name = '' - if self.__dict__.has_key('py_name'): - py_name=self.py_name - py_package = '' - if self.__dict__.has_key('py_package'): - py_package=self.py_package - dbId = 0 - if self.__dict__.has_key('dbId'): - dbId=self.dbId - - output = '\n%s/*****%s %s/%s (Python: import %s from %s) DB ID: %d' % (prepend,alg_type,name,alias,py_name,py_package,dbId) - if self.__dict__.has_key('properties'): - for n,v in self.properties.items() : - output += '\n%s|-%s\t\t%s' % (prepend,n,v) - - if printChildren : - prepend += '|' - if self.__dict__.has_key('_children'): - for child in self.getChildren() : - output += child.algToStr(prepend) - - output += '\n%s\------------------------------------------------------' % (prepend) - return output - - ## Set algorithm property - # @param self Object pointer - # @param name Property name - # @param value Property value - def setProperty(self, name, value): - self.setlog() - if not self.__dict__.has_key('properties'): - self.__dict__['properties'] = {} - - self._log.verbose('%s/%s.%s - value type: %s value %s' % (self.getName(), self.getAlias(), name, type(value), value)) - - # Test the split parameter type - split_param_flag = False - if '__IPC__' in name : - try : - index = eval(name[name.find('__IPC__')+len('__IPC__'):].lstrip('0')) - if isinstance(index,int): split_param_flag=True - except : - pass - - # Try to evaluate the value - if isinstance(value,str) and not split_param_flag : - try : - value = eval(value) - self._log.verbose('%s/%s.%s - value type: %s value %s' % (self.getName(), self.getAlias(), name, type(value), value)) - except : - pass - - self.properties[name] = value - self._log.debug('Property %s = %s' % (name, value)) - - ## Append child algorithm if exists - merge algorithms - # @param self Object pointer - # @param alg HLTAlgorithm child algorithm to be appended - def appendChild(self, alg) : - self.setlog() - success = True - # Test whether attribute _children exists - if not self.__dict__.has_key('_children'): - self.__dict__['_children'] = {} - - # Test if the child algorithm is present - if self._children.has_key(alg.alias): - self._log.debug('Existing child %s/%s - algorithms will be merged' % (self._children[alg.alias].getName(),alg.getAlias())) - # Check the compatibility - if alg.name == self._children[alg.alias].getName() : - success = self._children[alg.alias].mergeAlgorithm(alg) - else : - self._log.error("Can not append child %s/%s - incompatible - existing name: %s" % (alg.name, alg.alias, self._children[alg.alias].getName())) - success = False - else: - self.__dict__['_children'][alg.alias] = alg - self.__dict__['_children'][alg.alias].setParent(self) - - return success - - ## Set algorithm child - existing child will be deleted - # @param self Object pointer - # @param alg HLTAlgorithm child algorithm to be set - def setChild(self, alg): - self.setlog() - if not self.__dict__.has_key('_children'): - self.__dict__['_children'] = {} - # Test whether to replace an existing child - if self._children.has_key(alg.alias) : - self._log.debug('Child %s/%s exists - will be deleted' % (self.__dict__['_children'][alg.alias].name, alg.alias)) - self.__dict__['_children'][alg.alias].delete() - # Add the child - self.__dict__['_children'][alg.alias] = alg - self.__dict__['_children'][alg.alias].setParent(self) - - ## Get algorithm child - existing child will be deleted - # @param self Object pointer - # @param alias Child alias - # @return return HLTAlgorithm child or None - def getChild(self, alias) : - self.setlog() - if self.hasChildren() and self._children.has_key(alias) : - return self._children[alias] - else: - return None - - ## Remove algorithm child - existing child will be deleted - # @param self Object pointer - # @param alias Child alias - # @return return True if successful - def removeChild(self, alias) : - self.setlog() - success = True - if self.hasChildren() and self._children.has_key(alias) : - del self._children[alias] - else: - success = False - return success - - def getChildren(self): - self.setlog() - if not self.__dict__.has_key('_children'): - return [] - return self._children.values() - - def hasChildren(self) : - self.setlog() - if not self.__dict__.has_key('_children'): - return False - - if len(self._children) <= 0 : - return False - return True - - def getName(self) : - self.setlog() - if not self.__dict__.has_key('name'): - return None - return self.name - - def setName(self, name): - self.setlog() - # Change own name - if self.__dict__.has_key('name'): - self._log.debug('Previous name %s change to %s' % (self.name, name)) - self.name = name - return True - - def getAlias(self): - self.setlog() - if not self.__dict__.has_key('alias'): - return None - return self.alias - - def setAlias(self, alias): - self.setlog() - # Process all children - for child in self.getChildren() : - childAlias = child.alias.replace(self.alias,alias,1) - child.setAlias(childAlias) - - # Change own alias - if self.__dict__.has_key('alias') and self.alias != alias : - self._log.debug('Previous alias %s change to %s' % (self.alias, alias)) - # Change the reference in _children of the parent algorithm - if self.hasParent(): - self.getParent().removeChild(self.alias) - self.__dict__['alias'] = alias - self.getParent().setChild(self) - - self.__dict__['alias'] = alias - - def getType(self): - self.setlog() - if not self.__dict__.has_key('alg_type'): - return None - return self.alg_type - - def getPy_package(self): - self.setlog() - if not self.__dict__.has_key('py_package'): - return None - return self.py_package - - def getPy_name(self): - self.setlog() - if not self.__dict__.has_key('py_name'): - return None - return self.py_name - - def getTopAlg(self): - self.setlog() - if not self.__dict__.has_key('topAlg'): - return None - return self.topAlg - - # Merge self with another algorithm - def mergeAlgorithm(self,alg, mergeProperties=[]) : - self.setlog() - self._log.debug('mergeAlgorithm %s/%s' % (alg.name, alg.alias)) - success = True - # Merge properties of the algorithms - if not self.__dict__.has_key('properties'): - self.properties=alg.getProperties() - else : - success = self.mergeProperties(alg,mergeProperties=[]) - - # Merge children of the algorithms - for child in alg.getChildren() : - if not self.appendChild(child) : success = False - - return success - - # Merge properties with another algorithm - return True if successfull - def mergeProperties(self, alg, mergeProperties=[]) : - self.setlog() - success = True - problemMess = "merge algorithms %s/%s and %s/%s" % (self.getName(), self.getAlias(), alg.getName(), alg.getAlias()) - # Loop over properties - for k,v in alg.getProperties().items() : - properties = self.getProperties() - if k in properties : - if isinstance(v,list) and k in mergeProperties : - for item in v : - if item not in properties[k] : - self.properties[k].append(item) - - #if v != properties[k] and isinstance(v,list): - ## Merge the lists - #if k not in mergeProperties: - #self._log.warning("%s : \n\tDifferent values of property %s: %s vs. %s - lists will be merged." % (problemMess, k, properties[k],v)) - ## Loop over items in the list - #for item in v : - #try: - #ind = properties[k].index(item) - #except: - #self.properties[k].append(item) - - if v != properties[k] : - self._log.warning("%s: \n\tDifferent values of property %s: %s != %s" % (problemMess, k, self.properties[k], v)) - # Problem of merging the value - algLevel = alg.getLevel() - level = self.getLevel() - if not level : level = 'BOTH' - if not algLevel : algLevel = 'BOTH' - # Compare levels - priority: 1. BOTH, 2. EF, 3. L2 - same levels - error - if level != algLevel : - changeValue = False - if algLevel == 'BOTH' : - changeValue = True - elif level == 'BOTH' : - changeValue = False - elif algLevel == 'EF' : - changeValue = True - elif level == 'EF' : - changeValue = False - elif algLevel == 'L2' : - changeValue = True - elif level == 'L2' : - changeValue = False - else : - self._log.error("Can't %s: \n\tUnknown trigger levels %s, %s" % (problemMess, level, algLevel)) - success = False - - if changeValue : - self._log.debug("Algorithm %s/%s higher priority trigger level %s vs. %s" % (alg.getName(), alg.getAlias(), algLevel, level)) - self.setProperty(k,v) - else: - self._log.error("Can't %s: \n\tSame trigger level: %s" % (problemMess, level)) - success = False - else : - # Property doesn't exist just set the property - self.setProperty(k,v) - return success - - def getProperties(self): - self.setlog() - if not self.__dict__.has_key('properties'): - return {} - return self.properties - - def joinProperties(self): - self.setlog() - #print 'joinProperties' - if self.__dict__.has_key('properties'): - propTojoin = {} - propertyNames=self.properties.keys() - propertyNames.sort() - for propertyName in propertyNames : - nameFormatCheck=False - if '__IPC__' in propertyName : - newPropertyName = propertyName[0:propertyName.find('__IPC__')] - try : - index = eval(propertyName[propertyName.find('__IPC__')+len('__IPC__'):].lstrip('0')) - if isinstance(index,int) : - nameFormatCheck=True - except Exception, exc: - self._log.debug('Property %s : no split format - %s' % (propertyName, exc.message)) - nameFormatCheck=False - - if not nameFormatCheck: - continue - - value = self.properties[propertyName] - del self.properties[propertyName] - - self._log.debug('Property %s will be joined to %s' % (propertyName, newPropertyName)) - if self.properties.has_key(newPropertyName): - self.setProperty(newPropertyName, self.properties[newPropertyName]+value) - else : - self.setProperty(newPropertyName, value) - - def setParent(self, alg): - self.setlog() - self.parent = weakref.ref(alg)() - - def getParent(self): - self.setlog() - if not self.__dict__.has_key('parent'): - return None - return self.parent - - def hasParent(self): - self.setlog() - output = False - if self.__dict__.has_key('parent'): - output = True - return output - - def setLevel(self, level): - self.setlog() - if level.upper() in ('L2','EF','BOTH','OL') : - self.level = level.upper() - for child in self.getChildren() : - child.level = level - else : - self._log.error('Unsupported trigger level %s' % (level)) - - def getLevel(self): - self.setlog() - output = None - if self.__dict__.has_key('level') : - output = self.level - return output - - def formatPropertiesForCfgInit(self, cfg_class=None) : - properties = [] - for n,v in self.getProperties().items(): - if cfg_class : - try: - dflt_value = cfg_class.__slots__[n] - except KeyError,err: - self._log.warning("Configurable [%s] has no such property [%s] !!"%( cfg_class.__name__, n)) - continue - p = '%s = %s' - if isinstance(v,str) or v == None: - p = '%s = "%s"' - properties += [ p % (n,v) ] - - propertiesStr = ', '.join(properties) - return propertiesStr - - def setConfigurableProperties(self, cfg): - # cfg suppose to be Configurable - # Properties has to be a dictionary - output = True - cfgProperties = cfg.getProperties() - for property_name, property_value in self.getProperties().items(): - if property_name in cfgProperties.keys() : - # if not setCfgProperty(cfg,property_name,property_value, self._log) : - if not self.setConfigurableProperty(cfg,property_name) : - output = False - #self._log.warning('Original property: type: %s value: %s' % (type(cfg.getProperties()[property_name]),cfg.getProperties()[property_name])) - self._log.warning('Property %s.%s not set values: %s vs. %s' % (cfg.getFullJobOptName(), property_name, cfg.getProperties()[property_name], property_value)) - else : - self._log.warning('%s has no property name: %s' % (cfg.getFullJobOptName(), property_name)) - output = False - return output - - ## Set a single property of the configurable - # @param self pointer to the object - # @param cfg input configurable - # @param property_name name of the property to be set - def setConfigurableProperty(self, cfg, property_name) : - output = False - # Test the existence of the property - if not cfg.getProperties().has_key(property_name) : return False - - # Test the cfg property type - cfgProperty = cfg.getProperties()[property_name] - cfgPropertyType = None - cfgPropertyType = ('%s' % (type(cfgProperty))).replace('<class ','').replace('<type ','').replace("'",'') - cfgPropertyType = cfgPropertyType[:len(cfgPropertyType)-1] - - from GaudiKernel.GaudiHandles import PrivateToolHandle, PrivateToolHandleArray - from AthenaCommon.Configurable import Configurable - # PrivateToolHandleArray property - if isinstance(cfgProperty, PrivateToolHandleArray) : - output = self.setCfgProperty_PrivToolArray(cfg, property_name) - - # PrivateToolHandle property - if not output and isinstance(cfgProperty, (Configurable, PrivateToolHandle)) : - output = self.setCfgProperty_PrivTool(cfg, property_name) - - # All the other types of properties - if not output : - return setCfgProperty(cfg,property_name,self.getProperties()[property_name], self._log) - - return output - - ## Set PrivateToolHandleArray type property of the configurable - # @param self pointer to the object - # @param cfg input configurable - # @param property_name name of the property to be set - def setCfgProperty_PrivToolArray(self, cfg, property_name) : - output = True - # Test the existence of the property - if not self.getProperties().has_key(property_name): return False - property_value = self.getProperties()[property_name] - # Test the type of the property - if isinstance(property_value, list): - if not self.hasChildren() : # Set the property in the usual way - return setCfgProperty(cfg,property_name,property_value, self._log) - - self._log.verbose("setCfgProperty_PrivToolArray %s.%s = %s" % (cfg.getFullJobOptName(),property_name,property_value)) - origValue = cfg.getProperties()[property_name] - self._log.verbose("setCfgProperty_PrivToolArray - existing value: %s" % (origValue.toStringProperty())) - - for item in property_value : - self._log.verbose("setCfgProperty_PrivToolArray: set item %s" % (item)) - childCfg = None - childAlias = item.split("/")[1].split('.')[-1] - childName = item.split("/")[0] - child = self.getChild('.'.join([self.getAlias(),childAlias])) - if child and child.getName() == childName: - # Try to get the childcfg - try : - childCfg = origValue[childAlias] - except Exception, exc: - self._log.verbose("setCfgProperty_PrivToolArray - Exception occured: %s" % (exc.message)) - self._log.verbose("setCfgProperty_PrivToolArray - item %s not existing in current value" % (childAlias)) - childCfg = None - - # Check the childCfg - if childCfg : - from AthenaCommon.Configurable import Configurable - if isinstance(childCfg, Configurable) and (childCfg.getName(), childCfg.getType()) == (childAlias, childName): - self._log.debug('setCfgProperty_PrivToolArray - item %s exists' % (childCfg.getFullJobOptName())) - child.setConfigurableProperties(childCfg) - child.setConfigurableChildren(childCfg) - continue - elif not isinstance(childCfg, Configurable): - self._log.debug('setCfgProperty_PrivToolArray - item %s is not Configurable (type %s) - remove' % (item, type(childCfg))) - # Not a configurable instance - delete only an item from Array - stmt = 'del cfg.%s[\'%s\']' % (property_name,childAlias) - try : - self._log.verbose('Execute: %s' % (stmt)) - exec stmt - except Exception, exc: - self._log.debug('setCfgProperty_PrivToolArray - Exception occured: %s' % (exc.message)) - childCfg=None - elif isinstance(childCfg, Configurable) and not (childCfg.getName(), childCfg.getType()) == (childAlias, childName): - self._log.debug("setCfgProperty_PrivToolArray - Incompatible type of the child %s - required %s/%s" % (childCfg.getFullJobOptName(), childName, childAlias)) - from TrigConfOffline.HLTConfOffline import removeCfgChild - removeCfgChild(cfg, childCfg.getName()) - childCfg = None - else : - childCfg = None - - if not childCfg : # Get the child cfg configurable and append it to the array - do not set the properties - # Check for existing children - if a child exist - delete it - avoid doubling of the children - for c in cfg.getAllChildren() : - if c.getName() == childAlias : - self._log.debug("setCfgProperty_PrivToolArray - child %s exist within %s - delete" % (c.getFullJobOptName(), cfg.getFullJobOptName())) - from TrigConfOffline.HLTConfOffline import removeCfgChild - removeCfgChild(cfg, childAlias) - break - # Get the child configurable - if childCfg == None : childCfg = child.getCfgPyClassWithProperties() - if childCfg == None : childCfg = child.getCfgPyClass() - if childCfg == None : childCfg = child.getCfgPyFunc() - if childCfg == None : childCfg = child.getCfgCppWithProperties() - if childCfg == None : childCfg = child.getCfgCpp() - - if childCfg : - stmt = "cfg.%s += [childCfg]" % (property_name) - try : - self._log.verbose("setCfgProperty_PrivToolArray - Execute: %s" % (stmt)) - exec stmt - childCfg = cfg.getProperties()[property_name][childCfg.getName()] - except Exception, exc: - self._log.debug('setCfgProperty_PrivToolArray - Exception occured: %s' % (exc.message)) - - # Set the properties and children - child.setConfigurableProperties(childCfg) - child.setConfigurableChildren(childCfg) - continue - - # If the child doesn't exist or it has incompatible type or it was not assigned use the string interpretation - if not childCfg : - stmt = "cfg.%s += [\'%s\']" % (property_name, item) - try : - self._log.verbose("setCfgProperty_PrivToolArray - Execute: %s" % (stmt)) - exec stmt - except Exception, exc: - self._log.debug('setCfgProperty_PrivToolArray - Exception occured: %s' % (exc.message)) - - self._log.verbose("setCfgProperty_PrivToolArray end - %s.%s = %s" % (cfg.getFullJobOptName(),property_name,cfg.getProperties()[property_name].toStringProperty())) - return compareCfgProperty(cfg, property_name, property_value, self._log) - - ## Sets the property of the PrivateToolHandle type - # @param self object pointer - # @param cfg Configurable - # @param property_name Name of the property - def setCfgProperty_PrivTool(self, cfg, property_name) : - # Test the existence of the property in the HLTAlgorithms - if not self.getProperties().has_key(property_name): - self._log.error("setCfgProperty_PrivTool:\t algorithm %s/%s has no such property " % (self.getName(), self.getAlias(), property_name)) - return False - - # Value to be set - property_value = self.getProperties()[property_name] - childName = property_value.split("/")[0] - childAlias = property_value.split("/")[-1].split('.')[-1] - # Get and check corresponding HLTAlgorithm child - child = self.getChild('.'.join([self.getAlias(), childAlias])) - if child and child.getName() != childName : child = None - - # Original value of the property - origValue = cfg.getProperties()[property_name] - - self._log.verbose("setCfgProperty_PrivTool - %s.%s = %s" % (cfg.getFullJobOptName(), property_name, property_value)) - #self._log.verbose("Mirek: setCfgProperty_PrivTool - Original value: %s.%s = %s" % (cfg.getFullJobOptName(), property_name, origValue)) - #self._log.verbose("Mirek: setCfgProperty_PrivTool - Input Configurable:\n%s" % (cfg)) - - # Check the original value - childCfg = None - from AthenaCommon.Configurable import Configurable - if isinstance(origValue,Configurable) and (childName, childAlias) == (origValue.getType(), origValue.getName()): - self._log.verbose("setCfgProperty_PrivTool - PrivateTool %s.%s exist %s" % (cfg.getFullJobOptName(), property_name, origValue.getFullJobOptName())) - childCfg = origValue - if child : - child.setConfigurableProperties(childCfg) - child.setConfigurableChildren(childCfg) - return compareCfgProperty(cfg, property_name, property_value) - elif isinstance(origValue,Configurable) and child : - self._log.debug('setCfgProperty_PrivTool - property %s is not a Configurable (type %s) - remove' % (propertye_name, type(origValue))) - # Not a configurable instance set to None - stmt = 'cfg.%s = None' % (property_name) - try : - self._log.verbose('Execute: %s' % (stmt)) - exec stmt - except Exception, exc: - self._log.debug('setCfgProperty_PrivTool - Exception occured: %s' % (exc.message)) - childCfg=None - elif isinstance(origValue, Configurable) and not (origValue.getName(), origValue.getType()) == (childAlias, childName): - self._log.debug("setCfgProperty_PrivTool - Incompatible type of the child %s - required %s/%s" % (origValue.getFullJobOptName(), childName, childAlias)) - from TrigConfOffline.HLTConfOffline import removeCfgChild - removeCfgChild(cfg, origValue.getName()) - childCfg = None - - # On this place childCfg is None - if child: - #self._log.verbose("Mirek: setCfgProperty_PrivTool - child algorithm\n %s" % (child)) - for c in cfg.getAllChildren() : - if c.getName() == childAlias : - self._log.debug("setCfgProperty_PrivToolArray - child %s exist within %s - delete" % (c.getFullJobOptName(), cfg.getFullJobOptName())) - from TrigConfOffline.HLTConfOffline import removeCfgChild - removeCfgChild(cfg, childAlias) - break - - # Get the child configurable - if childCfg == None : childCfg = child.getCfgPyClassWithProperties() - if childCfg == None : childCfg = child.getCfgPyClass() - if childCfg == None : childCfg = child.getCfgPyFunc() - if childCfg == None : childCfg = child.getCfgCppWithProperties() - if childCfg == None : childCfg = child.getCfgCpp() - - if childCfg : - #self._log.verbose("Mirek: setCfgProperty_PrivTool - append Configurable:\n %s" % (childCfg)) - stmt = "cfg.%s = childCfg" % (property_name) - try : - self._log.verbose("setCfgProperty_PrivTool - Execute: %s" % (stmt)) - exec stmt - childCfg = cfg.getProperties()[property_name][childCfg.getName()] - except Exception, exc: - self._log.debug('setCfgProperty_PrivTool - Exception occured: %s' % (exc.message)) - # Set the properties and children - if isinstance(childCfg, Configurable) : - child.setConfigurableProperties(childCfg) - child.setConfigurableChildren(childCfg) - output = compareCfgProperty(cfg, property_name, property_value) - else : - return setCfgProperty(cfg,property_name,property_value, self._log) - - self._log.verbose("setCfgProperty_PrivTool end - %s.%s = %s" % (cfg.getFullJobOptName(), property_name, cfg.getProperties()[property_name])) - #self._log.verbose("Mirek: setCfgProperty_PrivTool - Output Configurable:\n%s" % (cfg)) - return output - - def setCfgPrivToolPyWithProperties(self, cfg,property_name) : - self.setlog() - childCfg = None - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return None - # Test if the properties exists - if len(self.getProperties()) <= 0 : - return None - - # Try to import the package and the class - import_stmt = "from %s.%s import %s" % (self.py_package, self.py_name, self.py_name) - try: - self._log.debug('Import configurable: %s' % (import_stmt)) - exec import_stmt - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return None - - # Assign the python class to cfg - alias = self.getAlias().split('.')[-1] - assign_stmt = "cfg.%s = %s(name = '%s', %s)" % (property_name, self.py_name, alias, self.formatPropertiesForCfgInit()) - - # Try the statement - try : - self._log.debug('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - childCfg = cfg.getProperties()[property_name] - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return None - - return childCfg - - def setCfgPrivToolPy(self, cfg,property_name) : - self.setlog() - childCfg = None - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return None - - # Try to import the package and the class - import_stmt = "from %s.%s import %s" % (self.py_package, self.py_name, self.py_name) - try: - self._log.debug('Import configurable: %s' % (import_stmt)) - exec import_stmt - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return None - - # Assign the python class to cfg - alias = self.getAlias().split('.')[-1] - assign_stmt = "cfg.%s = %s(name = '%s')" % (property_name, self.py_name, alias) - - # Try the statement - try : - self._log.debug('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - childCfg = cfg.getProperties()[property_name] - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return None - - return childCfg - - def setCfgPrivToolPyFunc(self, cfg,property_name) : - self.setlog() - childCfg = None - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return None - - # Try to import the package and the class - import_stmt = "from %s import %s" % (self.py_package, self.py_name) - try: - self._log.debug('Import configurable: %s' % (import_stmt)) - exec import_stmt - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return False - - # Assign the python class to cfg - alias = self.getAlias().split('.')[-1] - assign_stmt = "cfg.%s = %s(name=\"%s\")" % (property_name, self.py_name, alias) - - # Try the statement - try : - self._log.debug('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - childCfg = cfg.getProperties()[property_name] - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return None - - return childCfg - - def setCfgPrivToolCppWithProperties(self, cfg,property_name) : - childCfg = None - # Test if the properties exists - if len(self.getProperties()) <= 0 : - return None - - # Get Configurable Class if exists - from AthenaCommon.ConfigurableDb import getConfigurable - cfg_class = getConfigurable(self.getName(), assumeCxxClass=True) - - if not cfg_class : - self._log.debug('Configurable class: %s not found' % (self.getName())) - return None - - alias = self.getAlias().split('.')[-1] - from AthenaCommon import CfgMgr - # Executable statement - stmt = 'cfg.%(property)s = CfgMgr.%(cfg_class)s(name="%(cfg_name)s", %(properties)s)' - stmt = stmt % {'property':property_name, 'cfg_class':cfg_class.__name__, 'cfg_name':alias, 'properties':self.formatPropertiesForCfgInit(cfg_class)} - - try : - self._log.debug('Execute %s' % (stmt)) - exec(stmt) - childCfg = cfg.getProperties()[property_name] - except Exception, exc: - self._log.debug('Child %s/%s not set: %s' % (self.getName(), self.getAlias(), exc.message)) - return None - - return childCfg - - def setCfgPrivToolCpp(self, cfg,property_name) : - childCfg = None - # Test if the properties exists - if len(self.getProperties()) <= 0 : - return None - - # Get Configurable Class if exists - from AthenaCommon.ConfigurableDb import getConfigurable - cfg_class = getConfigurable(self.getName(), assumeCxxClass=True) - - if not cfg_class : - self._log.debug('Configurable class: %s not found' % (self.getName())) - return None - - alias = self.getAlias().split('.')[-1] - from AthenaCommon import CfgMgr - # Executable statement - stmt = 'cfg.%(property)s = CfgMgr.%(cfg_class)s(name="%(cfg_name)s")' - stmt = stmt % {'property':property_name, 'cfg_class':cfg_class.__name__, 'cfg_name':alias} - - try : - self._log.debug('Execute %s' % (stmt)) - exec(stmt) - childCfg = cfg.getProperties()[property_name] - except Exception, exc: - self._log.debug('Child %s/%s not set: %s' % (self.getName(), self.getAlias(), exc.message)) - return None - - return childCfg - - def getCfgPyClassWithProperties(self) : - self.setlog() - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return None - # Test if the properties exists - if len(self.getProperties()) <= 0 : - return None - - # Try to import the package and the class - import_success=False - import_stmt = "from %s.%s import %s" % (self.py_package, self.py_name, self.py_name) - try: - self._log.debug('Import configurable: %s' % (import_stmt)) - exec import_stmt - import_success=True - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return None - - # Assign the python class to cfg - cfg = None - alias = self.getAlias().split('.')[-1] - assign_stmt = "cfg = %s(name = '%s', %s)" % (self.py_name, alias, self.formatPropertiesForCfgInit()) - - # Try execute the statement - try : - self._log.debug('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return None - - # If everything is fine the configurable exists here - return cfg - - def getCfgPyClass(self) : - self.setlog() - - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return None - - # Try to import the package and the class - import_success=False - import_stmt = "from %s.%s import %s" % (self.py_package, self.py_name, self.py_name) - try: - self._log.debug('Import configurable: %s' % (import_stmt)) - exec import_stmt - import_success=True - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return None - - #Assign the python class to cfg - cfg = None - alias = self.getAlias().split('.')[-1] - assign_stmt = "cfg = %s(name = '%s')" % (self.py_name, alias) - - # Try ro assign the configurable - try : - self._log.debug('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return None - - # If everything is fine the configurable exists here - return cfg - - def getCfgPyFunc(self) : - self.setlog() - - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return None - - # Try to import the package and the function - import_stmt = "from %s import %s" % (self.py_package, self.py_name) - try: - self._log.debug('Import configurable: %s' % (import_stmt)) - exec import_stmt - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return None - - #Assign the python class to cfg - cfg = None - alias = self.getAlias().split('.')[-1] - - assign_stmt = "cfg = %s(name=\"%s\")" % (self.py_name,alias) - # Try the statement - try : - self._log.debug('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return None - - # If everything is fine the configurable exists here - return cfg - - def getCfgCppWithProperties(self) : - # Output variable - cfg = None - # Test the properties - if len(self.getProperties()) <= 0 : return None - # Format name and type of the configurable - name = self.getAlias() - cfg_name = self.getAlias().split('.')[-1] - cfg_type = self.getName() - - if name.count('.') > 0: - cfg_type = cfg_type.split('.')[-1] - - # Get the cfg_class - from AthenaCommon.ConfigurableDb import getConfigurable - cfg_class = getConfigurable(cfg_type, assumeCxxClass=True) - if not cfg_class : - self._log.debug('Configurable class: %s not found' % (cfg_type)) - # The base C++ class doesn't exist no way to get the configurable - return None - - # Create the executable statement - stmt = 'cfg = CfgMgr.%(cfg_class)s("%(cfg_name)s", %(properties)s)' - stmt = stmt % {'cfg_class' : cfg_class.__name__, 'cfg_name' : cfg_name, - 'properties' : self.formatPropertiesForCfgInit(cfg_class)} - - # Try to create the Configurable - from AthenaCommon import CfgMgr - try: - self._log.debug('Execute %s' % (stmt)) - exec(stmt) - - except NameError, exc: # Configurable is most probably a child of some algorithm - self._log.debug('Configurable: %s/%s not found %s' % (cfg_type, cfg_name, exc.message)) - return None - - except TypeError, exc: # Configurable exist under the same name, but different type (derived Configurable?) - mesg = 'attempt to redefine type of "%s"' % cfg_name - if exc.message[:len(mesg)] != mesg: return None - - self._log.debug(exc.message) - # Get the old configurable name - cfg_types = exc.message[len(mesg):].strip().strip('(').strip(')').replace(',','') - cfg_types = cfg_types.split() - del cfg_types[2] - del cfg_types[0] - existing_cfg_type = cfg_types[cfg_types.index(cfg_class.__name__)-1] - self._log.debug('Try to get configurable %s/%s' % (existing_cfg_type,cfg_name)) - - # Get the existing configurable - from AthenaCommon.Configurable import Configurable - existing_cfg = Configurable.allConfigurables[cfg_name] - - # Exceptions for some configurable names, do not set the properties - from TrigConfOffline.HLTConfOffline import doNotSetPropertiesCfgName - if cfg_name in doNotSetPropertiesCfgName : - return existing_cfg - - # Set the properties - # If there is at least 1 property which can't be set - delete existing configurable and set this one - propertiesSet = self.setConfigurableProperties(existing_cfg) - if not propertiesSet: - self._log.warning('Delete existing configurable %s/%s', (existing_cfg_type,cfg_name)) - from TrigConfOffline.HLTConfOffline import eraseConfigurable - eraseConfigurable(existing_cfg, self._log) - del existing_cfg - # Call itself recursively - cfg = self.getConfigurable() - else : - return existing_cfg - - except Exception, exc: # Unknown exception - self._log.debug(exc.message) - return None - - return cfg - - ## Get the confugrable based on C++ information only - # @param self Object pointer - def getCfgCpp(self) : - # Output variable - cfg = None - # Format name and type of the configurable - name = self.getAlias() - cfg_name = self.getAlias().split('.')[-1] - cfg_type = self.getName() - - if name.count('.') > 0: - cfg_type = cfg_type.split('.')[-1] - - # Get the cfg_class - from AthenaCommon.ConfigurableDb import getConfigurable - cfg_class = getConfigurable(cfg_type, assumeCxxClass=True) - if not cfg_class : - self._log.debug('Configurable class: %s not found' % (cfg_type)) - # The base C++ class doesn't exist no way to get the configurable - return None - - # Create the executable statement - stmt = 'cfg = CfgMgr.%(cfg_class)s("%(cfg_name)s")' - stmt = stmt % {'cfg_class' : cfg_class.__name__, 'cfg_name' : cfg_name} - - # Try to create the Configurable - from AthenaCommon import CfgMgr - try: - self._log.debug('Execute %s' % (stmt)) - exec(stmt) - - except NameError, exc: # Configurable is most probably a child of some algorithm - self._log.debug('Configurable: %s/%s not found %s' % (cfg_type, cfg_name, exc.message)) - return None - - except TypeError, exc: # Configurable exist under the same name, but different type (derived Configurable?) - mesg = 'attempt to redefine type of "%s"' % cfg_name - if exc.message[:len(mesg)] != mesg: return None - - self._log.debug(exc.message) - # Get the old configurable name - cfg_types = exc.message[len(mesg):].strip().strip('(').strip(')').replace(',','') - cfg_types = cfg_types.split() - del cfg_types[2] - del cfg_types[0] - existing_cfg_type = cfg_types[cfg_types.index(cfg_class.__name__)-1] - self._log.debug('Try to get configurable %s/%s' % (existing_cfg_type,cfg_name)) - - # Get the existing configurable - from AthenaCommon.Configurable import Configurable - existing_cfg = Configurable.allConfigurables[cfg_name] - - # Exceptions for some configurable names, do not set the properties - from TrigConfOffline.HLTConfOffline import doNotSetPropertiesCfgName - if cfg_name in doNotSetPropertiesCfgName : - return existing_cfg - - # Set the properties - # If there is at least 1 property which can't be set - delete existing configurable and set this one - propertiesSet = self.setConfigurableProperties(existing_cfg) - if not propertiesSet: - self._log.warning('Delete existing configurable %s/%s', (existing_cfg_type,cfg_name)) - from TrigConfOffline.HLTConfOffline import eraseConfigurable - eraseConfigurable(existing_cfg, self._log) - del existing_cfg - # Call itself recursively - cfg = self.getConfigurable() - else : - return existing_cfg - - except Exception, exc: # Unknown exception - self._log.debug(exc.message) - return None - - return cfg - - ## Documentation fo getConfigurable method - # @param self pointer to the object - # Accordignly to the information in the class try to create a configurable - # @return configurable if unsuccessfull None - def getConfigurable(self): - self.setlog() - cfg = None - # Look if the cfg doesn't exist yet - from AthenaCommon.Configurable import Configurable - if Configurable.allConfigurables.has_key(self.getAlias().replace('ToolSvc.','',1)) : - cfg = Configurable.allConfigurables[self.getAlias().replace('ToolSvc.','',1)] - self._log.debug("Configurable %s already exists" % (cfg.getFullJobOptName())) - # Compare the name of the algorithm - if cfg.getType() != self.getName(): - self._log.warning("Different type of existing configurable %s requested: %s" % (cfg.getType(), self.getName())) - from TrigConfOffline.HLTConfOffline import doNotSetPropertiesCfgName - if self.getAlias().split('.')[-1] not in doNotSetPropertiesCfgName : - from TrigConfOffline.HLTConfOffline import eraseConfigurable - eraseConfigurable(cfg) - cfg = None - - # 1. try to get cfg as a python class with properties - if cfg == None : cfg = self.getCfgPyClassWithProperties() - # 2. try to get cfg as a python class without properties - if cfg == None : cfg = self.getCfgPyClass() - # 3. try to get cfg as a python function - if cfg == None : cfg = self.getCfgPyFunc() - # 4. try to get cfg as a C++ class with properties - if cfg == None : cfg = self.getCfgCppWithProperties() - # 5. try to get cfg as a C++ class without properties - if cfg == None : cfg = self.getCfgCpp() - - # If the Configurable doesn't exists here - there is no known way how to get it - if cfg == None : - self._log.error("Can not create a configurable for: %s" % (self)) - return None - - # Before setting the Properties - fix the children - if len(cfg.getAllChildren()) > 0 : self.fixCfgChildCompatibility(cfg) - - # Configurable exists - set the properties - self.setConfigurableProperties(cfg) - - # Set the children - self.setConfigurableChildren(cfg) - - # Append to ToolSvc - #if self.getAlias().startswith('ToolSvc.') : - #from AthenaCommon.AppMgr import ToolSvc - #ToolSvc += cfg - - return cfg - - ## Fix the children algorithms within the HLTAlgorithm - # @param self Object pointer - # Check the children aliases compatibility with the parent name - # Try to fix child parent relations - # Called recursively for the children too - def fixChildren(self) : - ## Fixing of children within algorithm ## - self.setlog() - alias = self.getAlias() - if self.hasChildren() : - i = 0 - while i < len(self._children) : - child = self.getChildren()[i] - childAlias = child.getAlias() - aliases = childAlias.replace('%s.' % (alias),'',1).split('.') - # All fine the child alias is correct - if len(aliases) == 1 : - i += 1 - continue - - # Check whether fixable - if childAlias.find('%s.' % (alias)) != 0 : - self._log.warning('Child alias %s does not match parent alias - can not be fixed' % (childAlias)) - i += 1 - continue - - self._log.warning('Child alias %s does not match parent alias - another child algorithm should be a parent' % (childAlias)) - parentAlias = '%s.%s' % (alias, aliases[0]) - parent = self.getChild(parentAlias) - if parent : - self._log.info('Parent algorithm %s/%s found - move %s/%s' % (parent.getName(), parent.getAlias(), child.getName(), childAlias)) - parent.appendChild(child) - self.removeChild(childAlias) - else : - self._log.warning('Parent algorithm for %s not found' % (childAlias)) - i += 1 - - # Call the function recursively - for child in self.getChildren() : child.fixChildren() - - ## Check the compatibility of cfg children and HLTAlgorithm - # @param self pointer to the object - # @param cfg configurable - # @return True if compatible - # Check existing children from configurable with the HLTAlgorithm children - # Compatibility is checked based on the name and type resp. existence of the property referring to a child - # At 1st incompatible child returns False - def checkCfgChildCompatibility(self, cfg): - output = True - # Dictionairy with children - algChildrenDict = {} - for child in self.getChildren() : - algChildrenDict[child.getAlias().split('.')[-1]] = child.getName() - - # Check the children of the configurable - for child in cfg.getAllChildren() : - if child.getName() in algChildrenDict.keys(): - if child.getType() != algChildrenDict[child.getName()] : - self._log.warning("Conflicting type of child algorithm %s found - required type %s" % (child.getFullJobOptName(), algChildrenDict[child.getName()])) - return False - else : - privateToolMatch = False - cfgChildName = child.getName() - cfgChildType = child.getType() - # Look through HLTAlgorithm properties - for k,v in self.getProperties().items() : - # PrivateToolHandle - if isinstance(v,(str,unicode)) and (v.split('/')[0], v.split('/')[-1]) == (cfgChildType, cfgChildName) : - privateToolMatch = True - break - # PrivateToolHandle Array - if isinstance(v,list) and (cfgChildName in v or '/'.join([cfgChildType, cfgChildName]) in v) : - privateToolMatch = True - break - - if not privateToolMatch : - self._log.warning("Unwanted child algorithm %s found" % (child.getFullJobOptName())) - return False - - return output - - ## Fix the compatibility of cfg children and HLTAlgorithm - # @param self pointer to the object - # @param cfg configurable - # - # Remove the existing children from configurable uncompatible with the HLTAlgorithm children - # Compatibility is checked based on the name and type resp. existence of the property refering to child - def fixCfgChildCompatibility(self, cfg): - algChildrenDict = {} - for child in self.getChildren() : - algChildrenDict[child.getAlias().split('.')[-1]] = child.getName() - - from TrigConfOffline.HLTConfOffline import removeCfgChild - for child in cfg.getAllChildren() : - if child.getName() in algChildrenDict.keys(): - if child.getType() != algChildrenDict[child.getName()] : - self._log.debug("Remove child algorithm %s conflicting type - required type %s" % (child.getFullJobOptName(), algChildrenDict[child.getName()])) - removeCfgChild(cfg,child.getName()) - else : - privateToolMatch = False - cfgChildName = child.getName() - cfgChildType = child.getType() - # Look through HLTAlgorithm properties - for k,v in self.getProperties().items() : - # PrivateToolHandle - if isinstance(v,(str,unicode)) and (v.split('/')[0], v.split('/')[-1]) == (cfgChildType, cfgChildName) : - privateToolMatch = True - break - # PrivateToolHandle Array - if isinstance(v,list) and (cfgChildName in v or '/'.join([cfgChildType, cfgChildName]) in v) : - privateToolMatch = True - break - - if not privateToolMatch : - self._log.debug("Remove unwanted child algorithm %s" % (child.getFullJobOptName())) - removeCfgChild(cfg,child.getName()) - - ## Documentation for the method setConfigurableChildren - # @param self The Object pointer - # @param cfg input configurable to append the children of the object as private tools - def setConfigurableChildren(self, cfg) : - self.setlog() - nchildren = 0 - - # Fix the children - if not self.checkCfgChildCompatibility(cfg) and self.getName() not in ('ToolSvc','ServiceManager') : - self.fixCfgChildCompatibility(cfg) - - # Test if any children exists - if not self.hasChildren() : - return nchildren - - self._log.verbose('Set children of %s/%s to %s' % (self.getName(), self.getAlias(), cfg)) - # Loop over children and set them - for child in self.getChildren() : - childCfg = child.setConfigurableChild(cfg, nchildren) - - if childCfg : - self._log.debug('Child %s appended to parent %s' % (childCfg.getFullJobOptName(),cfg.getFullJobOptName())) - self._log.verbose('Child Algorithm vs. Configurable:\n %s \nvs\n %s' % (child, childCfg)) - nchildren += nchildren - - return nchildren - - ## Documentation for the method setConfigurableChild - # @param self The Object pointer - # @param cfg input configurable to append self as private tool - # @return Child configurable pointer - def setConfigurableChild(self, cfg, nchildren=0) : - self.setlog() - - childCfg = None - # Look for the existing children - for c in cfg.getAllChildren() : - if c.getName() == self.getAlias().split('.')[-1] : - if c.getType() == self.getName() : - childCfg = c - break - else : - self._log.debug("Conflicting type of child algorithm %s found - required type %s" % (c.getFullJobOptName(), self.getName())) - from TrigConfOffline.HLTConfOffline import removeCfgChild - # Remove the conflicting child - removeCfgChild(cfg, c.getName()) - - if childCfg == None : childCfg = self.setCfgChildPyWithProperties(cfg) - if childCfg == None : childCfg = self.setCfgChildPy(cfg) - if childCfg == None : childCfg = self.setCfgChildPyFunc(cfg) - if childCfg == None : childCfg = self.setCfgChildCppWithProperties(cfg) - if childCfg == None : childCfg = self.setCfgChildCpp(cfg) - - if not childCfg : - self._log.error("%s/%s could not be assign as child of %s" % (self.getName(),self.getAlias(),cfg.getFullJobOptName())) - return childCfg - - # Check for multiple children - nchild = 0 - childAlias = self.getAlias().split('.')[-1] - for c in cfg.getAllChildren() : - if c.getName() == childAlias : - nchild += 1 - - # If multiple children exists - delete them - if nchild > 1 : - self._log.warning('Multiple %d children %s/%s found' % (nchildren, self.getName(), self.getAlias())) - # Deleting the child should remove only one - if cfg.getProperties().has_key(childAlias) : - self._log.warning('Can not delete a child %s/%s identical property exist' % (self.getName(), self.getAlias())) - stmt = 'childCfg = cfg.%s' % (childAlias) - self._log.verbose('Execute: %s' % (stmt)) - exec (stmt) - else : - stmt = 'del cfg.%s' % (childAlias) - self._log.verbose('Execute: %s' % (stmt)) - exec (stmt) - # To be certain assign right childCfg - for c in cfg.getAllChildren() : - if c.getName() == childAlias : - childCfg = c - break - - # Fix the childCfg children if needed - if not self.checkCfgChildCompatibility(childCfg) : self.fixCfgChildCompatibility(childCfg) - - # Set properties of the child before assigning the children - self.setConfigurableProperties(childCfg) - - # Set the child configurable children if needed - if self.hasChildren(): nchildren += self.setConfigurableChildren(childCfg) - - return childCfg - - def loadFromDB(self, cursor, dbName=''): - self.setlog() - if self.dbId > 0: - # Test if db type is an oracle - oracleFlag ='%s' % (cursor.description[0][1]) - oracleFlag = oracleFlag.lower() - oracleFlag = 'oracle' in oracleFlag - - sqliteFlag = '%s' % (cursor) - sqliteFlag = sqliteFlag.lower() - sqliteFlag = 'sqlite' in sqliteFlag - - prepend='' - if dbName : - prepend = '%s.' % (dbName) - - query = ' SELECT %sHLT_COMPONENT.HCP_NAME, ' % (prepend) - query += ' %sHLT_COMPONENT.HCP_ALIAS, ' % (prepend) - query += ' %sHLT_COMPONENT.HCP_TYPE, ' % (prepend) - query += ' %sHLT_COMPONENT.HCP_PY_NAME, ' % (prepend) - query += ' %sHLT_COMPONENT.HCP_PY_PACKAGE ' % (prepend) - query += ' FROM %sHLT_COMPONENT ' % (prepend) - if sqliteFlag : - query += ' WHERE %sHLT_COMPONENT.HCP_ID=%d ' % (prepend, self.dbId) - else : - query += ' WHERE %sHLT_COMPONENT.HCP_ID=:hcp_id ' % (prepend) - - self._log.verbose('%s, hcp_id=%d' % (query,self.dbId)) - if sqliteFlag : - cursor.execute(query) - else : - cursor.execute(query, hcp_id=self.dbId) - - result = cursor.fetchall() - for column in result: - values = [] - # Format DB output for oracle - for val in column : - #if oracleFlag and val == '~' : - if val == '~' : - values.append('') - else : - values.append(val) - - self.name = str(values[0]) - self.alias = str(values[1]) - self.alg_type = str(values[2]) - self.py_name = str(values[3]) - self.py_package = str(values[4]) - - nProperties = self.loadPropertiesFromDB(cursor, dbName) - self.joinProperties() - nChildren = self.loadChildrenFromDB(cursor, dbName) - self._log.debug('Succesfull load of: \n%s' % (self)) - else: - self._log.warning('Invalid component dbId= %d' % (self.dbId)) - - def loadPropertiesFromDB(self, cursor, dbName=''): - self.setlog() - nProperties = 0 - if self.dbId > 0: - # Test if db type is an oracle - oracleFlag ='%s' % (cursor.description[0][1]) - oracleFlag = oracleFlag.lower() - oracleFlag = 'oracle' in oracleFlag - - sqliteFlag = '%s' % (cursor) - sqliteFlag = sqliteFlag.lower() - sqliteFlag = 'sqlite' in sqliteFlag - - prepend='' - if dbName : - prepend = '%s.' % (dbName) - - query = ' SELECT %sHLT_PARAMETER.HPA_NAME, ' % (prepend) - query += ' %sHLT_PARAMETER.HPA_VALUE ' % (prepend) - query += ' FROM %sHLT_CP_TO_PA ' % (prepend) - query += ' JOIN %sHLT_PARAMETER ON (%sHLT_CP_TO_PA.HCP2PA_PARAMETER_ID = %sHLT_PARAMETER.HPA_ID) ' % (prepend, prepend, prepend) - if sqliteFlag : - query += ' WHERE %sHLT_CP_TO_PA.HCP2PA_COMPONENT_ID=%d ' % (prepend, self.dbId) - else : - query += ' WHERE %sHLT_CP_TO_PA.HCP2PA_COMPONENT_ID=:hcp_id ' % (prepend) - query += ' ORDER BY %sHLT_PARAMETER.HPA_NAME ' % (prepend) - - self._log.verbose('%s, hcp_id=%d' % (query,self.dbId)) - if sqliteFlag : - cursor.execute(query) - else: - cursor.execute(query, hcp_id=self.dbId) - result = cursor.fetchall() - nProperties=len(result) - for column in result: - name = str(column[0]) - value = str(column[1]) - - setProperty=True - # Exception for properties with values "" or '' - if value =='""' or value =='\'\'' : - setProperty=False - - # Oracle may not contain empty value thus we set it in the DB to ~ - #if oracleFlag and value=='~': - if value=='~': - value='' - - if setProperty : - self.setProperty(name, value) - - else: - self._log.warning('Invalid component dbId= %d' % (self.dbId)) - - return nProperties - - def loadChildrenFromDB(self, cursor, dbName=''): - self.setlog() - nChildren=0 - if self.dbId > 0: - prepend='' - if dbName : - prepend = '%s.' % (dbName) - - sqliteFlag = '%s' % (cursor) - sqliteFlag = sqliteFlag.lower() - sqliteFlag = 'sqlite' in sqliteFlag - - query = ' SELECT %sHLT_CP_TO_CP.HCP2CP_CHILD_COMP_ID ' % (prepend) - query += ' FROM %sHLT_CP_TO_CP ' % (prepend) - if sqliteFlag : - query += ' WHERE %sHLT_CP_TO_CP.HCP2CP_PARENT_COMP_ID=%d ' % (prepend, self.dbId) - else : - query += ' WHERE %sHLT_CP_TO_CP.HCP2CP_PARENT_COMP_ID=:hcp_id ' % (prepend) - - self._log.verbose('%s, hcp_id=%d' % (query,self.dbId)) - if sqliteFlag : - cursor.execute(query) - else : - cursor.execute(query, hcp_id=self.dbId) - result = cursor.fetchall() - nChildren = len(result) - for column in result: - childAlgorithm=HLTAlgorithm(dbId=column[0],OutputLevel=self.OutputLevel) - childAlgorithm.loadFromDB(cursor, dbName) - self.setChild(childAlgorithm) - - else: - self._log.warning('Invalid component dbId= %d' % (self.dbId)) - return nChildren - - def loadFromXMLNode(self, node): - self.setlog() - alias="" - if node.hasAttribute('alias') : - self.alias = str(node.getAttribute('alias')) - else: - self._log.error('Component has no attribute alias %s' % (node.toxml())) - return False - name=alias - if node.hasAttribute('name') : - self.name = str(node.getAttribute('name')) - - typeList = ('TopAlg','Algorithm','SteerAlg','Service','PublicTool','PrivateTool','Auditor','Type') - self.alg_type = typeList[7] - if node.hasAttribute('aud') : - if int(node.getAttribute('aud')) > 0 : self.alg_type = typeList[6] - if node.hasAttribute('privT') : - if int(node.getAttribute('privT')) > 0 : self.alg_type = typeList[5] - if node.hasAttribute('pubT') : - if int(node.getAttribute('pubT')) > 0 : self.alg_type = typeList[4] - if node.hasAttribute('svc') : - if int(node.getAttribute('svc')) > 0 : self.alg_type = typeList[3] - if node.hasAttribute('steeralg') : - if int(node.getAttribute('steeralg')) > 0 : self.alg_type = typeList[2] - if node.hasAttribute('alg') : - if int(node.getAttribute('alg')) > 0 : self.alg_type = typeList[1] - if node.hasAttribute('topalg') : - if int(node.getAttribute('topalg')) > 0 : self.alg_type = typeList[0] - - if node.hasChildNodes() : - doc_pars = node.getElementsByTagName('parameter') - if len(doc_pars) > 0: - for p in doc_pars : - self.loadParameterfromXML(p) - - doc_children = node.getElementsByTagName('component') - if len(doc_children) > 0: - for child in doc_children : - child = HLTAlgorithm(OutputLevel=self.OutputLevel) - child.loadFromXML(child) - self.setChild(child) - return True - - def loadParameterfromXML(self, node): - self.setlog() - if node.hasAttribute('name') : - name = str(node.getAttribute('name')) - else: - self._log.error('Parameter has no attribute name %s' % (node.toxml())) - return False - - if node.hasAttribute('value') : - value = str(node.getAttribute('value')) - try: - value = eval(value) - except : - # Nothing happened just pass the value as string - pass - - self.setProperty(name,value) - return True - - def deepcopy(self, copyChildren=False) : - self.setlog() - alg = HLTAlgorithm() - for k,v in self.__dict__.items() : - if k=='_children': - if copyChildren : - for child in self.getChildren() : - alg.setChild(child) - elif k=='properties' : - for kprop, vprop in self.properties.items(): - alg.setProperty(kprop,vprop) - elif k=='_log': - continue - else : - alg.__setattr__(k,v) - return alg - - def flattenAlg(self): - self.setlog() - alglist = [] - alglist.append(self) - for ch in self.getChildren() : - alglist.extend(ch.flattenAlg()) - return alglist - - def convertToOld(self): - self.setlog() - alg={} - alg['alias']=self.getAlias() - alg['name']=self.getName() - alg['properties']={} - for k,v in self.getProperties().items() : - alg['properties'][k]=v - - if self.__dict__.has_key('topAlg') : - alg['topalg'] = self.topAlg - - return alg - - def setCfgChildPyWithProperties(self, parentCfg): - self.setlog() - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return None - # Test if the properties exists - if len(self.getProperties()) <= 0 : - return None - - # Test whether the parent configurable doesn't already have a child with the same name - childCfg = None - attributes = {"alias": self.getAlias().split('.')[-1], - "name": self.getName().split('.')[-1], - "py_name": self.py_name, - "py_package": self.py_package} - childAttributes = {"alias": None, "name": None, "py_name": None, "py_package": None} - for cCfg in parentCfg.getAllChildren() : - py_class = str(cCfg.__class__)[6:].strip('\' >').split('.')[-1] - py_package = str(cCfg.__module__) - cCfgAttributes = {"alias": cCfg.getName().split('.')[-1], - "name": cCfg.getType().split('.')[-1], - "py_name": py_class, - "py_package": py_package} - - if cCfgAttributes['alias'] == attributes['alias']: - childCfg = cCfg - childAttributes = cCfgAttributes - if cCfgAttributes == attributes : # 100% match - can't be better - return the configurable - return childCfg - - # Child exists but it does not agree with the setting - delete it - if childCfg : - from TrigConfOffline.HLTConfOffline import eraseConfigurable - eraseConfigurable(childCfg, self._log) - del childCfg - if parentCfg.getProperties().has_key(childAttributes['alias']) : - # self._log.warning('Can not delete a child %s/%s identical property exist' % (child.getName(), child.getAlias())) - stmt = 'parentCfg.%s = None' % (childAttributes['alias']) - self._log.verbose('Execute: %s' % (stmt)) - exec (stmt) - - # Try to import the package and the class - import_stmt = "from %s.%s import %s" % (self.py_package, self.py_name, self.py_name) - try: - self._log.verbose('Import configurable: %s' % (import_stmt)) - exec import_stmt - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return None - - # Assign the python class to cfg - alias = self.getAlias().split('.')[-1] - assign_stmt = "parentCfg += %s(name = '%s', %s)" % (self.py_name, alias, self.formatPropertiesForCfgInit()) - if parentCfg.getProperties().has_key(alias) : - cfgPropertyType = ('%s' % (type(cfg.getProperties()[childAlias]))).replace('<class ','').replace('<type ','').replace("'",'') - cfgPropertyType = cfgPropertyType[:len(cfgPropertyType)-1] - if cfgPropertyType in ('GaudiKernel.GaudiHandles.ServiceHandle', - 'GaudiKernel.GaudiHandles.PublicToolHandle','GaudiKernel.GaudiHandles.PrivateToolHandle') : - assign_stmt = "parentCfg.%s = %s(name = '%s', %s)" % (alias, self.py_name, alias, self.formatPropertiesForCfgInit()) - # Try the statement - try : - self._log.verbose('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return None - - # Search the children of the parent for the child - cfg = None - for cCfg in parentCfg.getAllChildren() : - py_class = str(cCfg.__class__)[6:].strip('\' >').split('.')[-1] - py_package = str(cCfg.__module__) - cCfgAttributes = {"alias": cCfg.getName().split('.')[-1], - "name": cCfg.getType().split('.')[-1], - "py_name": py_class, - "py_package": py_package} - if cCfgAttributes == attributes: - cfg = cCfg - - return cfg - - - def setCfgChildPy(self, parentCfg): - self.setlog() - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return None - - # Test whether the parent configurable doesn't already have a child with the same name - childCfg = None - attributes = {"alias": self.getAlias().split('.')[-1], - "name": self.getName().split('.')[-1], - "py_name": self.py_name, - "py_package": self.py_package} - childAttributes = {"alias": None, "name": None, "py_name": None, "py_package": None} - for cCfg in parentCfg.getAllChildren() : - py_class = str(cCfg.__class__)[6:].strip('\' >').split('.')[-1] - py_package = str(cCfg.__module__) - cCfgAttributes = {"alias": cCfg.getName().split('.')[-1], - "name": cCfg.getType().split('.')[-1], - "py_name": py_class, - "py_package": py_package} - - if cCfgAttributes['alias'] == attributes['alias']: - childCfg = cCfg - childAttributes = cCfgAttributes - if cCfgAttributes == attributes : # 100% match - can't be better - return the configurable - return childCfg - - # Child exists but it does not agree with the setting - delete it - if childCfg : - from TrigConfOffline.HLTConfOffline import eraseConfigurable - eraseConfigurable(childCfg, self._log) - del childCfg - if parentCfg.getProperties().has_key(childAttributes['alias']) : - # self._log.warning('Can not delete a child %s/%s identical property exist' % (child.getName(), child.getAlias())) - stmt = 'parentCfg.%s = None' % (childAttributes['alias']) - self._log.verbose('Execute: %s' % (stmt)) - exec (stmt) - - # Try to import the package and the class - import_stmt = "from %s.%s import %s" % (self.py_package, self.py_name, self.py_name) - try: - self._log.verbose('Import configurable: %s' % (import_stmt)) - exec import_stmt - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return None - - # Assign the python class to cfg - alias = self.getAlias().split('.')[-1] - assign_stmt = "parentCfg += %s(name = '%s')" % (self.py_name, alias) - if parentCfg.getProperties().has_key(alias) : - cfgPropertyType = ('%s' % (type(cfg.getProperties()[childAlias]))).replace('<class ','').replace('<type ','').replace("'",'') - cfgPropertyType = cfgPropertyType[:len(cfgPropertyType)-1] - if cfgPropertyType in ('GaudiKernel.GaudiHandles.ServiceHandle', - 'GaudiKernel.GaudiHandles.PublicToolHandle','GaudiKernel.GaudiHandles.PrivateToolHandle') : - assign_stmt = "parentCfg.%s = %s(name = '%s')" % (alias, self.py_name, alias) - # Try the statement - try : - self._log.verbose('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return None - - # Search the children of the parent for the child - cfg = None - for cCfg in parentCfg.getAllChildren() : - py_class = str(cCfg.__class__)[6:].strip('\' >').split('.')[-1] - py_package = str(cCfg.__module__) - cCfgAttributes = {"alias": cCfg.getName().split('.')[-1], - "name": cCfg.getType().split('.')[-1], - "py_name": py_class, - "py_package": py_package} - if cCfgAttributes == attributes: - cfg = cCfg - - return cfg - - def setCfgChildPyFunc(self, parentCfg): - self.setlog() - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return None - - # Test whether the parent configurable doesn't already have a child with the same name - childCfg = None - attributes = {"alias": self.getAlias().split('.')[-1], - "name": self.getName().split('.')[-1], - "py_name": self.py_name, - "py_package": self.py_package} - childAttributes = {"alias": None, "name": None, "py_name": None, "py_package": None} - for cCfg in parentCfg.getAllChildren() : - py_class = str(cCfg.__class__)[6:].strip('\' >').split('.')[-1] - py_package = str(cCfg.__module__) - cCfgAttributes = {"alias": cCfg.getName().split('.')[-1], - "name": cCfg.getType().split('.')[-1], - "py_name": py_class, - "py_package": py_package} - - if cCfgAttributes['alias'] == attributes['alias']: - childCfg = cCfg - childAttributes = cCfgAttributes - if cCfgAttributes == attributes : # 100% match - can't be better - return the configurable - return childCfg - - # Child exists but it does not agree with the setting - delete it - if childCfg : - from TrigConfOffline.HLTConfOffline import eraseConfigurable - eraseConfigurable(childCfg, self._log) - del childCfg - if parentCfg.getProperties().has_key(childAttributes['alias']) : - # self._log.warning('Can not delete a child %s/%s identical property exist' % (child.getName(), child.getAlias())) - stmt = 'parentCfg.%s = None' % (childAttributes['alias']) - self._log.verbose('Execute: %s' % (stmt)) - exec (stmt) - - # Try to import the package and the class - import_stmt = "from %s import %s" % (self.py_package, self.py_name) - try: - self._log.verbose('Import configurable: %s' % (import_stmt)) - exec import_stmt - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return None - - # Assign the python class to cfg - alias = self.getAlias().split('.')[-1] - assign_stmt = "parentCfg += %s(name=\"%s\")" % (self.py_name,alias) - if parentCfg.getProperties().has_key(alias) : - cfgPropertyType = ('%s' % (type(parentCfg.getProperties()[alias]))).replace('<class ','').replace('<type ','').replace("'",'') - cfgPropertyType = cfgPropertyType[:len(cfgPropertyType)-1] - if cfgPropertyType in ('GaudiKernel.GaudiHandles.ServiceHandle', - 'GaudiKernel.GaudiHandles.PublicToolHandle','GaudiKernel.GaudiHandles.PrivateToolHandle') : - assign_stmt = "parentCfg.%s = %s(name=\"%s\")" % (alias, self.py_name, alias) - # Try the statement - try : - self._log.verbose('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return None - - # Search the children of the parent for the child - cfg = None - for cCfg in parentCfg.getAllChildren() : - py_class = str(cCfg.__class__)[6:].strip('\' >').split('.')[-1] - py_package = str(cCfg.__module__) - cCfgAttributes = {"alias": cCfg.getName().split('.')[-1], - "name": cCfg.getType().split('.')[-1], - "py_name": py_class, - "py_package": py_package} - if cCfgAttributes == attributes: - cfg = cCfg - - return cfg - - def setCfgChildCppWithProperties(self, parentCfg): - self.setlog() - # Test if the properties exists - if len(self.getProperties()) <= 0 : - return None - - # Test whether the parent configurable doesn't already have a child with the same name - childCfg = None - attributes = {"alias": self.getAlias().split(',')[-1], "name": self.getName().split(',')[-1]} - childAttributes = {"alias": None, "name": None} - for cCfg in parentCfg.getAllChildren() : - cCfgAttributes = {"alias": cCfg.getName().split('.')[-1], "name": cCfg.getType().split('.')[-1]} - - if cCfgAttributes['alias'] == attributes['alias']: - childCfg = cCfg - childAttributes = cCfgAttributes - if cCfgAttributes == attributes : # 100% match - can't be better - return the configurable - return childCfg - - # Child exists - type of the child differs - test if it is not a derived configurable - if childCfg : - # Try to set the properties - if succesfull return the childCfg - propertiesSet = self.setConfigurableProperties(childCfg) - if not propertiesSet: - self._log.warning('Delete existing configurable %s/%s', (existing_cfg_type,cfg_name)) - from TrigConfOffline.HLTConfOffline import eraseConfigurable - eraseConfigurable(childCfg, self._log) - del childCfg - if parentCfg.getProperties().has_key(childAttributes['alias']) : - stmt = 'parentCfg.%s = None' % (childAttributes['alias']) - self._log.verbose('Execute: %s' % (stmt)) - exec (stmt) - else: - return childCfg - - # Get Configurable Class if exists - from AthenaCommon.ConfigurableDb import getConfigurable - cfg_class = getConfigurable(self.getName(), assumeCxxClass=True) - - if not cfg_class : - self._log.warning('Configurable class: %s not found' % (self.getName())) - return None - - alias = self.getAlias().split('.')[-1] - from AthenaCommon import CfgMgr - # Executable statement - stmt = 'parentCfg += CfgMgr.%(cfg_class)s(name="%(cfg_name)s", %(properties)s)' - stmt = stmt % {'cfg_class' : cfg_class.__name__, 'cfg_name' : alias, 'properties' : self.formatPropertiesForCfgInit(cfg_class)} - - if parentCfg.getProperties().has_key(alias) : - cfgPropertyType = ('%s' % (type(parentCfg.getProperties()[alias]))).replace('<class ','').replace('<type ','').replace("'",'') - cfgPropertyType = cfgPropertyType[:len(cfgPropertyType)-1] - - if cfgPropertyType in ('GaudiKernel.GaudiHandles.ServiceHandle', - 'GaudiKernel.GaudiHandles.PublicToolHandle','GaudiKernel.GaudiHandles.PrivateToolHandle') : - - stmt = 'parentCfg .%(property_name)s = CfgMgr.%(cfg_class)s(name="%(cfg_name)s", %(properties)s)' - stmt = stmt % {'property_name' : alias, 'cfg_class' : cfg_class.__name__, 'cfg_name' : alias, - 'properties' : self.formatPropertiesForCfgInit(cfg_class)} - - try : - self._log.verbose('Execute %s' % (stmt)) - exec(stmt) - except TypeError, exc: - # TypeError: attempt to redefine type of "Time" (was: TrigTimeHistTool, new: TrigTimeHistToolConfig) - if exc.message.startswith('attempt to redefine type of "%s"' % (alias)): - from AthenaCommon.Configurable import Configurable - existingCfg = Configurable.allConfigurables[alias] - # Check the type of the existing configurable - if OK use the python information - if existingCfg.getType() == self.getName() : - self.py_name = str(existingCfg.__class__)[6:].strip('\' >').split('.')[-1] - self.py_package = str(existingCfg.__module__) - childCfg = None - if childCfg == None : childCfg = self.setCfgChildPyWithProperties(parentCfg) - if childCfg == None : childCfg = self.setCfgChildPy(parentCfg) - if childCfg == None : childCfg = self.setCfgChildPyFunc(parentCfg) - if childCfg : return childCfg - else: - self._log.debug('Child %s/%s not set: %s' % (self.getName(), self.getAlias(), exc.message)) - except Exception, exc: - self._log.debug('Child %s/%s not set: %s' % (self.getName(), self.getAlias(), exc.message)) - - # Search the children of the parent for the child - cfg = None - for cCfg in parentCfg.getAllChildren() : - cCfgAttributes = {"alias": cCfg.getName().split('.')[-1], - "name": cCfg.getType().split('.')[-1]} - if cCfgAttributes == attributes: - cfg = cCfg - - return cfg - - def setCfgChildCpp(self, parentCfg): - self.setlog() - - # Test whether the parent configurable doesn't already have a child with the same name - childCfg = None - attributes = {"alias": self.getAlias().split('.')[-1], "name": self.getName().split('.')[-1]} - childAttributes = {"alias": None, "name": None} - for cCfg in parentCfg.getAllChildren() : - cCfgAttributes = {"alias": cCfg.getName().split('.')[-1], "name": cCfg.getType().split('.')[-1]} - - if cCfgAttributes['alias'] == attributes['alias']: - childCfg = cCfg - childAttributes = cCfgAttributes - if cCfgAttributes == attributes : # 100% match - can't be better - return the configurable - return childCfg - - # Child exists - type of the child differs - test if it is not a derived configurable - if childCfg : - # Try to set the properties - if succesfull return the childCfg - propertiesSet = self.setConfigurableProperties(childCfg) - if not propertiesSet: - self._log.warning('Delete existing configurable %s/%s', (existing_cfg_type,cfg_name)) - from TrigConfOffline.HLTConfOffline import eraseConfigurable - eraseConfigurable(childCfg, self._log) - del childCfg - if parentCfg.getProperties().has_key(childAttributes['alias']) : - stmt = 'parentCfg.%s = None' % (childAttributes['alias']) - self._log.verbose('Execute: %s' % (stmt)) - exec (stmt) - else: - return childCfg - - # Get Configurable Class if exists - from AthenaCommon.ConfigurableDb import getConfigurable - cfg_class = getConfigurable(self.getName(), assumeCxxClass=True) - - if not cfg_class : - self._log.warning('Configurable class: %s not found' % (self.getName())) - return None - - alias = self.getAlias().split('.')[-1] - from AthenaCommon import CfgMgr - # Executable statement - stmt = 'parentCfg += CfgMgr.%(cfg_class)s(name="%(cfg_name)s")' - stmt = stmt % {'cfg_class' : cfg_class.__name__, 'cfg_name' : alias} - - if parentCfg.getProperties().has_key(alias) : - cfgPropertyType = ('%s' % (type(parentCfg.getProperties()[alias]))).replace('<class ','').replace('<type ','').replace("'",'') - cfgPropertyType = cfgPropertyType[:len(cfgPropertyType)-1] - - if cfgPropertyType in ('GaudiKernel.GaudiHandles.ServiceHandle', - 'GaudiKernel.GaudiHandles.PublicToolHandle','GaudiKernel.GaudiHandles.PrivateToolHandle') : - - stmt = 'parentCfg .%(property_name)s = CfgMgr.%(cfg_class)s(name="%(cfg_name)s")' - stmt = stmt % {'property_name' : alias, 'cfg_class' : cfg_class.__name__, 'cfg_name' : alias} - - try : - self._log.verbose('Execute %s' % (stmt)) - exec(stmt) - except TypeError, exc: - # TypeError: attempt to redefine type of "Time" (was: TrigTimeHistTool, new: TrigTimeHistToolConfig) - if exc.message.startswith('attempt to redefine type of "%s"' % (alias)): - from AthenaCommon.Configurable import Configurable - existingCfg = Configurable.allConfigurables[alias] - # Check the type of the existing configurable - if OK use the python information - if existingCfg.getType() == self.getName() : - self.py_name = str(existingCfg.__class__)[6:].strip('\' >').split('.')[-1] - self.py_package = str(existingCfg.__module__) - childCfg = None - if childCfg == None : childCfg = self.setCfgChildPyWithProperties(parentCfg) - if childCfg == None : childCfg = self.setCfgChildPy(parentCfg) - if childCfg == None : childCfg = self.setCfgChildPyFunc(parentCfg) - if childCfg : return childCfg - else: - self._log.debug('Child %s/%s not set: %s' % (self.getName(), self.getAlias(), exc.message)) - except Exception, exc: - self._log.debug('Child %s/%s not set: %s' % (self.getName(), self.getAlias(), exc.message)) - - # Search the children of the parent for the child - cfg = None - for cCfg in parentCfg.getAllChildren() : - cCfgAttributes = {"alias": cCfg.getName().split('.')[-1], - "name": cCfg.getType().split('.')[-1]} - if cCfgAttributes == attributes: - cfg = cCfg - - return cfg - - # Sets the child of the cfg by appending it to the PrivateToolHandleArray - # Returns True in case of success - def appendToPrivToolArray(self, cfg, property) : - alias = self.getAlias().split('.')[-1] - childCfg = None - # Test if the child doesn't exists yet - attributes = {"alias": alias, - "name": self.getName(), - "py_name": self.py_name, - "py_package": self.py_package} - childAttributes = {"alias": None, "name": None, "py_name": None, "py_package": None} - for child in cfg.getAllChildren() : - py_class = str(child.__class__)[6:].strip('\' >').split('.')[-1] - py_package = str(child.__module__) - cAttributes = {"alias": child.getName().split('.')[-1], - "name": child.getType().split('.')[-1], - "py_name": py_class, - "py_package": py_package} - - if cAttributes['alias'] == attributes['alias']: - childCfg = child - childAttributes = cAttributes - if childAttributes == attributes : # 100% match - can't be better - return the configurable - break - - # Child exists but it does not agree with the setting - delete it - if childCfg and childAttributes != attributes: - from TrigConfOffline.HLTConfOffline import eraseConfigurable - eraseConfigurable(childCfg, self._log) - del childCfg - - # Append child to the PrivateToolArray - if childCfg : - matchingCfg = False - # Check if the child is not already in the PrivateToolHandleArray - for child in cfg.getProperties()[property] : - cJobOptName = None - try: - cJobOptName = child.getFullJobOptName() - except: - pass - if cJobOptName == childCfg.getFullJobOptName() : - matchingCfg = True - break - if not matchingCfg : - stmt = "cfg.%s += [childCfg]" % (property) - try: - exec stmt - except: # Sometimes an exception occurs because same child - pass - - if childCfg : - success = self.setConfigurableProperties(childCfg) - return childCfg - - # The childCfg is not existing yet - thus needs to be appended - success = False - if not success : success = self.appendToPrivToolArrayPyWithProperties(cfg,property) - if not success : success = self.appendToPrivToolArrayPy(cfg,property) - if not success : success = self.appendToPrivToolArrayPyFunc(cfg,property) - if not success : success = self.appendToPrivToolArrayCppWithProperties(cfg,property) - if not success : success = self.appendToPrivToolArrayCpp(cfg,property) - - # Test if the child was assigned - for child in cfg.getProperties()[property] : - if child.getName() == alias : - childCfg = child - break - - # Set the properties of the child - if childCfg : self.setConfigurableProperties(childCfg) - - return childCfg - - # Python Class with properties style - def appendToPrivToolArrayPyWithProperties(self, cfg, property) : - output = False - self.setlog() - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return False - # Test if the properties exists - if len(self.getProperties()) <= 0 : - return False - - # Try to import the package and the class - import_stmt = "from %s.%s import %s" % (self.py_package, self.py_name, self.py_name) - try: - self._log.verbose('Import configurable: %s' % (import_stmt)) - exec import_stmt - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return False - - # Assign the python class to cfg - alias = self.getAlias().split('.')[-1] - assign_stmt = "cfg.%s += [%s(name = '%s', %s)]" % (property, self.py_name, alias, self.formatPropertiesForCfgInit()) - - # Try the statement - try : - self._log.verbose('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - output = True - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return False - - return output - - # Python Class style - def appendToPrivToolArrayPy(self, cfg, property) : - output = False - self.setlog() - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return False - - # Try to import the package and the class - import_stmt = "from %s.%s import %s" % (self.py_package, self.py_name, self.py_name) - try: - self._log.verbose('Import configurable: %s' % (import_stmt)) - exec import_stmt - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return False - - # Assign the python class to cfg - alias = self.getAlias().split('.')[-1] - assign_stmt = "cfg.%s += [%s(name = '%s')]" % (property, self.py_name, alias) - - # Try the statement - try : - self._log.verbose('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - output = True - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return False - - return output - - # Python Func style - def appendToPrivToolArrayPyFunc(self, cfg, property) : - output = False - self.setlog() - # 1st try if there is a python package and python class and they have some value - if not (self.__dict__.has_key('py_name') and - self.__dict__.has_key('py_package') and - self.py_name != '' and - self.py_package != ''): - return False - - # Try to import the package and the class - import_stmt = "from %s import %s" % (self.py_package, self.py_name) - try: - self._log.verbose('Import configurable: %s' % (import_stmt)) - exec import_stmt - except Exception, exc: - self._log.debug('Exception occured: %s' % (exc.message)) - return False - - # Assign the python class to cfg - alias = self.getAlias().split('.')[-1] - assign_stmt = "cfg.%s += [%s(name=\"%s\")]" % (property, self.py_name, alias) - - # Try the statement - try : - self._log.verbose('Assign configurable: %s' % (assign_stmt)) - exec assign_stmt - output = True - except Exception, exc: - self._log.debug('%s' % (exc.message)) - return False - - return output - - # Cpp with properties style - def appendToPrivToolArrayCppWithProperties(self, cfg, property) : - self.setlog() - output = False - # Test if the properties exists - if len(self.getProperties()) <= 0 : - return False - - # Get Configurable Class if exists - from AthenaCommon.ConfigurableDb import getConfigurable - cfg_class = getConfigurable(self.getName(), assumeCxxClass=True) - - if not cfg_class : - self._log.warning('Configurable class: %s not found' % (self.getName())) - return False - - alias = self.getAlias().split('.')[-1] - from AthenaCommon import CfgMgr - # Executable statement - stmt = 'cfg.%(property)s += [CfgMgr.%(cfg_class)s(name="%(cfg_name)s", %(properties)s)]' - stmt = stmt % {'property':property, 'cfg_class':cfg_class.__name__, 'cfg_name':alias, 'properties':self.formatPropertiesForCfgInit(cfg_class)} - - try : - self._log.verbose('Execute %s' % (stmt)) - exec(stmt) - output = True - except Exception, exc: - self._log.debug('Child %s/%s not set: %s' % (self.getName(), self.getAlias(), exc.message)) - return output - - # Cpp style - def appendToPrivToolArrayCpp(self, cfg, property) : - self.setlog() - output = False - - # Get Configurable Class if exists - from AthenaCommon.ConfigurableDb import getConfigurable - cfg_class = getConfigurable(self.getName(), assumeCxxClass=True) - - if not cfg_class : - self._log.warning('Configurable class: %s not found' % (self.getName())) - return False - - alias = self.getAlias().split('.')[-1] - from AthenaCommon import CfgMgr - # Executable statement - stmt = 'cfg.%(property)s += [CfgMgr.%(cfg_class)s(name="%(cfg_name)s")]' - stmt = stmt % {'property':property, 'cfg_class':cfg_class.__name__, 'cfg_name':alias} - - try : - self._log.verbose('Execute %s' % (stmt)) - exec(stmt) - output = True - except Exception, exc: - self._log.debug('Child %s/%s not set: %s' % (self.getName(), self.getAlias(), exc.message)) - - return output - -# Functions which doesn't need to be class method - but used in the class -def setCfgProperty(cfg, property_name, property_value, logger=None): - ## Try to set the configurable property - if successfull return True - # Return value - output = False - # Set logger if needed - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.setCfgProperty') - #import logging - #logger=logging.getLogger('compareCfgProperty') - #logger.setLevel(logging.INFO) - #ch = logging.StreamHandler() - #ch.setLevel(logging.INFO) - #formatter = logging.Formatter("%(name)s - %(levelname)s\t%(message)s") - #ch.setFormatter(formatter) - #logger.addHandler(ch) - - #logger.verbose("Set: %s.%s = %s" % (cfg.getFullJobOptName(), property_name, property_value)) - - # Test original value for a type etc. - origValue = None - if property_name in cfg.getProperties().keys() : - origValue = cfg.getProperties()[property_name] - - if compareCfgProperty(cfg, property_name, property_value) : - #logger.verbose("No need to set the property - original and new value are equal") - return True - - # 1st attempt - try the brute force - if not output : output = setCfgPropertyNoPreFormat(cfg, property_name, property_value, logger) - # 2nd - try the string format - if not output : output = setCfgPropertyStrFormat(cfg, property_name, property_value, logger) - # 3rd - try the list format - if not output : output = setCfgPropertyListFormat(cfg, property_name, property_value, logger) - # 4th - try the Gaudi format - if not output : output = setCfgPropertyGaudiHandleFormat(cfg, property_name, property_value, logger) - - return output - -# Set the property without preformating the value -def setCfgPropertyNoPreFormat(cfg, property_name, property_value, logger=None): - ## Brute force set of the property - # Set logger if needed - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.setCfgPropertyNoPreFormat') - #import logging - #logger=logging.getLogger('compareCfgProperty') - #logger.setLevel(logging.INFO) - #ch = logging.StreamHandler() - #ch.setLevel(logging.INFO) - #formatter = logging.Formatter("%(name)s - %(levelname)s\t%(message)s") - #ch.setFormatter(formatter) - #logger.addHandler(ch) - - #logger.verbose("Set: %s.%s = %s" % (cfg.getFullJobOptName(), property_name, property_value)) - - stmt = "cfg.%s = %s" % (property_name,property_value) - # Format the setting of type string - if isinstance(property_value, str) : - stmt = "cfg.%s = '%s'" % (property_name,property_value) - - try : - logger.verbose(stmt) - exec(stmt) - except Exception, exc: - logger.debug('%s.%s = %s can not be set: %s' % (cfg.getFullName(), property_name, property_value, exc.message)) - return False - - return compareCfgProperty(cfg, property_name, property_value) - -# Set the property preformating the value to string -def setCfgPropertyStrFormat(cfg, property_name, property_value, logger=None): - ## Brute force set of the property - # Set logger if needed - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.setCfgPropertyStrFormat') - #import logging - #logger=logging.getLogger('compareCfgProperty') - #logger.setLevel(logging.INFO) - #ch = logging.StreamHandler() - #ch.setLevel(logging.INFO) - #formatter = logging.Formatter("%(name)s - %(levelname)s\t%(message)s") - #ch.setFormatter(formatter) - #logger.addHandler(ch) - - logger.verbose("Set: %s.%s = \'%s\'" % (cfg.getFullJobOptName(), property_name, str(property_value))) - - stmt = "cfg.%s = '%s'" % (property_name,str(property_value)) - try : - logger.verbose(stmt) - exec(stmt) - except Exception, exc: - logger.debug('%s.%s = \'%s\' can not be set: %s' % (cfg.getFullName(), property_name, property_value, exc.message)) - return False - - return compareCfgProperty(cfg, property_name, property_value) - -# Set the property preformating the value for List type -def setCfgPropertyListFormat(cfg, property_name, property_value, logger=None): - ## Brute force set of the property - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.setCfgPropertyListFormat') - #import logging - #logger=logging.getLogger('compareCfgProperty') - #logger.setLevel(logging.INFO) - #ch = logging.StreamHandler() - #ch.setLevel(logging.INFO) - #formatter = logging.Formatter("%(name)s - %(levelname)s\t%(message)s") - #ch.setFormatter(formatter) - #logger.addHandler(ch) - - logger.verbose("Set: %s.%s = \'%s\'" % (cfg.getFullJobOptName(), property_name, str(property_value))) - - origValue = None - if property_name in cfg.getProperties().keys(): - origValue = cfg.getProperties()[property_name] - - # Check the type of the original value: - if not isinstance(origValue,list): return False - - # Erase the original list: - stmt = "cfg.%s = %s" % (property_name,[]) - try: - logger.verbose("Erase original list: %s" %(stmt)) - exec(stmt) - except Exception, exc: - logger.debug('Can not erase original list %s.%s: %s' % (cfg.getFullName(), property_name, exc.message)) - return False - - # Try to set value at once: - stmt = "cfg.%s = %s" % (property_name,property_value) - try : - logger.verbose(stmt) - exec(stmt) - # Compare the value - if equal return True - if compareCfgProperty(cfg, property_name, property_value) : return True - except Exception, exc: - logger.debug('%s.%s = %s can not be set: %s' % (cfg.getFullName(), property_name, property_value, exc.message)) - - # Value can not be set at once - will sequentially - # 1st erase the mess left after previous actions: - stmt = "cfg.%s = %s" % (property_name,[]) - logger.verbose("Erase the list: %s" %(stmt)) - exec(stmt) - - # Go item by item and append it: - for item in property_value : - stmt = "cfg.%s += [%s]" % (property_name, item) - if isinstance(item, str) : - stmt = "cfg.%s += [\'%s\']" % (property_name, item) - - try : - logger.verbose(stmt) - exec(stmt) - except Exception, exc: - logger.debug('%s.%s = %s can not be set: %s' % (cfg.getFullName(), property_name, property_value, exc.message)) - return False - - # Compare the value and return the result of the comparison - return compareCfgProperty(cfg, property_name, property_value) - -# Set the property preformating the value to string -def setCfgPropertyGaudiHandleFormat(cfg, property_name, property_value, logger=None): - ## Brute force set of the property - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.setCfgPropertyGaudiHandleFormat') - #import logging - #logger=logging.getLogger('compareCfgProperty') - #logger.setLevel(logging.INFO) - #ch = logging.StreamHandler() - #ch.setLevel(logging.INFO) - #formatter = logging.Formatter("%(name)s - %(levelname)s\t%(message)s") - #ch.setFormatter(formatter) - #logger.addHandler(ch) - - logger.verbose("Set: %s.%s = %s" % (cfg.getFullJobOptName(), property_name, property_value)) - - cfgPropertyType = None - if property_name in cfg.getProperties().keys() : - cfgPropertyType = ('%s' % (type(cfg.getProperties()[property_name]))).replace('<class ','').replace('<type ','').replace("'",'') - cfgPropertyType = cfgPropertyType[:len(cfgPropertyType)-1] - - if cfgPropertyType not in ( 'GaudiKernel.GaudiHandles.ServiceHandleArray', - 'GaudiKernel.GaudiHandles.ServiceHandle', - 'GaudiKernel.GaudiHandles.PrivateToolHandleArray', - 'GaudiKernel.GaudiHandles.PrivateToolHandle', - 'GaudiKernel.GaudiHandles.PublicToolHandleArray', - 'GaudiKernel.GaudiHandles.PublicToolHandle') : - return False - - # Import needed Gaudi classes - from GaudiKernel.GaudiHandles import PublicToolHandle,PublicToolHandleArray,PrivateToolHandle,PrivateToolHandleArray,ServiceHandle,ServiceHandleArray - - # Compose the executable statement - stmt = '' - if cfgPropertyType == 'GaudiKernel.GaudiHandles.PublicToolHandle' : - stmt = "cfg.%s = PublicToolHandle('%s')" % (property_name,property_value) - if cfgPropertyType == 'GaudiKernel.GaudiHandles.PublicToolHandleArray' : - stmt = "cfg.%s = PublicToolHandleArray(%s)" % (property_name,property_value) - if cfgPropertyType == 'GaudiKernel.GaudiHandles.PrivateToolHandle' : - stmt = "cfg.%s = PrivateToolHandle('%s')" % (property_name,property_value) - if cfgPropertyType == 'GaudiKernel.GaudiHandles.PrivateToolHandleArray' : - stmt = "cfg.%s = PrivateToolHandleArray(%s)" % (property_name,property_value) - if cfgPropertyType == 'GaudiKernel.GaudiHandles.ServiceHandle' : - stmt = "cfg.%s = ServiceHandle('%s')" % (property_name,property_value) - if cfgPropertyType == 'GaudiKernel.GaudiHandles.ServiceHandleArray' : - stmt = "cfg.%s = ServiceHandleArray('%s')" % (property_name,property_value) - - try : - logger.verbose(stmt) - exec(stmt) - except Exception, exc: - logger.debug('%s.%s = %s can not be set: %s' % (cfg.getFullName(), property_name, property_value, exc.message)) - return False - - return compareCfgProperty(cfg, property_name, property_value) - -def compareCfgProperty(cfg, property_name, property_value, logger=None): - ## compare cfg property with the value - - # Set logger if needed - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.compareCfgProperty') - #import logging - #logger=logging.getLogger('compareCfgProperty') - #logger.setLevel(logging.INFO) - #ch = logging.StreamHandler() - #ch.setLevel(logging.INFO) - #formatter = logging.Formatter("%(name)s - %(levelname)s\t%(message)s") - #ch.setFormatter(formatter) - #logger.addHandler(ch) - - - - # Get the original value if exists - origValue = None - if property_name in cfg.getProperties().keys() : - origValue = cfg.getProperties()[property_name] - else : - logger.debug("Property: %s.%s doesn't exist" % (cfg.getFullJobOptName(), property_name)) - return False - - - #logger.verbose("Compare: %s.%s: %s vs. %s" % (cfg.getFullJobOptName(), property_name, origValue , property_value)) - - # Normal comparison - if origValue == property_value : return True - # Empty values comparison - if origValue == '<no value>' and (property_value=='' or property_value==None) : return True - - # Special type properties comparison - cfgPropertyType = ('%s' % (type(origValue))).replace('<class ','').replace('<type ','').replace("'",'') - cfgPropertyType = cfgPropertyType[:len(cfgPropertyType)-1] - - # Reformat the value of the cfg property if GaudiHandleArray - if cfgPropertyType in ( 'GaudiKernel.GaudiHandles.ServiceHandleArray', - 'GaudiKernel.GaudiHandles.PublicToolHandleArray') : - origValue = str(origValue).split()[1:] - if str(origValue) == str(property_value) : return True - - # Compare the PrivateToolHandle property - if cfgPropertyType == 'GaudiKernel.GaudiHandles.PrivateToolHandle': - try: - origValue = '/'.join([origValue.getType(), origValue.getName()]) - except : - pass - if str(origValue) == str(property_value) : return True - - # Compare the PrivateToolHandleArray property - if cfgPropertyType == 'GaudiKernel.GaudiHandles.PrivateToolHandleArray': - valueToCompare = origValue.toStringProperty() - try : - valueToCompare = eval(valueToCompare) - except : - pass - #for item in origValue : - #try : - #valueToCompare.append('/'.join([item.getType(),item.getName()])) - #except : - #valueToCompare.append(item) - valueToCompare.sort() - property_value.sort() - #logger.verbose("Mirek: compareCfgProperty %s vs. %s" % (property_value, valueToCompare)) - origValue = valueToCompare - if str(origValue) == str(property_value) : return True - - # On this place the cfg value and property_value differs - # Only a debugging think - if type({}) == type(origValue) and type({}) == type(property_value) and str(origValue) != str(property_value): - logMessage = '' - for k,v in origValue.items() : - if property_value.has_key(k) : - if property_value[k] != v : - logMessage += "\tValue difference key %s: %s vs. %s\n" % (k, v , property_value[k]) - else : - logMessage += "\nKey %s not in the property_value\n" % (k) - - for k,v in property_value.items() : - if not origValue.has_key(k) : - logMessage += "\nKey %s not in the cfg property\n" % (k) - - if logMessage : logger.debug(logMessage) - - # Just in case - if str(origValue) == str(property_value) : return True - - return False - - -## Compare 2 HLT algorithms and print out the differences -# @param alg1 Algorithm 1 -# @param alg2 Algorithm 2 -# @param pattern Bit patttern what should be compared -# @param prepend Prepend string for print out -# @return string - formatted for pretty print out -def diffHLTAlgorithms(alg1, alg2, pattern=0xffff, prepend='') : - if prepend=='' : prepend = '\t' - output = "" - # Compare Alias - if ((0x1 << 0) & pattern) : - if(alg1.getAlias()!=alg2.getAlias()) : - output += '%s| Alias differs:\t%s vs. %s\n' % (prepend, alg1.getAlias(), alg2.getAlias()) - - # Compare Name - if ((0x1 << 1) & pattern) : - if(alg1.getName()!=alg2.getName()) : - output += '%s| Name differs:\t%s vs. %s\n' % (prepend, alg1.getName(), alg2.getName()) - - # Compare Python Name - if ((0x1 << 2) & pattern) : - if(alg1.getPy_name()!=alg2.getPy_name()) : - output += '%s| Python name differs:\t%s vs. %s\n' % (prepend, alg1.getPy_name(), alg2.getPy_name()) - - # Compare Python Package - if ((0x1 << 3) & pattern) : - if(alg1.getPy_package()!=alg2.getPy_package()) : - output += '%s| Python package differs:\t%s vs. %s\n' % (prepend, alg1.getPy_package(), alg2.getPy_package()) - - # Compare Python Package - if ((0x1 << 4) & pattern) : - if(alg1.getType()!=alg2.getType()) : - output += '%s| Type differs:\t%s vs. %s\n' % (prepend, alg1.getType(), alg2.getType()) - - # Compare Properties - if ((0x1 << 8) & pattern) and alg1.getProperties() != alg2.getProperties(): - output += '%s| Properties differ:\n' % (prepend) - prop1 = alg1.getProperties() - prop2 = alg2.getProperties() - - # Find missing properties alg2 - for key in prop1.keys() : - if key not in prop2.keys() : - output += '%s| 2: %s%s/%s: has no property %s\n' % (prepend, prepend, alg2.getName(), alg2.getAlias(), key) - - # Find missing properties alg1 - for key in prop2.keys() : - if key not in prop1.keys() : - output += '%s| 1: %s%s/%s: has no property %s\n' % (prepend, prepend, alg1.getName(), alg1.getAlias(), key) - - # Compare values - for key in prop1.keys(): - if key != 'OutputLevel' and key in prop2.keys() and prop1[key] != prop2[key] : - output += '%s| %s%s: %s vs. %s\n' % (prepend, prepend, key, prop1[key], prop2[key]) - - # Compare child algorithms - if ((0x1 << 12) & pattern): - # Get missing children of alg2 - for child in alg1.getChildren() : - if not alg2.getChild(child.getAlias()) : - output += "%s| 2: %s/%s has no child %s/%s\n" % (prepend,alg2.getName(), alg2.getAlias(), child.getName(), child.getAlias()) - - # Get missing children of alg1 - for child in alg2.getChildren() : - if not alg1.getChild(child.getAlias()) : - output += "%s| 1: %s/%s has no child %s/%s\n" % (prepend,alg1.getName(), alg1.getAlias(), child.getName(), child.getAlias()) - - # Compare the children: - for child1 in alg1.getChildren() : - child2 = alg2.getChild(child1.getAlias()) - if child2 : - output += diffHLTAlgorithms(child1, child2, pattern, prepend+prepend[0]) - - if output!='' : - head = '%s/%s 1: %s/%s vs. 2: %s/%s %s\n' % (prepend,'='*30, alg1.getName(), alg1.getAlias(), alg2.getName(), alg2.getAlias(), '='*30) - end = '%s\%s 1: %s/%s vs. 2: %s/%s %s\n' % (prepend,'='*30, alg1.getName(), alg1.getAlias(), alg2.getName(), alg2.getAlias(), '='*30) - output = head + output + end - - return output - - - - - - - - - - - - - - - - - - - - - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTConfOffline.py b/Trigger/TrigConfiguration/TrigConfOffline/python/HLTConfOffline.py deleted file mode 100644 index 704c70799842c563eed149937ff423a16280dbee..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTConfOffline.py +++ /dev/null @@ -1,1547 +0,0 @@ -########################################################################### -# Copyright (C) 2008 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Copyright: See COPYING file that comes with this distribution -# -########################################################################### -doNotSetPropertiesCfgName = ['EventSelector'] - -class HLTConfOfflineError(Exception): - pass - -## Main Class of @package -# Basic usage: -# from TrigConfOffline.HLTConfOffline import HLTConfOffline -# hltConfOffline = HLTConfOffline() -# hltConfOffline.SMKey = 73 -# htConfOffline.load() -class HLTConfOffline(object) : - ## @var List of supported attributes - # - _properties = ('dbType','dbHost','dbUser','dbPasswd','dbName', - 'setupSource','rulesSource', 'OutputLevel', - 'SMKey','HLTPrescaleKey','LVL1PrescaleKey','LVL1BunchGroupKey','Level','RunNumber') - - ## Initialize the HLTConOffline service - def __init__(self, *args, **kwargs) : - from AthenaCommon.Logging import logging - self.__dict__['_log'] = logging.getLogger('HLTConfOffline') - self._log.setLevel(3) - ## @var setupSource - # Source of the TrigConfiguration - # supported values: DBLookup ALIAS, Connection string, db - self.__dict__['setupSource'] = 'TRIGGERDB' - - ## @var dbType - # Database type - # Supported values: oracle, mysql, sqlite - self.dbType = '' - ## @var dbHost - # Database server - self.dbHost = '' - ## @var dbUser - # Database login - self.dbUser = '' - ## @var dbPasswd - # Database user password - self.dbPasswd = '' - ## @var dbName - # Database schema name - self.dbName = '' - - ## @var rulesSource Source of rules - # Supported values: xml file , db - self.rulesSource = 'offline_setup_rules.xml' - - ## @var SMKey - # Super Master Key - self.SMKey = -1 - ## @var HLTPrescaleKey - # HLT Prescale Key - self.HLTPrescaleKey = -1 - ## @var LVL1PrescaleKey - # LVL1 Prescale Key - self.LVL1PrescaleKey = -1 - self.LVL1BunchGroupKey = -1 - - ## @var Level Trigger Level - # Supported values BOTH, L2, EF, OL - self.Level = 'BOTH' - ## @var RunNumber - # Run number resp. lumi block - self.RunNumber = None - - ## @var OutputLevel - # Logger OutputLevel - self.OutputLevel = 3 - - for k,v in kwargs.items() : - self.__setattr__(k,v) - - ## Set logger - def setlog(self) : - if self.__dict__.has_key('OutputLevel'): - self._log.setLevel(self.OutputLevel) - else: - self._log.setLevel(3) - self._log.name = 'HLTConfOffline ' - - ## Set attributes of the class. - # Special treatment for RunNumber, setupSource and OutputLevel - def __setattr__(self, name, value) : - self.setlog() - #_properties = ('dbType','dbHost','dbUser','dbPaswd','dbName','setupSource','rulesSource','SMKey','HLTPre','LVL1Pre','Level','RunNumber') - if name in self._properties: - self._log.debug('Set property: %s = %s' % (name, value)) - if name=='RunNumber': - if isinstance(value,int): value='%d/0' % (value) - - if name=='setupSource': - value = self._setSetupSource(value) - - if name=='OutputLevel': - self._log.setLevel(value) - # After all the exceptions set the value - self.__dict__[name] = value - else: - self._log.warning('Unknown property: %s = %s - property not set' % (name, value)) - - ## Convert to string for printout - def __str__(self): - self.setlog() - output = "-"*80 + "\n" - string = "%s.%s" % (self.__module__,'HLTConfOffline') - output += "|" + " "*(39 - len(string)/2) + string +" "*(39 - len(string)/2) + "|\n" - output += "-"*80 + "\n" - - for k,v in self.__dict__.items() : - if k[0] == '_' : - # Skip the private properties - continue - elif k == 'dbPasswd' : - output += "\t%s = %s\n" % (k,"*"*len(v)) - elif k in self._properties : - output += "\t%s = %s\n" % (k,v) - - return output - - ## Process the connnection string - # @param connectionString Connection string for details see TrigConfigSvc.TrigConfigSvcUtils.py - def _setSetupSource(self, connectionString) : - output = connectionString - #self.setlog() - self._log.verbose("_setSetupSource(%s)" % (connectionString)) - - if connectionString != 'db' : - connectionParameters = interpretConnectionString(connectionString) - if connectionParameters.has_key('techno') :self.dbType = connectionParameters['techno'] - if connectionParameters.has_key('server'): self.dbHost = connectionParameters['server'] - if connectionParameters.has_key('schema'): self.dbName = connectionParameters['schema'] - if connectionParameters.has_key('user'): self.dbUser = connectionParameters['user'] - if connectionParameters.has_key('passwd'): self.dbPasswd = connectionParameters['passwd'] - if self.dbType == 'sqlite' and connectionParameters.has_key('filename'): self.dbHost = connectionParameters['filename'] - return connectionString - - ## Check the consistency of the data members - def _consistencyCheck(self) : - self.setlog() - self._log.verbose('Consistency check') - if not (self.__dict__.has_key('setupSource') and self.setupSource): - # Test the existence of neccesairy parameters: - dbParComplete = True - if dbParComplete and (not (self.__dict__.has_key('dbType') and self.dbType)) : dbParComplete = False - if dbParComplete and (not (self.__dict__.has_key('dbHost') and self.dbHost)) : dbParComplete = False - - # If there is a type of DB sqlite already enough parameters are present - if not (dbParComplete and self.dbType=='sqlite') : - if dbParComplete and not (self.__dict__.has_key('dbUser') and self.dbUser) : dbParComplete = False - if dbParComplete and not (self.__dict__.has_key('dbPasswd') and self.dbPasswd) : dbParComplete = False - if dbParComplete and self.dbType!='oracle' : - if dbParComplete and not (self.__dict__.has_key('dbName') and self.dbName) : dbParComplete = False - - if not dbParComplete: - self._log.fatal('No trigger setup source') - raise HLTConfOfflineError('No trigger setup source') - else : - self._log.warning('setupSource previously not set') - self.setupSource = 'db' - - # If rules source doesn't exist set default - if not self.__dict__.has_key('rulesSource') : - self.rulesSource='offline_setup_rules.xml' - #self._log.fatal('No rules source') - #raise HLTConfOfflineError('No rules source') - - # Check the manual setup of the DB parameters - try to be idiot resistant - if self.setupSource == 'db' : - if not (self.__dict__.has_key('dbType') and self.dbType) : - self._log.fatal('No DB Type specified') - raise HLTConfOfflineError('Inconsistent DB parameters') - - if not (self.__dict__.has_key('dbHost') and self.dbHost) : - self._log.fatal('No DB Host or sqlite file specified') - raise HLTConfOfflineError('Inconsistent DB parameters') - - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbUser') and self.dbUser) : - self._log.fatal('No DB User specified') - raise HLTConfOfflineError('Inconsistent DB parameters') - - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbPasswd') and self.dbPasswd) : - self._log.fatal('No DB Password specified') - raise HLTConfOfflineError('Inconsistent DB parameters') - - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbName') and self.dbName) : - if self.dbType=='oracle' : - self.dbName = self.dbUser - else : - self._log.fatal('No DB Name specified') - raise HLTConfOfflineError('Inconsistent DB parameters') - else : # Should not appear - but just in case user gets here - if not (self.__dict__.has_key('dbType') and self.dbType) : self._setSetupSource(self.setupSource) - if not (self.__dict__.has_key('dbHost') and self.dbHost) : self._setSetupSource(self.setupSource) - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbUser') and self.dbUser) : self._setSetupSource(self.setupSource) - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbPasswd') and self.dbPasswd) : self._setSetupSource(self.setupSource) - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbName') and self.dbName) : self._setSetupSource(self.setupSource) - - # Check the Run number and get the Trigger Keys - if self.__dict__.has_key('RunNumber') and self.RunNumber: - self._getDBKeysFromCool() - - # Check the Trigger Keys - if not self.__dict__.has_key('SMKey') or not self.SMKey or self.SMKey <= 0 : - self._log.fatal('Wrong SMKey %s' % (self.SMKey)) - raise HLTConfOfflineError('Wrong SMKey %s' % (self.SMKey)) - - if not self._checkLVL1PrescaleKey() : - self._log.fatal('Wrong LVL1 Prescale Key %s' % (self.LVL1PrescaleKey)) - #raise HLTConfOfflineError('Inconsistent LVL1PrescaleKey') - - if not self._checkHLTPrescaleKey() : - self._log.fatal('Wrong HLT Prescale Key %s' % (self.HLTPrescaleKey)) - #raise HLTConfOfflineError('Inconsistent HLTPrescaleKey') - - ## Get Trigger Keys from the COOL - # @param self Pointer to the object - # Use the run number and lumi block information - def _getDBKeysFromCool(self) : - self.setlog() - self._log.debug('Get DB Keys from Cool: Run/Lumi Block %s' % self.RunNumber) - runNumber=long(self.RunNumber.split('/')[0]) - lumiBlock=0 - if len(self.RunNumber.split('/')) > 1: lumiBlock=long(self.RunNumber.split('/')[1]) - - self._log.verbose('Run: %d (%s)' % (runNumber, type(runNumber))) - self._log.verbose('Lumi Block: %d (%s)' % (lumiBlock, type(lumiBlock))) - - from CoolConvUtilities import AtlCoolTool - dbconn='COOLONL_TRIGGER/COMP200' - self._log.verbose('DB connection %s' % dbconn) - cooltool = AtlCoolTool.AtlCoolTool(dbconn) - if(str(cooltool)=="Not connected"): - self._log.ERROR('COOL not connected') - return False - - self._log.verbose(cooltool) - - from PyCool import cool - limmin = cool.ValidityKeyMin - limmax = cool.ValidityKeyMax - limmin=(runNumber << 32)+lumiBlock - limmax=limmin+1 - self._log.verbose('IOV: %d - %d' % (limmin, limmax)) - - folder = cooltool.db.getFolder( "/TRIGGER/HLT/HltConfigKeys" ) - chansel=cool.ChannelSelection(0) - objs = folder.browseObjects( limmin,limmax,chansel) - - configKeys = {} - while objs.hasNext(): - obj=objs.next() - runNr = obj.since()>>32 - if runNr>1000000: continue - lumiBl = obj.since() & 0xFFFFFFFF - #runNr='%d/%d' % (runNr,lumiBl) - payload=obj.payload() - smk = payload['MasterConfigurationKey'] - hltpsk = payload['HltPrescaleConfigurationKey'] - confsrc = payload['ConfigSource'].split(',') - release = 'not known' - if len(confsrc)>1: - release = confsrc[1] - configKeys[runNr] = { "REL" : release, - "SMK" : smk, - "HLTPSK" : hltpsk, - "LVL1PSK" : []} - - folder = cooltool.db.getFolder( "/TRIGGER/LVL1/Lvl1ConfigKey" ) - objs = folder.browseObjects(limmin,limmax,chansel) - - while objs.hasNext(): - obj=objs.next() - runNr = obj.since()>>32 - if runNr>1000000: continue - lumiBl = obj.since() & 0xFFFFFFFF - #runNr='%d/%d' % (runNr,lumiBl) - payload=obj.payload() - l1psk = payload['Lvl1PrescaleConfigurationKey'] - if configKeys.has_key(runNr): - configKeys[runNr]["LVL1PSK"] += [l1psk] - else: - configKeys[runNr] = { "REL" : "-", - "SMK" : '-', - "HLTPSK" : '-', - "LVL1PSK" : [l1psk]} - - self._log.debug('Found Keys: %s' % (configKeys)) - if configKeys.has_key(runNumber) : - self.SMKey = configKeys[runNumber]['SMK'] - self.HLTPrescaleKey = configKeys[runNumber]['HLTPSK'] - if len(configKeys[runNumber]['LVL1PSK']) > 1 : - self._log.warning('Multiple L1 prescale keys found (%s) - assigning first' % (configKeys[runNumber]['LVL1PSK'])) - self.LVL1PrescaleKey = configKeys[runNumber]['LVL1PSK'][0] - else : - self._log.error('No trigger keys in COOL') - - return True - - ## Check the consistency of LVL1 Prescale and Super Master keys - def _checkLVL1PrescaleKey(self) : - #self.setlog() - if self.setupSource.lower().endswith('.xml'): - return True - cursor = self.connectDB() - prescaleKeys = self.getLVL1PrescaleKeys(cursor) - self._log.debug("SMKey=%d - available LVL1 prescale keys: %s" % (self.SMKey, prescaleKeys)) - cursor.close() - check = False - - if self.__dict__.has_key('LVL1PrescaleKey'): - if self.LVL1PrescaleKey and self.LVL1PrescaleKey > 0: - if self.LVL1PrescaleKey not in prescaleKeys : - self._log.error('Wrong LVL1PrescaleKey %d: available keys for SMKey=%d : %s)' % (self.LVL1PrescaleKey, self.SMKey, prescaleKeys)) - #raise HLTConfOfflineError('Wrong LVL1PrescaleKey: available keys for SMKey=%d : %s)' % (self.SMKey, prescaleKeys)) - else : - check = True - - # No LVL1 Prescale Key was set - if not check: - if len(prescaleKeys) == 1: - self.LVL1PrescaleKey = prescaleKeys[0] - self._log.info('LVL1PrescaleKey set to %d' % (self.LVL1PrescaleKey)) - check = True - else: - self._log.error('No LVL1PrescaleKey set: available keys for SMKey=%d : %s)' % (self.SMKey, prescaleKeys)) - #raise HLTConfOfflineError('No LVL1PrescaleKey set: available keys for SMKey=%d : %s)' % (self.SMKey, prescaleKeys)) - - return check - - ## Check the consistency of HLT Prescale and Super Master keys - def _checkHLTPrescaleKey(self) : - #self.setlog() - if self.setupSource.lower().endswith('.xml'): - return True - cursor = self.connectDB() - prescaleKeys = self.getHLTPrescaleKeys(cursor) - self._log.debug("SMKey=%d - available HLT prescale keys: %s" % (self.SMKey, prescaleKeys)) - check = False - - if self.__dict__.has_key('HLTPrescaleKey'): - if self.HLTPrescaleKey and self.HLTPrescaleKey > 0: - if self.HLTPrescaleKey not in prescaleKeys : - raise HLTConfOfflineError('Wrong HLTPrescaleKey: available keys for SMKey=%d : %s)' % (self.SMKey, prescaleKeys)) - else : - check = True - - # No HLT Prescale Key was set - if not check: - if len(prescaleKeys) == 1: - self.HLTPrescaleKey = prescaleKeys[0] - check = True - else: - raise HLTConfOfflineError('No HLTPrescaleKey set: available keys for SMKey=%d : %s)' % (self.SMKey, prescaleKeys)) - - return check - - ## Load the Trigger Configuration setup - def loadSetup(self) : - self.setlog() - import time - start = time.time() - - import TrigConfOffline.HLTSetupLoader as HLTSetupLoader - hltsetuploader = HLTSetupLoader.SetupLoader(Source=self.setupSource, - dbType = self.dbType, - dbHost = self.dbHost, - dbUser = self.dbUser, - dbName = self.dbName, - dbPasswd = self.dbPasswd, - SMKey = self.SMKey, - Level = self.Level, - OutputLevel = self.OutputLevel) - - self._log.info('\n%s' % (hltsetuploader)) - - startAlg = time.time() - algorithms = hltsetuploader.load() - - self._log.info('%d algorithms loaded in %ds' % (len(algorithms),time.time()-startAlg)) - - # Check the prescale keys - self._checkHLTPrescaleKey() - self._checkLVL1PrescaleKey() - - for alg in algorithms : - #Exception for the L1/HLTConfigSvc - set the connection to the same DB - if (alg.getName(), alg.getAlias()) in (('TrigConf::HLTConfigSvc','HLTConfigSvc'),('TrigConf::LVL1ConfigSvc','LVL1ConfigSvc')): - #if (alg_name, alg_alias) == ('TrigConf::HLTConfigSvc','HLTConfigSvc') - self._log.info('Modify %s' % (alg)) - cfg_source = self.setupSource - - alg.setProperty('ConfigSource', self.dbType) - alg.setProperty('DBUser',self.dbUser) - alg.setProperty('DBServer',self.dbHost) - alg.setProperty('DBAccount',self.dbName) - alg.setProperty('DBSMKey',self.SMKey) - - if (alg.getName(), alg.getAlias()) == ('TrigConf::HLTConfigSvc','HLTConfigSvc'): - alg.setProperty('DBPassword',self.dbPasswd) - alg.setProperty('DBTable',self.dbName) - alg.setProperty('XMLMenuFile','') - if self.HLTPrescaleKey: - alg.setProperty('DBHLTPSKey',self.HLTPrescaleKey) - - if (alg.getName(), alg.getAlias()) == ('TrigConf::LVL1ConfigSvc','LVL1ConfigSvc'): - alg.setProperty('DBPass',self.dbPasswd) - alg.setProperty('XMLFile','') - if self.LVL1PrescaleKey: - alg.setProperty('DBLVL1PSKey',self.LVL1PrescaleKey) - - self._log.info('Modified %s' % (alg)) - - # Exception for the IOVDbSvc - disentangle the ConvertHLTSetup_txt2xml.py formating - #if (alg.getName(), alg.getAlias()) == ('IOVDbSvc','IOVDbSvc') : - #self._log.info('Modify %s' % (alg)) - #max_folder = alg.getProperties()['dbConnection'] - #folders = alg.getProperties()['Folders'] - #alg.setProperty('Folders' ,[]) - #for f in folders : - #if '<db>' not in f [:5] : - #f = '<db>%s</db>%s' % (max_folder,f) - #alg.getProperties()['Folders'].append(f) - #self._log.info('Modified %s' % (alg)) - - # Print out verbose message - if self.OutputLevel <= 1: - self._log.verbose('Algorithms before application of rules:') - for i in xrange(len(algorithms)): - self._log.verbose('\n%d\t%s' % (i, algorithms[i])) - - # Load and apply the rules - if self.rulesSource not in ('none','') : - startRules = time.time() - import TrigConfOffline.HLTOfflineRuleLoader as HLTOfflineRuleLoader - ruleloader = None - if self.rulesSource == "db": - ruleloader = HLTOfflineRuleLoader.OfflineRuleLoader(Source=self.rulesSource, - dbType = self.dbType, - dbHost = self.dbHost, - dbUser = self.dbUser, - dbName = self.dbName, - dbPasswd = self.dbPasswd, - SMKey = self.SMKey, - OutputLevel=self.OutputLevel ) - elif self.rulesSource: - ruleloader = HLTOfflineRuleLoader.OfflineRuleLoader(Source=self.rulesSource,OutputLevel=self.OutputLevel) - - if ruleloader : - self._log.debug("\n%s" % (ruleloader)) - rules = ruleloader.load() - - self._log.info('Rules loaded in %ds' % (time.time()-startRules)) - startRules = time.time() - nmod = 0 - - for r in rules: - nmod += r.apply(algorithms, self.OutputLevel) - - self._log.info('Offline to Online setup conversion in %ds' % (time.time()-startRules) ) - #for r in rules: - #if r._nactive == 0 : - #self._log.debug('Rule %s was not applied' % (r)) - - if self.OutputLevel <= 1: - self._log.verbose('Algorithms after application of rules:') - for i in xrange(len(algorithms)): - self._log.verbose('\n%d\t%s' % (i, algorithms[i])) - - else: - self._log.warning('No offline rules were loaded - continue with unmodified algorithms') - - stop = time.time() - self._log.info('HLT setup loaded in %ds' % (stop-start)) - - return algorithms - - ## Merge algorithms with the same alias - # @param algs List of algorithms - def mergeAlg(self, algs) : - self.setlog() - nmod = 0 - if isinstance(algs, list) : - # Loop over parent algorithms - merge them if needed - i = 0 - while i < len(algs): - firstLog = True - # Loop over remaining parent algorithms - ii = i+1 - while ii < len(algs) : - # Fix the unknowns if possible - if (algs[ii].getAlias() == algs[i].getAlias()) and (algs[i].getName().lower() in ('unknown','') or algs[ii].getName().lower() in ('unknown','')) : - if algs[i].getName().lower() in ('unknown','') and algs[ii].getName().lower() not in ('unknown','') : - self._log.debug('Fix the algorithm %s name %s to %s' % (algs[i].getAlias(),algs[i].getName(), algs[ii].getName())) - algs[i].setName(algs[ii].getName()) - - elif algs[ii].getName().lower() in ('unknown','') and algs[i].getName().lower() not in ('unknown','') : - self._log.debug('Fix the algorithm %s name %s to %s' % (algs[ii].getAlias(),algs[ii].getName(), algs[i].getName())) - algs[ii].setName(algs[i].getName()) - - if algs[ii].getName() == algs[i].getName() and algs[ii].getAlias() == algs[i].getAlias() : - success = False - if firstLog : - firstLog=False - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += '%s' % (algs[i]) - self._log.debug(messg) - - # If the algorithms are successfully merged - success = algs[i].mergeAlgorithm(algs[ii]) - - # Delete succesfully merged algorithm or increase the counter - if not success : - # Problems in merging of the algorithms - self._log.warning("Merging of the algorithms unsuccessfull - see previous error messages") - - # Increase the statistics counter - nmod += 1 - # Print log message for debugging - messg = "\n____________________________\n" - messg += "Algorithm will be deleted:\n" - messg += "----------------------------\n" - messg += '%s' % (algs[ii]) - self._log.debug(messg) - - # Use the delete method in order to delete possible references - algs[ii].delete() - del algs[ii] - - else: - # Increase counter if not matching - ii += 1 - - # End of loop over remaining parent algorithms - if not firstLog : - # Increase the statistics counter - nmod += 1 - # Print the log message for debugging - messg = "\n____________________________\n" - messg += "Algorithm after application:\n" - messg += "----------------------------\n" - messg += '%s' % (algs[i]) - self._log.debug(messg) - - i += 1 - # End of Loop over parent algorithms - - # Merge the children - use recursive method - for parentAlg in algs : - if parentAlg.hasChildren() : - nmod += self.mergeAlg(parentAlg.getChildren()) - #self.mergeAlg(parentAlg.getChildren()) - - return nmod - - ## Fix the child parent relation based on the alias of an algorithm - # @param algorithms List of HLTAlgorithm objects - def fixChildParentRelations(self, algorithms): - self.setlog() - if isinstance(algorithms, list) : - # Suppose the algorithms does not have parents - # Sorting of the algorithms accordingly to the alias assure the consequence of the parent and child - algorithms.sort(self.hltAlgAliases_cmp) - i = 0 - while i < len(algorithms): - alias = algorithms[i].getAlias() - # Remove the ToolSvc. from alias - if alias[:8] == 'ToolSvc.' : - alias = alias[8:] - - # Check the alias - if '.' in alias : - self._log.warning('Attempt to fix child algorithm %s/%s' % (algorithms[i].getName(), algorithms[i].getAlias())) - childAlias = algorithms[i].getAlias().split('.')[-1] - parentAlias = algorithms[i].getAlias().rstrip(childAlias) - parentAlias = parentAlias.rstrip('.') - - parentFound = False - flattenAlgs = [] - for ii in range(len(algorithms)) : - if ii != i : - flattenAlgs.extend(algorithms[ii].flattenAlg()) - - for alg in flattenAlgs : - if alg.getAlias() == parentAlias : - self._log.debug("Parent found: %s/%s - algorithm will be appended as child" % (alg.getName(), alg.getAlias())) - parentFound = True - alg.appendChild(algorithms[i]) - - # If the algorithm was assigned as a child alg to some parent - delete it - if parentFound : - self._log.debug("Appended algorithm %s/%s will be deleted from top parents list" % (algorithms[i].getName(), algorithms[i].getAlias())) - del algorithms[i] - else : - self._log.warning("No parent algorithm found for %s/%s" % (algorithms[i].getName(), algorithms[i].getAlias())) - i = i+1 - - else : - i = i+1 - - # Fix the children within the parents - for parent in algorithms : parent.fixChildren() - - ## Create a TrigConfiguration setup - # @param algorithms List of HLTAlgorithms which will be converted to the Configurable - def createSetup(self,algorithms): - self.setlog() - from AthenaCommon.Configurable import (ConfigurableAlgorithm, - ConfigurableService, - ConfigurableAlgTool, - ConfigurableAuditor) - # load configurable db and create the ToolSvc - from AthenaCommon.AppMgr import ToolSvc,ServiceMgr,theApp - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - - algs = [] - nservices = 0 - ntools = 0 - nauditors = 0 - nnocfg = 0 - cfgs = [] - applicationMgr = None - - algorithms.sort(compareSvcToolsAuditorsAlg) - #algorithms.sort(compareAlgToolsSvcAuditor) - - algcfg_pair = [] - # Create the configurables - for alg in algorithms : - # Exclude ApplicationMgr - set it as last - if (alg.getAlias(), alg.getName()) == ('ApplicationMgr', 'ApplicationMgr') : - applicationMgr = alg - algcfg_pair.append([alg,cfg]) - else : - cfg = alg.getConfigurable() - algcfg_pair.append([alg,cfg]) - self._log.debug('Algorithm:\n%s' % (alg)) - self._log.debug('Configurable:\n%s' % (cfg)) - if cfg : - cfgs.append(cfg) - if isinstance(cfg, ConfigurableAlgorithm): - algs.append({'cfg':cfg, 'topalg':alg.getTopAlg()}) - elif isinstance(cfg, ConfigurableService): - ServiceMgr += cfg - nservices += 1 - elif isinstance(cfg, ConfigurableAlgTool): - ToolSvc += cfg - ntools += 1 - elif isinstance(cfg, ConfigurableAuditor): - ServiceMgr.AuditorSvc += cfg - nauditors += 1 - else: - self._log.error('Not nested and not algorithm: %s' % (alg)) - else : - self._log.error('No configurable assigned for algorithm: %s' % (alg)) - nnocfg += 1 - - # Set the Configurable properties again - for alg,cfg in algcfg_pair : - if cfg: alg.setConfigurableProperties(cfg) - - # Assign the algorithms - algs.sort(self.alg_compare) - unbound_algs = [] - #for a in algs: - #alg_full_name = a['cfg'].getFullJobOptName() - #if alg_full_name in applicationMgr.getProperties()['TopAlg']: - #topSequence += a['cfg'] - #self._log.debug('Top algorithm %s set' %(alg_full_name)) - #elif not a['topalg'] : # In case there is no TopAlg - #unbound_algs.append(a['cfg']) - #else: - #cfg = a['cfg'] - #stmt = 'topSequence.%s += cfg' % (a['topalg'].split('/')[-1]) - #self._log.verbose('Execute %s' % (stmt)) - #exec(stmt) - #self._log.debug('Algorithm %s added to TopAlg %s' %(alg_full_name,a['topalg'])) - - for a in unbound_algs : - self._log.warning("Unbound algorithm: %s " % (a.getFullJobOptName())) - - # Set the ApplicationMgr - # Configure the ApplicationMgr - if applicationMgr.getProperties().has_key('EvtSel'): - oldEvtSel=theApp.getProperties()['EvtSel'] - evtSel = applicationMgr.getProperties()['EvtSel'] - if not (oldEvtSel == '' or oldEvtSel == '<no value>'): - self._log.debug('EventSelector defined: %s - keep the value (DB value %s)' % (oldEvtSel, evtSel)) - applicationMgr.getProperties()['EvtSel'] = oldEvtSel - - for n,v in applicationMgr.getProperties().items(): - stmt = 'theApp.%s = %s' - dflt_value = None - try : - dflt_value = theApp.__slots__[n] - except : - pass - if v == dflt_value: - continue - if isinstance(dflt_value,str): stmt = 'theApp.%s = "%s"' - stmt = stmt % (n,v) - if n=='CreateSvc' : - for vv in v: - self._log.debug('theApp.CreateSvc += [\'%s\']' % (vv)) - theApp.CreateSvc += [vv] - self._log.verbose('Value: theApp.CreateSvc=%s' % (theApp.CreateSvc)) - elif n=='ExtSvc' : - oldExtSvc=theApp.ExtSvc - theApp.ExtSvc = self.handleExtSvc(oldExtSvc, v) - self._log.verbose('Value: theApp.ExtSvc=%s' % (theApp.ExtSvc)) - elif n=='TopAlg' : - self._log.debug('Set: theApp.TopAlg = %s' % (v)) - setTopAlg(v,self._log) - self._log.verbose('Value: theApp.TopAlg=%s' % (theApp.TopAlg)) - else : - self._log.verbose('Execute %s' % (stmt)) - try: - exec(stmt) - self._log.verbose('Value theApp.%s set: %s' % (n, theApp.getProperties()[n])) - except Exception,err: - self._log.error('Can not set theApp.%s=%s :%s' % (n,v,err.message)) - - - self._log.info("Configurables in db: %d" % (len(algorithms))) - self._log.info("Algorithms set: %d" % (len(algs))) - self._log.info("Services set: %d" % (nservices)) - self._log.info("Tools set: %d" % (ntools)) - self._log.info("Auditors set: %d" % (nauditors)) - # The 1 is for the ApplicationMgr - not_set = len(algorithms) - len(algs) - nservices - ntools - nauditors - 1 - - if not_set != 0: - self._log.warning("Failed to restore %d configurables" % (not_set)) - - ## Special setting of the ApplicationMgr.ExtSvc property - # @param existingExtSvc pointer to the existing property - # @param addExtSvc values which has to be add to the existing property - # @return returns new value - def handleExtSvc(self, existingExtSvc, addExtSvc) : - self.setlog() - extSvcDict = self.extSvcListToDict(existingExtSvc) - extSvcDict = self.extSvcListToDict(addExtSvc, extSvcDict) - - output = [] - for k,v in extSvcDict.items() : - if v != '' : - output.append('%s/%s' %(v,k)) - else: - output.append(k) - return output - - ## Convert ApplicationMgr.ExtSvc to dictionairy - # @param extSvcList Input ApplicationMgr.ExtSvc - # @param existingDict Existing dictionairy - def extSvcListToDict(self, extSvcList, existingDict={}): - self.setlog() - extSvcDict = existingDict - # Process the existing ExtSvc to dictionary - for k in extSvcList: - svc_name=k - svc_type='' - if len(k.split('/'))==2 : - svc_type = k.split('/')[0] - svc_name = k.split('/')[1] - - saved_type = extSvcDict.get(svc_name, svc_type) - if saved_type != svc_type : - self._log.warning('Different job types for name: %s - existing: %s required: %s - existing will be kept' % (svc_name, saved_type, svc_type)) - else: - extSvcDict[svc_name] = svc_type - return extSvcDict - - def alg_compare(self, a1, a2) : - if a1['topalg'] == a1['cfg'].getFullJobOptName() : - return -1 - - if a2['topalg'] == a2['cfg'].getFullJobOptName() : - return 1 - - return cmp(a1['cfg'].getName(), a2['cfg'].getName()) - - def hltAlgAliases_cmp(self, a1, a2) : - if a1.getAlias()[:8] == 'ToolSvc.' and a2.getAlias()[:8] != 'ToolSvc.' : - return -1 - - if a2.getAlias()[:8] == 'ToolSvc.' and a1.getAlias()[:8] != 'ToolSvc.' : - return 1 - - return cmp(a1.getAlias(), a2.getAlias()) - - def connectDB(self): - self.setlog() - import TrigConfOffline.HLTSQLUtils as HLTSQLUtils - cursor = HLTSQLUtils.get_cursor(self.dbHost, self.dbUser, self.dbName, self.dbType, False, self.dbPasswd) - return cursor - - ## Get the HLT Prescale Keys - # @param cursor DB cursor - def getHLTPrescaleKeys(self, cursor) : - self.setlog() - prepend = "" - if self.dbType == "oracle" and self.dbName != self.dbUser : - prepend = "%s." % (self.dbName) - - query = " SELECT %sHLT_PRESCALE_SET.HPS_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - query += " JOIN %sHLT_MASTER_TABLE ON (%sSUPER_MASTER_TABLE.SMT_HLT_MASTER_TABLE_ID = %sHLT_MASTER_TABLE.HMT_ID) " % (prepend, prepend, prepend) - query += " JOIN %sHLT_TM_TO_PS ON (%sHLT_MASTER_TABLE.HMT_TRIGGER_MENU_ID = %sHLT_TM_TO_PS.HTM2PS_TRIGGER_MENU_ID) " % (prepend, prepend, prepend) - query += " JOIN %sHLT_PRESCALE_SET ON (%sHLT_PRESCALE_SET.HPS_ID = %sHLT_TM_TO_PS.HTM2PS_PRESCALE_SET_ID) " % (prepend, prepend, prepend) - query += " WHERE %sSUPER_MASTER_TABLE.SMT_ID=%s " % (prepend, self.SMKey) - - self._log.debug(query) - cursor.execute( query ) - result = cursor.fetchall() - if len(result) > 0 and len(result[0]) > 0: - prescaleKeys = [] - for t in result : - prescaleKeys.append(t[0]) - return prescaleKeys - else: - return None - - ## Get the LVL1 Prescale Keys - # @param cursor DB cursor - def getLVL1PrescaleKeys(self, cursor) : - self.setlog() - prepend = "" - if self.dbType == "oracle" and self.dbName != self.dbUser : - prepend = "%s." % (self.dbName) - - query = " SELECT %sL1_PRESCALE_SET.L1PS_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - query += " JOIN %sL1_MASTER_TABLE ON (%sSUPER_MASTER_TABLE.SMT_L1_MASTER_TABLE_ID = %sL1_MASTER_TABLE.L1MT_ID) " % (prepend, prepend, prepend) - query += " JOIN %sL1_TM_TO_PS ON (%sL1_MASTER_TABLE.L1MT_TRIGGER_MENU_ID = %sL1_TM_TO_PS.L1TM2PS_TRIGGER_MENU_ID) " % (prepend, prepend, prepend) - query += " JOIN %sL1_PRESCALE_SET ON (%sL1_PRESCALE_SET.L1PS_ID = %sL1_TM_TO_PS.L1TM2PS_PRESCALE_SET_ID) " % (prepend, prepend, prepend) - query += " WHERE %sSUPER_MASTER_TABLE.SMT_ID=%s " % (prepend, self.SMKey) - - self._log.debug(query) - cursor.execute( query ) - result = cursor.fetchall() - if len(result) > 0 and len(result[0]) > 0: - prescaleKeys = [] - for t in result : - prescaleKeys.append(t[0]) - return prescaleKeys - else: - return None - - ## Set the DB connection parameters using the dblookup alias - # @param dblookupString Alias in the dblookup file - def setDbConnectionFromAuthFile(self, dblookupString='TRIGGERDB') : - #self.setlog() - # Read Trigger DB Parameters from dblookup and db authentication files - import os - dblookup_file_name='dblookup.xml' - authentication_file_name='authentication.xml' - # Find the DBLookup file path: - dblookup_file=dblookup_file_name - authentication_file=authentication_file_name - - from AthenaCommon.Utils.unixtools import FindFile - # look for it in the local and then all XML directories - dblookup_file = FindFile(dblookup_file,['.']+os.environ[ 'XMLPATH' ].split(os.pathsep),os.R_OK ) - authentication_file = FindFile(authentication_file,['.']+os.environ[ 'XMLPATH' ].split(os.pathsep),os.R_OK ) - - # Not found in user space - look in the AtlasAuthentication package - if not dblookup_file: - dblookup_file = 'AtlasAuthentication/'+dblookup_file_name - dblookup_file = FindFile(dblookup_file,['.']+os.environ[ 'XMLPATH' ].split(os.pathsep),os.R_OK ) - - if not authentication_file: - authentication_file = 'AtlasAuthentication/'+authentication_file_name - authentication_file = FindFile(authentication_file,['.']+os.environ[ 'XMLPATH' ].split(os.pathsep),os.R_OK ) - - # Look for CORAL_DBLOOKUP_PATH and CORAL_AUTH_PATH - if not dblookup_file: - coral_dblookup_path = os.environ.get('CORAL_DBLOOKUP_PATH') - if not coral_dblookup_path: - self._log.error('no CORAL_DBLOOKUP_PATH environment variable found') - return False - dblookup_file = coral_dblookup_path + '/dblookup.xml' - - if not authentication_file: - coral_auth_path = os.environ.get('CORAL_AUTH_PATH') - if not coral_auth_path: - self._log.error('no CORAL_AUTH_PATH environment variable found') - return False - authentication_file = coral_auth_path + '/authentication.xml' - - if authentication_file and dblookup_file : - self._log.verbose('dblookup file: %s' % (dblookup_file)) - self._log.verbose('authentication file: %s' % (authentication_file)) - - if self.__dict__.has_key('setupSource') and self.setupSource : - dblookupString=self.setupSource - - trigger_connection_list = None - import xml.dom.minidom - # read dblookup file - doc = xml.dom.minidom.parse(dblookup_file) - doc = doc.documentElement - trigger_dblookup_list = [] - trigger_connection_list = [] - for logsvc in doc.getElementsByTagName('logicalservice') : - if dblookupString in logsvc.getAttribute('name') : - for svc in logsvc.getElementsByTagName('service') : - connectionString = str(svc.getAttribute('name')) - self._log.verbose('Connection string: %s' % (connectionString)) - connection = {} - connection['dbType'] = connectionString.split(':')[0] - connection['dbUser'] = None - connection['dbPasswd'] = None - trigger_dblookup_list.append(connectionString) - if svc.hasAttribute('authentication') : - if connection['dbType'] != 'sqlite_file' : - connection['dbServer'] = connectionString.split('://')[1].split('/')[0] - connection['dbName'] = connectionString.split('://')[1].split('/')[1] - if connection['dbType'] == 'sqlite_file': - connection['dbType'] = 'sqlite' - connection['dbServer'] = connectionString.split(':')[1] - connection['dbName'] = connectionString.split(':')[1] - - trigger_connection_list.append(connection) - - if len(trigger_dblookup_list) <= 0: - self._log.error('no logicalservice %s found in file %s' % (dblookupString,dblookup_file)) - return False - - # read authentication file - if len(trigger_dblookup_list) > 0: - doc = xml.dom.minidom.parse(authentication_file) - doc = doc.documentElement - - for conn in doc.getElementsByTagName('connection') : - if conn.getAttribute('name') in trigger_dblookup_list: - name = str(conn.getAttribute('name')) - ind = trigger_dblookup_list.index(name) - connection = {} - connection['dbType'] = name.split(':')[0] - connection['dbServer'] = name.split('://')[1].split('/')[0] - connection['dbName'] = name.split('://')[1].split('/')[1] - connection['dbUser'] = None - connection['dbPasswd'] = None - for par in conn.getElementsByTagName('parameter'): - if par.getAttribute('name').lower() == 'user': - connection['dbUser'] = str(par.getAttribute('value')) - elif par.getAttribute('name').lower() == 'password': - connection['dbPasswd'] = str(par.getAttribute('value')) - - if trigger_connection_list[ind]['dbUser'] : - trigger_connection_list.append(connection) - else: - trigger_connection_list[ind] = connection - - conn = False - if len(trigger_connection_list) == 0: - self._log.error('missing %s connection parameters check files:\n\t %s \n\t%s' % (dblookupString, dblookup_file, authentication_file)) - return False - - if self.OutputLevel <= 2: - mesg = 'Available connections:' - for connection in trigger_connection_list : - mesg += '\n\t%s' % (connection) - - self._log.debug(mesg) - - for connection in trigger_connection_list : - self.dbType = connection['dbType'] - if connection['dbType'] in ('oracle','mysql') : - self.dbHost = connection['dbServer'] - self.dbUser = connection['dbUser'] - self.dbPasswd = connection['dbPasswd'] - self.dbName = connection['dbName'] - - try: - cursor = None - cursor = self.connectDB() - if cursor : - cursor.close() - return True - else: - self._log.debug('Can\'t connect to the DB %s' % (connection)) - except Exception, exc: - self._log.debug(exc.message) - pass - - - self._log.error('No valid %s connection found - check files:\n\t %s \n\t%s' % (dblookupString, dblookup_file, authentication_file)) - - return False - - ## Load and create the Trigger Configuration setup - def load(self): - self.setlog() - self.configure() - import time, sys - start = time.time() - - # Load the algorithms - algorithms = self.loadSetup() - - # Merge loaded algorithms - nmod = self.mergeAlg(algorithms) - self._log.debug('%d modified algorithms during merge' % (nmod)) - - # There may be some child algorithms - self.fixChildParentRelations(algorithms) - - # Create a job setup - self.createSetup(algorithms) - - stop = time.time() - self._log.info('Full configuration loaded in %ds' % (stop-start)) - - ## Configure self - def configure(self) : - self.setlog() - self._consistencyCheck() - self._checkHLTPrescaleKey() - self._checkLVL1PrescaleKey() - - def initialize(self): - self.setlog() - self.load() - - def run(self): - self.setlog() - self.load() - - def finalize(self): - pass - -## Erase Configurable -# @param cfg Configurable which has to be entirely deleted -# @param logger Logger -def eraseConfigurable(cfg, logger=None): - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.eraseConfigurable') - from AthenaCommon.AppMgr import ToolSvc,ServiceMgr - # erase existing Configurable - cfg_parent = cfg.getParent() # It is a string with the configurable parent name if empty - no parent - cfg_children = cfg.getAllChildren() - name = cfg.getName() - from AthenaCommon.Configurable import (ConfigurableAlgorithm, - ConfigurableService, - ConfigurableAlgTool, - ConfigurableAuditor) - if isinstance(cfg, ConfigurableAlgorithm): - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - logger.info('remove algorithm: %s' % (name)) - stmt = 'del topSequence.%s' % (name) - logger.verbose(stmt) - exec(stmt) - elif isinstance(cfg, ConfigurableService): - logger.info('remove service: %s' % (name)) - stmt = 'del ServiceMgr.%s' % (name) - logger.verbose(stmt) - exec(stmt) - elif isinstance(cfg, ConfigurableAlgTool): - logger.info('remove public tool: %s' % (name)) - stmt = 'del ServiceMgr.ToolSvc.%s' % (name) - logger.verbose(stmt) - exec(stmt) - elif isinstance(cfg, ConfigurableAuditor): - logger.info('remove auditor service: %s' % (name)) - stmt = 'del ServiceMgr.AuditorSvc.%s' % (name) - logger.verbose(stmt) - exec(stmt) - else: - logger.error('Unknown type of configurable: %s' % (cfg.getFullName())) - - del cfg - # Just in case - from AthenaCommon.Configurable import Configurable - try: - del Configurable.allConfigurables[name] - except : - pass - -## Documentation for function removeAllCfgChildren -# @param cfg Input configurable -# @param logger Logger default value None message HLTConfOffline.removeAllCfgChildren -# -# Remove all the children from the configurable including the PrivateTools and PrivateToolArrays -def removeAllCfgChildren(cfg, logger=None): - # Set logger if non existing - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.removeAllCfgChildren') - #import logging - #logger=logging.getLogger('HLTConfOffline.removeAllCfgChildren') - #logger.setLevel(logging.INFO) - #ch = logging.StreamHandler() - #ch.setLevel(logging.INFO) - #formatter = logging.Formatter("%(name)s - %(levelname)s\t%(message)s") - #ch.setFormatter(formatter) - #logger.addHandler(ch) - - logger.verbose("Configurable before child removal:\n%s" % (cfg)) - privToolCand = {} - # Check properties for PrivateTool - for k,v in cfg.getProperties().items() : - # Test the type of the property - cfgPropertyType = ('%s' % (type(v))).replace('<class ','').replace('<type ','').replace("'",'') - cfgPropertyType = cfgPropertyType[:len(cfgPropertyType)-1] - - # Skip PublicTools and Services - if cfgPropertyType in ( 'GaudiKernel.GaudiHandles.ServiceHandle', - 'GaudiKernel.GaudiHandles.ServiceHandleArray', - 'GaudiKernel.GaudiHandles.PublicToolHandle', - 'GaudiKernel.GaudiHandles.PublicToolHandleArray') : continue - - # Search the PrivateTooHandleArray - if cfgPropertyType == 'GaudiKernel.GaudiHandles.PrivateToolHandleArray' : - logger.verbose('Clear PrivateToolHandleArray %s.%s = %s' % (cfg.getFullJobOptName(),k,v)) - stmt = 'cfg.%s = []' % (k) - logger.verbose('Execute: %s' % (stmt)) - exec stmt - continue - - # Search the PrivateTooHandle - if cfgPropertyType == 'GaudiKernel.GaudiHandles.PrivateToolHandle' : - logger.verbose('Set the PrivateToolHandle to None %s.%s = %s' % (cfg.getFullJobOptName(),k,v)) - stmt = 'cfg.%s = None' % (k) - logger.verbose('Execute: %s' % (stmt)) - exec stmt - continue - - # Skip the built-in-type values - if isinstance(v,(bool,int,long,float,str,unicode,tuple,list,dict)) : continue - - privTFullJobOptName = None - try : - privTFullJobOptName = v.getFullJobOptName() - except : - pass - if privTFullJobOptName : - logger.verbose('PrivateToolHandle candidate %s.%s = %s (type: %s)' % (cfg.getFullJobOptName(),k,privTFullJobOptName, type(v))) - privToolCand[privTFullJobOptName] = k - - # Erase the children - start with the last item - inds = range(len(cfg.getAllChildren())) - inds.reverse() - for i in inds : - cFullJobOptName = cfg.getAllChildren()[i].getFullJobOptName() - logger.verbose('Delete child %s' % (cFullJobOptName)) - del cfg.getAllChildren()[i] - if cFullJobOptName in privToolCand.keys() : - logger.verbose('Set the PrivateToolHandle to None %s.%s = %s' % (cfg.getFullJobOptName(),privToolCand[cFullJobOptName],None)) - stmt = 'cfg.%s = None' % (privToolCand[cFullJobOptName]) - logger.verbose('Execute: %s' % (stmt)) - exec stmt - -## Documentation for function removeCfgChild -# @param cfg Input configurable -# @param childName Name of the child to be removed -# @param logger Logger default value None message HLTConfOffline.removeAllCfgChildren -# -# Remove the child from the configurable including the PrivateTools and PrivateToolArrays -def removeCfgChild(cfg, childName, logger=None): - # Set logger if non existing - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.removeAllCfgChildren') - #import logging - #logger=logging.getLogger('HLTConfOffline.removeCfgChild') - #logger.setLevel(logging.INFO) - #ch = logging.StreamHandler() - #ch.setLevel(logging.INFO) - #formatter = logging.Formatter("%(name)s - %(levelname)s\t%(message)s") - #ch.setFormatter(formatter) - #logger.addHandler(ch) - - - logger.verbose('Remove child %s from %s' % (childName, cfg.getFullJobOptName())) - privToolCand = {} - # Check properties for PrivateTool or PrivateToolHandleArray - for k,v in cfg.getProperties().items() : - # Test the type of the property - cfgPropertyType = ('%s' % (type(v))).replace('<class ','').replace('<type ','').replace("'",'') - cfgPropertyType = cfgPropertyType[:len(cfgPropertyType)-1] - - # Skip PublicTools and Services - if cfgPropertyType in ( 'GaudiKernel.GaudiHandles.ServiceHandle', - 'GaudiKernel.GaudiHandles.ServiceHandleArray', - 'GaudiKernel.GaudiHandles.PublicToolHandle', - 'GaudiKernel.GaudiHandles.PublicToolHandleArray') : continue - - # Remove the child from the PrivateToolHandleArray - if cfgPropertyType == 'GaudiKernel.GaudiHandles.PrivateToolHandleArray' : - for item in v : - privToolJobOptName = item - try : - privToolJobOptName = item.getName() - except: - pass - if privToolJobOptName and isinstance(privToolJobOptName,str) and privToolJobOptName == childName : - # Format the privToolJobOptName if needed - if len(privToolJobOptName.split('/')) >= 2 : - privToolJobOptName = '/'.join([privToolJobOptName.split('/')[0],privToolJobOptName.split('/')[-1].split('.')[-1]]) - stmt = 'del cfg.%s[\'%s\']' % (k,privToolJobOptName) - try : - logger.verbose('Execute: %s' % (stmt)) - exec stmt - except Exception, exc: - logger.debug('Exception occured: %s' % (exc.message)) - continue - - # Remove the child from PrivateToolHandle - if cfgPropertyType == 'GaudiKernel.GaudiHandles.PrivateToolHandle' : - privToolFullJobOptName = v - try : - privToolFullJobOptName = v.getFullJobOptName() - except: - pass - if privToolFullJobOptName and isinstance(privToolFullJobOptName,str) and privToolFullJobOptName.split('/')[-1].split('.')[-1] == childName : - stmt = 'cfg.%s = None' % (k) - logger.verbose('Execute: %s' % (stmt)) - exec stmt - continue - - # Skip the built-in-type values - if isinstance(v,(bool,int,long,float,str,unicode,tuple,list,dict)) : continue - - # Check the unsupported types - privTFullJobOptName = v - try : - privTFullJobOptName = v.getFullJobOptName() - except : - pass - if privTFullJobOptName and isinstance(privTFullJobOptName,str) and privTFullJobOptName.split('/')[-1].split('.')[-1] == childName : - logger.debug('PrivateToolHandle candidate %s.%s = %s' % (cfg.getFullJobOptName(),k,privTFullJobOptName)) - privToolCand[privTFullJobOptName] = k - - # Remove the child - start with the last item - inds = range(len(cfg.getAllChildren())) - inds.reverse() - for i in inds : - if cfg.getAllChildren()[i].getName() == childName : - cFullJobOptName = cfg.getAllChildren()[i].getFullJobOptName() - logger.debug('Delete child %s' % (cFullJobOptName)) - del cfg.getAllChildren()[i] - if cFullJobOptName in privToolCand.keys() : - logger.debug('Set the PrivateToolHandle to None %s.%s' % (cfg.getFullJobOptName(),privToolCand[cFullJobOptName])) - stmt = 'cfg.%s = None' % (privToolCand[cFullJobOptName]) - logger.verbose('Execute: %s' % (stmt)) - exec stmt - -## Documentation for function getUserPasswdFromAuth -# @param connectionName string obtained from the dblookup.xml file -# @return dictionairy with items user,passwd or empty dictionairy -# Extract the DB connection parameters -def getUserPasswdFromAuth(connectionName, logger=None) : - # Set logger if non existing - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.getUserPasswdFromAuth') - # output dictionairy - output = {} - authentication_file='authentication.xml' - import os - from AthenaCommon.Utils.unixtools import FindFile - # look for it in the local and then all XML directories - authentication_file = FindFile(authentication_file,['.']+os.environ[ 'XMLPATH' ].split(os.pathsep),os.R_OK ) - - # Not found in user space - look in the AtlasAuthentication package - if not authentication_file: - authentication_file = 'AtlasAuthentication/authentication.xml' - authentication_file = FindFile(authentication_file,['.']+os.environ[ 'XMLPATH' ].split(os.pathsep),os.R_OK ) - - # Look for CORAL_DBLOOKUP_PATH and CORAL_AUTH_PATH - if not authentication_file: - coral_auth_path = os.environ.get('CORAL_AUTH_PATH') - if not coral_auth_path: - logger.error('no CORAL_AUTH_PATH environment variable found') - return output - authentication_file = coral_auth_path + '/authentication.xml' - - import xml.dom.minidom - doc = xml.dom.minidom.parse(authentication_file) - doc = doc.documentElement - - for conn in doc.getElementsByTagName('connection') : - if conn.getAttribute('name')==connectionName: - for par in conn.getElementsByTagName('parameter'): - if par.getAttribute('name').lower() == 'user': - output['user'] = str(par.getAttribute('value')) - elif par.getAttribute('name').lower() == 'password': - output['passwd'] = str(par.getAttribute('value')) - - return output - -## Get the conection strings from the dblookup file -# @param alias Logical service attibute - name -# @return list of connection strings -def getConnectionsFromDBLookup(alias, logger=None) : - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.getConnectionsFromDBLookup') - - output = [] - dblookup_file='dblookup.xml' - import os - from AthenaCommon.Utils.unixtools import FindFile - # look for it in the local and then all XML directories - dblookup_file = FindFile(dblookup_file,['.']+os.environ[ 'XMLPATH' ].split(os.pathsep),os.R_OK ) - - # Not found in user space - look in the AtlasAuthentication package - if not dblookup_file: - dblookup_file = 'AtlasAuthentication/dblookup.xml' - dblookup_file = FindFile(dblookup_file,['.']+os.environ[ 'XMLPATH' ].split(os.pathsep),os.R_OK ) - - # Look for CORAL_DBLOOKUP_PATH and CORAL_AUTH_PATH - if not dblookup_file: - coral_dblookup_path = os.environ.get('CORAL_DBLOOKUP_PATH') - if not coral_dblookup_path: - logger.error('no CORAL_DBLOOKUP_PATH environment variable found') - return output - dblookup_file = coral_dblookup_path + '/dblookup.xml' - - import xml.dom.minidom - doc = xml.dom.minidom.parse(dblookup_file) - doc = doc.documentElement - - for logsvc in doc.getElementsByTagName('logicalservice') : - if alias==logsvc.getAttribute('name') : - for svc in logsvc.getElementsByTagName('service') : - connectionString = str(svc.getAttribute('name')) - output.append(connectionString) - - return output -## Function for sorting the algorithms - priority: Services, Tools, Auditors, Algorithms -def compareSvcToolsAuditorsAlg(alg1, alg2) : - name1 = alg1.getName() - name2 = alg2.getName() - alias1 = alg1.getAlias() - alias2 = alg2.getAlias() - - # Services - if (name1.endswith('Svc') or alias1.endswith('Svc')) and not (name2.endswith('Svc') or alias2.endswith('Svc')) : - return -1 - - if (name2.endswith('Svc') or alias2.endswith('Svc')) and not (name1.endswith('Svc') or alias1.endswith('Svc')) : - return 1 - - # Tools - if alias1.startswith('ToolSvc') and not alias2.startswith('ToolSvc') : - return -1 - - if alias2.startswith('ToolSvc') and not alias1.startswith('ToolSvc') : - return 1 - - return cmp(alias1, alias2) - -## Function for sorting the algorithms - priority: Algorithms, Tools, Services -def compareAlgToolsSvcAuditor(alg1, alg2) : - name1 = alg1.getName() - name2 = alg2.getName() - alias1 = alg1.getAlias() - alias2 = alg2.getAlias() - - a1Svc = name1.endswith('Svc') or alias1.endswith('Svc') - a2Svc = name2.endswith('Svc') or alias2.endswith('Svc') - a1Tool = alias1.startswith('ToolSvc') - a2Tool = alias2.startswith('ToolSvc') - a1ToolSvc = name1 == 'ToolSvc' - a2ToolSvc = name2 == 'ToolSvc' - a1Auditor = name1.endswith('Auditor') or alias1.endswith('Auditor') - a2Auditor = name2.endswith('Auditor') or alias2.endswith('Auditor') - a1Alg = not (a1Svc or a1Tool or a1Tool or a1ToolSvc) - a2Alg = not (a2Svc or a2Tool or a2Tool or a2ToolSvc) - - # Algorithms - if a1Alg and not a2Alg : return -1 - if a2Alg and not a1Alg : return 1 - if a1Alg and a2Alg : return cmp(alias1, alias2) - - # ToolSvc - if a1ToolSvc and not a2ToolSvc : return -1 - if a2ToolSvc and not a1ToolSvc : return 1 - if a1ToolSvc and a2ToolSvc : return cmp(alias1, alias2) - - # Tools - if a1Tool and not a2Tool : return -1 - if a2Tool and not a1Tool : return 1 - if a1Tool and a2Tool : return cmp(alias1, alias2) - - # Services - if a1Svc and not a2Svc : return -1 - if a2Svc and not a1Svc : return 1 - if a1Svc and a2Svc : return cmp(alias1, alias2) - - # Auditors - if a1Auditor and not a2Auditor : return -1 - if a2Auditor and not a1Auditor : return 1 - if a1Auditor and a2Auditor : return cmp(alias1, alias2) - - # Unencoutered - return cmp(alias1, alias2) - -## Interprets the connection string -# @param connectionString connection string -# connection string needs to be of the following format (this is also the order of checking) -# \<ALIAS\> -- any string without a colon ':' will be checked for in the dblookup.xml file -# type:\<detail\> -- no dblookup will be used, type has to be oracle, mysql, or sqlite_file -# sqlite_file:filename.db -- an sqlite file, no authentication needed, will be opened in read-only mode -# oracle://ATLR/ATLAS_CONF_TRIGGER_V2 -- a service description without user and password, requires lookup in authentication.xml -# oracle://ATLR/ATLAS_CONF_TRIGGER_V2;username=ATLAS_CONF_TRIGGER_V2_R;password=<...> -- a service description with user and password -# @return dictionairy - items techno, server, schema, user, passwd, filename -def interpretConnectionString(connectionString, logger=None) : - # Set logger if non existing - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.interpretConnectionString') - # output dictionairy - connectionParameters={} - dbtype='' - - if ':' in connectionString : # Connection string in format type:<detail> - dbtype = connectionString.split(':')[0].lower() - if dbtype in ('sqlite','oracle','mysql') : - connectionParameters['techno'] = dbtype - else: - logger.error('Unsupported type of DB %s - check the connection string: %s' % (dbtype,connectionString)) - return connectionParameters - # Remaining information - # Process sqlite type connection string - if dbtype == 'sqlite' : # Remaining information is a filename - filename = ':'.join(connectionString.split(':')[1:]) - from AthenaCommon.Utils.unixtools import FindFile - # Get full file path - filename = FindFile(filename,['.'],os.R_OK ) - if filename: - connectionParameters['filename'] = filename - else : - connectionParameters['filename'] = connInformation - logger.error('sqlite file %s not found' % (connectionParameters['filename'])) - # enough information saved - nothing to process - return connectionParameters - # Here the type of DB is either oracle or mysql - # Extract the server resp. schema information from begining of the string - connInformation = ':'.join(connectionString.split(':')[1:]).lstrip('/') - serverDbSchema=connInformation.split(';')[0] - connectionParameters['server'] = serverDbSchema.split('/')[0] - if '/' in serverDbSchema : - connectionParameters['schema'] = serverDbSchema.split('/')[1].split(';')[0] - if serverDbSchema.count('/') == 1 : - connInformation = connInformation.replace(serverDbSchema,'',1).strip(';') - elif serverDbSchema.count('/') == 2 : - connInformation = connInformation.replace('/'.join(serverDbSchema.split('/')[:1]),'',1).lstrip('/') - # If other information provided process it - for item in connInformation.split(';'): - if '=' in item : - name = item.split('=')[0].lower() - value = item.split('=')[1] - if name in ('schema','name') : - connectionParameters['schema'] = value - elif name.startswith('user') : - connectionParameters['user'] = value - elif name in ('passwd', 'password') : - connectionParameters['passwd'] = value - - # Password needed and not specified - use the authentication file - if dbtype !='sqlite' and not connectionParameters.has_key('passwd'): - authConnPar = getUserPasswdFromAuth(connectionString) - if authConnPar.has_key('user') : connectionParameters['user'] = authConnPar['user'] - if authConnPar.has_key('passwd') : connectionParameters['passwd'] = authConnPar['passwd'] - else : # aliases and passwords to be searched in the dblokup file - connStrings=getConnectionsFromDBLookup(connectionString) - import TrigConfOffline.HLTSQLUtils as HLTSQLUtils - # Process all the connection strings found - return 1st valid connection - for conStr in connStrings : - # Recursive call to process the dblookup connection string - connectionParameters = interpretConnectionString(conStr) - # Try the connection on 1st successfull connection return the parameters and stop searching - cursor = None - if connectionParameters['techno'] in ('oracle','mysql') : - cursor = HLTSQLUtils.get_cursor(connectionParameters['server'], connectionParameters['user'], - connectionParameters['schema'], connectionParameters['techno'], - False, connectionParameters['passwd']) - elif connectionParameters['techno'] in ('sqlite') : - cursor = HLTSQLUtils.get_cursor(connectionParameters['filename'], None, None, connectionParameters['techno'], False, None) - # If connection is opened - stop - if cursor : - cursor.close() - break - - return connectionParameters - -## Set the top algorithms -# @param TopAlg top algorithm list as stated in ApplicationMgr.TopAlg -# @param logger Logger -def setTopAlg(TopAlg, logger=None) : - # Set logger if non existing - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTConfOffline.setTopAlg') - - logger.verbose('Top algorithms to be set: (%s) %s' %(type(TopAlg),TopAlg)) - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - from AthenaCommon.Configurable import Configurable - for item in TopAlg : - if len(item.split('/')) not in (1,2) : - logger.error('Unsupported form of TopAlg item %s - will be ignored' % (item)) - continue - logger.verbose("Get the top algorithm %s" % (item)) - topAlgAlias = item.split('/')[-1] - topAlgType = item.split('/')[0] - topAlgCfg = None - # Test if the configurable exists - if Configurable.allConfigurables.has_key(topAlgAlias) : - topAlgCfg = Configurable.allConfigurables[topAlgAlias] - logger.verbose("Top algorithm %s exists %s/%s" % (topAlgAlias, topAlgCfg.getType(), topAlgCfg.getName())) - # Test the type if stated - if len(item.split('/'))==2 and topAlgType != topAlgCfg.getType(): - logger.warning('Imcompatible type of existing configurable %s/%s - required %s' % (topAlgCfg.getType(), topAlgCfg.getName(),item)) - topAlgCfg = None - - # The requested top algorithm doesn't exist for some reason create new configurable - if not topAlgCfg : - logger.verbose("Top algorithm %s does not exist create new" % (item)) - from TrigConfOffline.HLTAlgorithm import HLTAlgorithm - topAlg = HLTAlgorithm(name=topAlgType, alias=topAlgAlias) - topAlgCfg = topAlg.getConfigurable() - - if topAlgCfg: - logger.debug("Append top algorithm %s/%s to alg sequence" % (topAlgCfg.getType(), topAlgCfg.getName())) - topSequence += topAlgCfg - else : - logger.error('Can not get top algorithm %s' % (item)) - - - \ No newline at end of file diff --git a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTOfflineRuleLoader.py b/Trigger/TrigConfiguration/TrigConfOffline/python/HLTOfflineRuleLoader.py deleted file mode 100644 index 211eaea5e60d8dc3a2528f4ff0f7e52e9571b96c..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTOfflineRuleLoader.py +++ /dev/null @@ -1,895 +0,0 @@ -########################################################################### -# Copyright (C) 2008 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Description: -# Class to loads the rules from given source -# -########################################################################### - -import string - -## OfflineRuleLoader Class -# The rules for modification of an online trigger setup to offline trigger setup -class OfflineRuleLoader(object) : - ## @var _properties List of attributes which may be set for class OfflineRuleLoader - _properties = ('Source','dbType','dbHost','dbUser','dbPasswd','dbName','SMKey','RunNumber','OutputLevel') - - ## Exception to be raised if the xml rules file is inconsistent - class XMLConsistencyError(Exception): - pass - - ## Class constructor - def __init__(self, *args, **kwargs) : - from AthenaCommon.Logging import logging - self.__dict__['_log'] = logging.getLogger('HLTOfflineRuleLoader') - - ## @var Source - # rule source - set the default value to offline_setup_rules.xml - self.Source = "offline_setup_rules.xml" - - for k,v in kwargs.items() : - self.__setattr__(k,v) - - self._log.verbose("\n%s" % (self)) - - def setlog(self) : - if self.__dict__.has_key('OutputLevel'): - self._log.setLevel(self.OutputLevel) - else: - self._log.setLevel(3) - self._log.name = 'HLTOfflineRuleLoader ' - - def __setattr__(self, name, value) : - self.setlog() - # Find the absolut path to the file - if name=='Source' and value.lower().endswith('.xml'): - filepath=value - # find the absolute file path - import os - from AthenaCommon.Utils.unixtools import FindFile - # look for it in the local and then all XML directories - filepath = FindFile(filepath,['.']+os.environ[ 'XMLPATH' ].split(os.pathsep),os.R_OK ) - - # Not found in user space - look in the AtlasAuthentication package - if not filepath: - filepath = 'TrigConfOffline/'+value - filepath = FindFile(filepath,['.']+os.environ[ 'XMLPATH' ].split(os.pathsep),os.R_OK ) - - if not filepath: - self._log.warning("Rules source file %s not found" % (value)) - else : - value=filepath - self._log.debug("Rules source file found in %s" % (value)) - - if name in self._properties: - self._log.debug('Set property: %s = %s' % (name, value)) - self.__dict__[name] = value - if name=='OutputLevel': - self._log.setLevel(value) - else: - self._log.warning('Unknown property: %s = %s - property not set' % (name, value)) - - def __str__(self): - self.setlog() - output = "-"*80 + "\n" - string = "%s.%s" % (self.__module__,'HLTOfflineRuleLoader') - output += "|" + " "*(39 - len(string)/2) + string +" "*(39 - len(string)/2) + "|\n" - output += "-"*80 + "\n" - - for k,v in self.__dict__.items() : - if k == 'dbPasswd' : - output += "\t%s = %s\n" % (k,"*"*len(v)) - elif k[0] != '_' : - output += "\t%s = %s\n" % (k,v) - - return output - - def load(self) : - self.setlog() - #import TrigConfOffline.HLTOfflineRules - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - # Returns the list of Rules - rules = [] - - if not self.Source.lower().endswith('.xml'): - rules = self._loadfromDB() - else: - rules = self._loadfromFile() - - self._log.info('Loaded %d rules from %s' % (len(rules), self.Source)) - return rules - - def _loadfromDB(self): - self.setlog() - self._log.debug('Load from DB') - # DB connection utils - cursor = self.connectDB() - - rules = [] - ruleSetKey = self.getRuleSetKey(cursor) - if ruleSetKey > 0 : - for ruleID in self.getRuleIDs(ruleSetKey, cursor) : - rule = self.loadRuleFromDb(ruleID, cursor) - if not rule: - continue - elif isinstance(rule,list) : - rules.extend(rule) - else: - rules.append(rule) - - self._log.debug('%d rules loaded' % (len(rules))) - return rules - - def _loadfromFile(self): - self.setlog() - self._log.debug('Load from file') - if self.Source.lower().endswith('.xml') : - return self._loadfromXML() - else: - self._log.error('Unsupported source type: %s' % (self.Source)) - return [] - - def _loadfromXML(self): - self.setlog() - import xml.dom.minidom - rules = [] - doc = xml.dom.minidom.parse(self.Source) - doc = doc.documentElement - - doc_children = doc.childNodes - i = 0 - for ch in doc_children : - if ch.nodeName in ['Copy','Modify','Replace','Rename','Sort','Merge']: - i += 1 - rule = self.loadRulefromXML(ch) - if not rule: - continue - elif isinstance(rule,list) : - rules.extend(rule) - else: - rules.append(rule) - - return rules - - def connectDB(self): - self.setlog() - import TrigConfOffline.HLTSQLUtils as HLTSQLUtils - cursor = HLTSQLUtils.get_cursor(self.dbHost, self.dbUser, self.dbName, self.dbType, False, self.dbPasswd) - return cursor - - def loadParameterfromXML(self,node): - self.setlog() - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - parameter = {} - name = "" - value = "" - if node.hasAttribute('name') : - name = str(node.getAttribute('name')) - else: - self._log.error('Parameter has no attribute name %s' % (node.toxml())) - return None - - if node.hasAttribute('value') : - value = str(node.getAttribute('value')) - try: - value = eval(value) - except : - # Nothing happened just pass the value as string - pass - - parameter = {name:value} - return parameter - - def loadComponentfromXML(self, node): - self.setlog() - component = {} - - alias="" - if node.hasAttribute('alias') : - alias = str(node.getAttribute('alias')) - else: - self._log.error('Component has no attribute alias %s' % (node.toxml())) - return None - - name=alias - if node.hasAttribute('name') : - name = str(node.getAttribute('name')) - - component = {'alias': alias, 'name': name} - # Set the py_package and py_name if exist - if node.hasAttribute('py_name'): component['py_name'] = str(node.getAttribute('py_name')) - if node.hasAttribute('py_package'): component['py_package'] = str(node.getAttribute('py_package')) - - # Set the type of the algorithm - if node.hasAttribute('topalg') and str(node.getAttribute('topalg'))=="1": component['type']='TopAlg' - if node.hasAttribute('svc') and str(node.getAttribute('svc'))=="1": component['type']='Service' - if node.hasAttribute('pubT') and str(node.getAttribute('pubT'))=="1": component['type']='PublicTool' - if node.hasAttribute('privT') and str(node.getAttribute('privT'))=="1": component['type']='PrivateTool' - if node.hasAttribute('aud') and str(node.getAttribute('aud'))=="1": component['type']='Auditor' - - if node.hasChildNodes() : - doc_pars = node.getElementsByTagName('parameter') - if len(doc_pars) > 0: - component.setdefault('properties',{}) - for p in doc_pars : - par = self.loadParameterfromXML(p) - component['properties'].update(par) - return component - - - def loadRulefromXML(self, node) : - self.setlog() - rules = None - name = node.nodeName - if name == 'Sort': - rules = [] - for ind in range(len(node.getElementsByTagName('component'))) : - rule = self.loadSortRulefromXML(node, ind) - if rule : - rules.append(rule) - return rules - - if name == 'Copy': - return self.loadCopyRulefromXML(node) - - if name == 'Replace': - return self.loadReplaceRulefromXML(node) - - if name == 'Rename': - return self.loadRenameRulefromXML(node) - - if name == 'Modify': - return self.loadModifyRulefromXML(node) - - if name == 'Merge': - rules = [] - for ind in range(len(node.getElementsByTagName('component'))) : - rule = self.loadMergeRulefromXML(node, ind) - if rule: - rules.append(rule) - return rules - - return rules - - def loadSortRulefromXML(self, node, ind) : - self.setlog() - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - rule = {} - if not node.hasAttribute('position') : - self._log.error('Sort Rule Node has no Attributes %s' % (node.toxml())) - return None - sortOrder = str(node.getAttribute('position')) - comp_node = node.getElementsByTagName('component')[ind] - return HLTOfflineRules.SortRule({'sortOrder':sortOrder,'component': self.loadComponentfromXML(comp_node)}) - - ## Load Merge Rule from XML node - # @param self OfflineRuleLoader object pointer - # @param node XML node - # @return CopyRule object or None if not successfull - def loadMergeRulefromXML(self, node, ind) : - self.setlog() - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - rule = {} - comp_node = node.getElementsByTagName('component')[ind] - return HLTOfflineRules.MergeRule(online=loadHLTRuleAlgorithmFromXML(comp_node), OutputLevel=self.OutputLevel) - - ## Load Copy Rule from XML node - # @param self OfflineRuleLoader object pointer - # @param node XML node - # @return CopyRule object or None if not successfull - def loadCopyRulefromXML(self, node) : - self.setlog() - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - rule = {} - # Check the number of online nodes - must be 1 - online_node = node.getElementsByTagName('online') - if not len(online_node) == 1: - self._log.error('Copy Rule inconsistent number of online items %s' % (node.toxml())) - return None - online_node = online_node[0] - - # Check the number of offline nodes - must be 1 - offline_node = node.getElementsByTagName('offline') - if not len(offline_node) == 1: - self._log.error("Copy Rule inconsistent number of offline items \n%s" % (node.toxml())) - return None - offline_node = offline_node[0] - - # Check for online components - must be 1 - online_component = None - if online_node.hasChildNodes(): - comp_nodes = online_node.getElementsByTagName('component') - if not len(comp_nodes) == 1: - self._log.error("Copy Rule inconsistent number of online components \n%s" % (node.toxml())) - return None - - # Check the number of online component parameters - must be 1 - par_nodes = comp_nodes[0].getElementsByTagName('parameter') - if not len(par_nodes) == 1: - self._log.error("Copy Rule inconsistent number of online components \n%s" % (node.toxml())) - return None - - online_component = loadHLTRuleAlgorithmFromXML(comp_nodes[0]) - - # Check for offline components - must be 1 - offline_component = None - if offline_node.hasChildNodes(): - comp_nodes = offline_node.getElementsByTagName('component') - if not len(comp_nodes) == 1: - self._log.error("Copy Rule inconsistent number of offline components \n%s" % (node.toxml())) - return None - - # Check the number of offline component parameters - must be 1 - par_nodes = comp_nodes[0].getElementsByTagName('parameter') - if not len(par_nodes) == 1: - self._log.error("Copy Rule inconsistent number of online components \n%s" % (node.toxml())) - return None - - offline_component = loadHLTRuleAlgorithmFromXML(comp_nodes[0]) - - return HLTOfflineRules.CopyRule(online=online_component, offline=offline_component, OutputLevel=self.OutputLevel) - - def loadModifyRulefromXML(self, node) : - self.setlog() - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - rule = {} - online_node = node.getElementsByTagName('online') - if not len(online_node) == 1: - self._log.error("Modify Rule inconsistent number of online items \n%s" % (node.toxml())) - return None - online_node = online_node[0] - - offline_node = node.getElementsByTagName('offline') - if not len(offline_node) == 1: - self._log.error("Modify Rule inconsistent number of offline items \n%s" % (node.toxml())) - return None - offline_node = offline_node[0] - - # Check for online components - online_component = {} - if online_node.hasChildNodes(): - comp_nodes = online_node.getElementsByTagName('component') - if not len(comp_nodes) == 1: - self._log.error("Modify Rule inconsistent number of online components \n%s" % (node.toxml())) - return None - online_component = loadHLTRuleAlgorithmFromXML(comp_nodes[0]) - # Just in case evaluate the properties if strings - for prop in online_component.properties : - if isinstance(prop.getValue(), str): - propValue = eval(prop.getValue()) - prop.value = propValue - - # Check for online components - offline_component = {} - if offline_node.hasChildNodes(): - comp_nodes = offline_node.getElementsByTagName('component') - if not len(comp_nodes) == 1: - self._log.error("Modify Rule inconsistent number of offline components \n%s" % (node.toxml())) - return None - offline_component = loadHLTRuleAlgorithmFromXML(comp_nodes[0]) - # Just in case evaluate the properties if strings - for prop in offline_component.properties : - if isinstance(prop.getValue(), str): - propValue = eval(prop.getValue()) - prop.value = propValue - - return HLTOfflineRules.ModifyRule(online=online_component, offline=offline_component, OutputLevel=self.OutputLevel) - - - def loadReplaceRulefromXML(self, node) : - self.setlog() - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - rule = {} - - online_node = node.getElementsByTagName('online') - if not len(online_node) == 1: - self._log.error("Replace Rule inconsistent number of online items \n%s" % (node.toxml())) - return None - online_node = online_node[0] - - offline_node = node.getElementsByTagName('offline') - if not len(offline_node) == 1: - slef._log.error("Replace Rule inconsistent number of offline items \n%s" % (node.toxml())) - return None - offline_node = offline_node[0] - - # Check for online components - online_components = [] - if online_node.hasChildNodes(): - comp_nodes = online_node.getElementsByTagName('component') - for c in comp_nodes : - online_components.append(self.loadComponentfromXML(c)) - - # Check for offline components - offline_components = [] - if offline_node.hasChildNodes(): - comp_nodes = offline_node.getElementsByTagName('component') - for c in comp_nodes : - offline_components.append(self.loadComponentfromXML(c)) - - return HLTOfflineRules.ReplaceRule({'online': online_components, 'offline':offline_components}) - - ## Load Rename Rule from XML node - # @param self OfflineRuleLoader object pointer - # @param node XML node - # @return RenameRule object or None if not successfull - def loadRenameRulefromXML(self, node) : - self.setlog() - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - rule = {} - online_node = node.getElementsByTagName('online') - if not len(online_node) == 1: - self._log.error("Rename Rule inconsistent number of online items \n%s" % (node.toxml())) - return None - online_node = online_node[0] - - offline_node = node.getElementsByTagName('offline') - if not len(offline_node) == 1: - self._log.error("Rename Rule inconsistent number of offline items \n%s" % (node.toxml())) - return None - offline_node = offline_node[0] - - # Check for online components - online_component = {} - if online_node.hasChildNodes(): - comp_nodes = online_node.getElementsByTagName('component') - if not len(comp_nodes) == 1: - self._log.error("Rename Rule inconsistent number of online components \n%s" % (node.toxml())) - return None - - par_nodes = comp_nodes[0].getElementsByTagName('parameter') - if len(par_nodes) > 1: - self._log.error("Rename Rule inconsistent number of online parameters \n%s" % (node.toxml())) - return None - - online_component = loadHLTRuleAlgorithmFromXML(comp_nodes[0]) - - # Check for online components - offline_component = {} - if offline_node.hasChildNodes(): - comp_nodes = offline_node.getElementsByTagName('component') - if not len(comp_nodes) == 1: - self._log.error("Rename Rule inconsistent number of offline components \n%s" % (node.toxml())) - return None - - par_nodes = comp_nodes[0].getElementsByTagName('parameter') - if len(par_nodes) > 1: - self._log.error("Rename Rule inconsistent number of offline parameters \n%s" % (node.toxml())) - return None - - offline_component = loadHLTRuleAlgorithmFromXML(comp_nodes[0]) - - return HLTOfflineRules.RenameRule(online=online_component, offline=offline_component, OutputLevel=self.OutputLevel) - - def getRuleSetKey(self, cursor) : - self.setlog() - output = -1 - - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - - # Full query in order to ensure existing connections - query = ' SELECT DISTINCT %sHLT_RULE_SET.HRS_ID ' % (prepend) - query += ' FROM %sSUPER_MASTER_TABLE ' % (prepend) - query += ' JOIN %sHLT_SMT_TO_HRE ON (%sSUPER_MASTER_TABLE.SMT_ID = %sHLT_SMT_TO_HRE.SMT2RE_SUPER_MASTER_TABLE_ID) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_RELEASE ON (%sHLT_SMT_TO_HRE.SMT2RE_RELEASE_ID = %sHLT_RELEASE.HRE_ID) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_HRE_TO_HRS ON (%sHLT_RELEASE.HRE_ID = %sHLT_HRE_TO_HRS.HRE2RS_RELEASE_ID) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_RULE_SET ON (%sHLT_HRE_TO_HRS.HRE2RS_RULE_SET_ID = %sHLT_RULE_SET.HRS_ID) ' % (prepend, prepend, prepend) - query += ' WHERE %sSUPER_MASTER_TABLE.SMT_ID=%d' % (prepend, self.SMKey) - - # Shortened query - to save time to get info from DB - trust the foreign keys etc. - query = ' SELECT DISTINCT %sHLT_HRE_TO_HRS.HRE2RS_RULE_SET_ID ' % (prepend) - query += ' FROM %sHLT_SMT_TO_HRE ' % (prepend) - query += ' JOIN %sHLT_HRE_TO_HRS ON (%sHLT_SMT_TO_HRE.SMT2RE_RELEASE_ID = %sHLT_HRE_TO_HRS.HRE2RS_RELEASE_ID) ' % (prepend, prepend, prepend) - if self.dbType == 'sqlite' : - query += ' WHERE %sHLT_SMT_TO_HRE.SMT2RE_SUPER_MASTER_TABLE_ID=%d' % (prepend,self.SMKey) - else : - query += ' WHERE %sHLT_SMT_TO_HRE.SMT2RE_SUPER_MASTER_TABLE_ID=:smkey' % (prepend) - - ruleSetIDs = [] - self._log.verbose('%s, smkey=%d' % (query, self.SMKey)) - if self.dbType == 'sqlite' : - cursor.execute(query) - else : - cursor.execute(query, smkey=self.SMKey) - - result = cursor.fetchall() - for column in result: - ruleSetIDs.append(column[0]) - - if(len(ruleSetIDs) == 1) : - output = ruleSetIDs[0] - - return output - - def getRuleIDs(self, ruleSetID, cursor) : - self.setlog() - # Get rule ID's sorted accordingly to the rule_counter - output = [] - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - - # Full query in order to ensure existing connections - query = ' SELECT DISTINCT %sHLT_RULE.HRU_ID, %sHLT_HRS_TO_HRU.HRS2RU_RULE_COUNTER ' % (prepend, prepend) - query += ' FROM %sHLT_RULE_SET ' % (prepend) - query += ' JOIN %sHLT_HRS_TO_HRU ON (%sHLT_RULE_SET.HRS_ID = %sHLT_HRS_TO_HRU.HRS2RU_RULE_SET_ID) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_RULE ON (%sHLT_HRS_TO_HRU.HRS2RU_RULE_ID = %sHLT_RULE.HRU_ID) ' % (prepend, prepend, prepend) - query += ' WHERE %sHLT_RULE_SET.HRS_ID=%d' % (prepend, ruleSetID) - query += ' ORDER %sHLT_HRS_TO_HRU.HRS2RU_RULE_COUNTER ' % (prepend) - - # Shortened query - to save time to get info from DB - trust the foreign keys etc. - query = ' SELECT DISTINCT %sHLT_HRS_TO_HRU.HRS2RU_RULE_ID, %sHLT_HRS_TO_HRU.HRS2RU_RULE_COUNTER ' % (prepend, prepend) - query += ' FROM %sHLT_HRS_TO_HRU ' % (prepend) - if self.dbType == 'sqlite' : - query += ' WHERE %sHLT_HRS_TO_HRU.HRS2RU_RULE_SET_ID=%d' % (prepend,ruleSetID) - else : - query += ' WHERE %sHLT_HRS_TO_HRU.HRS2RU_RULE_SET_ID=:ruleset_id' % (prepend) - query += ' ORDER BY %sHLT_HRS_TO_HRU.HRS2RU_RULE_COUNTER ' % (prepend) - - self._log.verbose('%s, ruleset_id=%d' % (query, ruleSetID)) - if self.dbType == 'sqlite' : - cursor.execute(query) - else: - cursor.execute(query, ruleset_id=ruleSetID) - result = cursor.fetchall() - for column in result: - output.append(column[0]) - - return output - - def getComponentIDs(self, ruleID, cursor, componentType=-1) : - self.setlog() - self._log.verbose("getComponentIDs -- start\n Component type: %d" % (componentType)) - output = [] - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - # Full query in order to ensure existing connections - query = ' SELECT DISTINCT %sHLT_RULE_COMPONENT.HRC_ID ' % (prepend) - query += ' FROM %sHLT_RULE ' % (prepend) - query += ' JOIN %sHLT_HRU_TO_HRC ON (%sHLT_RULE.HRU_ID = %sHLT_HRU_TO_HRC.HRU2RC_RULE_ID) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_COMPONENT ON (%sHLT_HRU_TO_HRC.HRU2RC_COMPONENT_ID = %sHLT_COMPONENT.HRC_ID) ' % (prepend, prepend, prepend) - query += ' WHERE %sHLT_RULE.HRU_ID=%d' % (prepend, ruleID) - if componentType >=0 : - query += ' AND %sHLT_HRU_TO_HRC.HRU2RC_COMPONENT_TYPE=%d' % (prepend, componentType) - - # Shortened query - to save time to get info from DB - trust the foreign keys etc. - query = " SELECT DISTINCT %sHLT_HRU_TO_HRC.HRU2RC_COMPONENT_ID " % (prepend) - query += " FROM %sHLT_HRU_TO_HRC " % (prepend) - if self.dbType == 'sqlite' : - query += " WHERE %sHLT_HRU_TO_HRC.HRU2RC_RULE_ID=%d " % (ruleID) - else : - query += " WHERE %sHLT_HRU_TO_HRC.HRU2RC_RULE_ID=:rule_id " % (prepend) - if componentType >=0 : - if self.dbType == 'sqlite' : - query += ' AND %sHLT_HRU_TO_HRC.HRU2RC_COMPONENT_TYPE=%d' % (prepend,componentType) - else : - query += ' AND %sHLT_HRU_TO_HRC.HRU2RC_COMPONENT_TYPE=:component_type' % (prepend) - - if componentType >=0 : - self._log.verbose('%s, rule_id=%d, component_type=%d' % (query,ruleID, componentType)) - if self.dbType == 'sqlite' : - cursor.execute(query) - else : - cursor.execute(query, rule_id=ruleID, component_type=componentType) - else : - self._log.verbose('%s, rule_id=%d' % (query,ruleID)) - if self.dbType == 'sqlite' : - cursor.execute(query) - else : - cursor.execute(query, rule_id=ruleID) - result = cursor.fetchall() - for column in result: - output.append(column[0]) - return output - - def getOfflineComponentIDs(self, ruleID, cursor) : - self.setlog() - componentType=2 - return self.getComponentIDs(ruleID,cursor,componentType) - - def getOnlineComponentIDs(self, ruleID, cursor) : - self.setlog() - componentType=1 - return self.getComponentIDs(ruleID,cursor,componentType) - - def getParameterIDs(self, componentID, cursor) : - self.setlog() - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - output = [] - # Full query in order to ensure existing connections - query = ' SELECT DISTINCT %sHLT_RULE_PARAMETER.HRP_ID ' % (prepend) - query += ' FROM %sHLT_RULE_COMPONENT ' % (prepend) - query += ' JOIN %sHLT_HRC_TO_HRP ON (%sHLT_RULE_COMPONENT.HRC_ID = %sHLT_HRC_TO_HRP.HRC2RP_COMPONENT_ID) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_PARAMETER ON (%sHLT_HRC_TO_HRP.HRC2RP_PARAMETER_ID = %sHLT_PARAMETER.HRP_ID) ' % (prepend, prepend, prepend) - query += ' WHERE %sHLT_RULE_COMPONENT.HRC_ID=%d' % (prepend, componentID) - - # Shortened query - to save time to get info from DB - trust the foreign keys etc. - query = " SELECT DISTINCT %sHLT_HRC_TO_HRP.HRC2RP_PARAMETER_ID " % (prepend) - query += " FROM %sHLT_HRC_TO_HRP " % (prepend) - if self.dbType == 'sqlite' : - query += " WHERE %sHLT_HRC_TO_HRP.HRC2RP_COMPONENT_ID=%d " % (prepend,componentID) - else : - query += " WHERE %sHLT_HRC_TO_HRP.HRC2RP_COMPONENT_ID=:component_id " % (prepend) - - self._log.verbose('%s, component_id=%d' % (query, componentID)) - if self.dbType == 'sqlite' : - cursor.execute(query) - else : - cursor.execute(query, component_id=componentID) - result = cursor.fetchall() - for column in result: - output.append(column[0]) - - self._log.debug("%d parameter IDs found" % (len(output))) - return output - - - def loadParameterFromDb(self, parameterID, cursor) : - self.setlog() - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - parameter = {} - name = "" - value = "" - - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - - query = " SELECT DISTINCT %sHLT_RULE_PARAMETER.HRP_NAME, %sHLT_RULE_PARAMETER.HRP_VALUE, %sHLT_RULE_PARAMETER.HRP_OP " % (prepend, prepend, prepend) - query += " FROM %sHLT_RULE_PARAMETER " % (prepend) - if self.dbType == 'sqlite': - query += " WHERE %sHLT_RULE_PARAMETER.HRP_ID=%d " % (prepend,parameterID) - else: - query += " WHERE %sHLT_RULE_PARAMETER.HRP_ID=:parameter_id " % (prepend) - - self._log.verbose('%s, parameter_id=%d' % (query, parameterID)) - if self.dbType == 'sqlite': - cursor.execute(query) - else: - cursor.execute(query, parameter_id=parameterID) - result = cursor.fetchall() - for column in result: - value = column[1] - name = column[0] - # Format the value for oracle DB empty string - #if self.dbType == 'oracle' and '~' in (value, name): - if '~' in (value, name): - if value == '~' : value = '' - if name == '~' : name = '' - try : # Evaluate value if possible - value = eval(value) - except : # Nothing happened just pass the value as string - pass - parameter[name] = value - - if len(parameter) >1 : - self._log.error("DB incosistency multiple parameters with ID %d found" % (componentID)) - - self._log.debug('Parameter ID %d - %s loaded from DB' % (parameterID, parameter)) - - return parameter - - - def loadComponentFromDb(self, componentID, cursor) : - self.setlog() - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - component = {} - name = "" - alias = "" - - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - - query = " SELECT DISTINCT %sHLT_RULE_COMPONENT.HRC_NAME, %sHLT_RULE_COMPONENT.HRC_ALIAS " % (prepend, prepend) - query += " %sHLT_RULE_COMPONENT.HRC_TYPE, %sHLT_RULE_COMPONENT.HRC_PY_NAME, %sHLT_RULE_COMPONENT.HRC_PY_PACKAGE " % (prepend, prepend, prepend) - query += " FROM %sHLT_RULE_COMPONENT " % (prepend) - if self.dbType == 'sqlite' : - query += " WHERE %sHLT_RULE_COMPONENT.HRC_ID=%d " % (prepend,componentID) - else: - query += " WHERE %sHLT_RULE_COMPONENT.HRC_ID=:comp_id " % (prepend) - self._log.verbose('%s, comp_id=%d' % (query,componentID)) - if self.dbType == 'sqlite' : - cursor.execute(query) - else : - cursor.execute(query, comp_id=componentID) - result = cursor.fetchall() - ncomponents = 0 - for column in result: - name = column[0] - alias = column[1] - alg_type = column[2] - py_name = column[3] - py_package = column[4] - # Correct oracle empty string - #if self.dbType == 'oracle' and '~' in (name,alias,alg_type,py_name,py_package): - if '~' in (name,alias,alg_type,py_name,py_package): - if name=='~' : name='' - if alias=='~' : alias='' - if alg_type=='~' : name='' - if py_name=='~' : py_name='' - if py_package=='~' : py_package='' - - component = {'alias': alias, 'name': name} - if alg_type !='': component['type']=alg_type - if py_name !='': component['py_name']=py_name - if py_package !='': component['py_package']=py_package - - ncomponents += 1 - - self._log.debug("Component ID %d - %s/%s loaded from DB" % (componentID, name, alias)) - - if ncomponents >1 : - self._log.error("DB incosistency multiple components with ID %d found" % (componentID)) - - # Get parameter ID's - parameterIDs = self.getParameterIDs(componentID, cursor) - - if len(parameterIDs) > 0 : - component.setdefault('properties',{}) - - for parID in parameterIDs : - parameter = self.loadParameterFromDb(parID, cursor) - component['properties'].update(parameter) - - return component - - def loadRuleFromDb(self, ruleID, cursor) : - self.setlog() - import TrigConfOffline.HLTOfflineRules as HLTOfflineRules - rules = None - ruleName="" - ruleType=0 - - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - - query = ' SELECT DISTINCT %sHLT_RULE.HRU_NAME, %sHLT_RULE.HRU_TYPE ' % (prepend, prepend) - query += ' FROM %sHLT_RULE ' % (prepend) - if self.dbType == 'sqlite' : - query += ' WHERE %sHLT_RULE.HRU_ID=%d' % (prepend,ruleID) - else : - query += ' WHERE %sHLT_RULE.HRU_ID=:rule_id' % (prepend) - self._log.verbose('%s, rule_id=%d' % (query,ruleID)) - - if self.dbType == 'sqlite' : - cursor.execute(query) - else : - cursor.execute(query,rule_id=ruleID) - result = cursor.fetchall() - nrules = 0 - for column in result: - ruleName = column[0] - ruleType = column[1] - #if self.dbType == 'oracle' and '~' in (ruleName, ruleType) : - if '~' in (ruleName, ruleType) : - if ruleName=='~' : ruleName='' - if ruleType=='~' : ruleType='' - nrules += 1 - - if nrules > 1 : - self._log.error("DB incosistency multiple rules with ID %d found" % (ruleID)) - return rules - if nrules == 0: - return rules - - online_components = [] - for componentID in self.getOnlineComponentIDs(ruleID, cursor) : - online_components.append(self.loadComponentFromDb(componentID, cursor)) - offline_components = [] - for componentID in self.getOfflineComponentIDs(ruleID, cursor) : - offline_components.append(self.loadComponentFromDb(componentID, cursor)) - - if ruleType==1 : # Replace rule - return HLTOfflineRules.ReplaceRule({'online': online_components, 'offline':offline_components}) - elif ruleType==2 : # Rename rule - if len(online_components) == 1 and len(offline_components) == 1 : - return HLTOfflineRules.RenameRule({'online': online_components[0], 'offline':offline_components[0]}) - else: - self._log.error("Rule ID %d: Inconsistent number of online/offline components %d/%d" % (ruleID,len(online_components),len(offline_components))) - elif ruleType==3 : # Modify rule - if len(online_components) == 1 and len(offline_components) == 1 : - return HLTOfflineRules.ModifyRule({'online': online_components[0], 'offline':offline_components[0]}) - else : - self._log.error("Rule ID %d: Inconsistent number of online/offline components %d/%d" % (ruleID,len(online_components),len(offline_components))) - elif ruleType==6 : # Copy rule - if len(online_component) == 1 and len(offline_component) == 1 : - return HLTOfflineRules.CopyRule({'online': online_components[0], 'offline':offline_components[0]}) - else : - self._log.error("Rule ID %d: Inconsistent number of online/offline components %d/%d" % (ruleID,len(online_components),len(offline_components))) - elif ruleType==4 : # Merge rule - rules = [] - # Split merge rule to single Merge rules - for componentID in self.getComponentIDs(ruleID, cursor) : - rules.append(HLTOfflineRules.MergeRule({'component': self.loadComponentFromDb(componentID,cursor)})) - return rules - elif ruleType==5 : # Sort rule - rules = [] - for component in online_components : - rules.append(HLTOfflineRules.SortRule({'sortOrder':'end','component': component})) - for component in offline_components : - rules.append(HLTOfflineRules.SortRule({'sortOrder':'start','component': component})) - return rules - else: # Unsupported rule type - self._log.error("Rule ID %d: Unsupported type %d" % (ruleType)) - - return rules - -## Load HLTRuleAlgorithm from xml node -# @param node XML component node -# @param logger Message logger - default None - will be created -def loadHLTRuleAlgorithmFromXML(node, logger=None): - # Set logger if non existing - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTOfflineRuleLoader.loadHLTRuleAlgorithmfromXML') - - from TrigConfOffline.HLTOfflineRules import HLTRuleAlgorithm - hltRuleAlgorithm = HLTRuleAlgorithm(OutputLevel=logger.getEffectiveLevel()) - # Set the alias of the algorithm if exists - if node.hasAttribute('alias') : - hltRuleAlgorithm.alias = str(node.getAttribute('alias')) - else: - logger.warning('Component has no attribute alias %s' % (node.toxml())) - - # Set the name of the algorithm if exists - if node.hasAttribute('name') : - hltRuleAlgorithm.name = str(node.getAttribute('name')) - else : - logger.warning('Component has no attribute alias %s' % (node.toxml())) - - # Set the py_package and py_name if exist - if node.hasAttribute('py_name'): hltRuleAlgorithm.py_name = str(node.getAttribute('py_name')) - if node.hasAttribute('py_package'): hltRuleAlgorithm.py_package = str(node.getAttribute('py_package')) - - # Set the type of the algorithm - Here I can treat regular expression or rather than the single types - if node.hasAttribute('topalg') and str(node.getAttribute('topalg'))=="1": hltRuleAlgorithm.alg_type='TopAlg' - if node.hasAttribute('svc') and str(node.getAttribute('svc'))=="1": hltRuleAlgorithm.alg_type='Service' - if node.hasAttribute('pubT') and str(node.getAttribute('pubT'))=="1": hltRuleAlgorithm.alg_type='PublicTool' - if node.hasAttribute('privT') and str(node.getAttribute('privT'))=="1": hltRuleAlgorithm.alg_type='PrivateTool' - if node.hasAttribute('aud') and str(node.getAttribute('aud'))=="1": hltRuleAlgorithm.alg_type='Auditor' - if node.hasAttribute('steeralg') and str(node.getAttribute('steeralg'))=="1": hltRuleAlgorithm.alg_type='SteerAlg' - - - if node.hasChildNodes() : - doc_pars = node.getElementsByTagName('parameter') - for p in doc_pars : - hltRuleAlgorithm.setProperty(loadHLTRulePropertyFromXML(p,logger)) - return hltRuleAlgorithm - -## Load HLTRuleProperty from xml node -# @param node XML component node -# @param logger Message logger - default None - will be created -def loadHLTRulePropertyFromXML(node, logger=None): - # Set logger if non existing - if logger == None : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTOfflineRuleLoader.loadHLTRulePropertyFromXML') - - from TrigConfOffline.HLTOfflineRules import HLTRuleProperty - hltRuleProperty = HLTRuleProperty() - - if node.hasAttribute('name') : - hltRuleProperty.name = str(node.getAttribute('name')) - else: - self._log.warning('Parameter has no attribute name %s' % (node.toxml())) - - if node.hasAttribute('value') : - value = str(node.getAttribute('value')) - try: - value = eval(value) - except : - # Nothing happened just pass the value as string - pass - hltRuleProperty.value = value - else: - self._log.warning('Parameter has no attribute value %s' % (node.toxml())) - - return hltRuleProperty \ No newline at end of file diff --git a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTOfflineRules.py b/Trigger/TrigConfiguration/TrigConfOffline/python/HLTOfflineRules.py deleted file mode 100644 index c63219d2f2efd3f7982506f02fcf47ec9312fc4f..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTOfflineRules.py +++ /dev/null @@ -1,1800 +0,0 @@ -########################################################################### -# Copyright (C) 2008 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Copyright: See COPYING file that comes with this distribution -# -# Description: -# Set of rules needed for the transformation from online to offline setup -# Every Rule has an apply method with an input with dictionary or array of HLT Algorithms -# -# Copy Rule: -# Data: source algorithm with maximum 1 parameter, target algorithm with maximum 1 parameter -# The value of source parameter is copied to the target -# -# Replace Rule: -# Data: online algorithms, offline algorithms -# Online algorithms are replaced by the offline algorithms -# -# Merge Rule: -# Data: algorithm with one or more properties -# Online properties of an online algorithm will be merged -# -# Rename Rule: -# Data: 1 online algorithm (max. 1 parameter), 1 offline algorithm -# Online algorithm resp. its parameter will be renamed to offline -# -# Modify Rule: -# Data: 1 online algorithm with 1 parameter, 1 offline algorithm with 1 offline parameter -# Value of the online parameter will be replaced by the offline value -# Value must be of type: list -# -# Sort Rule: -# Data: 1 algorithm, sort_order -# Values (must be of type: list) will be put at the start/end dependend on the sort_order of the list -# -########################################################################### - -import TrigConfOffline.HLTAlgorithm as HLTAlgorithm -import re, os - -class HLTOfflineRuleConsistencyError(Exception): - """ - Exception thrown by the rules in case of inconsistency - """ - pass - -## CopyRule class -# The copy rules applies to the list of HLTAlgorithms -class CopyRule(object): - ## The constructor of the class. - # @param self The object pointer - # @param kwargs arguments - def __init__(self, **kwargs): - self.__initLogger__() - ## @var sourceAlg - # Online algorithm with maximum 1 property it's value will be copied to the offline algorithm - self.__dict__['sourceAlg'] = None - ## @var targetAlg - # Offline algorithm with maximum 1 property will be set to value of the online algorithm property - self.__dict__['targetAlg'] = None - ## @var nactive - # Counter of algorithms modified by the rule - self.__dict__['nactive'] = 0 - - if kwargs.has_key('online') and isinstance(kwargs['online'],HLTRuleAlgorithm): - self.sourceAlg = kwargs['online'] - - if kwargs.has_key('offline') and isinstance(kwargs['offline'],HLTRuleAlgorithm): - self.targetAlg = kwargs['offline'] - - ## Conversion of the rule for pretty print - def __str__(self): - """ Convert the Copy Rule to string for print out.""" - output = "Copy Rule:" - algStr = "%s" % (self.sourceAlg) - output += "\n\tSource Algorithm:" - output += "\t\t" + algStr.replace("\n","\n\t\t") - output += "\n\tTarget Algorithm:" - algStr = "%s" % (self.targetAlg) - output += "\t\t" + algStr.replace("\n","\n\t\t") - return output - - ## Initialize logger of the class - def __initLogger__(self) : - from AthenaCommon.Logging import logging - self.__dict__['_log'] = logging.getLogger('HLTOfflineRules.CopyRule') - if self.__dict__.has_key('OutputLevel') : - self._log.setLevel(self.OutputLevel) - else : - self.__dict__['OutputLevel'] = 3 - - ## Set attribute of the class - def __setattr__(self, name, value) : - self._log.verbose('set attribute %s=%s' % (name, value)) - if name not in self.__dict__.keys(): - self.warning('Can not set %s=%s - unsupported attribute' % (name, value)) - return - - # Setting of the source/target algorithms - check the type - if name in ('sourceAlg', 'targetAlg') : - if isinstance(value, HLTRuleAlgorithm) : - self.__dict__[name] = value - else: - self._log.error('Unsupported type %s of the %s' % (type(value),name)) - - # Set the OutputLevel and the logger level - if name=='OutputLevel' : - self.__dict__[name]= value - self._log.setLevel(value) - - ## Apply Method - # @param self The object pointer - # @param algs Input list of HLTAlgorithms - # @return Number of modified algorithms - def apply(self, algs, OutputLevel=1): - """ Apply the Copy Rule on the list of algorithms: - Find matching online and offline algorithms in the list - algs - Apply the rule if matching algorithms found and return the number of modified algorithms. - """ - messg = '\n******************************************\n' - messg += '|| Copy Rule: Start ||\n' - messg += '******************************************\n' - self._log.verbose(messg) - self._log.verbose(self) - messgEnd = '\n******************************************\n' - messgEnd += '|| Copy Rule: End ||\n' - messgEnd += '******************************************\n' - nmod = 0 - # Test type of algs - if not isinstance(algs, list) : - self._log.warning('Unsupported input type %s - rule not applied' % (type(algs))) - self._log.verbose(messgEnd) - return 0 - - # Keep the found value in this variable - value = None - nvalues = 0 - # Search the input algorithm list for the source algorithm value - for parentAlg in algs : - for alg in parentAlg.flattenAlg() : - if self.sourceAlg.match(alg) : # Match the online algorithm - for propName, propValue in alg.getProperties().items() : - if self.sourceAlg.properties[0].match(propName,propValue) : - if nvalues<=0: - value = propValue - nvalues += 1 - elif value!=propValue: - self._log.error('Multiple inconsistent properties in input algorithm list - rule can not be applied') - self._log.debug('Existing value %s vs. %s/%s.%s= %s' % (value, alg.name, alg.alias, propName, propValue)) - self._log.verbose(messgEnd) - return 0 - - # Test if a source value exists - if nvalues<=0: - self._log.verbose("No source found %s" % (self.sourceAlg)) - self._log.verbose(messgEnd) - return 0 - - # Search the input algorithm list for the target algorithm value - for parentAlg in algs : - for alg in parentAlg.flattenAlg() : - if self.targetAlg.match(alg) : # Match the offline algorithm - for propName, propValue in alg.getProperties().items() : - if self.targetAlg.properties[0].match(propName,propValue) : - self._log.verbose('Original value: %s/%s.%s= %s' % (alg.name, alg.alias, propName, alg.getProperties()[propName])) - alg.setProperty(propName, value) - self._log.verbose('Modified value: %s/%s.%s= %s' % (alg.name, alg.alias, propName, alg.getProperties()[propName])) - nmod += 1 - self.nactive += 1 - - self._log.verbose(messgEnd) - return nmod - -class ReplaceRule(object): - """Replace Rule Class: - Replace the online algorithms by the offline algorithms - """ - ## List of online algorithms - _onlineAlgs = [] - ## List of offline algorithms - _offlineAlgs = [] - ## Counter of algorithms modified by the rule - _nactive = 0 - - ## The constructor of the class. - # @param self The object pointer - # @param args arguments - def __init__(self,*args): - if len(args) ==1 : - if isinstance(args[0],dict): - if args[0].has_key('online') : - self._onlineAlgs = args[0]['online'] - else : - raise HLTOfflineRuleConsistencyError('Replace Rule: No online component found') - - if args[0].has_key('offline') : - self._offlineAlgs = args[0]['offline'] - else : - raise HLTOfflineRuleConsistencyError('Replace Rule: No offline component found') - - def __str__(self): - """ Convert the Replace Rule to string for print out.""" - output = "Replace Rule:\n" - output += "\tOnline Algorithms:\n" - for a in self._onlineAlgs : - output += "\t\t%s/%s\n" % (a['name'], a['alias']) - if a.has_key('properties') : - for p,v in a['properties'].items() : - output += "\t\t\t%s = \'%s\'\n" % (p,v) - output+= "\tOffline Algorithms:\n" - for a in self._offlineAlgs : - output += "\t\t%s/%s\n" % (a['name'], a['alias']) - if a.has_key('properties') : - for p,v in a['properties'].items() : - output += "\t\t\t%s = \'%s\'\n" % (p,v) - return output - - ## Append an offline algorithm to the algorithm list - # @param self The object pointer - # @param offlineAlg Offline algorithm - # @param algs Algorithm list - # @param logger Logger - def _appendOfflineAlg(self, offlineAlg, algs, logger) : - nmod = 0 # Number of modified algs - inputAlgJobOptNames = getAlgJobOptNames(algs) - joboptname = "%s/%s" % (offlineAlg['name'],offlineAlg['alias']) - if joboptname in inputAlgJobOptNames : - ind = 0 - while ind < len(inputAlgJobOptNames) : - try : - ind += inputAlgJobOptNames[ind:].index(joboptName) - mesg = "\n____________________________\n" - mesg += "Algorithm before application: %d\n" % (ind) - mesg += "----------------------------\n" - mesg += alg2str(algs[ind]) - logger.debug(mesg) - for offpropname in offlineAlg['properties'] : - algs[ind]['properties'][offpropname] = offlineAlg['properties'][offpropname] - - mesg = "\n____________________________\n" - mesg += "Algorithm after application: %d\n" % (ind) - mesg += "----------------------------\n" - mesg += alg2str(algs[ind]) - logger.debug(mesg) - nmod += 1 - ind +=1 - except : - ind = len(inputAlgJobOptNames) - else: - mesg = "\n____________________________\n" - mesg += "Append Offline Algorithm: \n" - mesg += "----------------------------\n" - mesg += alg2str(offlineAlg) - logger.debug(mesg) - algs.append(offlineAlg) - nmod += 1 - return nmod - - ## Apply the rule to the list of algorithms - # @param self The object pointer - # @param algs List of algorithms - # @param OutputLevel Logger OutputLevel - # @return Number of modified algorithms - def apply(self, algs, OutputLevel=3) : - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTOfflineRule.Replace') - logger.setLevel(OutputLevel) - # Counter of modified algorithms - nmod = 0 - nmodprop = 0 - - if isinstance(algs, list) : - messg = '\n==========================================\n' - messg += '|| Replace Rule: Start ||\n' - messg += '==========================================\n' - logger.verbose(messg) - logger.debug(self) - - # Execute the recursive application of the rule - nmod = self.applyRecursive(algs,logger) - - messg = '\n==========================================\n' - messg += '|| Replace Rule: %d End ||\n' % (nmod) - messg += '==========================================\n' - logger.verbose(messg) - - self._nactive += nmod - return nmod - - ## Apply the rule recursively to the list of algorithms - # @param self The object pointer - # @param algs List of algorithms - # @param logger Logger - # @return Number of modified algorithms - def applyRecursive(self,algs,logger) : - # Counter of modified algorithms - nmod = 0 - # Counter of modified properties - nmodprop = 0 - - if isinstance(algs, list) and len(algs)>0: - nmatchingOnlineAlgs = 0 - for onlineAlg in self._onlineAlgs : - for alg in algs : - matchingAlg = matchString(onlineAlg['name'], alg.name) and matchString(onlineAlg['alias'], alg.alias) - if matchingAlg and onlineAlg.has_key('py_name'): - matchingAlg = matchString(onlineAlg['py_name'], alg.getPy_name()) - if matchingAlg and onlineAlg.has_key('py_package'): - matchingAlg = matchString(onlineAlg['py_package'], alg.getPy_package()) - if matchingAlg: - nmatchingOnlineAlgs += 1 - # Break the loop over parent algorithms - no need to continue the counter has been increased - break - - # Apply only if all online algorithms have been found in the list - if nmatchingOnlineAlgs == len(self._onlineAlgs) and nmatchingOnlineAlgs > 0 : - # Set the parent algorithm if exists - the input algorithms must have either no parent or a common parent algorithm - parentAlgorithm = None - if algs[0].hasParent() : - parentAlgorithm = algs[0].getParent() - - # Found matching offline Algorithms - the not found will be attached to the list of algorithms - matchingOfflineAlgs = {} - # Process the parent algorithms first - # Loop over parent algorithms for selection of matching algs - i = 0 - while i < len(algs) : - # Flag that the algorithm was modified - algModified = False - algDeleted = False - # Select matching online parent algorithms: - for onlineAlg in self._onlineAlgs : - matchingAlg = matchString(onlineAlg['name'], algs[i].name) and matchString(onlineAlg['alias'], algs[i].alias) - if matchingAlg and onlineAlg.has_key('py_name'): - matchingAlg = matchString(onlineAlg['py_name'], algs[i].getPy_name()) - if matchingAlg and onlineAlg.has_key('py_package'): - matchingAlg = matchString(onlineAlg['py_package'], algs[i].getPy_package()) - if matchingAlg: - logger.verbose("Matching online Algorithm found:\n%s" % (algs[i])) - firstLog = True - # Search for matching offline algorithm - matchOffline = None - for offlineAlg in self._offlineAlgs : - if matchString(offlineAlg['alias'], algs[i].getAlias()) : - # Match the rest of the algorithm items - matchingAlg = matchString(offlineAlg['name'], algs[i].name) - if matchingAlg and offlineAlg.has_key('py_name'): - matchingAlg = matchString(offlineAlg['py_name'], algs[i].getPy_name()) - if matchingAlg and offlineAlg.has_key('py_package'): - matchingAlg = matchString(offlineAlg['py_package'], algs[i].getPy_package()) - if matchingAlg: - matchOffline = offlineAlg - elif matchOffline == None : - matchOffline = offlineAlg - - # If no matching algorithm found - delete the online algorithm - if matchOffline == None : - messg = "\n____________________________\n" - messg += "Algorithm will be deleted: %d\n" % (i) - messg += "----------------------------\n" - messg += '%s' % (algs[i]) - logger.debug(messg) - algs[i].delete() - algDeleted = True - del algs[i] - nmod += 1 - continue - else : # At least the alias of the algorithm matches - # If the alias matches only - change the name of the algorithm - matchingAlg = matchString(matchOffline['name'], algs[i].name) - if matchingAlg and matchOffline.has_key('py_name'): - matchingAlg = matchString(matchOffline['py_name'], algs[i].getPy_name()) - if matchingAlg and matchOffline.has_key('py_package'): - matchingAlg = matchString(matchOffline['py_package'], algs[i].getPy_package()) - if not matchingAlg: - if not algModified : - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += '%s' % (algs[i]) - logger.debug(messg) - # This operation may be dangerous if the name of the offline algorithm contains wildcards - #logger.debug('Algorithm %s/%s - set name: %s' % (algs[i].getAlias(), algs[i].getName(), matchOffline['name'])) - algs[i].setName(matchOffline['name']) - if matchOffline.has_key('py_name') : algs[i].py_name = matchOffline['py_name'] - if matchOffline.has_key('py_package') : algs[i].py_package = matchOffline['py_package'] - algModified = True - - # Append an algorithm to the used offline algorithms - dictName = '%s/%s' % (matchOffline['name'],matchOffline['alias']) - if not matchingOfflineAlgs.has_key(dictName) : - matchingOfflineAlgs[dictName] = matchOffline - - # Handle the properties - onlineProperties = {} - if onlineAlg.has_key('properties') : onlineProperties = onlineAlg['properties'] - offlineProperties = {} - if matchOffline.has_key('properties') : offlineProperties = matchOffline['properties'] - - for k in onlineProperties.keys() : - # Property mentioned in online and offline and in alg - set it - if offlineProperties.has_key(k) and algs[i].getProperties().has_key(k) : - if not algModified : - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += '%s' % (algs[i]) - logger.debug(messg) - algs[i].setProperty(k,offlineProperties[k]) - algModified = True - nmodprop += 1 - - # Property mentioned in online does not exists in offline - delete it - if not offlineProperties.has_key(k) and algs[i].getProperties().has_key(k) : - if not algModified : - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += '%s' % (algs[i]) - logger.debug(messg) - del algs[i].properties[k] - algModified = True - nmodprop += 1 - - for k,v in offlineProperties.items() : - # Property mentioned in offline only - set it - if not onlineProperties.has_key(k) : - if not algModified : - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += '%s' % (algs[i]) - logger.debug(messg) - algs[i].setProperty(k,v) - algModified = True - nmodprop += 1 - - # Print the debug message - # Get to the next iteration if the online algorithm was modified - if algModified : - messg = "\n____________________________\n" - messg += "Algorithm after application:\n" - messg += "----------------------------\n" - messg += '%s' % (algs[i]) - logger.debug(messg) - nmod += 1 - #if not algDeleted: i += 1 - continue - # End of loop over Rule online algorithms - if algDeleted : continue - # Select matching offline parent algorithms: - for offlineAlg in self._offlineAlgs : - if matchString(offlineAlg['name'], algs[i].name) and matchString(offlineAlg['alias'], algs[i].alias): - dictName = '%s/%s' % (offlineAlg['name'],offlineAlg['alias']) - if not matchingOfflineAlgs.has_key(dictName) : - matchingOfflineAlgs[dictName] = offlineAlg - - # Handle the properties - offlineProperties = {} - if offlineAlg.has_key('properties') : offlineProperties = offlineAlg['properties'] - - for k,v in offlineProperties.items() : - if not algModified : - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += '%s' % (algs[i]) - logger.debug(messg) - algs[i].setProperty(k,v) - algModified = True - nmodprop += 1 - - # Print the debug message - if algModified : - messg = "\n____________________________\n" - messg += "Algorithm after application:\n" - messg += "----------------------------\n" - messg += '%s' % (algs[i]) - logger.debug(messg) - nmod += 1 - - if not algDeleted: i += 1 - # End of loop over parent algorithms for selection of matching algs - - # Process the offline algorithms which were not used - for offlineAlg in self._offlineAlgs : - dictName = '%s/%s' % (offlineAlg['name'],offlineAlg['alias']) - # Unused offline algorithm - it has to be appended - either to the list or to the parent algorithm - if not matchingOfflineAlgs.has_key(dictName) : - offlineHLTAlg = HLTAlgorithm.HLTAlgorithm(name=offlineAlg['name'],alias=offlineAlg['alias']) - for k,v in offlineAlg.items() : - if k != 'properties' : - offlineHLTAlg.__setattr__(k,v) - else: - for kk,vv in v.items() : - offlineHLTAlg.setProperty(kk,vv) - - # Append the algorithm - if parentAlgorithm == None : - algs.append(offlineHLTAlg) - else : - parentAlgorithm.appendChild(offlineHLTAlg) - - nmod += 1 - - # Printout a message - messg = "\n____________________________\n" - messg += "New offline Algorithm created:\n" - messg += "----------------------------\n" - messg += '%s' % (offlineHLTAlg) - logger.debug(messg) - - # Process the children algorithms within the parent algorithms - for parentAlg in algs : - if parentAlg.hasChildren() : # recursive call of the apply function - nmod += self.applyRecursive(parentAlg.getChildren(),logger) - - return nmod - -## MergeRule class -class MergeRule(object): - ## The constructor of the class. - # @param self The object pointer - # @param kwargs arguments - def __init__(self, **kwargs): - self.__initLogger__() - ## @var sourceAlg - # Online algorithm with maximum 1 property it's value will be copied to the offline algorithm - self.__dict__['sourceAlg'] = None - ## @var nactive - # Counter of algorithms modified by the rule - self.__dict__['nactive'] = 0 - - if kwargs.has_key('online') and isinstance(kwargs['online'],HLTRuleAlgorithm): - self.sourceAlg = kwargs['online'] - - ## Conversion of the rule for pretty print - def __str__(self): - """ Convert the Copy Rule to string for print out.""" - output = "Merge Rule:" - algStr = "%s" % (self.sourceAlg) - output += "\n\tSource Algorithm:\n %s" - output += "\t\t" + algStr.replace("\n","\n\t\t") - return output - - ## Initialize logger of the class - def __initLogger__(self) : - from AthenaCommon.Logging import logging - self.__dict__['_log'] = logging.getLogger('HLTOfflineRules.MergeRule') - if self.__dict__.has_key('OutputLevel') : - self._log.setLevel(self.OutputLevel) - else : - self.__dict__['OutputLevel'] = 3 - - ## Set attribute of the class - def __setattr__(self, name, value) : - self._log.verbose('set attribute %s=%s' % (name, value)) - if name not in self.__dict__.keys(): - self.warning('Can not set %s=%s - unsupported attribute' % (name, value)) - return - - # Setting of the source/target algorithms - check the type - if name in ('sourceAlg') : - if isinstance(value, HLTRuleAlgorithm) : - self.__dict__[name] = value - else: - self._log.error('Unsupported type %s of the %s' % (type(value),name)) - - # Set the OutputLevel and the logger level - if name=='OutputLevel' : - self.__dict__[name]= value - self._log.setLevel(value) - - ## Apply Method - # @param self The object pointer - # @param algs Input list of HLTAlgorithms - # @return Number of modified algorithms - def apply(self, algs, OutputLevel=1): - """ Apply the Merge Rule on the list of algorithms: - Find matching online algorithms in the list - algs - Apply the rule if matching algorithms found and return the number of modified algorithms. - """ - messg = '\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n' - messg += '|| Merge Rule: Start ||\n' - messg += '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n' - self._log.verbose(messg) - self._log.verbose(self) - messgEnd = '\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n' - messgEnd += '|| Merge Rule: End ||\n' - messgEnd += '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n' - nmod = 0 - # Test type of algs - if not isinstance(algs, list) : - self._log.warning('Unsupported input type %s - rule not applied' % (type(algs))) - self._log.verbose(messgEnd) - return 0 - - # Find and assemble matching properties - properties = {} - matchingAlgs = [] - for parentAlg in algs : - for alg in parentAlg.flattenAlg(): - if self.sourceAlg.match(alg): - matchingAlgs.append(alg) - for propName, value in alg.getProperties().items() : - for propRule in self.sourceAlg.properties : - if propRule.match(propName,value): - if properties.has_key(propName): - properties[propName] = self.mergeItems(properties[propName], value) - else: - properties[propName] = value - - nmod=0 - for alg in matchingAlgs : - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += "%s" % (alg) - self._log.debug(messg) - # Set the properties - for name, value in properties.items(): - alg.setProperty(name,value) - - nmod += 1 - messg = "\n____________________________\n" - messg += "Algorithm after application:\n" - messg += "----------------------------\n" - messg += "%s" % (alg) - self._log.debug(messg) - - self.nactive += nmod - self._log.verbose(messgEnd) - return nmod - - ## Merge Values - # @param self The object pointer - # @param value1 - # @param value2 - # @return Merged values - def mergeItems(self, value1, value2): - """ Merge 2 values - Value1 type: Value2 type: Result type: - list other list - other list list - str str str - other other list - If type one of the input values is of list type it checks the present of the items and do not repeat them - """ - output=None - if isinstance(value1, list) and isinstance(value2, list): - output = [] - for item in value1 : - if item not in output : - output.append(item) - for v2 in value2 : - if not v2 in output : output.append(v2) - - elif isinstance(value1, list) and not isinstance(value2, list): - output = [] - for item in value1 : - if item not in output : - output.append(item) - if value2 not in value1 : output.append(value2) - - elif not isinstance(value1, list) and isinstance(value2, list): - output = [] - for item in value2 : - if item not in output : - output.append(item) - if value1 not in value2 : output.append(value1) - - elif isinstance(value1, str) and isinstance(value2, str): - output = value1+value2 - - else : - output = [] - output.append(value1) - if value2 not in output : - output.append(value2) - - return output - -class MergeRuleOld(object): - _alg = {} - _nactive = 0 - def __init__(self,*args): - if len(args) ==1 : - if isinstance(args[0],dict): - if args[0].has_key('component') : - self._alg = args[0]['component'] - else : - self._alg = args[0] - - def __str__(self): - output = "Merge Rule:\n" - output += "\tAlgorithm:\n" - output += "\t\t%s/%s\n" % (self._alg['name'], self._alg['alias']) - if self._alg.has_key('properties') : - for p,v in self._alg['properties'].items() : - output += "\t\t\t%s = \'%s\'\n" % (p,v) - return output - - def apply(self, algs, OutputLevel=3): - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTOfflineRule.Merge') - logger.setLevel(OutputLevel) - nmod = 0 - if isinstance(algs, list) : - messg = '\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n' - messg += '|| Merge Rule: Start ||\n' - messg += '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n' - logger.verbose(messg) - logger.debug(self) - - # Prepare the container for the merged properties - for k in self._alg['properties'].keys() : - self._alg['properties'][k] = [] - - # Flatten the algorithm list - flattenAlgs = [] - for alg in algs : - flattenAlgs.extend(alg.flattenAlg()) - - # Container for algorithms which has to be modified - speeds up the treatment - modifyAlgs = [] - for alg in flattenAlgs : - matchingAlg = matchString(self._alg['name'], alg.name) and matchString(self._alg['alias'], alg.alias) - if matchingAlg and self._alg.has_key('py_name'): - matchingAlg = matchString(self._alg['py_name'], alg.getPy_name()) - if matchingAlg and self._alg.has_key('py_package'): - matchingAlg = matchString(self._alg['py_package'], alg.getPy_package()) - if matchingAlg : - modifyAlgs.append(alg) - for property, value in self._alg['properties'].items() : - logger.debug('Property: %s\tValue: %s' % (property,value)) - if alg.getProperties().has_key(property) : - logger.debug('Algorithm Property: %s\tValue: %s\t Type of value:%s' % (property,alg.getProperties()[property], type(alg.getProperties()[property]))) - for item in alg.getProperties()[property] : - logger.verbose('Item: %s' % (item)) - if item not in value : - value.append(item) - logger.debug('Item %s appended: %s' % (item, value)) - # Accumulate the items in the rule alg.property - self._alg['properties'][property] = value - - # Loop over algorithms which has to be modified - for alg in modifyAlgs : - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += '%s' % (alg) - logger.debug(messg) - for property, value in self._alg['properties'].items() : - alg.setProperty(property, value) - nmod += 1 - messg = "\n____________________________\n" - messg += "Algorithm after application:\n" - messg += "----------------------------\n" - messg += '%s' % (alg) - logger.debug(messg) - #nmod += self.applyRecursive(algs,logger) - - # Empty the containers for the merged properties - for k in self._alg['properties'].keys() : - self._alg['properties'][k] = [] - - messg = '\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n' - messg += '|| Merge Rule: End ||\n' - messg += '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n' - logger.verbose(messg) - - self._nactive += nmod - return nmod - -## RenameRule class -# The Rename rule applies to the list of algorithms -# Algorithm matching the online algorithm is renamed to offline -class RenameRule(object): - ## The constructor of the class. - # @param self The object pointer - # @param kwargs arguments - def __init__(self, **kwargs): - self.__initLogger__() - ## @var sourceAlg - # Online algorithm with maximum 1 property it's value will be copied to the offline algorithm - self.__dict__['sourceAlg'] = None - ## @var targetAlg - # Offline algorithm with maximum 1 property will be set to value of the online algorithm property - self.__dict__['targetAlg'] = None - ## @var nactive - # Counter of algorithms modified by the rule - self.__dict__['nactive'] = 0 - - if kwargs.has_key('online') and isinstance(kwargs['online'],HLTRuleAlgorithm): - self.sourceAlg = kwargs['online'] - - if kwargs.has_key('offline') and isinstance(kwargs['offline'],HLTRuleAlgorithm): - self.targetAlg = kwargs['offline'] - - ## Initialize logger of the class - def __initLogger__(self) : - from AthenaCommon.Logging import logging - self.__dict__['_log'] = logging.getLogger('HLTOfflineRules.RenameRule') - if self.__dict__.has_key('OutputLevel') : - self._log.setLevel(self.OutputLevel) - else : - self.__dict__['OutputLevel'] = 3 - - ## Set attribute of the class - def __setattr__(self, name, value) : - self._log.verbose('set attribute %s=%s' % (name, value)) - if name not in self.__dict__.keys(): - self.warning('Can not set %s=%s - unsupported attribute' % (name, value)) - return - - # Setting of the source/target algorithms - check the type - if name in ('sourceAlg', 'targetAlg') : - if isinstance(value, HLTRuleAlgorithm) : - self.__dict__[name] = value - else: - self._log.error('Unsupported type %s of the %s' % (type(value),name)) - - # Set the OutputLevel and the logger level - if name=='OutputLevel' : - self.__dict__[name]= value - self._log.setLevel(value) - - ## Convert the class for pretty print - def __str__(self): - output = "Rename Rule:\n" - output += "\tOnline Algorithm:" - algStr = '%s' % (self.sourceAlg) - output += "\n\t\t" + algStr.replace("\n","\n\t\t") + "\n" - output += "\tOffline Algorithm:" - algStr = '%s' % (self.targetAlg) - output += "\n\t\t" + algStr.replace("\n","\n\t\t") - return output - - ## Check self consistency of the rule - def consistencycheck(self) : - nonline_par = len(self.sourceAlg.properties) - noffline_par = len(self.targetAlg.properties) - if nonline_par > 1 or noffline_par > 1 or nonline_par != noffline_par: - self._log.error("Incosistent number of properties in online or offline algorithm") - return False - return True - - ## Apply the rule to the HLTAlgorithm list - # @param self The object pointer - # @param algs - list of HLTAlgorithms - # @param OutputLevel - obsolete - def apply(self, algs, OutputLevel=3): - messg = '\n******************************************\n' - messg += '|| Rename Rule: Start ||\n' - messg += '******************************************\n' - self._log.verbose(messg) - self._log.verbose(self) - nmod = 0 - if not self.consistencycheck(): return 0 - # test type of algs - if isinstance(algs, list) : - # Search the input algorithm list for the source algorithm value - for parentAlg in algs : - for alg in parentAlg.flattenAlg() : - if self.sourceAlg.match(alg) : - # Print the message - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += "%s" % (alg) - self._log.debug(messg) - # Change the algorithm - for item in self.targetAlg.getApplicableItems() : - if item != 'properties' : - alg.__setattr__(item,self.targetAlg.getAttribute(item)) - elif len (self.targetAlg.properties) > 0: - alg.setProperty(self.targetAlg.properties[0].getName(),self.targetAlg.properties[0].getvalue()) - - nmod += 1 - # Print the message - messg = "\n____________________________\n" - messg += "Algorithm after application:\n" - messg += "----------------------------\n" - messg += "%s" % (alg) - self._log.debug(messg) - - messg = '\n******************************************\n' - messg += '|| Rename Rule: End ||\n' - messg += '******************************************\n' - self._log.verbose(messg) - self.nactive += nmod - return nmod - -class RenameRuleOld(object): - _onlineAlg = {} - _offlineAlg = {} - _nactive = 0 - def __init__(self,*args): - if len(args) ==1 : - if isinstance(args[0],dict): - if args[0].has_key('online') : - self._onlineAlg = args[0]['online'] - else : - raise HLTOfflineRuleConsistencyError('Rename Rule: No online component found') - - if args[0].has_key('offline') : - self._offlineAlg = args[0]['offline'] - else : - raise HLTOfflineRuleConsistencyError('Rename Rule: No offline component found') - - self._consistencycheck() - - def __str__(self): - output = "Rename Rule:\n" - output += "\tOnline Algorithm:\n" - output += "\t\t%s/%s\n" % (self._onlineAlg['name'], self._onlineAlg['alias']) - if self._onlineAlg.has_key('properties') : - for p,v in self._onlineAlg['properties'].items() : - output += "\t\t\t%s = \'%s\'\n" % (p,v) - output+= "\tOffline Algorithm:\n" - output += "\t\t%s/%s\n" % (self.targetAlg['name'], self.targetAlg['alias']) - if self.targetAlg.has_key('properties') : - for p,v in self.targetAlg['properties'].items() : - output += "\t\t\t%s = \'%s\'\n" % (p,v) - return output - - def _consistencycheck(self) : - nonline_par = 0 - noffline_par = 0 - if self.sourceAlg.has_key('properties') : - nonline_par = len(self._onlineAlg['properties']) - if self._offlineAlg.has_key('properties') : - noffline_par = len(self._offlineAlg['properties']) - - if nonline_par > 1 or noffline_par > 1 or nonline_par != noffline_par: - raise HLTOfflineRuleConsistencyError('Rename Rule: Inconsistent number of parameters: \n %s' % (self)) - - def apply(self, algs, OutputLevel=3): - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTOfflineRule.Rename') - logger.setLevel(OutputLevel) - messg = '\n******************************************\n' - messg += '|| Rename Rule: Start ||\n' - messg += '******************************************\n' - logger.verbose(messg) - logger.debug(self) - nmod = 0 - # test type of algs - if isinstance(algs, list) : - sourceParentName = self._onlineAlg['name'].split('.')[0] - sourceParentAlias = self._onlineAlg['alias'].split('.')[0] - # Search the input algorithm list for the source algorithm value - for parentAlg in algs : - #algParentAlias = parentAlg.alias.split('.')[0] - #if matchString(sourceParentAlias, algParentAlias) : - for alg in parentAlg.flattenAlg() : - matchingAlg = matchString(self._onlineAlg['name'], alg.name) and matchString(self._onlineAlg['alias'], alg.alias) - if matchingAlg and self._onlineAlg.has_key('py_name'): - matchingAlg = matchString(self._onlineAlg['py_name'], alg.getPy_name()) - if matchingAlg and self._onlineAlg.has_key('py_package'): - matchingAlg = matchString(self._onlineAlg['py_package'], alg.getPy_package()) - if matchingAlg : - # Print the message - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += "%s" % (alg) - logger.debug(messg) - # Change the algorithm - for k,v in self._offlineAlg.items() : - if k != 'properties' : - alg.__setattr__(k,v) - nmod += 1 - # Print the message - messg = "\n____________________________\n" - messg += "Algorithm after application:\n" - messg += "----------------------------\n" - messg += "%s" % (alg) - logger.debug(messg) - - messg = '\n******************************************\n' - messg += '|| Rename Rule: End ||\n' - messg += '******************************************\n' - logger.verbose(messg) - self._nactive += nmod - return nmod - - -## ModifyRule class -# The modify rules applies to the list of HLTAlgorithms -class ModifyRule(object): - ## The constructor of the class. - # @param self The object pointer - # @param kwargs arguments - def __init__(self, **kwargs): - self.__initLogger__() - ## @var sourceAlg - # Online algorithm with maximum 1 property it's value will be copied to the offline algorithm - self.__dict__['sourceAlg'] = None - ## @var targetAlg - # Offline algorithm with maximum 1 property will be set to value of the online algorithm property - self.__dict__['targetAlg'] = None - ## @var nactive - # Counter of algorithms modified by the rule - self.__dict__['nactive'] = 0 - - if kwargs.has_key('online') and isinstance(kwargs['online'],HLTRuleAlgorithm): - self.sourceAlg = kwargs['online'] - - if kwargs.has_key('offline') and isinstance(kwargs['offline'],HLTRuleAlgorithm): - self.targetAlg = kwargs['offline'] - - ## Conversion of the rule for pretty print - def __str__(self): - """ Convert the Copy Rule to string for print out.""" - output = "Modify Rule:" - output += "\n\tSource Algorithm:" - algStr = "%s" % (self.sourceAlg) - output += "\t\t" + algStr.replace("\n","\n\t\t") - output += "\n\tTarget Algorithm:" - algStr = "%s" % (self.targetAlg) - output += "\t\t" + algStr.replace("\n","\n\t\t") - return output - - ## Initialize logger of the class - def __initLogger__(self) : - from AthenaCommon.Logging import logging - self.__dict__['_log'] = logging.getLogger('HLTOfflineRules.ModifyRule') - if self.__dict__.has_key('OutputLevel') : - self._log.setLevel(self.OutputLevel) - else : - self.__dict__['OutputLevel'] = 3 - - ## Set attribute of the class - def __setattr__(self, name, value) : - self._log.verbose('set attribute %s=%s' % (name, value)) - if name not in self.__dict__.keys(): - self.warning('Can not set %s=%s - unsupported attribute' % (name, value)) - return - - # Setting of the source/target algorithms - check the type - if name in ('sourceAlg', 'targetAlg') : - if isinstance(value, HLTRuleAlgorithm) : - self.__dict__[name] = value - else: - self._log.error('Unsupported type %s of the %s' % (type(value),name)) - - # Set the OutputLevel and the logger level - if name=='OutputLevel' : - self.__dict__[name]= value - self._log.setLevel(value) - - ## Apply Method - # @param self The object pointer - # @param algs Input list of HLTAlgorithms - # @return Number of modified algorithms - def apply(self, algs, OutputLevel=1): - """ Apply the Copy Rule on the list of algorithms: - Find matching online and offline algorithms in the list - algs - Apply the rule if matching algorithms found and return the number of modified algorithms. - """ - messg = '\n******************************************\n' - messg += '|| Modify Rule: Start ||\n' - messg += '******************************************\n' - self._log.verbose(messg) - self._log.verbose(self) - messgEnd = '\n******************************************\n' - messgEnd += '|| Modify Rule: End ||\n' - messgEnd += '******************************************\n' - nmod = 0 - # Test type of algs - if not isinstance(algs, list) : - self._log.warning('Unsupported input type %s - rule not applied' % (type(algs))) - self._log.verbose(messgEnd) - return 0 - - # Search the input algorithm list for the source algorithm value - for parentAlg in algs : - for alg in parentAlg.flattenAlg() : - if self.sourceAlg.match(alg, 0x1ff) : # Match the online algorithm - match only property name not a value - for propName, propValue in alg.getProperties().items() : - propToSet = {} - # Loop over source properties to match and remove the items - for srcAlgProp in self.sourceAlg.properties : - if srcAlgProp.match(propName,propValue, 0x1) : - # Test if all items are present in the algorithm property - matchFlag = True - copyPropValue = propValue[:] - for item in srcAlgProp.getValue(): - if item not in propValue: - matchFlag = False - break - else : # remove item from the value - i=0 - while i < len(copyPropValue) : - if copyPropValue[i]==item : - del copyPropValue[i] - else : - i += 1 - - if matchFlag : - propToSet[propName] = copyPropValue - - # Loop Over target properties to set the items - for trgAlgProp in self.targetAlg.properties: - if trgAlgProp.match(propName,propValue, 0x1) and propToSet.has_key(propName): - for item in trgAlgProp.getValue(): propToSet[propName].append(item) - - # Set the properties of the algorithm - for k,v in propToSet.items() : - # Print the message - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += "%s" % (alg) - self._log.debug(messg) - alg.setProperty(k,v) - nmod += 1 - messg = "\n____________________________\n" - messg += "Algorithm after application:\n" - messg += "----------------------------\n" - messg += "%s" % (alg) - self._log.debug(messg) - - # End of apply - self._log.verbose(messg) - self.nactive += nmod - return nmod - -class ModifyRuleOld(object): - _onlineAlg = {} - _offlineAlg = {} - _nactive = 0 - def __init__(self,*args): - if len(args) ==1 : - if isinstance(args[0],dict): - if args[0].has_key('online') : - self._onlineAlg = args[0]['online'] - else : - raise HLTOfflineRuleConsistencyError('Modify Rule: No online component found') - - if args[0].has_key('offline') : - self._offlineAlg = args[0]['offline'] - else : - raise HLTOfflineRuleConsistencyError('Modify Rule: No offline component found') - - def __str__(self): - output = "Modify Rule:\n" - output += "\tOnline Algorithm:\n" - output += "\t\t%s/%s\n" % (self._onlineAlg['name'], self._onlineAlg['alias']) - if self._onlineAlg.has_key('properties') : - for p,v in self._onlineAlg['properties'].items() : - output += "\t\t\t%s = \'%s\'\n" % (p,v) - output+= "\tOffline Algorithm:\n" - output += "\t\t%s/%s\n" % (self._offlineAlg['name'], self._offlineAlg['alias']) - if self._offlineAlg.has_key('properties') : - for p,v in self._offlineAlg['properties'].items() : - output += "\t\t\t%s = \'%s\'\n" % (p,v) - return output - - def apply(self, algs, OutputLevel=3): - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTOfflineRule.Modify') - logger.setLevel(OutputLevel) - messg = '\n##########################################\n' - messg += '|| Modify Rule: Start ||\n' - messg += '##########################################\n' - logger.verbose(messg) - logger.debug(self) - nmod = 0 - if isinstance(algs, list) : - sourceParentName = self._onlineAlg['name'].split('.')[0] - sourceParentAlias = self._onlineAlg['alias'].split('.')[0] - # Search the input algorithm list for the source algorithm value - for parentAlg in algs : - #algParentAlias = parentAlg.alias.split('.')[0] - #if matchString(sourceParentAlias, algParentAlias) : - for alg in parentAlg.flattenAlg() : - matchingAlg = matchString(self._onlineAlg['name'], alg.name) and matchString(self._onlineAlg['alias'], alg.alias) - if matchingAlg and self._onlineAlg.has_key('py_name'): - matchingAlg = matchString(self._onlineAlg['py_name'], alg.getPy_name()) - if matchingAlg and self._onlineAlg.has_key('py_package'): - matchingAlg = matchString(self._onlineAlg['py_package'], alg.getPy_package()) - if matchingAlg : - for k in self._onlineAlg['properties'].keys(): - if k in alg.getProperties().keys(): - onlinevalues = self._onlineAlg['properties'][k] - propvalue = alg.properties[k] - nonlinefound = 0 - for onlineel in onlinevalues : - if onlineel in propvalue : - nonlinefound += 1 - - # If all items in the rule found in algorithm property the algorithm will be changed - if nonlinefound == len(self._onlineAlg['properties'][k]) : - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += "\t %s/%s.%s = %s" % (alg.name, alg.alias, k, alg.properties[k]) - logger.debug(messg) - ind = 0 - if nonlinefound != 0 : - # Delete the online items - for onlineel in onlinevalues : - while ind < len(alg.properties[k]) : - try: - ind = alg.properties[k].index(onlineel) - del alg.properties[k][ind] - except : - ind = len(alg.properties[k]) - # Extend algorithm value with the offline items - for offlineeel in self._offlineAlg['properties'][k] : - if offlineeel not in alg.properties[k] : - alg.properties[k].append(offlineeel) - messg = "\n____________________________\n" - messg += "Algorithm after application:\n" - messg += "----------------------------\n" - messg += "\t %s/%s.%s = %s" % (alg.name, alg.alias, k, alg.properties[k]) - logger.debug(messg) - nmod += 1 - - messg = '\n##########################################\n' - messg += '|| Modify Rule: %d End ||\n' % (nmod) - messg += '##########################################\n' - logger.verbose(messg) - self._nactive += nmod - return nmod - -class SortRule(object): - _alg = {} - _sortOrder = 'start' - _nactive = 0 - def __init__(self,*args): - if len(args) ==1 : - if isinstance(args[0],dict): - if args[0].has_key('sortOrder') : - self._sortOrder = args[0]['sortOrder'].lower() - if args[0].has_key('component') : - self._alg = args[0]['component'] - else : - raise HLTOfflineRuleConsistencyError('Sort Rule: No component found: %s' % (args[0])) - - def __str__(self): - output = "Sort Rule:\n" - output +="\tSort Order: %s" % (self._sortOrder) - output += "\tAlgorithm:\n" - output += "\t\t%s/%s\n" % (self._alg['name'], self._alg['alias']) - if self._alg.has_key('properties') : - for p,v in self._alg['properties'].items() : - output += "\t\t\t%s = \'%s\'\n" % (p,v) - return output - - def apply(self, algs, OutputLevel=3): - from AthenaCommon.Logging import logging - logger = logging.getLogger('HLTOfflineRule.Sort') - logger.setLevel(OutputLevel) - messg = '\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n' - messg += '|| Sort Rule: Start ||\n' - messg += '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n' - logger.verbose(messg) - logger.debug(self) - nmod = 0 - if isinstance(algs, list) : - sourceParentName = self._alg['name'].split('.')[0] - sourceParentAlias = self._alg['alias'].split('.')[0] - # Search the input algorithm list for the source algorithm value - for parentAlg in algs : - #algParentAlias = parentAlg.alias.split('.')[0] - #if matchString(sourceParentAlias, algParentAlias) : - for alg in parentAlg.flattenAlg() : - matchingAlg = matchString(self._alg['name'], alg.name) and matchString(self._alg['alias'], alg.alias) - if matchingAlg and self._alg.has_key('py_name'): - matchingAlg = matchString(self._alg['py_name'], alg.getPy_name()) - if matchingAlg and self._alg.has_key('py_package'): - matchingAlg = matchString(self._alg['py_package'], alg.getPy_package()) - if matchingAlg : - algModified=False - # Loop over properties of the sort algorithm - for k in self._alg['properties'].keys(): - if k in alg.getProperties().keys(): - # Deepcopy the algorithm property - propvalue = [] - for algv in alg.getProperties()[k] : - propvalue.append(algv) - - nfound = 0 - matchvalues = [] - # Loop over items of the Sort algorithm - for onlineel in self._alg['properties'][k] : - ind = 0 - lmatch = len(matchvalues) - while ind < len(propvalue) : - try : - # Find sort Algorithm item - ind = propvalue.index(onlineel) - # If found delete it from the list - matchvalues.append(propvalue.pop(ind)) - except: - # If not found set the ind to stop the loop - ind = len(propvalue) - # set the count of found values - if lmatch < len(matchvalues) : - nfound += 1 - - if len(matchvalues) != len(self._alg['properties'][k]) and nfound == len(self._alg['properties'][k]) : - # Mismatch of items in algorithm and values listed in sort rule - more items in the alg property - logger.warning("%s can't be applied inconsistent properties: %s" % (self._alg['properties'][k], alg.properties[k])) - elif nfound == len(self._alg['properties'][k]): - # Match - found properties - value = alg.properties[k] - # Prepend the items - if self._sortOrder in ['start', 'begin'] : - value = self._alg['properties'][k] - value.extend(propvalue) - # Append the items - if self._sortOrder in ['end'] : - value = propvalue - value.extend(self._alg['properties'][k]) - - if not algModified : - messg = "\n____________________________\n" - messg += "Algorithm before application:\n" - messg += "----------------------------\n" - messg += '%s' % (alg) - logger.debug(messg) - - # Set the algorithm.property value - logger.verbose("Previous value of property: %s/%s.%s=%s" % (alg.name, alg.alias, k, alg.getProperties()[k])) - alg.setProperty(k,value) - algModified=True - logger.verbose("Set value of property: %s/%s.%s=%s" % (alg.name, alg.alias, k, alg.getProperties()[k])) - - if algModified : - messg = "\n____________________________\n" - messg += "Algorithm after application:\n" - messg += "----------------------------\n" - messg += '%s' % (alg) - logger.debug(messg) - - messg = '\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n' - messg += '|| Sort Rule: End ||\n' - messg += '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n' - logger.verbose(messg) - self._nactive += nmod - return nmod - -## Container class for the algorithms used in rules -class HLTRuleAlgorithm(object): - import re - - ## Class Constructor - def __init__(self,**kwargs): - self.__initLogger__() - ## @var name - # Name (type) of the HLTComponent (algorithm) - self.__dict__['name'] = re.compile(".*") - ## @ var alias - # Alias (name) of the HLTComponent (algorithm) - self.__dict__['alias'] = re.compile(".*") - ## @var py_name - # Python class of the HLTComponent (algorithm) - #self.__dict__['py_name'] = re.compile(".*") - self.__dict__['py_name'] = None - ## @var py_package - # Python module of the HLTComponent (algorithm) - #self.__dict__['py_package'] = re.compile(".*") - self.__dict__['py_package'] = None - ## @var alg_type - # Type of the HLTComponent (algorithm) - usual values TopAlg, Service, PublicTool, PrivateTool, Auditor, SteerAlg - #self.__dict__['alg_type'] = re.compile(".*") - self.__dict__['alg_type'] = None - ## @var properties - # List of Properties - self.__dict__['properties']=[] - - # Set the attributes - for k,v in kwargs.items() : - self.__setattr__(k,v) - - ## Initialize the logger - def __initLogger__(self) : - from AthenaCommon.Logging import logging - self.__dict__['_log'] = logging.getLogger('HLTRuleAlgorithm') - ## @var OutputLevel - # Logger level - self.__dict__['OutputLevel'] = 3 - self._log.setLevel(self.OutputLevel) - - ## Set attributes of the class - # @param self The object pointer - # @param name The name of the attribute - # @param value The value of the attribute to be set - def __setattr__(self, name, value) : - # Set only the allowed attributes - if name in self.__dict__.keys() and name not in ('._log','OutputLevel','properties'): - if not isinstance(value,(str,unicode)): - self._log.error('Unsupported type %s of attribute %s - must be str' % (type(name),name)) - else: - try : - regex = re.compile(r"%s" % (value)) - if regex: - self.__dict__[name] = regex - except Exception, exc: - self._log.debug('%s' % (exc.message)) - self.__dict__[name] = value - elif name=='OutputLevel' : - self.__dict__[name] = value - self._log.setLevel(value) - elif name=='properties' : - if isinstance(value,list) : - self.__dict__[name] = value - else : - self._log.error('Unsupported type %s of attribute properties' % (type(value))) - else : - self._log.error('Unsupported attribute name=\"%s\"' % (name)) - - ## Convert to string for pretty print - # @return string - def __str__(self): - alg_type = self.getAttribute('alg_type') - name = self.getAttribute('name') - alias = self.getAttribute('alias') - py_name = self.getAttribute('py_name') - py_package = self.getAttribute('py_package') - output = '%s:\n/***** -%s- %s/%s (Python: import %s from %s)' % ('HLTRuleAlgorithm',alg_type,name,alias,py_name,py_package) - # Print the properties - if len(self.properties) > 0: - for prop in self.properties : - output += '\n|-%s' % (prop) - - output += '\n\------------------------------------------------------' - return output - - ## Get applicable items of the HLTRuleAlgorithm - # @return List of items which might be used for application of the rule - def getApplicableItems(self) : - output = [] - items=('name','alias','py_name','py_package','alg_type','properties') - return [item for item in items if item in self.__dict__.keys() and self.__dict__[item]!=None] - - ## Get HLTRuleAlgorithm public attribute - # @param self Object pointer - # @param name Attribute name - # @return value of public attributes - def getAttribute(self, name): - if name not in self.__dict__.keys(): - self._log.error('Attribute %s does not exists' % (name)) - self._log.verbose('List of supported attributes: %s' % (self.__dict__.keys())) - return None - - if name in ('name','alias','py_name','py_package','alg_type') : # Regular expression attributes - value = None - try: - value = self.__dict__[name].pattern - except Exception, exc : - value = self.__dict__[name] - return value - elif not name.startswith('_') : # Strictly private attributes - return self.__dict__[name] - - return None - - ## Set property of the HLTRuleAlgorithm - # @param args - def setProperty(self, *args): - if len(args) == 1: - self._setProperty1(args[0]) - elif len(args) == 2: - self._setProperty2(args[0], args[1]) - else : - self._log.error("Invalid number of arguments %d - property not set" % (len(args))) - - ## Set property of the HLTRuleAlgorithm - # @param name Property name - # @param value Property value - def _setProperty2(self, name, value): - propertySet = False - for i in range(len(self.properties)): - if name == self.properties[i].getName(): - self.properties[i].value=value - propertySet = True - - if not propertySet: self.properties.append(HLTRuleProperty(name=name,value=value)) - - ## Set property of the HLTRuleAlgorithm - # @param prop HLTRuleProperty - def _setProperty1(self, prop): - name = prop.getName() - value= prop.getValue() - self.setProperty(name, value) - - ## Match the HLTAlgorithm to the HLTRuleAlgorithm - # @param self The object pointer - # @param hltAlgorithm HLTAlgorithm object - # @param pattern Mask for the matching entities - # @return True in case of matching attributes - def match(self,hltAlgorithm, pattern=0xffff): - - output = True - # Match the main attributes - if output and ((0x1 << 0) & pattern) and self.__dict__.has_key('alias') and self.__dict__['alias'] != None: - output = self.matchAttribute('alias',hltAlgorithm.getAlias()) - if output and ((0x1 << 1) & pattern) and self.__dict__.has_key('name') and self.__dict__['name'] != None: - output = self.matchAttribute('name',hltAlgorithm.getName()) - self._log.verbose("Pattern:\t %s" % (self)) - self._log.verbose("HLTAlgorithm:\t %s" % (hltAlgorithm)) - - if output and ((0x1 << 2) & pattern) and self.__dict__.has_key('py_name') and self.__dict__['py_name'] != None: - output = self.matchAttribute('py_name',hltAlgorithm.getPy_name()) - if output and ((0x1 << 3) & pattern) and self.__dict__.has_key('py_package') and self.__dict__['py_package'] != None: - output = self.matchAttribute('py_package',hltAlgorithm.getPy_package()) - if output and ((0x1 << 4) & pattern) and self.__dict__.has_key('alg_type') and self.__dict__['alg_type'] != None: - output = self.matchAttribute('alg_type',hltAlgorithm.getType()) - - if not output or ((pattern >> 8) & 0xff)==0: return output - - # Match the properties - for prop in self.properties : - propMatch = False - for k,v in hltAlgorithm.getProperties().items() : - if prop.match(k,v, (pattern>>8)) : - propMatch = True - break - if not propMatch : - self._log.debug('None matching property %s found' % (prop)) - return False - - return output - - ## Get matching group - # @param self the object pointer - # @param name name of the attribute to be matched - # @param value string value to be matched - # @return matching group - def getMatchingGroup(self,name,value) : - output = None - if not self.matchAttribute(name,value): - self._log.debug("Attribute %s: value \'%s\' does not match: \'%s\'" % (name, value, self.getAttribute(name))) - return output - - # Matching is fine - get the group - try : - output=self.__dict__[name].match("%s" % (value)).group() - except Exception, exc: - self._log.verbose('getMatch(%s,%s)' % (exc.message,name,value)) - output=value - - return output - - ## Match single attribute - # @param self The object pointer - # @param name Name of the attribute - # @param value Value of the attribute - # @return True in case of matching attributes - def matchAttribute(self, name, value) : - match=False - if name not in self.__dict__.keys(): - self._log.warning('Can not match %s - no such attribute' % (name)) - return False - if name in ('_log','OutputLevel', 'properties') : - self._log.warning('Can not compare %s - unsupported' % (name)) - return False - - try : - match = self.__dict__[name].match("%s" % (value)) - if match: self._log.verbose('Attribute %s=%s matches regexp %s' % (name, value, self.__dict__[name].pattern)) - except Exception, exc: - self._log.verbose('match - %s' % (exc.message)) - match = (self.__dict__[name] == value) - if match: self._log.verbose('Attribute %s=%s matches %s' % (name, value, self.__dict__[name])) - - return match - -## Container class for the properties used in the HLTRuleAlgorithms -class HLTRuleProperty(object): - ## Class Constructor - def __init__(self,**kwargs): - self.__initLogger__() - ## @var name - # Name of the property - self.__dict__['name'] = re.compile(".*") - ## @var value - # Property value - self.__dict__['value'] = re.compile(".*") - - for k,v in kwargs.items() : - self.__setattr__(k,v) - - ## Initialize the logger - def __initLogger__(self) : - from AthenaCommon.Logging import logging - self.__dict__['_log'] = logging.getLogger('HLTRuleProperty') - self.__dict__['OutputLevel'] = 3 - self._log.setLevel(self.OutputLevel) - - ## Convert HLTRuleProperty to the string for pretty print - def __str__(self) : - out = '' - try: - out += '%s= ' % (self.name.pattern) - except : - out += '%s= ' % (self.name) - - try: - out += '%s' % (self.value.pattern) - except : - out += '%s' % (self.value) - - return out - - ## Set attributes of the class - # @param self The object pointer - # @param name The name of the attribute - # @param value The value of the attribute to be set - def __setattr__(self, name, value) : - # Set only the allowed attributes - if name in self.__dict__.keys() and name != '._log': - if name=='name': - if not isinstance(value,(str,unicode)): - self._log.error('Unsupported type %s of attribute %s - must be str' % (type(name),name)) - else: - try : - regex = re.compile(r"%s" % (value)) - if regex: - self.__dict__[name] = regex - except Exception, exc: - self._log.error('%s' % (exc.message)) - - if name=='value': - if not isinstance(value,(str,unicode)): - self.__dict__[name] = value - else: - try : - regex = re.compile(r"%s" % (value)) - if regex: - self.__dict__[name] = regex - except Exception, exc: - self._log.debug('%s' % (exc.message)) - self.__dict__[name] = value - - if name=='OutputLevel': - self._log.setLevel(value) - - else: - self._log.error('Unsupported attribute name=\"%s\"' % (name)) - - ## Match the property name and value to the HLTRuleProperty - # @param self The object pointer - # @param name The name of the proeprty - # @param value The value of the property - # @param pattern Bit mask what should be compared - # @return True if matching False if not - def match(self, name, value, pattern=0xff) : - if not isinstance(name,(str,unicode)): - self._log.error('Unsupported type %s of the name %s' % (type(name), name)) - return False - - output = True - # Compare name - if output and ((0x1 << 0) & pattern) : output=self.matchAttribute("name", name) - - # Compare value - if output and ((0x1 << 1) & pattern) : output=self.matchAttribute("value", value) - - return output - - ## Get the property name - # @param self Object pointer - # @return name attribute - def getName(self) : - name = None - try : - name = self.name.pattern - except : - name = self.name - return name - - ## Get the property value - # @param self Object pointer - # @return value attribute - def getValue(self) : - value = None - try : - value = self.value.pattern - except : - value = self.value - return value - - ## Get public attribute - # @param self Object pointer - # @param name Attribute name - # @return value of public attributes - def getAttribute(self, name): - if name not in self.__dict__.keys(): - self._log.error('Attribute %s does not exists' % (name)) - self._log.verbose('List of supported attributes: %s' % (self.__dict__.keys())) - return None - - if name in ('name','value') : # Regular expression attributes - value = None - try: - value = self.__dict__[name].pattern - except Exception, exc : - value = self.__dict__[name] - return value - elif not name.startswith('_') : # Strictly private attributes - return self.__dict__[name] - - return None - - ## Match single attribute - # @param self The object pointer - # @param name Name of the attribute - # @param value Value of the attribute - # @return True in case of matching attributes - def matchAttribute(self, name, value) : - match=False - if name not in self.__dict__.keys(): - self._log.warning('Can not match %s - no such attribute' % (name)) - return False - if name in ('_log','OutputLevel') : - self._log.warning('Can not compare %s - unsupported' % (name)) - return False - - try : - match = self.__dict__[name].match("%s" % (value)) - if match: self._log.verbose('Attribute %s=%s matches regexp %s' % (name, value, self.__dict__[name].pattern)) - except Exception, exc: - self._log.verbose('match - %s' % (exc.message)) - match = (self.__dict__[name] == value) - if match: self._log.verbose('Attribute %s=%s matches %s' % (name, value, self.__dict__[name])) - - return match - - ## Get matching group - # @param self the object pointer - # @param name name of the attribute to be matched - # @param value string value to be matched - # @return matching group - def getMatchingGroup(self,name,value) : - output = None - if not self.matchAttribute(name,value): - self._log.debug("Attribute %s: value \'%s\' does not match: \'%s\'" % (name, value, self.getAttribute(name))) - return output - - # Matching is fine - get the group - try : - output=self.__dict__[name].match("%s" % (value)).group() - except Exception, exc: - self._log.verbose('getMatch(%s,%s)' % (exc.message,name,value)) - output=value - - return output - -def getAlgJobOptNames(algs) : - output = [] - for a in algs : - output.append('%s/%s' % (a['name'],a['alias'])) - - return output - -def matchString(strPattern, strInput): - # Function to match wildcards string pattern with some input string - # Test the simple cases: no wildcard present or anything matches - if not '*' in strPattern : - return strInput == strPattern - elif strPattern == '*' : - return True - - # First input is a pattern which may contain wildcards - second is a string which has to be compared - patterns = strPattern.split('*') - - output = True - indexes = [] - lastindex = 0 - for part in patterns : - ind = strInput.find(part,lastindex) - if not ind==-1 : - lastindex = ind+1 - else: - return False - - if len(patterns[-1])>0 and not (lastindex-1+len(patterns[-1]) == len(strInput)) : - output = False - return output - - -def alg2str(alg) : - output = "%s/%s" % (alg['name'], alg['alias']) - - if alg.has_key('topalg') : - output += "\t TopAlg = %s" % (alg['topalg']) - - output +='\n' - - if alg.has_key('properties') : - for p,v in alg['properties'].items() : - output += "\t%s = \'%s\'\n" % (p,v) - return output - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTSQLUtils.py b/Trigger/TrigConfiguration/TrigConfOffline/python/HLTSQLUtils.py deleted file mode 100644 index 6bf99524a53fbf30189430f05e6880acfd6d0a34..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTSQLUtils.py +++ /dev/null @@ -1,56 +0,0 @@ -# $Id: HLTSQLUtils.py,v 1.7 2009/03/02 16:25:20 nozicka Exp $ -# Created by Miroslav Nozicka <nozicka@mail.desy.de> - -def get_cursor (host, user, db="", type="mysql", ask_passwd=True, passwd=""): - - """ Gets a python DB cursor for a given triple: db, host, user. The passwd - flag can be used to trigger a little trigger interactive password request to - the user. The type can be either 'mysql' or 'oracle' and that will return one - of the two different cursor implementations. """ - - if type.lower() == "mysql": - return _get_mysql_cursor(host, db, user, ask_passwd, passwd) - elif type.lower() == "oracle": - return _get_oracle_cursor(host, user, ask_passwd, passwd) - elif type.lower() == "sqlite": - return _get_sqlite_cursor(host) - -def _get_oracle_cursor (tns, user, ask_passwd=True, passwd=""): - """Returns an Oracle cursor""" - try: - from cx_Oracle import connect - except ImportError: - print "ERROR: Have you setup your Oracle environment correctly?" - print "You have to set these enviroment variables to make it work:" - print "LD_LIBRARY_PATH: include the directory of the client libraries" - print "TNS_ADMIN: include the TNS definitions %s" % \ - "(e.g.: /afs/cern.ch/project/oracle/admin)" - sys.exit(2) - - if ask_passwd: - from getpass import getpass - passwd = getpass("[Oracle] database password for %s@%s: " % (user, tns)) - connection = connect (user, passwd, tns, threaded=True) - else: - connection = connect (user, passwd, tns, threaded=True) - return connection.cursor() - -def _get_mysql_cursor (host, db, user, ask_passwd=True, passwd=""): - """Returns a MySQL cursor""" - - from MySQLdb import connect - from getpass import getpass - - if ask_passwd: - passwd = getpass("[MySQL] `%s' database password for %s@%s: " % - (db, user, host)) - connection = connect (host=host, user=user, passwd=passwd, db=db, connect_timeout=10) - return connection.cursor() - -def _get_sqlite_cursor(file): - """Returns a SQLite cursor""" - from sqlite3 import dbapi2 as sqlite - connection = sqlite.connect(file) - return connection.cursor() - - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTSetupLoader.py b/Trigger/TrigConfiguration/TrigConfOffline/python/HLTSetupLoader.py deleted file mode 100644 index 6308df57886c39e67b5d632bd4515cf6ee6733cb..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/python/HLTSetupLoader.py +++ /dev/null @@ -1,708 +0,0 @@ -########################################################################### -# Copyright (C) 2008 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Copyright: See COPYING file that comes with this distribution -# -########################################################################### - -import string - -class SetupLoader(object) : - _properties = ('Source','dbType','dbHost','dbUser','dbPasswd','dbName','SMKey','Level','RunNumber','OutputLevel') - - ## Initialize the SetupLoader service - def __init__(self, *args, **kwargs) : - from AthenaCommon.Logging import logging - self.__dict__['_log'] = logging.getLogger('HLTSetupLoader') - self._log.setLevel(3) - ## @var setupSource - # Source of the TrigConfiguration - # supported values: DBLookup ALIAS, Connection string, db - self.__dict__['Source'] = 'TRIGGERDB' - - ## @var dbType - # Database type - # Supported values: oracle, mysql, sqlite - self.dbType = '' - ## @var dbHost - # Database server - self.dbHost = '' - ## @var dbUser - # Database login - self.dbUser = '' - ## @var dbPasswd - # Database user password - self.dbPasswd = '' - ## @var dbName - # Database schema name - self.dbName = '' - - ## @var SMKey - # Super Master Key - self.SMKey = -1 - - ## @var Level Trigger Level - # Supported values BOTH, L2, EF, OL - self.Level = 'BOTH' - ## @var RunNumber - # Run number resp. lumi block - self.RunNumber = None - - ## @var OutputLevel - # Logger OutputLevel - self.OutputLevel = 3 - - for k,v in kwargs.items() : - self.__setattr__(k,v) - - ## Set the Logger - def setlog(self): - if self.__dict__.has_key('OutputLevel'): - self._log.setLevel(self.OutputLevel) - else: - self._log.setLevel(3) - - self._log.name = 'HLTSetupLoader ' - - ## Set attributes of the class - # Allowed attributes: Source,dbType,dbHost,dbUser,dbPasswd,dbName,SMKey,Level,RunNumber,OutputLevel - # @param name Name of the attribute - # @param value Value to be set - def __setattr__(self, name, value) : - #self.setlog() - self._log.verbose("__setattr__(%s,%s)" % (name,value)) - if name in self._properties: - self._log.debug('Set property: %s = %s' % (name, value)) - if name=="Source": - value = self._setSource(value) - - self.__dict__[name] = value - if name=='OutputLevel': - self._log.setLevel(value) - else: - self._log.warning('Unknown property: %s = %s - property not set' % (name, value)) - - ## Convert the class to string for pretty print - # @param self Pointer to the class - # @return String - def __str__(self): - self.setlog() - output = "-"*80 + "\n" - string = "%s.%s" % (self.__module__,'HLTSetupLoader') - output += "|" + " "*(39 - len(string)/2) + string +" "*(39 - len(string)/2) + "|\n" - output += "-"*80 + "\n" - - for k,v in self.__dict__.items() : - if k == 'dbPasswd' : - output += "\t%s = %s\n" % (k,"*"*len(v)) - elif k== '_log': - pass - else : - output += "\t%s = %s\n" % (k,v) - - return output - - ## Check the consistency of the DB source - # @param self Object pointer - # @return True if parameters are OK - def _consistencyCheck(self): - self.setlog() - if self.Source[:-4] != '.xml' : - return _consistencyDBCheck() - else: - return _consistencyFileCheck() - - return False - - ## Check the consistency of the DB source - # @param self Object pointer - def _consistencyDBCheck(self): - self.setlog() - # Check existence of the superMaster key - if not self.__dict__.has_key['SMKey'] : - return False - if self.SMKey <= 0 : - return False - - # Check if the source of the configuration exists - if not (self.__dict__.has_key('Source') and self.Source): - # Test the existence of neccesairy parameters: - dbParComplete = True - if dbParComplete and (not (self.__dict__.has_key('dbType') and self.dbType)) : dbParComplete = False - if dbParComplete and (not (self.__dict__.has_key('dbHost') and self.dbHost)) : dbParComplete = False - - # If there is a type of DB sqlite already enough parameters are present - if not (dbParComplete and self.dbType=='sqlite') : - if dbParComplete and not (self.__dict__.has_key('dbUser') and self.dbUser) : dbParComplete = False - if dbParComplete and not (self.__dict__.has_key('dbPasswd') and self.dbPasswd) : dbParComplete = False - if dbParComplete and self.dbType!='oracle' : - if dbParComplete and not (self.__dict__.has_key('dbName') and self.dbName) : dbParComplete = False - - if not dbParComplete: - self._log.warning('No trigger setup source') - # Try to fix it - however looks doing nothing it does more - self.Source = self.Source - else : - self._log.warning('setupSource previously not set') - self.setupSource = 'db' - - # Check the remaining DB parameters - if self.setupSource == 'db' : - if not (self.__dict__.has_key('dbType') and self.dbType) : - self._log.fatal('No DB Type specified') - return False - - if not (self.__dict__.has_key('dbHost') and self.dbHost) : - self._log.fatal('No DB Host or sqlite file specified') - return False - - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbUser') and self.dbUser) : - self._log.fatal('No DB User specified') - return False - - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbPasswd') and self.dbPasswd) : - self._log.fatal('No DB Password specified') - return False - - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbName') and self.dbName) : - if self.dbType=='oracle' : - self.dbName = self.dbUser - else : - self._log.fatal('No DB Name specified') - return False - else : # Should not appear - but just in case user gets here - if not (self.__dict__.has_key('dbType') and self.dbType) : self._setSource(self.setupSource) - if not (self.__dict__.has_key('dbHost') and self.dbHost) : self._setSource(self.setupSource) - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbUser') and self.dbUser) : self._setSource(self.setupSource) - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbPasswd') and self.dbPasswd) : self._setSource(self.setupSource) - if self.dbType!='sqlite' and not (self.__dict__.has_key('dbName') and self.dbName) : self._setSource(self.setupSource) - - return True - - def _consistencyFileCheck(self): - self.setlog() - if self.Source[:-4] == ".xml" : - return self._consistencyXMLCheck() - return True - - ## Check the consistensy of the XML source - # @param self Object pointer - def _consistencyXMLCheck(self): - self.setlog() - return True - - ## Process the connnection string - # @param connectionString Connection string for details see TrigConfigSvc.TrigConfigSvcUtils.py - def _setSource(self, connectionString) : - output = connectionString - #self.setlog() - self._log.verbose("_setSetupSource(%s)" % (connectionString)) - - if connectionString != 'db' : - from TrigConfOffline.HLTConfOffline import interpretConnectionString - connectionParameters = interpretConnectionString(connectionString) - if connectionParameters.has_key('techno') :self.dbType = connectionParameters['techno'] - if connectionParameters.has_key('server'): self.dbHost = connectionParameters['server'] - if connectionParameters.has_key('schema'): self.dbName = connectionParameters['schema'] - if connectionParameters.has_key('user'): self.dbUser = connectionParameters['user'] - if connectionParameters.has_key('passwd'): self.dbPasswd = connectionParameters['passwd'] - if self.dbType == 'sqlite' and connectionParameters.has_key('filename'): self.dbHost = connectionParameters['filename'] - return connectionString - - ## Load algorithms - # @return HLTAlgorithm list - def load(self) : - self.setlog() - hlt_setup = None - if self.Source[:-4] !='.xml': - hlt_setup = self._loadfromDB() - else : - hlt_setup = self._loadfromXML() - - return hlt_setup - - def _loadfromXML(self) : - self.setlog() - hlt_setup = [] - return hlt_setup - - ## Load algorithms from DB - # @return HLTAlgorithm list - def _loadfromDB(self) : - self.setlog() - cursor = self.connectDB() - hmt_id = self.getHLTMasterKeys(cursor) - # top_algs = self.getTopAlgs(cursor, hmt_id) - - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - - # All component IDs - componentIDs = [] - - # L2 TE component IDs - componentL2TEIDs= [] - if self.Level.upper() in ('L2','BOTH','OL'): - # Get the L2 TE components - level = 'L2' - componentL2TEIDs=self.getHLTTEComponentIDs(cursor, level, hmt_id) - - # EF TE component IDs - componentEFTEIDs= [] - if self.Level.upper() in ('EF','BOTH','OL'): - # Get the EF TE components - level = 'EF' - componentEFTEIDs=self.getHLTTEComponentIDs(cursor, level, hmt_id) - - # Get the HLT_SETUP ID's - hst_l2_id = hst_ef_id = -1 - if self.Level.upper() in ('L2','BOTH','OL'): hst_l2_id = self.getHLTL2SetupID(cursor, hmt_id) - if self.Level.upper() in ('EF','BOTH','OL'): hst_ef_id = self.getHLTEFSetupID(cursor, hmt_id) - - # Get the upper layer components related to the L2 setup - componentL2IDs = [] - if self.Level.upper() in ('L2','BOTH','OL'): - componentL2IDs = self.getHLTSetupComponentIDs(cursor, hst_l2_id) - for component_id in componentL2IDs : - if component_id not in componentIDs : componentIDs.append(component_id) - - # Get the upper layer components related to the EF setup - componentEFIDs = [] - if self.Level.upper() in ('EF','BOTH','OL'): - if hst_ef_id == hst_l2_id and self.Level.upper()!='EF': - componentEFIDs = componentL2IDs - else : - componentEFIDs = self.getHLTSetupComponentIDs(cursor, hst_ef_id) - for component_id in componentEFIDs : - if component_id not in componentIDs : componentIDs.append(component_id) - - componentIDs.sort() - algorithms = [] - import TrigConfOffline.HLTAlgorithm as HLTAlgorithm - trigSteer_L2 = None - trigSteer_EF = None - for compID in componentIDs: - alg=HLTAlgorithm.HLTAlgorithm(dbId=compID,OutputLevel=self.OutputLevel) - alg.loadFromDB(cursor,self.dbName) - if compID in componentL2IDs : - alg.setLevel('L2') - elif compID in componentEFIDs : - alg.setLevel('EF') - algorithms.append(alg) - # Search through the algorithms for the main steering alg - for flatAlg in alg.flattenAlg() : - if flatAlg.getName() == 'HLT::TrigSteer': - if flatAlg.getAlias()[-2:] == 'L2': - trigSteer_L2 = flatAlg - self._log.debug('L2 TrigSteer Algorithm found: %s' % (trigSteer_L2)) - elif flatAlg.getAlias()[-2:] == 'EF': - trigSteer_EF = flatAlg - self._log.debug('EF TrigSteer Algorithm found: %s' % (trigSteer_EF)) - - for compID in componentL2TEIDs: - alg=HLTAlgorithm.HLTAlgorithm(dbId=compID,OutputLevel=self.OutputLevel) - alg.loadFromDB(cursor,self.dbName) - alg.setLevel('L2') - if trigSteer_L2 : - trigSteer_L2.appendChild(alg) - else : - algorithms.append(alg) - - for compID in componentEFTEIDs: - alg=HLTAlgorithm.HLTAlgorithm(dbId=compID,OutputLevel=self.OutputLevel) - alg.loadFromDB(cursor,self.dbName) - alg.setLevel('EF') - if trigSteer_EF : - trigSteer_EF.appendChild(alg) - else : - algorithms.append(alg) - - cursor.close() - return algorithms - - ## Connect to the database - # @return Database cursor - def connectDB(self): - self.setlog() - import TrigConfOffline.HLTSQLUtils as HLTSQLUtils - cursor = HLTSQLUtils.get_cursor(self.dbHost, self.dbUser, self.dbName, self.dbType, False, self.dbPasswd) - return cursor - - ## Get the HLT_MASTER_TABLE ID - # @param cursor Database cursos - # @return int HLT_MASTER_TABLE ID - <0 not found - def getHLTMasterKeys(self, cursor) : - self.setlog() - table_name = 'SUPER_MASTER_TABLE' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - table_name = "%s.%s" % (self.dbName, table_name) - - # Get the HMT_ID - query = "" - query += " SELECT DISTINCT %s.SMT_HLT_MASTER_TABLE_ID " % (table_name) - query += " FROM %s " % (table_name) - query += " WHERE %s.SMT_ID = %s " % (table_name, self.SMKey) - - self._log.debug(query) - cursor.execute( query ) - result = cursor.fetchall() - - hmt_id = -1 - if len(result) == 1 : - if len(result[0]) ==1 : - hmt_id = result[0][0] - else : - self._log.error('No HLT Master Key found check the parameters: \n%s' % (self)) - self._log.debug(query) - #raise HLTSetupLoaderError('No HLT Master Key found: query: %s \nCheck the parameters: \n%s' % (query,self)) - elif len(result) > 1: - self._log.error('Multiple HLT Master Keys found check the parameters: \n%s' % (self)) - self._log.debug(query) - #raise HLTSetupLoaderError('Multiple HLT Master Keys found: Corrupted DB: \n%s' % (self)) - else : - self._log.error('No HLT Master Key found check the parameters: \n%s' % (self)) - self._log.debug(query) - #raise HLTSetupLoaderError('No HLT Master Key found: query: %s \nCheck the parameters: \n%s' % (query,self)) - - self._log.verbose("HLT Master table ID:%d" % (hmt_id)) - return hmt_id - - ## Get the L2 HLT_SETUP ID - # @param cursor Database cursos - # @param hmt_id HLT_MASTER_TABLE ID - default -2 - # @return int HLT_SETUP ID - < 0 not found - def getHLTL2SetupID(self, cursor, hmt_id=-2): - hst_id = -1 - self.setlog() - if hmt_id == -2: hmt_id=self.getHLTMasterKeys(cursor) - if hmt_id<=0 : return hst_id - - table_name = 'HLT_MASTER_TABLE' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - table_name = "%s.%s" % (self.dbName, table_name) - query = "" - query += " SELECT DISTINCT %s.HMT_L2_SETUP_ID " % (table_name) - query += " FROM %s " % (table_name) - if self.dbType == 'sqlite': - query += " WHERE %s.HMT_ID=%d" % (table_name, hmt_id) - else : - query += " WHERE %s.HMT_ID=:hmt_id" % (table_name) - - self._log.verbose('%s, hmt_id=%d' % (query,hmt_id)) - if self.dbType == 'sqlite': - cursor.execute(query) - else : - cursor.execute(query, hmt_id=hmt_id) - result = cursor.fetchall() - if len(result) == 1 : - if len(result[0]) ==1 : - hst_id = result[0][0] - else : - self._log.error('No HLT L2 Setup ID check the parameters: HMT_ID=%d \n%s' % (hmt_id,self)) - self._log.debug('%s, hmt_id=%d' % (query,hmt_id)) - elif len(result) > 1: - self._log.error('Multiple HLT L2 Setup ID found check the parameters: HMT_ID=%d \n%s' % (hmt_id,self)) - self._log.debug('%s, hmt_id=%d' % (query,hmt_id)) - else : - self._log.error('No HLT L2 Setup ID found check the parameters: HMT_ID=%d \n%s' % (hmt_id,self)) - self._log.debug(query) - - # Test the level matching - level = self.getHLTSetupTriggerLevel(cursor, hst_id) - if level != 'L2' : - if level == 'OL' and self.Level.upper() not in ('BOTH', 'OL') : - self._log.warning('L2 HLT Setup trigger level mismatch - trigger level %s required level: %s' % (level,self.Level.upper())) - elif level != 'OL': - self._log.warning('Unknown trigger level %s (required level %s) in HLT setup ID %d' % (level, self.Level.upper(), hst_id) ) - return hst_id - - ## Get the EF HLT_SETUP ID - # @param cursor Database cursos - # @param hmt_id HLT_MASTER_TABLE ID - default -2 - # @return int HLT_SETUP ID - < 0 not found - def getHLTEFSetupID(self, cursor, hmt_id=-2): - hst_id = -1 - self.setlog() - if hmt_id == -2: hmt_id=self.getHLTMasterKeys(cursor) - if hmt_id<=0 : return hst_id - - table_name = 'HLT_MASTER_TABLE' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - table_name = "%s.%s" % (self.dbName, table_name) - query = "" - query += " SELECT DISTINCT %s.HMT_EF_SETUP_ID " % (table_name) - query += " FROM %s " % (table_name) - if self.dbType == 'sqlite' : - query += " WHERE %s.HMT_ID=%d" % (table_name, hmt_id) - else: - query += " WHERE %s.HMT_ID=:hmt_id" % (table_name) - - self._log.verbose('%s, hmt_id=%d' % (query,hmt_id)) - if self.dbType == 'sqlite' : - cursor.execute(query) - else : - cursor.execute(query, hmt_id=hmt_id) - result = cursor.fetchall() - if len(result) == 1 : - if len(result[0]) ==1 : - hst_id = result[0][0] - else : - self._log.error('No HLT EF Setup ID check the parameters: HMT_ID=%d \n%s' % (hmt_id,self)) - self._log.debug('%s, hmt_id=%d' % (query,hmt_id)) - elif len(result) > 1: - self._log.error('Multiple HLT EF Setup ID found check the parameters: HMT_ID=%d \n%s' % (hmt_id,self)) - self._log.debug('%s, hmt_id=%d' % (query,hmt_id)) - else : - self._log.error('No HLT EF Setup ID found check the parameters: HMT_ID=%d \n%s' % (hmt_id,self)) - self._log.debug(query) - - # Test the level matching - level = self.getHLTSetupTriggerLevel(cursor, hst_id) - if level != 'EF' : - if level == 'OL' and self.Level.upper() not in ('BOTH', 'OL') : - self._log.warning('EF HLT Setup trigger level mismatch - trigger level %s required level: %s' % (level,self.Level.upper())) - elif level != 'OL': - self._log.warning('Unknown trigger level %s (required level %s) in HLT setup ID %d' % (level, self.Level.upper(), hst_id) ) - - return hst_id - - ## Get the HLT_SETUP trigger level - # @param cursor DB connection cursor - # @param hst_id HLT_SETUP ID - # @return String - in HLT_SETUP.HST_L2_OR_EF - def getHLTSetupTriggerLevel(self, cursor, hst_id) : - level = '' - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - - # Get the upper layer components related to the EF setup - query = ' SELECT DISTINCT %sHLT_SETUP.HST_L2_OR_EF ' % (prepend) - query += ' FROM %sHLT_SETUP ' % (prepend) - if self.dbType == 'sqlite': - query += ' WHERE %sHLT_SETUP.HST_ID=%d ' % (prepend, hst_id) - else: - query += ' WHERE %sHLT_SETUP.HST_ID=:hst_id ' % (prepend) - - self._log.verbose('%s, hst_id=%d' % (query, hst_id)) - if self.dbType == 'sqlite': - cursor.execute(query) - else: - cursor.execute(query, hst_id=hst_id) - result = cursor.fetchall() - if len(result) == 1 : - if len(result[0]) ==1 : - level = str(result[0][0]).upper() - else : - self._log.error('No HLT Setup Level found check the parameters: HST_ID=%d \n%s' % (hst_id,self)) - self._log.debug('%s, hst_id=%d' % (query,hst_id)) - elif len(result) > 1: - self._log.error('Multiple HLT Setup Levels found check the parameters: HST_ID=%d \n%s' % (hst_id,self)) - self._log.debug('%s, hst_id=%d' % (query,hst_id)) - else : - self._log.error('No HLT EF Setup Level found check the parameters: HMT_ID=%d \n%s' % (hmt_id,self)) - self._log.debug(query) - - return level - - ## Get the HLT_SETUP parent components ID's - # @param cursor DB connection cursor - # @param hst_id HLT_SETUP ID - # @return List of the component ID's - def getHLTSetupComponentIDs(self, cursor, hst_id): - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - - algIDs = [] - # Get the upper layer components related to the EF setup - query = ' SELECT DISTINCT %sHLT_COMPONENT.HCP_ID ' % (prepend) - query += ' FROM %sHLT_SETUP ' % (prepend) - query += ' JOIN %sHLT_ST_TO_CP ON (%sHLT_ST_TO_CP.HST2CP_SETUP_ID = %sHLT_SETUP.HST_ID ) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_COMPONENT ON (%sHLT_COMPONENT.HCP_ID = %sHLT_ST_TO_CP.HST2CP_COMPONENT_ID) ' % (prepend, prepend, prepend) - if self.dbType == 'sqlite': - query += ' WHERE %sHLT_SETUP.HST_ID=%d ' % (prepend, hst_id) - else: - query += ' WHERE %sHLT_SETUP.HST_ID=:hst_id ' % (prepend) - - self._log.verbose('%s, hst_id=%d' % (query, hst_id)) - if self.dbType == 'sqlite': - cursor.execute(query) - else: - cursor.execute(query, hst_id=hst_id) - result = cursor.fetchall() - for column in result: - algIDs.append(column[0]) - - return algIDs - - ## Get the HLT_TRIGGER_MENU parent components ID's - # @param cursor DB connection cursor - # @param hmt_id HLT_MASTER_TABLE ID - # @param level Trigger Level - EF/L2 - # @return List of the HLT_COMPONENTs ID's - def getHLTTEComponentIDs(self, cursor, level, hmt_id=-2): - componentIDs = [] - self.setlog() - if hmt_id==-2: hmt_id=self.getHLTMasterKeys(cursor) - if hmt_id<=0 : return componentIDs - - prepend='' - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - prepend = '%s.' % (self.dbName) - - # Get the upper layer components related to the trigger elements for EF - query = ' SELECT DISTINCT %sHLT_COMPONENT.HCP_ID ' % (prepend) - query += ' FROM %sHLT_MASTER_TABLE ' % (prepend) - query += ' JOIN %sHLT_TRIGGER_MENU ON (%sHLT_TRIGGER_MENU.HTM_ID = %sHLT_MASTER_TABLE.HMT_TRIGGER_MENU_ID) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_TM_TO_TC ON ( %sHLT_TM_TO_TC.HTM2TC_TRIGGER_MENU_ID = %sHLT_TRIGGER_MENU.HTM_ID ) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_TRIGGER_CHAIN ON ( %sHLT_TM_TO_TC.HTM2TC_TRIGGER_CHAIN_ID = %sHLT_TRIGGER_CHAIN.HTC_ID ) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_TC_TO_TS ON ( %sHLT_TC_TO_TS.HTC2TS_TRIGGER_CHAIN_ID = %sHLT_TRIGGER_CHAIN.HTC_ID ) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_TRIGGER_SIGNATURE ON ( %sHLT_TC_TO_TS.HTC2TS_TRIGGER_SIGNATURE_ID = %sHLT_TRIGGER_SIGNATURE.HTS_ID ) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_TS_TO_TE ON ( %sHLT_TS_TO_TE.HTS2TE_TRIGGER_SIGNATURE_ID = %sHLT_TRIGGER_SIGNATURE.HTS_ID ) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_TRIGGER_ELEMENT ON ( %sHLT_TS_TO_TE.HTS2TE_TRIGGER_ELEMENT_ID = %sHLT_TRIGGER_ELEMENT.HTE_ID ) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_TE_TO_CP ON ( %sHLT_TE_TO_CP.HTE2CP_TRIGGER_ELEMENT_ID = %sHLT_TRIGGER_ELEMENT.HTE_ID ) ' % (prepend, prepend, prepend) - query += ' JOIN %sHLT_COMPONENT ON ( %sHLT_COMPONENT.HCP_ID = %sHLT_TE_TO_CP.HTE2CP_COMPONENT_ID) ' % (prepend, prepend, prepend) - if self.dbType == 'sqlite' : - query += ' WHERE %sHLT_MASTER_TABLE.HMT_ID=%d ' % (prepend, hmt_id) - else : - query += ' WHERE %sHLT_MASTER_TABLE.HMT_ID=:hmt_id ' % (prepend) - query += ' AND %sHLT_TRIGGER_CHAIN.HTC_L2_OR_EF=\'%s\' ' % (prepend, level) - - self._log.verbose('%s, hmt_id=%d' % (query, hmt_id)) - if self.dbType == 'sqlite' : - cursor.execute(query) - else : - cursor.execute(query, hmt_id=hmt_id) - result = cursor.fetchall() - for column in result: - componentIDs.append(column[0]) - - return componentIDs - - ## Get the Top Algorithms from ApplicationMgr.TopAlg parameter - # @param cursor DB connection cursor - # @param hmt_id HLT_MASTER_TABLE ID - # @return List of the TopAlg names - def getTopAlgs(self, cursor, hmt_id) : - self.setlog() - view_name = "HLT_MK_TL_TO_PA_VIEW" - if self.dbType == 'oracle' and (self.dbUser != self.dbName) : - view_name = "%s.%s" % (self.dbName, view_name) - # Get the TopAlgorithms - - db_levels = (self.Level) - if db_levels == ('BOTH'): - db_levels = ('L2', 'EF') - top_algs = None - - top_algs = {} - - for l in db_levels : - query="" - query += " SELECT %s.HPA_VALUE " % (view_name) - query += " FROM %s " % (view_name) - query += " WHERE %s.HMT_ID IN (%s) " % (view_name, hmt_id) - query += " AND %s.HST_L2EF =\'%s\' " % (view_name, l) - query += " AND %s.HCP_NAME =\'ApplicationMgr\' " % (view_name) - query += " AND %s.HCP_ALIAS =\'ApplicationMgr\' " % (view_name) - query += " AND %s.HPA_NAME =\'TopAlg\' " % (view_name) - - self._log.debug(query) - cursor.execute( query ) - result = cursor.fetchall() - - if len(result) > 0 and len(result[0]) == 1: - top_algs[l] = eval(result[0][0]) - else : - # Try Offline setup, send warning - self._log.warning('No Top Algorithms were found for level %s try OL ' % (l)) - query="" - query += " SELECT %s.HPA_VALUE " % (view_name) - query += " FROM %s " % (view_name) - query += " WHERE %s.HMT_ID IN (%s) " % (view_name, hmt_id) - query += " AND %s.HST_L2EF =\'%s\' " % (view_name, 'OL') - query += " AND %s.HCP_NAME =\'ApplicationMgr\' " % (view_name) - query += " AND %s.HCP_ALIAS =\'ApplicationMgr\' " % (view_name) - query += " AND %s.HPA_NAME =\'TopAlg\' " % (view_name) - - self._log.debug(query) - cursor.execute( query ) - result = cursor.fetchall() - - if len(result) > 0 and len(result[0]) == 1: - top_algs[l] = eval(result[0][0]) - else: - self._log.error('No Top Algorithms were found for level OL') - #raise HLTSetupLoaderError('No Top Algorithms were found') - - return top_algs - - def findTopAlg(self, top_algs, level, algorithm) : - self.setlog() - topalg = None - - if len(top_algs[level]) == 1: - topalg = top_algs[level][0] - elif len(top_algs[level]) > 1: - # Check whether the algorithm isn't top alg itself - fullalgname = "%s/%s" % (algorithm.getName(),algorithm.getAlias()) - if fullalgname in top_algs[level] : return fullalgname - #look for the HLT::TrigSteer Top Alg - hltsteer_topalg = [] - for n in top_algs[level]: - if n.split('/')[0] == 'HLT::TrigSteer' and n.split('/')[1][-2:].upper() == level: - if n not in hltsteer_topalg: - hltsteer_topalg.append(n) - - if len(hltsteer_topalg) != 1: - if len(hltsteer_topalg) == 0: - self._log.warning('No HLT::TrigSteer top algorithm found') - else : - self._log.warning('Multiple HLT::TrigSteer top algorithms found: %s' % (hltsteer_topalg)) - return None - - # Test the algorithm for presence of the properties doTiming, AthenaMonTools - if algorithm.getProperties() : - if algorithm.properties.has_key('doTiming') and algorithm.properties.has_key('AthenaMonTools') : - topalg = hltsteer_topalg[0] - return topalg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistoryAlg.py b/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistoryAlg.py index 8793af64456c2c39925a68eb11e80d82e46f9bc6..fb12c653f9b21b12ebf3d58b4a9a10e16ce20776 100755 --- a/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistoryAlg.py +++ b/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistoryAlg.py @@ -1,14 +1,10 @@ -########################################################################### -# Copyright (C) 2009 by Miroslav Nozicka -# <nozicka@mail.desy.de> +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration # # DESCRIPTION: TrigHistorySvc - derived configurable of the HistorySvc # - extends the functionality of the HistorySvc obtaining # the python class (py_name) and python module (py_package) # of the algorithm # -########################################################################### - from AthenaPython.PyAthena import Alg, StatusCode diff --git a/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistoryDumper.py b/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistoryDumper.py index 29b0fe37d2c5c823316434eba1cbf02cd4352c89..e22f3ce7339a23dca9ef9294626dff96a9bd7421 100755 --- a/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistoryDumper.py +++ b/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistoryDumper.py @@ -1,13 +1,10 @@ -########################################################################### -# Copyright (C) 2009 by Miroslav Nozicka -# <nozicka@mail.desy.de> +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration # # DESCRIPTION: TrigHistorySvc - derived configurable of the HistorySvc # - extends the functionality of the HistorySvc obtaining # the python class (py_name) and python module (py_package) # of the algorithm # -########################################################################### __all__ = [ 'dump' diff --git a/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistorySvc.py b/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistorySvc.py index 4ea2898fa6dbedb160ae3e8c837f17dff98c437b..8cba1cbdbcdfd861470da26a5b8e7fa786f7bdeb 100644 --- a/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistorySvc.py +++ b/Trigger/TrigConfiguration/TrigConfOffline/python/TrigHistorySvc.py @@ -1,13 +1,10 @@ -########################################################################### -# Copyright (C) 2009 by Miroslav Nozicka -# <nozicka@mail.desy.de> +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration # # DESCRIPTION: TrigHistorySvc - derived configurable of the HistorySvc # - extends the functionality of the HistorySvc obtaining # the python class (py_name) and python module (py_package) # of the algorithm # -########################################################################### from AthenaCommon import CfgMgr diff --git a/Trigger/TrigConfiguration/TrigConfOffline/share/HLTSetup_txt2xml.py b/Trigger/TrigConfiguration/TrigConfOffline/share/HLTSetup_txt2xml.py deleted file mode 100755 index e15e02fd4c75ee331d653145006668592debc3eb..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/share/HLTSetup_txt2xml.py +++ /dev/null @@ -1,931 +0,0 @@ -#!/usr/bin/env python -# $Id: HLTSetup_txt2xml.py,v 1.6 2009/05/15 13:57:42 nozicka Exp $ - -# converts the python style output from the HistorySvc into xml -# Joerg Stelzer, CERN, 10.Sept.2006 - -# PJB 21/11/08 Ignore the DataFlowConfig component (savannah 43616) -# but also need to ignore CalBufferName comp of MuFast (set to "") -# which is otherwise set by this - -import getopt, sys, re, os.path, time -import xml.dom.minidom -from TrigConfOffline.HLTAlgorithm import HLTAlgorithm - -flatComponentStructure = False -ConversionForPointOne = False # Sylvie 11/07/2008 - # This is a tempory hack to set "OnlineRun" to "True" for muFast_Muon (muFast) - # when preparing configuration for Point1. - # This can be set to True by using the option --ForPointOne - -# List of the special handled parameters, algorithms -# Special properties which value should be ignored and set manually -propertyNameSpecial = ('OutputLevel', - 'rfac','energies','regions','correction','interp_barriers', - 'wtEMB0''wtEME0''wtEMB1''wtEMB2''wtEME1''wtEME2''wtTile1', 'wtTile2','wtHec1''wtHec2','wtFCal1','wtFCal2','etaFit','sampling_depth', - 'MuonCalBufferName','DoRecursiveLoad') - -algAliasSpecial = ('DataFlowConfig','CosmicEgammaTrigCaloClusterMaker_slw.trigslw','HistorySvc','muFast_Muon') -algNameSpecial = ('muFast') - -typeLUT = { - 'AthAlgSeq' :'AthSequencer', - 'ServiceManager' :'ServiceManager', - 'Streams' :'AthSequencer', - 'DataFlowConfig' :'DataFlowConfig' - } - - -def convertLinesToAlg(lines): - alg = None - alg = HLTAlgorithm(name='unknown',OutputLevel=5) - lineind = 0 - nlines = len(lines) - while lineind < nlines: - line = lines[lineind].rstrip("\n").rstrip() - #print 'convertLinesToAlg:\t[%d]' % (lineind),line - if line.startswith('Type:') : - algName = line[len('Type:'):].strip() - alg.setName(algName) - lineind += 1 - continue - elif line.startswith('Name:') : - algAlias = line[len('Name:'):].strip() - # Remove spaces from alias - aliases = algAlias.split('.') - for ind in range(len(aliases)): - aliases[ind] = aliases[ind].strip() - algAlias = '.'.join(aliases) - alg.setAlias(algAlias) - lineind += 1 - continue - - elif line.startswith('Py_Name:') : - algPyName = line[len('Py_Name:'):].strip() - alg.py_name = algPyName - lineind += 1 - continue - - elif line.startswith('Py_Package:') : - algPyPackage = line[len('Py_Package:'):].strip() - alg.py_package = algPyPackage - lineind += 1 - continue - # Expect the Properties of the algorithm - elif line.startswith('Properties:') : - # Skip the line with Properties: [ - lineind +=1 - propsStart = lineind - propsEnd = len(lines) - for propind in range(lineind,nlines) : - propline = lines[propind].rstrip("\n").strip() - propsEnd = propind - # Test for end of the properties - if propline == ']': break - properties = convertLinesToProperties(lines[propsStart:propsEnd]) - # Set the algorithm properties - for k,v in properties.items() : - alg.setProperty(k,v) - - # Increase the line counter to skip the properties - lineind = propsEnd+1 - continue - - # Expect the children of the algorithm - elif line.startswith('Subalgorithms:') : - lineind += convertSubalgorithmsToChildAlg(lines[lineind:],alg) - lineind += 1 - continue - - # increase Line counter - lineind += 1 - - #print alg - return alg - -# Return number of processed lines -def convertSubalgorithmsToChildAlg(lines,parentAlg) : - # Format : - # Subalgorithms: { - # ---------- - # Type: InDet::Pixel_TrgClusterization - # Name: PixelClustering_Bphysics_EFID - # Version: TrigInterfaces-01-01-09 - # Properties: [ - # ....... - # ] - # No subalgorithms - # ---------- - # Type: InDet::TRT_TrgRIO_Maker - # Name: TRTDriftCircleMaker_Bphysics_EFID - # Version: TrigInterfaces-01-01-09 - # ....... - # No subalgorithms. - # ---------- - # } - - # - #print 'convertSubalgorithmsToChildAlg - %s/%s: start:\t[%d]' % (parentAlg.getName(), parentAlg.getAlias(),len(lines)),lines[0].rstrip('\n').strip() - lineind = 0 - # Skip the 1st line in case the Subalgorithms name on it - if lines[0].rstrip("\n").rstrip().startswith('Subalgorithms:') : - #print 'convertSubalgorithmsToChildAlg - %s/%s:\t[%d]' % (parentAlg.getName(), parentAlg.getAlias(),lineind),lines[lineind].rstrip('\n').strip() - lineind += 1 - alg = HLTAlgorithm(name='unknown', alias='', OutputLevel=5, alg_type='PrivateTool') - nlines = len(lines) - while lineind < nlines : - #print 'convertSubalgorithmsToChildAlg - %s/%s:\t[%d]' % (parentAlg.getName(), parentAlg.getAlias(),lineind),lines[lineind].rstrip('\n').strip() - line = lines[lineind].rstrip("\n").strip() - if line.startswith('----------') : - lineind+=1 - continue - elif line.startswith('Type:') : - algName = line[len('Type:'):].strip() - alg.setName(algName) - lineind+=1 - continue - elif line.startswith('Name:') : - algAlias = '%s.%s' % (parentAlg.getAlias(),line[len('Name:'):].strip()) - alg.setAlias(algAlias) - lineind+=1 - continue - elif line.startswith('Py_Name:') : - algPyName = line[len('Py_Name:'):].strip() - alg.py_name = algPyName - lineind+=1 - continue - elif line.startswith('Py_Package:') : - algPyPackage = line[len('Py_Package:'):].strip() - alg.py_package = algPyPackage - lineind+=1 - continue - elif line.startswith('Properties:') : - propsStart=lineind - propsEnd=propsStart - for propind in range(propsStart,nlines) : - propsEnd = propind - if lines[propind].rstrip("\n").strip() == ']' : break - - # Set the algorithm properties - for k,v in convertLinesToProperties(lines[propsStart:propsEnd]).items() : - alg.setProperty(k,v) - - # Increase the line counter to skip the properties - lineind = propsEnd+1 - continue - - elif line.startswith('No subalgorithms.') : # End of the child algorithm append it to the parent, create new one - if alg and alg.getAlias() : - #print 'convertSubalgorithmsToChildAlg - %s/%s: append a child alg %s/%s' % (parentAlg.getName(), parentAlg.getAlias(), alg.getName(), alg.getAlias()) - parentAlg.appendChild(alg) - - alg = HLTAlgorithm(name='unknown', alias='',OutputLevel=5, alg_type='PrivateTool') - lineind += 1 - continue - - elif line.startswith('Subalgorithms:') : # Child algorithm has sub algorithms - call recursively - #print 'convertSubalgorithmsToChildAlg - %s/%s: Subalgorithms found - recursive call' % (parentAlg.getName(), parentAlg.getAlias()) - lineind += convertSubalgorithmsToChildAlg(lines[lineind:],alg) - lineind += 1 - continue - - elif line == '}' : # Subalgorithms finished - #print 'convertSubalgorithmsToChildAlg - %s/%s: Subalgorithms finished at }' % (parentAlg.getName(), parentAlg.getAlias()) - if alg and alg.getAlias() : - #print 'convertSubalgorithmsToChildAlg - %s/%s: append a child alg %s/%s' % (parentAlg.getName(), parentAlg.getAlias(), alg.getName(), alg.getAlias()) - parentAlg.appendChild(alg) - #print 'convertSubalgorithmsToChildAlg:\n%s' % alg - else : # An empty algorithms may be created at the end - pass - #print 'convertSubalgorithmsToChildAlg - %s/%s: empty child alg' % (parentAlg.getName(), parentAlg.getAlias()) - alg = HLTAlgorithm(name='unknown', alias='',OutputLevel=5, alg_type='PrivateTool') - #lineind += 1 - break - - # In all the other cases - skip the line - lineind += 1 - - if lineind > len(lines) : - print 'WARNING:\t','Processed lines: %d' % (lineind), 'vs. nr lines %d' % (len(lines)) - lineind = len(lines) - - # Before quitting - make sure the last child algorithm was appended - if alg and alg.getAlias() and not parentAlg.getChild(alg.getAlias()): - #print 'convertSubalgorithmsToChildAlg - %s/%s: additional append a child alg %s/%s' % (parentAlg.getName(), parentAlg.getAlias(), alg.getName(), alg.getAlias()) - parentAlg.appendChild(alg) - - #print 'convertSubalgorithmsToChildAlg - %s/%s: quit:\t[%d]' % (parentAlg.getName(), parentAlg.getAlias(),lineind),lines[lineind-1].rstrip('\n').strip() - return lineind - -# Apply property exceptions - return corrected value -def applyPropertyValueExceptions(name, value) : - # Exception for the OutputLevel - if name == 'OutputLevel': return 3 - if name == 'OutputLevel' and value < 3: return 3 - # Special properties of the Calorimeter Tools - #if name == 'rfac' and value in ('',None): return '""' - #if name == 'energies' and value in ('',None): return '""' - #if name == 'regions' and value in ('',None): return '""' - #if name == 'correction' and value in ('',None): return '""' - #if name == 'interp_barriers' and value in ('',None): return '""' - #if name == 'wtEMB0' and value in ('',None): return '""' - #if name == 'wtEME0' and value in ('',None): return '""' - #if name == 'wtEMB1' and value in ('',None): return '""' - #if name == 'wtEMB2' and value in ('',None): return '""' - #if name == 'wtEME1' and value in ('',None): return '""' - #if name == 'wtEME2' and value in ('',None): return '""' - #if name == 'wtTile1' and value in ('',None): return '""' - #if name == 'wtTile2' and value in ('',None): return '""' - #if name == 'wtHec1' and value in ('',None): return '""' - #if name == 'wtHec2' and value in ('',None): return '""' - #if name == 'wtFCal1' and value in ('',None): return '""' - #if name == 'wtFCal2' and value in ('',None): return '""' - #if name == 'etaFit' and value in ('',None): return '""' - #if name == 'sampling_depth' and value in ('',None): return '""' - - #if name == 'MuonCalBufferName': return '' - #if name == 'DoRecursiveLoad': return '' - - return value - -# Convert lines to properties -def convertLinesToProperties(lines): - properties = {} - lineind = 0 - for line in lines: - line = line.rstrip("\n").strip() - #print 'convertLinesToProperties:\t %d' % (lineind),line - # Skip the first line - if line.startswith('Properties:') : continue - # End of the properties - lineind += 1 - if line==']' : break - items = line.split(':') - if len(items) >=2 : - key = eval(items[0]) - value = line.replace(items[0],'',1).lstrip(':').strip() - try : - value = eval(value) - except : - pass - value = applyPropertyValueExceptions(key,value) - properties[key]=value - - #print 'convertLinesToProperties:\t',properties - return properties - -# Fix the alone standing algorithms in setup -def fixLonelyAlgs(setup) : - # 2D list where the child alias and matching lonely alg alias are saved - matchChildLonelyAlg = [] - for alias in setup.keys(): - # Split alias to particular algorithms - childrenAliases = alias.split('.') - # Single algorithm in the setup - not what I am searching for - if len(childrenAliases) == 1 : continue - # Cut the parent alias - childrenAliases = childrenAliases[1:] - for childind in range(len(childrenAliases)) : - childAlias = '.'.join(childrenAliases[childind:]) - if setup.has_key(childAlias) : # A lonely algorithm found - matchChildLonelyAlg.append([childAlias,alias]) - if setup[childAlias].getName() == setup[alias].getName(): - # Compare properties whether the algorithms may be merged - matchingProperties = True - lonelyAlgProperties = setup[childAlias].getProperties() - for k,v in setup[alias].getProperties().items() : - if lonelyAlgProperties.has_key(k) and lonelyAlgProperties[k] != v : - matchingProperties = False - break - - #if matchingProperties : matchChildLonelyAlg.append([childAlias,alias]) - - for item in matchChildLonelyAlg : - print "Lonely algorithm %s/%s may be merged with %s/%s" % (setup[item[0]].getName(), setup[item[0]].getAlias(), setup[item[1]].getName(), setup[item[1]].getAlias()) - -# Fix the alone standing algorithms in setup -def fixLonelySteerAlgs(setup) : - matchChildLonelyAlg = [] - # 2D list where the child alias and matching lonely alg alias are saved - for alias in setup.keys(): - if 'TrigSteer_' != alias[:10] : continue - # Split alias to particular algorithms - childrenAliases = alias.split('.') - # Single algorithm in the setup - not what I am searching for - if len(childrenAliases) == 1 : continue - # Cut the parent alias - childrenAliases = childrenAliases[1:] - for childind in range(len(childrenAliases)) : - childAlias = '.'.join(childrenAliases[childind:]) - if setup.has_key(childAlias) : # A lonely algorithm found - if setup[childAlias].getName() == setup[alias].getName(): - matchChildLonelyAlg.append([childAlias,alias]) - #if matchingProperties : matchChildLonelyAlg.append([childAlias,alias]) - - for item in matchChildLonelyAlg : - print "Merge Steering algorithms: %s/%s and %s/%s" % (setup[item[1]].getName(), setup[item[1]].getAlias(), setup[item[0]].getName(), setup[item[0]].getAlias()) - setup[item[0]].setAlias(item[1]) - success = setup[item[1]].mergeAlgorithm(setup[item[0]]) - if success : del setup[item[0]] - -# Fix the child parent relations accordingly to the name of the algorithm -def fixChildParentRelations(algorithms): - if isinstance(algorithms, list) : - # Suppose the algorithms does not have parents - # Sorting of the algorithms accordingly to the alias assure the consequence of the parent and child - def hltAlgAliases_cmp(a1, a2) : - return cmp(a1.getAlias(), a2.getAlias()) - - algorithms.sort(hltAlgAliases_cmp) - i = 0 - while i < len(algorithms): - alias = algorithms[i].getAlias() - # Remove the ToolSvc. from alias - #if alias[:8] == 'ToolSvc.' : - #alias = alias[8:] - - # Check the alias - if '.' in alias : - #self._log.warning('Attempt to fix child algorithm %s/%s' % (algorithms[i].getName(), algorithms[i].getAlias())) - childAlias = algorithms[i].getAlias().split('.')[-1] - parentAlias = algorithms[i].getAlias().rstrip(childAlias) - parentAlias = parentAlias.rstrip('.') - - parentFound = False - flattenAlgs = [] - for ii in range(len(algorithms)) : - if ii != i : - flattenAlgs.extend(algorithms[ii].flattenAlg()) - - for alg in flattenAlgs : - if alg.getAlias() == parentAlias : - #self._log.debug("Parent found: %s/%s - algorithm will be appended as child" % (alg.getName(), alg.getAlias())) - parentFound = True - # Set the type of the algorithm - alg_type = 'PrivateTool' - if alg.getAlias() == 'ToolSvc' : alg_type = 'PublicTool' - algorithms[i].alg_type = alg_type - alg.appendChild(algorithms[i]) - - # If the algorithm was assigned as a child alg to some parent - delete it - if parentFound : - #self._log.debug("Appended algorithm %s/%s will be deleted from top parents list" % (algorithms[i].getName(), algorithms[i].getAlias())) - #algorithms[i].delete() - del algorithms[i] - else : - print "WARNING - No parent algorithm found for %s/%s" % (algorithms[i].getName(), algorithms[i].getAlias()) - i = i+1 - - else : - i = i+1 - - # Fix the children within the parents - for parent in algorithms : parent.fixChildren() - - #return algorithms - -# Get the TopAlg from the AthSequencer -def getCorrectTopAlgsFromAthSequencer(setup,athSequencerAlias) : - output = [] - if setup.has_key(athSequencerAlias) and setup[athSequencerAlias].getProperties().has_key('Members') : - for member in setup[athSequencerAlias].getProperties()['Members'] : - memberName = member.split('/')[0].strip() - memberAlias = member.replace(member.split('/')[0],'',1).lstrip('/').strip() - # Recursive call - if memberName == 'AthSequencer' : - output.extend(getCorrectTopAlgsFromAthSequencer(setup,memberAlias)) - else : - output.append(member) - - # At the end remove the AthSequencer from the setup - del setup[athSequencerAlias] - - return output - -# Convert HLTAlgorithm class to XML Element -def hltAlgorithmtoXMLElement(alg,document) : - algtype = 'algorithm' - try: - algtype = alg.alg_type.lower() - except : - pass - - algorithm=topalg=steeralg=svc=pubt=privt=aud='0' - if algtype == 'algorithm' : algorithm='1' - if algtype == 'topalg': topalg='1' - if algtype == 'steeralg': - algorithm='1' - steeralg='1' - if algtype == 'service': svc='1' - if algtype == 'publictool': pubt='1' - if algtype == 'privatetool': privt='1' - if algtype == 'auditor': aud='1' - - component = document.createElement('component') - component.setAttribute('name', str(alg.getName())) - component.setAttribute('alias', str(alg.getAlias())) - py_name = alg.getPy_name() - if py_name == None : py_name = '' - component.setAttribute('py_name', str(py_name)) - py_package = alg.getPy_package() - if py_package == None : py_package = '' - component.setAttribute('py_package', str(py_package)) - component.setAttribute('topalg', topalg) - component.setAttribute('alg', algorithm) - component.setAttribute('steeralg', steeralg) - component.setAttribute('svc', svc) - component.setAttribute('pubt', pubt) - component.setAttribute('privt', privt) - component.setAttribute('aud', aud) - - # append the properties - for k,v in alg.getProperties().items() : - component.appendChild(propertyToXmlElement(document,k,v)) - - for child in alg.getChildren() : - component.appendChild(hltAlgorithmtoXMLElement(child, document)) - - return component - -def propertyToXmlElement(document, name, value) : - parameter = document.createElement('parameter') - parameter.setAttribute('name', str(name)) - if name in propertyNameSpecial: value = applyPropertyValueExceptions(name, value) - if value == None: value='' - if isinstance(value,(str,unicode)) : - parameter.setAttribute('value', value) - else: - parameter.setAttribute('value', str(value)) - parameter.setAttribute('op','set') - - return parameter - -def usage(): - """Prints a help message""" - print "\nusage:" - print "%s [options] inputfile.txt" % sys.argv[0] - print "options are:" - print " -h|--help : prints this message" - print " --ForPointOne : temporary hack to run at Point 1 (muFast_Muon)\n" - print "Minimum required : you have to specify the .txt file to be converted.\n" - return - -# Strip the AthSequencer and create a list of algorithm -def stripAthSequencer(athSequencer) : - output = [] - if athSequencer.getName() != 'AthSequencer' : - output.append(athSequencer) - return output - # Create a 1st item in the list - empty - place for the athSequencer - output.append(None) - athSeqAlias = athSequencer.getAlias() - for child in athSequencer.getChildren() : - # Remove the parent alias from child alias - childAlias = child.getAlias() - childAlias = childAlias.replace('%s.' % (athSeqAlias),'',1) - #print '2. stripAthSequencer:', childAlias - child.setAlias(childAlias) - if child.alg_type.lower() == 'privatetool' : child.alg_type = 'Algorithm' - - # Call recursively if child is an AthSequencer - if child.getName() == 'AthSequencer' : - output.extend(stripAthSequencer(child)) - else : - output.append(child) - - athSequencer.removeChild(child.getAlias()) - del child - # Set the 1st algorithm in the list - output[0] = athSequencer - - # Just for debugging - #for alg in output : - #print '3. stripAthSequencer:', alg - return output - -# Functions for application of any exceptions which should be handled manually -# input value is a dictionary of HLTAlgorithm's referenced by their alias -def applyManualExceptions(setup) : - # Remove DataFlowConfig - if setup.has_key('DataFlowConfig') : - print "WARNING\t",'Manual delete %s/%s' % (setup['DataFlowConfig'].getName(),setup['DataFlowConfig'].getAlias()) - setup['DataFlowConfig'].delete() - del setup['DataFlowConfig'] - - # Remove ServiceManager - if setup.has_key('ServiceManager') : - print "WARNING\t",'Manual delete %s/%s' % (setup['ServiceManager'].getName(),setup['ServiceManager'].getAlias()) - setup['ServiceManager'].delete() - del setup['ServiceManager'] - - # Disable HistorySvc - if setup.has_key('HistorySvc') : - print "WARNING\t",'Manual disable %s/%s' % (setup['HistorySvc'].getName(),setup['HistorySvc'].getAlias()) - setup['HistorySvc'].setProperty('Dump', False) - setup['HistorySvc'].setProperty('Activate', False) - setup['HistorySvc'].setProperty('OutputFile', '') - if setup.has_key('ApplicationMgr') : - setup['ApplicationMgr'].setProperty('ActivateHistory', False) - - #Delete CaloRunClusterCorrections tools - masterAlgAliases = [] - for alg in setup.values() : - if alg.getName() == "CaloRunClusterCorrections" : - masterAlgAliases += [alg.getAlias()] - - for masterAlgAlias in masterAlgAliases : - subtools = [algAlias for algAlias in setup.keys() if algAlias.startswith(masterAlgAlias+".")] - for subtool in subtools : - print "WARNING\t",'Manual delete of CaloRunClusterCorrections tool %s/%s' % (setup[subtool].getName(), subtool) - setup.pop(subtool) - - # Delete the children of masterAlgAlias - for child in setup[masterAlgAlias].getChildren() : - print "WARNING\t",'Manual delete of CaloRunClusterCorrections tool %s/%s' % (child.getName(), child.getlAlias()) - setup[masterAlgAlias].removeChild(child.getAlias()) - - # Replace empty properties of the H1WeightToolCSC12Generic - for alg in setup.values() : - if alg.getName() in ('H1WeightToolCSC12Generic', 'MCNumInversionResponse') : - properties = alg.getProperties() - for k,v in properties.items() : - if k not in ('prefix') and v in ('',None): - alg.getProperties()[k]='""' - print "WARNING\t",'Manual set of %s/%s.%s = \'%s\'' % (alg.getName(),alg.getAlias(),k, setup[alg.getAlias()].getProperties()[k]) - - # Set the exceptions for the point 1 - if ConversionForPointOne : - #if setup.has_key('muFast_Muon') : - #setup['muFast_Muon'].setProperty('OnlineRun',True) - - for key in setup.keys() : - if setup[key].getName() == 'muFast' : - print "WARNING\t",'Modification for P1 - %s/%s.%s = %s' % (setup[key].getName(),setup[key].getAlias(),'OnlineRun',True) - setup[key].setProperty('OnlineRun',True) - - -if __name__ == '__main__': - - short_opt = "h?" - long_opt = ['help','ForPointOne'] - - if len(sys.argv) <= 1: - usage() - sys.exit(1) - - try: - opts, args = getopt.getopt(sys.argv[1:], short_opt, long_opt) - except getopt.GetoptError: - usage() - sys.exit(2) - - # Read the options - for o, a in opts: - if o in ('-h', '-?', '--help'): - usage() - sys.exit(0) - # Sylvie 11/07/2008 - # This is a tempory hack to set "OnlineRun" to "True" for muFast_Muon (muFast) - # when preparing configuration for Point1. - if o in ('--ForPointOne'): - ConversionForPointOne = True - else: - ConversionForPointOne = False - - infilename = sys.argv[-1] # The input text file is always the last argument - if len(infilename)-infilename.rfind(".txt") == 4: - (root,ext) = os.path.splitext(infilename) - if ext==".txt": - outfilename = root+".xml" - else: - outfilename = root+ext+".xml" - else: - print "\nError, the file to be converted (last argument) is not a .txt file.\n" - usage() - sys.exit(1) - - - print "Input : ", infilename - print "Output : ", outfilename - - fin = open(infilename, 'r') - lines = fin.readlines() - fin.close() - - - currentPart = '' - globalProp = {} - - globalStart = -1 - globalEnd = -1 - servicesStart = -1 - servicesEnd = -1 - algsStart = -1 - algsEnd = -1 - toolsStart = -1 - toolsEnd = -1 - pyStart = -1 - pyEnd = -1 - - # All the read algorithms will be stored in the setup dictionairy - setup = {} - - # Loop trough lines of the file - read GLOBAL part last - startPart = start = time.time() - startPartLine = lineind = 0 - nlines = len(lines) - currentPart = None - while lineind < nlines : - currentLine = lines[lineind].rstrip('\n').strip() - if currentLine=='GLOBAL': - if currentPart and currentPart != 'GLOBAL' : - print 'Finished %s in %fs - %d lines processed' % (currentPart, time.time()-startPart, lineind-startPartLine) - startPart = time.time() - startPartLine = lineind+1 - currentPart = 'GLOBAL' - print 'PROCESSING %s ....' % (currentPart) - globalStart = lineind - lineind += 1 - continue - elif currentLine=='SERVICES': - if currentPart and currentPart != 'SERVICES' : - print 'Finished %s in %fs - %d lines processed' % (currentPart, time.time()-startPart, lineind-startPartLine) - startPart = time.time() - startPartLine = lineind+1 - servicesStart = lineind - currentPart = 'SERVICES' - print 'PROCESSING %s ....' % (currentPart) - lineind += 1 - continue - elif currentLine=='ALGORITHMS': - if currentPart and currentPart != 'ALGORITHMS' : - print 'Finished %s in %fs - %d lines processed' % (currentPart, time.time()-startPart, lineind-startPartLine) - startPart = time.time() - startPartLine = lineind+1 - algsStart = lineind - currentPart = 'ALGORITHMS' - print 'PROCESSING %s ....' % (currentPart) - lineind += 1 - continue - elif currentLine=='ALGTOOLS': - if currentPart and currentPart != 'ALGTOOLS' : - print 'Finished %s in %fs - %d lines processed' % (currentPart, time.time()-startPart, lineind-startPartLine) - startPart = time.time() - startPartLine = lineind+1 - toolsStart = lineind - currentPart = 'ALGTOOLS' - print 'PROCESSING %s ....' % (currentPart) - lineind += 1 - continue - elif currentLine=='SETUP': - if currentPart and currentPart != 'SETUP' : - print 'Finished %s in %fs - %d lines processed' % (currentPart, time.time()-startPart, lineind-startPartLine) - startPart = time.time() - startPartLine = lineind+1 - pyStart = lineind - currentPart = 'SETUP' - print 'PROCESSING %s ....' % (currentPart) - lineind += 1 - continue - - # Skip the global part - until other part isn't found - if currentPart == 'GLOBAL' : - line = lines[lineind].rstrip('\n').strip() - if len(line.split()) > 1 : - componentAlias = line.split()[0].strip() - if not setup.has_key(componentAlias) : # New component - this one should probably be corrected - by typeLUT - hcpname = 'unknown' - alg = HLTAlgorithm(alias=componentAlias, name=hcpname, OutputLevel=5) - # Set highest priority to the GLOBAL part properties - alg.setLevel('BOTH') - setup[componentAlias] = alg - - property = line.replace(line.split()[0],'',1).strip() - propertyName = eval(property.split(':')[0]) - propertyValue= property.replace(property.split(':')[0],'',1).lstrip(':').strip() - # Convert the property - try : - propertyValue = eval(propertyValue) - except : - pass - propertyValue = applyPropertyValueExceptions(propertyName, propertyValue) - # Set the property of the algorithm - setup[componentAlias].setProperty(propertyName,propertyValue) - lineind += 1 - continue - - if currentPart in ('SETUP','SERVICES','ALGORITHMS','ALGTOOLS') : - if currentLine.startswith('>>') : - componentStart = lineind+1 - componentEnd = componentStart - for componentind in range(componentStart, nlines) : - if lines[componentind].startswith('>>') : break - if lines[componentind].rstrip('\n').strip() in ('SETUP','SERVICES','ALGORITHMS','ALGTOOLS','GLOBAL') : break - componentEnd = componentind - - alg = convertLinesToAlg(lines[componentStart:componentEnd]) - # Skip the lines already used for the component - lineind = componentEnd +1 - # Set default type of algorithm - alg.alg_type='Algorithm' - if currentPart == 'SETUP' : # If an algorithm exist - don't set the properties: set the lowest trigger level of the algorithm - alg.setLevel('L2') - #alg.setLevel('BOTH') - elif currentPart in ('SERVICES','ALGORITHMS','ALGTOOLS') : # Set the properties of the algorithms - alg.setLevel('EF') - # Set the type of the algorithm - if currentPart == 'SERVICES' : - alg.alg_type='Service' - elif currentPart == 'ALGORITHMS' : - alg.alg_type='Algorithm' - elif currentPart == 'ALGTOOLS' : - alg.alg_type='PublicTool' - - algs = [] - - # Strip the AthSequencer Algorithm - if alg.getName() == 'AthSequencer' : - algs.extend(stripAthSequencer(alg)) - else : - algs.append(alg) - - # Remove steering algorithms from private Tools of the HLT::TrigSteer algorithm - for alg in algs : - if alg.getName() == 'HLT::TrigSteer' and setup.has_key(alg.getAlias()): - for child in alg.getChildren(): - steerAlgAlias = '.'.join((child.getAlias().split('.')[1:])) - # Steering algorithms stay in the GLOBAL part alone - if setup.has_key(steerAlgAlias) : - #print "Trigger Steering algorithm found: %s/%s" % (child.getName(),child.getAlias()) - setup[steerAlgAlias].alg_type='SteerAlg' - setup[steerAlgAlias].setName(child.getName()) - child.setAlias(steerAlgAlias) - child.alg_type ='SteerAlg' - algs.append(child) - alg.removeChild(child.getAlias()) - #print alg - - # Flatten the algorithms and process them - flatalgs = [] - for alg in algs : - flatalgs.extend(alg.flattenAlg()) - - # Test if the algorithm is present in the setup already - for alg in flatalgs : - if currentPart == 'SETUP' : # If an algorithm exist - don't set the properties: set the lowest trigger level of the algorithm - alg.setLevel('L2') - #alg.setLevel('BOTH') - elif currentPart in ('SERVICES','ALGORITHMS','ALGTOOLS') : # Set the properties of the algorithms - alg.setLevel('EF') - - alias = alg.getAlias() - if setup.has_key(alias) : - # Set the algorithm name - if setup[alias].getName().lower() in ('unknown','',None): - setup[alias].setName(alg.getName()) - elif setup[alias].getName() != alg.getName(): # Compare existing names - print "WARNING:\t","Incompatible algorithms: existing - %s/%s vs. new - %s/%s" % (setup[alias].getName(), setup[alias].getAlias(), alg.getName(),alg.getAlias()) - - # Set python package and python class - if currentPart=='SETUP' : - # Set the python class name - if setup[alias].getPy_name() and setup[alias].getPy_name() != alg.getPy_name() : - print 'WARNING:\t','Reset %s/%s algorithm py_name to %s (previous value: %s)' % (setup[alias].getName(),alias,setup[alias].getPy_name(),alg.getPy_name()) - setup[alias].py_name = alg.getPy_name() - - # Set the python class package - if setup[alias].getPy_package() and setup[alias].getPy_package() != alg.getPy_package() : - print 'WARNING:\t','Reset %s/%s algorithm py_package to %s (previous value: %s)' % (setup[alias].getName(),alias,setup[alias].getPy_package(),alg.getPy_package()) - setup[alias].py_package = alg.getPy_package() - # End of if currentPart=='SETUP' : - - # Compare properties of existing algorithm and current algorithm if one of the algorithms is from python dump - if ("L2" in (alg.getLevel(), setup[alias].getLevel())) and not ((alg.getLevel(), setup[alias].getLevel())==("L2","L2")): - pyAlgProperties = alg.getProperties() - glAlgProperties = setup[alias].getProperties() - if alg.getLevel()!="L2" : - pyAlgProperties = setup[alias].getProperties() - glAlgProperties = alg.getProperties() - - for k,v in pyAlgProperties.items(): - # Compare all the simple type properties - #if glAlgProperties.has_key(k) and isinstance(pyAlgProperties[k],(str,unicode, bool,int,float,long)): - #if glAlgProperties.has_key(k) and isinstance(pyAlgProperties[k],(bool,int,float,long)): - if glAlgProperties.has_key(k): - if pyAlgProperties[k] != glAlgProperties[k] and not k.startswith("Audit") and k not in ('OutputLevel'): - if isinstance(pyAlgProperties[k],(str,unicode)) and "%s/%s" % (glAlgProperties[k],glAlgProperties[k]) != pyAlgProperties[k]: - print "WARNING:\t", "C++/Python property %s/%s.%s value mismatch" % (alg.getName(), alg.getAlias(),k ) - print "\tC++ value:\t%s" % (glAlgProperties[k]) - print "\tPython value:\t%s" % (pyAlgProperties[k]) - # Set the property to the default Python value - if glAlgProperties.has_key(k) and isinstance(pyAlgProperties[k],(bool,int,long)): - setup[alias].setProperty(k,pyAlgProperties[k]) - alg.setProperty(k,pyAlgProperties[k]) - - # Merge algorithms: - success = setup[alias].mergeAlgorithm(alg) - else : - # Append new algorithm - #if currentPart == 'SETUP' : print 'SETUP\t new algorithm %s/%s appended to setup' % (alg.getName(),alg.getAlias()) - setup[alias] = alg - - continue - lineind += 1 - # End of loop over lines - if currentPart : - print 'Finished %s in %fs - %d lines processed' % (currentPart, time.time()-startPart, lineind-startPartLine) - - print '%d algorithms found' % len(setup) - - startCorrections = time.time() - # Here the setup has been filled with correct information - # Fix the unknowns using typeLUT - for k in setup.keys() : - if setup[k].getName().lower() in ('unknown','') : - # remove ToolSvc from the alias: - alias = k - if alias[:8] == 'ToolSvc.' : - alias = alias.replace('ToolSvc.','',1) - # Exception for ApplicationMgr - if alias == 'ApplicationMgr' : - setup[k].setName('ApplicationMgr') - continue - - if alias in typeLUT.keys() : - print 'WARNING\t','fixing %s type of algorithm %s using typeLUT value %s' % (setup[k].getName(), setup[k].getAlias(), typeLUT[alias]) - setup[k].setName(typeLUT[alias]) - else : - print 'ERROR\t','can not determine type of the algorithm %s/%s' % (setup[k].getName(),setup[k].getAlias()) - - corrtime = time.time() - startCorrections - if corrtime > 0 : print 'The unknown types fixed in %fs' % (corrtime) - - # Fix ApplicationMgr TopAlg property and find and set top algorithms type to TopAlg - #if setup.has_key('ApplicationMgr') and setup['ApplicationMgr'].getProperties().has_key('TopAlg') : - #print "Fixing ApplicationMgr.TopAlg ...." - #startAppTopAlg = time.time() - #topAlgs = setup['ApplicationMgr'].getProperties()['TopAlg'] - #correctedTopAlgs = [] - #for topAlg in topAlgs : - #topAlgName = topAlg.split('/')[0].strip() - #topAlgAlias = topAlg.replace(topAlgName,'',1).lstrip('/').strip() - ## If the type is AthSequencer - look for its property Members and is deleted from the setup - #if topAlgName == 'AthSequencer' : - #correctedTopAlgs.extend(getCorrectTopAlgsFromAthSequencer(setup,topAlgAlias )) - #else : - #correctedTopAlgs.append(topAlg) - - #setup['ApplicationMgr'].setProperty('TopAlg',correctedTopAlgs) - #print "ApplicationMgr.TopAlg fixed in %fs" % (time.time()-startAppTopAlg) - - #print "Setting TopAlg type ...." - #startAppTopAlg = time.time() - ## Fix ApplicationMgr TopAlg property - #topAlgs = setup['ApplicationMgr'].getProperties()['TopAlg'] - #ntopAlgs = 0 - #if isinstance(topAlgs,list) : - #for topAlg in topAlgs : - #topAlgAlias = topAlg.split('/')[0].strip() - #if len(topAlg.split('/')) >= 2 : - #topAlgAlias = topAlg.replace(topAlgAlias,'',1).lstrip('/').strip() - - #if setup.has_key(topAlgAlias) : - #setup[topAlgAlias].alg_type='TopAlg' - #ntopAlgs += 1 - #else : - #print 'WARNING - Top algorithm %s not found in the setup' % (topAlgAlias) - #print "%d TopAlg algorithms type assigned in %fs" % (ntopAlgs,time.time()-startAppTopAlg) - - # Think about any exceptions which has to be set manually - applyManualExceptions(setup) - - # Fix the child - parent relations - algorithms = setup.values() - startFixCPRel = time.time() - print "Fixing child-parent relations ...." - #algorithms = fixChildParentRelations(algorithms) - fixChildParentRelations(algorithms) - print 'Child - Parent relations fixed in %fs' % (time.time()-startFixCPRel) - print 'Number of parent algorithms: %d' % (len(algorithms)) - - # On this place the algorithms should be already fixed and may be converted to the XML format and saved in the XML file - print "Convert the setup to XML" - startXML = time.time() - fout = open(outfilename, 'w') - import xml.dom.minidom - impl = xml.dom.minidom.getDOMImplementation() - document = impl.createDocument(None, "setup", None) - - for alg in algorithms : - alias = alg.getAlias() - #if alias[:8] == 'ToolSvc.' : - #alias = alias.replace('ToolSvc.','',1) - if '.' in alias: print "WARNING - %s/%s should be a child algorithm" % (alg.getName(), alg.getAlias()) - docElement = document.documentElement - docElement.appendChild(hltAlgorithmtoXMLElement(alg, document)) - print "Setup converted to XML document in %fs" % (time.time() - startXML) - # Save the XML document - document.writexml(fout, addindent=' ', newl='\n') - fout.close() - - sys.exit(0) diff --git a/Trigger/TrigConfiguration/TrigConfOffline/share/LoadTriggerMenuFromXML.py b/Trigger/TrigConfiguration/TrigConfOffline/share/LoadTriggerMenuFromXML.py deleted file mode 100755 index 016bd1c5f2e613ad42e4f3957174a644c12c371c..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/share/LoadTriggerMenuFromXML.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python - -#from TrigConfOffline import * -#import TrigConfOffline as tc -from TrigConfOffline.menuloader import * - -hltmenu = hltmenuloader("HLTconfig_Physics_pp_v4_18.1.0.xml").menu -c = hltmenu.chains()[0] -s = hltmenu.sequences()[0] -print c - -#for c in (x for x in hltmenu.chains() if '4j45' in x.name()): -# print c.name() - -l1menu = l1menuloader("LVL1config_Physics_pp_v4.xml").menu -i = l1menu.menu().items()[0] -print i - -#for item in l1menu.menu().items(): -# print item.name() - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/share/Load_trigger_db_shelve.py b/Trigger/TrigConfiguration/TrigConfOffline/share/Load_trigger_db_shelve.py deleted file mode 100755 index 68b30a93a252612fcce4f387889e5426fd622a54..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/share/Load_trigger_db_shelve.py +++ /dev/null @@ -1,283 +0,0 @@ -#!/usr/bin/env python - -import getopt, sys, os, time -import user -import shelve - - -inFileName = 'trigger_db.pickle' - -print ">>> opening py-shelve [%s]..." % inFileName -hlt_config_db = shelve.open(inFileName)['config'] -print ">>> found [%i] configurables" % len(hlt_config_db) - -def is_nested(c): - return c.count('.') > 0 -#def cnv_prop(): - -import GaudiKernel.GaudiHandles as GaudiHandles -from AthenaCommon import CfgMgr -from AthenaCommon.Configurable import (ConfigurableAlgorithm, - ConfigurableService, - ConfigurableAlgTool, - ConfigurableAuditor) - -# load configurable db and create the ToolSvc -toolSvc = CfgMgr.ToolSvc() - -from AthenaCommon.ConfigurableDb import getConfigurable,cfgDb -from AthenaCommon.AppMgr import ToolSvc,ServiceMgr,theApp -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -algs = [] -services = [] -tools = [] -auditors = [] -nprivate_algs = 0 -# EventSelector -#include( "ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py" ) -# Geometry -#include( "DetDescrDictionary/DetDescrDictionaryDict_joboptions.py" ) -#include ("AtlasGeoModel/SetGeometryVersion.py") - -# Get the Sorted list of DB Components -names = hlt_config_db.keys() -# Exclude the ApplicationMgr -del names[names.index('ApplicationMgr')] -# Sort the Components (alg1 > alg1.some) in order to initialize the Parent algorithms first -names.sort() - -for name in names: - c = hlt_config_db[name] - cfg_name = name - cfg_type = c['type'] - if name.count('.') > 0: - cfg_type = cfg_type.split('.')[-1] - if 'ToolSvc.' in name : - cfg_name = name.replace('ToolSvc.','') - #cfg_name = cfg_name.split('.')[-1] - #print 'Try to get Configurable:', cfg_type, ':\t %s/%s' % (c['type'],name) - cfg_class = getConfigurable(cfg_type, assumeCxxClass=True) - if not cfg_class : - print 'WARNING: Configurable %s/%s (%s/%s) not found' % (cfg_type, cfg_name, c['type'],name) - continue - - ## create an instance with the correct name - stmt = 'cfg = CfgMgr.%(cfg_class)s( "%(cfg_name)s", %(properties)s)' - - properties = [] - for n,v in c['properties'].items(): - try: - dflt_value = cfg_class.__slots__[n] - except KeyError,err: - print "::ERROR:: configurable [%s] has no such property [%s] !!"%( - cfg_class.__name__, n - ) - continue - p = '%s = %s' - if isinstance(dflt_value,str): - p = '%s = "%s"' - elif isinstance(dflt_value,GaudiHandles.GaudiHandle): - p = '%s = "%s"' - properties += [ p % (n,v) ] - - stmt = stmt % { - 'cfg_class' : cfg_class.__name__, - 'cfg_name' : cfg_name, - 'properties': ', '.join(properties) - } - - - try: - exec(stmt) - - #print 'Configurable:', cfg_type, ':\t %s/%s' % (c['type'],name), 'Succesfully initialized' - #print '\t', cfg - - if isinstance(cfg, ConfigurableAlgorithm): algs.append ({'cfg':cfg, 'topalg':c['topalg']}) - elif isinstance(cfg, ConfigurableService): services.append(cfg) - elif isinstance(cfg, ConfigurableAlgTool): tools.append (cfg) - elif isinstance(cfg, ConfigurableAuditor): auditors.append(cfg) - else: - print ":::ERROR::: not nested and not an algorithm:", - print c,"(%s)"%type(cfg) - pass - except NameError: - if cfg_name.count('.') > 0 : - alg_name = cfg_name.split('.')[-1] - top_parent_name = cfg_name.split('.')[0] - parent_name = cfg_name[:cfg_name.rfind(alg_name)-1] - # cfg_name = alg_name - top_parent_cfg = None - top_parent_cfg_str = '' - - # Search the Algorithms for the parent - if not top_parent_cfg: - count = 0 - for a in algs : - if a['cfg'].getName() == top_parent_name : - top_parent_cfg_str = 'algs[%d][\'cfg\']' % (count) - top_parent_cfg = algs[count]['cfg'] - count += 1 - - # Search the Services for the parent - if not top_parent_cfg: - count = 0 - for s in services : - if s.getName() == top_parent_name : - top_parent_cfg_str = 'services[%d]' % (count) - top_parent_cfg = services[count] - count += 1 - - # Search the Tools for the parent - if not top_parent_cfg: - count = 0 - for t in tools : - if t.getName() == top_parent_name : - top_parent_cfg_str = 'tools[%d]' % (count) - top_parent_cfg = tools[count] - count += 1 - - # Search the Auditors for the parent - if not top_parent_cfg: - count = 0 - for a in auditors : - if a.getName() == top_parent_name : - top_parent_cfg_str = 'auditors[%d]' % (count) - top_parent_cfg = auditors[count] - count += 1 - - if top_parent_cfg: - parent_cfg = top_parent_cfg - if parent_name.count('.') > 1 : - for parent in parent_name[len(top_parent_name):].split('.') : - child_cfg = None - for child in parent_cfg.getAllChildren() : - if child.getName() == parent : - child_cfg = child - break - if child_cfg : - parent_cfg = child_cfg - else : - print 'ERROR: ', 'Configurable:', cfg_type, ':\t %s/%s' % (c['type'],name), 'Parent algorithm: %s was not found' % (parent_name) - - # Test the existence of the Child Configurable if exists set the properties only - cfg = None - for child in parent_cfg.getAllChildren() : - if child.getName() == alg_name: - cfg = child - break; - - #print top_parent_cfg_str, parent_name - #stmt = top_parent_cfg_str + parent_name[len(top_parent_name):] - #print stmt - if not cfg : - stmt = 'parent_cfg += CfgMgr.%(cfg_class)s( "%(cfg_name)s", %(properties)s)' - stmt = stmt % { - 'cfg_class' : cfg_class.__name__, - 'cfg_name' : alg_name, - 'properties': ', '.join(properties) - } - - try : - exec(stmt) - nprivate_algs += 1 - #print 'Private algorithm %s/%s (%s/%s) successfully initialized with name %s' % (private_alg['cfg_class'], private_alg['name'], c['type'], c['name'], cfg_name) - #print parent_cfg - except NameError: - print 'ERROR: Configurable:', cfg_type, ':\t %s/%s' % (c['type'],name), 'Can not be initialized' - #except AttributeError: - else: - for k,v in c['properties'].items(): - try : - v = eval(v) - except : - v = v - stmt = 'cfg.%s = %s' % (k,v) - if isinstance(v,str) : - stmt = 'cfg.%s = \'%s\'' % (k,v) - exec (stmt) - nprivate_algs += 1 - else : - print 'ERROR: Configurable:', cfg_type, ':\t %s/%s' % (c['type'],name), 'Parent algorithm: %s was not found' % (parent_name) - else: - print 'ERROR: Configurable:', cfg_type, ':\t %s/%s' % (c['type'],name), 'is not a private or nested algorithm' - pass - - -## testing -## Sort the algs list such that parent algorithms are before the child algorithms -# means: alg1 < alg1.child => alphabetical sorting of the alg names would do -def alg_compare(a1, a2) : - if a1['topalg'] == a1['cfg'].getFullJobOptName() : - return -1 - - if a2['topalg'] == a2['cfg'].getFullJobOptName() : - return 1 - - return cmp(a1['cfg'].getName(), a2['cfg'].getName()) - -algs.sort(alg_compare) -unbound_algs = [] -hlt_app = hlt_config_db['ApplicationMgr'] -for a in algs: - alg_full_name = a['cfg'].getFullJobOptName() - if alg_full_name in hlt_app['properties']['TopAlg']: - print 'Top Algorithm Found: ', alg_full_name - topSequence += a['cfg'] - elif not a['topalg'] : # In case there is no TopAlg - unbound_algs.append(a['cfg']) - else: - cfg = a['cfg'] - stmt = 'topSequence.%s += cfg' % (a['topalg'].split('/')[-1]) - exec(stmt) - -print "-"*40,'Unbound Algorithms: %d' %(len(unbound_algs)),"-"*40 -for a in unbound_algs : - print "\t%s" % (a.getFullJobOptName()) - -for s in services: ServiceMgr += s -for t in tools: ToolSvc += t -for a in auditors: ServiceMgr.AuditorSvc += a - -# then, take care of the application manager -print "-"*80 - -for n,v in hlt_app['properties'].items(): - stmt = 'theApp.%s = %s' - dflt_value = theApp.__slots__[n] - if v == dflt_value: - continue - if isinstance(dflt_value,str): stmt = 'theApp.%s = "%s"' - stmt = stmt % (n,v) - if n=='CreateSvc' : - v = eval(v) - for vv in v: - theApp.CreateSvc += [vv] - print ":::","theApp.CreateSvc += [\'%s\']" % (vv) - else : - try: - exec(stmt) - print ":::",stmt - except Exception,err: - print "::ERROR:: theApp setup:",err - print " ",n,v - print " ",stmt - - -print ">>> configurables in db:",len(hlt_config_db) -print ">>> algs: ",len(algs) -print ">>> services:",len(services) -print ">>> tools: ",len(tools) -print ">>> auditors:",len(auditors) -print ">>> private algs:", nprivate_algs -print "::: failed to restore [%i] configurables" %(len(hlt_config_db) - - len(algs) - - len(services) - - len(tools) - - len(auditors) - - nprivate_algs) - - -theApp.setup() \ No newline at end of file diff --git a/Trigger/TrigConfiguration/TrigConfOffline/share/testHLT_standaloneDB.py b/Trigger/TrigConfiguration/TrigConfOffline/share/testHLT_standaloneDB.py deleted file mode 100755 index ada7d31d026ac0668abae4e980b4253b21d576c4..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/share/testHLT_standaloneDB.py +++ /dev/null @@ -1,167 +0,0 @@ -########################################################################### -# Author: Miroslav Nozicka <nozicka@mail.desy.de> -# -# Usage: athena.py -c "[flags]" testHLT_standaloneDB.py -# -########################################################################### -from TrigConfOffline.HLTConfOffline import HLTConfOffline -hltConfOffline = HLTConfOffline() - -# Process the commands -## @var dbSMKeyFlag -# Either SMKey or Run number must be specified in the command option -dbSMKeyFlag = False -try : - hltConfOffline.SMKey = DBSMKey - dbSMKeyFlag = True -except NameError: - pass - -runNumberFlag = False -try : - hltConfOffline.RunNumber = Run - runNumberFlag = True -except NameError: - pass - -# Raise the Exception if neither SMKey nor Run number specified -if not (runNumberFlag or dbSMKeyFlag) : - raise Exception('Please specify Run or SMKey') - -# Process the remaining command options -try : - hltConfOffline.OutputLevel = OutputLevel -except NameError: - pass - -try : - hltConfOffline.setupSource = DBConn -except NameError: - pass - -try : - hltConfOffline.dbType = DBType.lower() -except NameError: - pass - -try : - hltConfOffline.dbHost = DBServer -except NameError: - pass - -try : - hltConfOffline.dbUser = DBUser -except NameError: - pass - -try : - hltConfOffline.dbPasswd = DBPasswd -except NameError: - pass - -try : - hltConfOffline.dbName = DBName -except NameError: - pass - -try : - hltConfOffline.rulesSource = Rules -except NameError: - pass - -try : - hltConfOffline.HLTPrescaleKey = DBHLTPSKey -except NameError: - pass - -try : - hltConfOffline.LVL1PrescaleKey = DBLVL1PSKey -except NameError: - pass - -try : - hltConfOffline.Level = Instance -except NameError: - pass - -# Load the trigger setup -hltConfOffline.load() - -# Set Maximum number of events -try: - theApp.EvtMax = EvtMax -except NameError: - pass - -# Set input data file -try: - inputdata = DataFile - if isinstance(inputdata, str) or isinstance(inputdata,unicode) : - inputdatalist = [] - inputdatalist.append(inputdata) - inputdata=inputdatalist - - svcMgr = theApp.serviceMgr() - svcMgr.ByteStreamInputSvc.FullFileName = inputdata -except NameError: - pass - -# Set the output ByteStreamData -try: - outputData = BSOutput - - svcMgr = theApp.serviceMgr() - from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamEventStorageOutputSvc - svcMgr += ByteStreamEventStorageOutputSvc() - # Properties - ByteStreamCnvSvc = svcMgr.ByteStreamCnvSvc - ByteStreamCnvSvc.ByteStreamOutputSvc ="ByteStreamEventStorageOutputSvc" - ByteStreamCnvSvc.InitCnvs += ["EventInfo"] - - # OutputStream - from AthenaServices.AthenaServicesConf import AthenaOutputStream - oStream = AthenaOutputStream( - "StreamBS", - EvtConversionSvc = "ByteStreamCnvSvc", - OutputFile = "ByteStreamEventStorageOutputSvc" - ) - theApp.addOutputStream( oStream ) - theApp.OutStreamType ="AthenaOutputStream"; - - # Define the output as follows: - outputDir = "./" - if isinstance(outputData,str) : - if '/' in outputData : - outputDir = outputData[:outputData.rfind('/')] - - run = 0 - lb = 0 - if runNumberFlag : - run = Run - if isinstance(Run, str) : - run = Run.split('/')[0] - if len(Run.split('/') >1): - lb = Run.split('/')[1] - - ByteStreamEventStorageOutputSvc = svcMgr.ByteStreamEventStorageOutputSvc - ByteStreamEventStorageOutputSvc.OutputDirectory = outputDir - ByteStreamEventStorageOutputSvc.AppName = "TrigConfOffline" - - StreamBS = AthenaOutputStream("StreamBS", EvtConversionSvc = "ByteStreamCnvSvc") - StreamBS.ForceRead=True - - for container in svcMgr.ByteStreamAddressProviderSvc.TypeNames : - namealias=container.split('/') - cont = '%s#' % (namealias[0]) - if len(namealias)==2 : - cont += namealias[1] - else: - cont += '*' - StreamBS.ItemList += [cont] - -except NameError: - pass - - - - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/sql/GetOfflineRules.sql b/Trigger/TrigConfiguration/TrigConfOffline/sql/GetOfflineRules.sql deleted file mode 100644 index 2b748d692633eb7bf0a239850d19b090973de989..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/sql/GetOfflineRules.sql +++ /dev/null @@ -1,175 +0,0 @@ - - --- Obtain the differences in parameters for same components -SELECT DISTINCT HLT_SETUP.HST_ID, HLT_SETUP.HST_NAME, x.HCP_ID, x.HCP_NAME, x.HCP_ALIAS, xx.HPA_ID, xx.HPA_NAME, xx.HPA_VALUE -FROM HLT_COMPONENT x - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = x.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER xx ON (xx.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE ((HLT_SETUP.HST_ID IN (3,4)) - AND (x.HCP_NAME, x.HCP_ALIAS) IN (SELECT DISTINCT y.HCP_NAME, y.HCP_ALIAS - FROM HLT_COMPONENT y - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = y.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (y.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (5,6)) - ) - AND (x.HCP_ID) NOT IN (SELECT DISTINCT z.HCP_ID - FROM HLT_COMPONENT z - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = z.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (z.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (5,6)) - ) - AND NOT ((x.HCP_NAME, x.HCP_ALIAS, xx.HPA_ID) IN (SELECT DISTINCT y.HCP_NAME, y.HCP_ALIAS, yy.HPA_ID - FROM HLT_COMPONENT y - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = y.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (y.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER yy ON (yy.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (5,6)) - ) - )) - OR - ((HLT_SETUP.HST_ID IN (5,6)) - AND (x.HCP_NAME, x.HCP_ALIAS) IN (SELECT DISTINCT y.HCP_NAME, y.HCP_ALIAS - FROM HLT_COMPONENT y - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = y.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (y.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (3,4)) - ) - AND (x.HCP_ID) NOT IN (SELECT DISTINCT z.HCP_ID - FROM HLT_COMPONENT z - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = z.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (z.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (3,4)) - ) - AND NOT ((x.HCP_NAME, x.HCP_ALIAS, xx.HPA_ID) IN (SELECT DISTINCT y.HCP_NAME, y.HCP_ALIAS, yy.HPA_ID - FROM HLT_COMPONENT y - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = y.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (y.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER yy ON (yy.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (3,4)) - ) - )) -ORDER BY HCP_NAME, HCP_ALIAS, xx.HPA_NAME, HLT_SETUP.HST_ID, xx.HPA_ID - - - --- Obtain the differences in parameters for components with the same alias -SELECT DISTINCT HLT_SETUP.HST_ID, HLT_SETUP.HST_NAME, x.HCP_ID, x.HCP_NAME, x.HCP_ALIAS, xx.HPA_ID, xx.HPA_NAME, xx.HPA_VALUE -FROM HLT_COMPONENT x - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = x.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER xx ON (xx.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE ((HLT_SETUP.HST_ID IN (3,4)) - AND (x.HCP_ALIAS) IN (SELECT DISTINCT y.HCP_ALIAS - FROM HLT_COMPONENT y - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = y.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (y.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (5,6)) - ) - AND (x.HCP_ID) NOT IN (SELECT DISTINCT z.HCP_ID - FROM HLT_COMPONENT z - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = z.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (z.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (5,6)) - ) - AND NOT ((x.HCP_ALIAS, xx.HPA_ID) IN (SELECT DISTINCT y.HCP_ALIAS, yy.HPA_ID - FROM HLT_COMPONENT y - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = y.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (y.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER yy ON (yy.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (5,6)) - ) - )) - OR - ((HLT_SETUP.HST_ID IN (5,6)) - AND (x.HCP_ALIAS) IN (SELECT DISTINCT y.HCP_ALIAS - FROM HLT_COMPONENT y - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = y.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (y.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (3,4)) - ) - AND (x.HCP_ID) NOT IN (SELECT DISTINCT z.HCP_ID - FROM HLT_COMPONENT z - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = z.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (z.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (3,4)) - ) - AND NOT ((x.HCP_ALIAS, xx.HPA_ID) IN (SELECT DISTINCT y.HCP_ALIAS, yy.HPA_ID - FROM HLT_COMPONENT y - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = y.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (y.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER yy ON (yy.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (3,4)) - ) - )) -ORDER BY HCP_NAME, HCP_ALIAS, xx.HPA_NAME, HLT_SETUP.HST_ID, xx.HPA_ID - --- Obtain Components not present in other setup -SELECT DISTINCT HLT_SETUP.HST_ID, HLT_SETUP.HST_NAME, HCP_ID, HCP_NAME, HCP_ALIAS -FROM HLT_COMPONENT x - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (3,4)) - AND (x.HCP_NAME, x.HCP_ALIAS) NOT IN (SELECT DISTINCT y.HCP_NAME, y.HCP_ALIAS - FROM HLT_COMPONENT y - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = y.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (y.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (5,6)) - ) - -ORDER BY HLT_SETUP.HST_ID, HCP_NAME, HCP_ALIAS, HLT_PARAMETER.HPA_ID, HLT_PARAMETER.HPA_NAME - --- Obtain Identical components -SELECT DISTINCT HLT_SETUP.HST_ID, HLT_SETUP.HST_NAME, HCP_ID, HCP_NAME, HCP_ALIAS -FROM HLT_COMPONENT x - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (3,4)) - AND (x.HCP_NAME, x.HCP_ALIAS) IN (SELECT DISTINCT y.HCP_NAME, y.HCP_ALIAS - FROM HLT_COMPONENT y - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = y.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (y.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (5,6)) - ) - AND (x.HCP_ID) IN (SELECT DISTINCT z.HCP_ID - FROM HLT_COMPONENT z - JOIN HLT_ST_TO_CP ON (HLT_ST_TO_CP.HST2CP_COMPONENT_ID = z.HCP_ID) - JOIN HLT_SETUP ON (HLT_ST_TO_CP.HST2CP_SETUP_ID = HLT_SETUP.HST_ID) - JOIN HLT_CP_TO_PA ON (z.HCP_ID = HLT_CP_TO_PA.HCP2PA_COMPONENT_ID) - JOIN HLT_PARAMETER ON (HLT_PARAMETER.HPA_ID = HLT_CP_TO_PA.HCP2PA_PARAMETER_ID) - WHERE (HLT_SETUP.HST_ID IN (3,4)) - ) - -ORDER BY HCP_NAME, HCP_ALIAS, HLT_SETUP.HST_ID, HLT_PARAMETER.HPA_ID, HLT_PARAMETER.HPA_NAME - - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/tools/compareAlgs.py b/Trigger/TrigConfiguration/TrigConfOffline/tools/compareAlgs.py deleted file mode 100644 index 35109f008fee52a5a48d21f44b8800d328a5eb7e..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/tools/compareAlgs.py +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env python -########################################################################### -# Copyright (C) 2009 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Copyright: See COPYING file that comes with this distribution -# -########################################################################### - -import getopt, sys - -def usage(): - """Prints a help message""" - print "Usage: %s [database-options]" % \ - sys.argv[0].split('/')[-1] - print " -h|-?|--help Issues this help message" - print " Database options may be:" - print " -p|--password The user password to the DB" - print " -u|--user <string> The name of the user in the DB" - print " -n|--name <string> The name of the DB inside the server" - print " -m|--host <string> The name of the host where the DB server is running" - print " -sm1|--sm1 <string> Super Master Key of the first setup" - print " -sm2|--sm2 <string> Super Master Key of the second setup" - - -if __name__ == '__main__': - import cx_Oracle - print dir(cx_Oracle) - print cx_Oracle.apilevel - print cx_Oracle.version - print cx_Oracle.SYSDBA - - db_user='atlas_trig_nozicka' - db_passwd='*******' - db_host='devdb10' - db_name = '' - sm1=-1 - sm2=-1 - - short_opt = "h?p:u:n:m:sm1:sm2" - long_opt = ['help', 'password=', 'user=', 'name=', 'host=','sm1=','sm2='] - - if len(sys.argv) == 1: - print "Missing arguments" - usage() - sys.exit(1) - - #these are common bootstrap procedures for option processing - try: - opts, args = getopt.getopt(sys.argv[1:], short_opt, long_opt) - except getopt.GetoptError, exc: - print '\nError: '+exc.msg+'\n' - usage() - sys.exit(1) - - # The defaults - - #Read the options - for o, a in opts: - if o in ['-h', '-?', '--help']: - usage() - sys.exit(0) - if o in ['-p', '--password']: db_passwd = a - if o in ['-u', '--user']: db_user = a - if o in ['-n', '--name']: db_name = a - if o in ['-m', '--host']: db_host = a - if o in ['-sm1', '--sm1']: sm1 = a - if o in ['-sm2', '--sm2']: sm2 = a - - connection = cx_Oracle.Connection(db_user, db_passwd, db_host) - cursor = connection.cursor() - print cursor - - if db_name=='' : db_name=db_user - prepend ='' - if db_name != db_user and db_name != '': - prepend = '%s.' % (db_name) - - table_names = [] - query = " SELECT %sall_objects.object_name " % (prepend) - query += " FROM %sall_objects " % (prepend) - query += " WHERE %sall_objects.object_type='TABLE' " % (prepend) - query += " AND %sall_objects.owner='%s' " % (prepend,db_name.upper()) - cursor.execute(query) - result = cursor.fetchall() - for column in result : - table_names.append(column[0].upper()) - - print len(table_names),'tables available' - trigger_keys= [] - # Get super Master keys - if 'SUPER_MASTER_TABLE' not in table_names : - print 'SUPER_MASTER_TABLE not found in database' - cursor.close() - sys.exit(1) - else : - query = " SELECT %sSUPER_MASTER_TABLE.SMT_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - cursor.execute(query) - result = cursor.fetchall() - for column in result : - trigger_keys.append([column[0],[],[]]) - - if 'HLT_PRESCALE_SET' not in table_names : - print 'HLT_PRESCALE_SET not found in database' - else : - for i in range(len(trigger_keys)) : - query = " SELECT %sHLT_PRESCALE_SET.HPS_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - query += " JOIN %sHLT_MASTER_TABLE ON (%sSUPER_MASTER_TABLE.SMT_HLT_MASTER_TABLE_ID = %sHLT_MASTER_TABLE.HMT_ID) " % (prepend, prepend, prepend) - query += " JOIN %sHLT_TM_TO_PS ON (%sHLT_MASTER_TABLE.HMT_TRIGGER_MENU_ID = %sHLT_TM_TO_PS.HTM2PS_TRIGGER_MENU_ID) " % (prepend, prepend, prepend) - query += " JOIN %sHLT_PRESCALE_SET ON (%sHLT_PRESCALE_SET.HPS_ID = %sHLT_TM_TO_PS.HTM2PS_PRESCALE_SET_ID) " % (prepend, prepend, prepend) - query += " WHERE %sSUPER_MASTER_TABLE.SMT_ID=:smt_id " % (prepend) - cursor.execute(query, smt_id=trigger_keys[i][0]) - result = cursor.fetchall() - for column in result : - trigger_keys[i][1].append(column[0]) - - if 'L1_PRESCALE_SET' not in table_names : - print 'L1_PRESCALE_SET not found in database' - else : - for i in range(len(trigger_keys)) : - query = " SELECT %sL1_PRESCALE_SET.L1PS_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - query += " JOIN %sL1_MASTER_TABLE ON (%sSUPER_MASTER_TABLE.SMT_L1_MASTER_TABLE_ID = %sL1_MASTER_TABLE.L1MT_ID) " % (prepend, prepend, prepend) - query += " JOIN %sL1_TM_TO_PS ON (%sL1_MASTER_TABLE.L1MT_TRIGGER_MENU_ID = %sL1_TM_TO_PS.L1TM2PS_TRIGGER_MENU_ID) " % (prepend, prepend, prepend) - query += " JOIN %sL1_PRESCALE_SET ON (%sL1_PRESCALE_SET.L1PS_ID = %sL1_TM_TO_PS.L1TM2PS_PRESCALE_SET_ID) " % (prepend, prepend, prepend) - query += " WHERE %sSUPER_MASTER_TABLE.SMT_ID=:smt_id " % (prepend) - cursor.execute(query, smt_id=trigger_keys[i][0]) - result = cursor.fetchall() - for column in result : - trigger_keys[i][2].append(column[0]) - - if len(trigger_keys) > 0 : - print 'Available trigger keys:' - print 'SMKey','\t','HLTPSK','\t','LVL1PSK' - for keys in trigger_keys : - print keys[0],'\t',keys[1],'\t',keys[2] - - cursor.close() - - - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/tools/compareSetups.py b/Trigger/TrigConfiguration/TrigConfOffline/tools/compareSetups.py deleted file mode 100755 index e7deeca50bad0b3bb0c876a582caf6b173fccbac..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/tools/compareSetups.py +++ /dev/null @@ -1,194 +0,0 @@ -#!/usr/bin/env python -########################################################################### -# Copyright (C) 2009 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Copyright: See COPYING file that comes with this distribution -# -########################################################################### - -import getopt, sys - -from TrigConfOffline.HLTAlgorithm import HLTAlgorithm -from TrigConfOffline.HLTAlgorithm import diffHLTAlgorithms -from TrigConfOffline.HLTSetupLoader import SetupLoader - -def usage(): - """Prints a help message""" - print "Usage: %s [database-options]" % \ - sys.argv[0].split('/')[-1] - print " -h|-?|--help Issues this help message" - print " Database options may be:" - print " -t| --type The database technology (oracle/mysql)" - print " -p| --password The user password to the DB" - print " -u| --user <string> The name of the user in the DB" - print " -n| --name <string> The name of the DB inside the server" - print " -m| --host <string> The name of ther host where the DB server is running" - print " -s| --smkey1 <int> The super master key 1" - print " -S| --smkey2 <int> The super master key 2" - print " -l| --level <string> Set the Trigger level : L2/EF/BOTH" - print " -o| --menuonly Compare the menu components only" - print " -u| --setuponly Compare the menu components only" - print " -d| --diffmask <int> Set mask for difference" - -def getAlgIDs(setupLoader, smkey, cursor) : - # Get the algorithms for SM Key - setupLoader.SMKey = smkey - hmtkey = setupLoader.getHLTMasterKeys(cursor) - - printout = "Super Master Key: %d" % (smkey) - printout += "\tHLT Master Key: %d" % (hmtkey) - - alg_ids = [] - hltL2Alg_ids = [] - if setupLoader.Level.upper() in ('L2', 'BOTH') and not menuOnly: - hstL2ID = setupLoader.getHLTL2SetupID(cursor, hmtkey) - printout += "\tL2 Setup ID: %d" % (hstL2ID) - hltL2Alg_ids.extend(setupLoader.getHLTSetupComponentIDs(cursor, hstL2ID)) - for alg_id in hltL2Alg_ids : - if alg_id not in alg_ids : alg_ids.append(alg_id) - - hltEFAlg_ids = [] - if setupLoader.Level.upper() in ('EF', 'BOTH') and not menuOnly: - hstEFID = setupLoader.getHLTEFSetupID(cursor, hmtkey) - printout += "\tEF Setup ID: %d" % (hstEFID) - hltEFAlg_ids.extend(setupLoader.getHLTSetupComponentIDs(cursor, hstEFID)) - for alg_id in hltEFAlg_ids : - if alg_id not in alg_ids : alg_ids.append(alg_id) - - hltMenuL2Alg_ids = [] - if setupLoader.Level.upper() in ('L2', 'BOTH') and not setupOnly: - hltMenuL2Alg_ids.extend(setupLoader.getHLTTEComponentIDs(cursor, 'L2', hmtkey)) - for alg_id in hltMenuL2Alg_ids : - if alg_id not in alg_ids : alg_ids.append(alg_id) - - hltMenuEFAlg_ids = [] - if setupLoader.Level.upper() in ('EF', 'BOTH') and not setupOnly: - hltMenuEFAlg_ids.extend(setupLoader.getHLTSetupComponentIDs(cursor, 'EF', hmtkey)) - for alg_id in hltMenuEFAlg_ids : - if alg_id not in alg_ids : alg_ids.append(alg_id) - - print printout - return alg_ids - -if __name__ == '__main__': - - db_user='atlas_trig_nozicka' - db_passwd='*******' - db_host='devdb10' - db_name = '' - db_type = 'oracle' - - level = 'BOTH' - smkey1 = -1 - smkey2 = -1 - menuOnly = False - setupOnly= False - diffmask= 0xffff - - short_opt = "h?t:p:u:n:m:s:S:l:d:ou" - long_opt = ['help', 'type=', 'password=', 'user=', 'name=', 'host=', 'smkey1=', 'smkey2=', 'level=', 'diffmask=', 'menuonly', 'setuponly'] - - if len(sys.argv) == 1: - print "Missing arguments" - usage() - sys.exit(1) - - # These are common bootstrap procedures for option processing - try: - opts, args = getopt.getopt(sys.argv[1:], short_opt, long_opt) - except getopt.GetoptError, exc: - print '\nError: '+exc.msg+'\n' - usage() - sys.exit(1) - - # The defaults - - # Read the options - for o, a in opts: - if o in ['-h', '-?', '--help']: - usage() - sys.exit(0) - if o in ['-t', '--type']: db_type = a - if o in ['-p', '--password']: db_passwd = a - if o in ['-u', '--user']: db_user = a - if o in ['-n', '--name']: db_name = a - if o in ['-m', '--host']: db_host = a - if o in ['-s', '--smkey1']: smkey1 = a - if o in ['-S', '--smkey2']: smkey2 = a - if o in ['-l', '--level']: level = a - if o in ['-o', '--menuonly']: menuOnly = True - if o in ['-u', '--setuponly']: setupOnly = True - if o in ['-d', '--diffmask']: diffmask = a - - smkey1 = eval(smkey1) - smkey2 = eval(smkey2) - diffmask = eval(diffmask) - - # Setup loader - from TrigConfOffline.HLTSetupLoader import SetupLoader - setupLoader = SetupLoader(dbType=db_type, dbHost=db_host, dbUser=db_user, dbPasswd=db_passwd, dbName=db_name, Level=level) - cursor = setupLoader.connectDB() - alg1_ids = getAlgIDs(setupLoader, smkey1, cursor) - alg2_ids = getAlgIDs(setupLoader, smkey2, cursor) - - alg1 = {} - for alg_id in alg1_ids : - # No need to compare identic algorithms - if alg_id not in alg2_ids : - alg=HLTAlgorithm(dbId=alg_id) - alg.loadFromDB(cursor,setupLoader.dbName) - alg1[alg.getAlias()] = alg - - alg2 = {} - for alg_id in alg2_ids : - # No need to compare identic algorithms - if alg_id not in alg1_ids : - alg=HLTAlgorithm(dbId=alg_id) - alg.loadFromDB(cursor,setupLoader.dbName) - alg2[alg.getAlias()] = alg - - cursor.close() - - alg2Missing = [] - # Compare identic alias algorithms - for key in alg1.keys() : - if key in alg2.keys() : - out = diffHLTAlgorithms(alg1[key], alg2[key], diffmask, ' ') - if out.strip() !='' : - print out - else : - alg2Missing.append(key) - - # Find missing algs in setup - alg1Missing = [] - for key in alg2.keys() : - if key not in alg1.keys(): - alg1Missing.append(key) - - # Print out of algorithms missing in the SM1 - if len(alg2Missing) >=0 : print "Algorithms missing in the configuration SM=%d" % (smkey2) - - for alg in alg2Missing: - print alg1[alg].algToStr('\t',False) - - # Print out of algorithms missing in the SM1 - if len(alg1Missing) >=0 : print "Algorithms missing in the configuration SM=%d" % (smkey1) - for alg in alg1Missing: - print alg2[alg].algToStr('\t',False) - - - - - - - - - - - - - - - - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/tools/dumpSetup.py b/Trigger/TrigConfiguration/TrigConfOffline/tools/dumpSetup.py deleted file mode 100644 index 107a4ed078f49f72bf553f8faa3bb8cc857dc6fa..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/tools/dumpSetup.py +++ /dev/null @@ -1,232 +0,0 @@ -########################################################################### -# Copyright (C) 2008 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Copyright: See COPYING file that comes with this distribution -# -########################################################################### - - -class TrigHistorySvc(object) : - def __init__(self, *args, **kwargs) : - for k,v in kwargs.items() : - self.__setattr__(k,v) - - def __setattr__(self, name, value) : - _properties = {'OutputFile':str('L2EF_Setup.txt'),'Dump':True,'Activate':True} - if name in (_properties.keys()) : - if type(value) == type(_properties[name]) : - self.__dict__[name] = value - else : - print 'Unsupported type of value %s - type %s expected' % (type(value),type(_properties[name])) - else : - print 'Unsupported property name %s' % (name) - - def dump(self) : - # Set the output file - document = None - file = None - if self.__dict__.has_key('OutputFile') and self.OutputFile != '' : - # Dump the algorithms to the file - file = open(self.OutputFile, 'w') - - # Test the xml type of the output - if self.OutputFile[-4:] == '.xml' : - import xml.dom.minidom - impl = xml.dom.minidom.getDOMImplementation() - document = impl.createDocument(None, "setup", None) - else: - import sys - file = sys.stdout - - # Get the algorithms - from AthenaCommon.AppMgr import ToolSvc,ServiceMgr,theApp - from AthenaCommon.AlgSequence import AlgSequence - #toolSvc = CfgMgr.ToolSvc() - svcMgr = theApp.serviceMgr() - toolSvc = svcMgr.ToolSvc - topAlgs = theApp.TopAlg - auditors = svcMgr.AuditorSvc - - # Dump the ApplicationMgr - if document : - topElement = document.documentElement - topElement.appendChild(self.algtoXML(theApp, document, dumpChildren=False)) - else : - file.write(self.algtoStr(theApp, ntabs=1, dumpChildren=False)) - - # Dump the Tools - if document : - topElement = document.documentElement - topElement.appendChild(self.algtoXML(toolSvc, document,'Service',dumpChildren=False)) - else : - file.write(self.algtoStr(toolSvc, ntabs=1, dumpChildren=False)) - for alg in toolSvc.getAllChildren(): - if document: - topElement = document.documentElement - topElement.appendChild(self.algtoXML(alg, document, 'PublicTool')) - else : - file.write(self.algtoStr(alg)) - - # Dump the Auditors - if document : - topElement = document.documentElement - topElement.appendChild(self.algtoXML(auditors, document,'Service',dumpChildren=False)) - else : - file.write(self.algtoStr(auditors, ntabs=1, dumpChildren=False)) - - for alg in auditors.getAllChildren(): - if document: - topElement = document.documentElement - topElement.appendChild(self.algtoXML(alg, document, 'Auditor')) - else : - file.write(self.algtoStr(alg)) - - # Dump the Services - if document : - topElement = document.documentElement - topElement.appendChild(self.algtoXML(svcMgr, document,'Service',dumpChildren=False)) - else : - file.write(self.algtoStr(svcMgr, ntabs=1, dumpChildren=False)) - for alg in svcMgr.getAllChildren(): - if alg.getName() not in ('AuditorSvc','ToolSvc') : - if document: - topElement = document.documentElement - topElement.appendChild(self.algtoXML(alg, document, 'Service')) - else : - file.write(self.algtoStr(alg)) - - # Dump the top Algorithms - from AthenaCommon.ConfigurableDb import getConfigurable, cfgDb - from AthenaCommon import CfgMgr - from AthenaCommon.Configurable import Configurable - for algNameClass in topAlgs: - alg = None - algName = algNameClass.split('/')[1] - algClass = algNameClass.split('/')[0] - if Configurable.allConfigurables.has_key(algName) : - alg = Configurable.allConfigurables[algName] - if alg.getFullName() != algNameClass: alg = None - if not alg : - cfg_class = getConfigurable(algClass, assumeCxxClass=True) - Configurable.allConfigurables.has_key('TrigSteer_L2') - stmt = 'alg = CfgMgr.%s("%s")' % (cfg_class.__name__,algName) - try : - exec stmt - except Exception, exc: - print "ERROR:\t\tTop algorithm: %s/%s was not assigned: %s" % (algClass,algName) - print exc - - if alg : - if document: - topElement = document.documentElement - topElement.appendChild(self.algtoXML(alg, document, 'TopAlg')) - else : - file.write(self.algtoStr(alg)) - else : - print "Top algorithm: %s/%s was not assigned" % (algClass,algName) - - if document : - document.writexml(file, addindent=' ', newl='\n') - - file.close() - - def algtoStr(self, alg, ntabs=1, dumpChildren=True) : - py_class = str(alg.__class__).strip('<class \' \'>').split('.')[-1] - py_package = str(alg.__module__) - - py_info = ' (Python: %s/%s) ' % (py_package, py_class) - max_length = 100 - nendchar = max_length - (ntabs + 5 + len(alg.getPrintTitle()) + len(py_info)) - output = '|'*(ntabs-1) + '/' + '*'*5 + alg.getPrintTitle() + py_info + '*'*nendchar + '\n' - - # Formating of the properties - maxproplength = 0 - for k,v in alg.getProperties().items() : - if len('%s\t%s' %(k,type(v))) > maxproplength : maxproplength = len('%s\t%s' %(k,type(v))) - - for k,v in alg.getProperties().items(): - output += '|'*ntabs - output += '-%s\t%s ' % (k, type(v)) - output += ' '*(maxproplength-len('%s\t%s' %(k,type(v)))) - output += '= %s' % (v) - output += '\n' - - if dumpChildren : - for child in alg.getAllChildren() : - output += self.algtoStr(child, ntabs+1) - - nendchar = nendchar - len('(End of )') - output += '|'*(ntabs-1) + '\\' + '*'*5 + '(End of %s%s)' % (alg.getPrintTitle(), py_info) + '*'*nendchar + '\n' - return output - - def algtoXML(self, alg, document, algtype='Algorithm', dumpChildren=True) : - py_class = str(alg.__class__)[6:].strip('\' >').split('.')[-1] - py_package = str(alg.__module__) - alg_name = alg.getType() - alg_alias = alg.getFullJobOptName().split('/')[-1] - - algorithm='1' - topalg=steeralg=svc=pubT=privT=aud='0' - if algtype == 'TopAlg': topalg='1' - if algtype == 'SteerAlg': steeralg='1' - if algtype == 'Service': svc='1' - if algtype == 'PublicTool': pubT='1' - if algtype == 'PrivateTool': privT='1' - if algtype == 'Auditor': aud='1' - - component = document.createElement('component') - component.setAttribute('name', str(alg_name)) - component.setAttribute('alias', str(alg_alias)) - component.setAttribute('py_name', py_class) - component.setAttribute('py_package', py_package) - component.setAttribute('topalg', topalg) - component.setAttribute('alg', algorithm) - component.setAttribute('steeralg', steeralg) - component.setAttribute('svc', svc) - component.setAttribute('pubT', pubT) - component.setAttribute('privT', privT) - component.setAttribute('aud', aud) - - # Append the properties - for k,v in alg.getProperties().items() : - if v=='<no value>': v = alg.getDefaultProperties()[k] - component.appendChild(self.propertytoXML(document,k,v)) - - if dumpChildren : - # Append the child algorithms - if alg_name == 'HLT::TrigSteer': algtype = 'SteerAlg' - for child in alg.getAllChildren() : - if algtype != 'SteerAlg' : algtype='PrivateTool' - component.appendChild(self.algtoXML(child, document, algtype, True)) - - return component - - def propertytoXML(self, document, name, value) : - prop_type = str(type(value)).strip('<type >').strip('\'') - if value == '<no value>' : value ='' - if prop_type[:6] == 'class ': - propertyClass = prop_type[6:].strip('\'') - if propertyClass in ('GaudiKernel.GaudiHandles.ServiceHandleArray', - 'GaudiKernel.GaudiHandles.PrivateToolHandleArray', - 'GaudiKernel.GaudiHandles.PublicToolHandleArray') : - new_value = [] - for item in value : - try: - new_value.append(item.getFullName()) - except: - pass - value = '%s' % (new_value) - else : - try : - value = value.getFullJobOptName() - except : - pass - parameter = document.createElement('parameter') - parameter.setAttribute('name', str(name)) - parameter.setAttribute('value', str(value)) - parameter.setAttribute('type', prop_type) - parameter.setAttribute('op','set') - - return parameter - \ No newline at end of file diff --git a/Trigger/TrigConfiguration/TrigConfOffline/tools/testMySQLDBConnection.py b/Trigger/TrigConfiguration/TrigConfOffline/tools/testMySQLDBConnection.py deleted file mode 100755 index 23835fb5f806d6e0c82cb2e2d9d3939bf9eacbfc..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/tools/testMySQLDBConnection.py +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/env python -########################################################################### -# Copyright (C) 2009 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Copyright: See COPYING file that comes with this distribution -# -########################################################################### - -import getopt, sys - -def usage(): - """Prints a help message""" - print "Usage: %s [database-options]" % \ - sys.argv[0].split('/')[-1] - print " -h|-?|--help Issues this help message" - print " Database options may be:" - print " -p|--password The user password to the DB" - print " -u|--user <string> The name of the user in the DB" - print " -n|--name <string> The name of the DB inside the server" - print " -m|--host <string> The name of ther host where the DB server is running" - - -if __name__ == '__main__': - db_user='atlas_trig_nozicka' - db_passwd='*******' - db_host='devdb10' - db_name = '' - - short_opt = "h?p:u:n:m:" - long_opt = ['help', 'password=', 'user=', 'name=', 'host='] - - if len(sys.argv) == 1: - print "Missing arguments" - usage() - sys.exit(1) - - #these are common bootstrap procedures for option processing - try: - opts, args = getopt.getopt(sys.argv[1:], short_opt, long_opt) - except getopt.GetoptError, exc: - print '\nError: '+exc.msg+'\n' - usage() - sys.exit(1) - - # The defaults - - #Read the options - for o, a in opts: - if o in ['-h', '-?', '--help']: - usage() - sys.exit(0) - if o in ['-p', '--password']: db_passwd = a - if o in ['-u', '--user']: db_user = a - if o in ['-n', '--name']: db_name = a - if o in ['-m', '--host']: db_host = a - - from MySQLdb import connect - connection = connect (host=db_host, user=db_user, passwd=db_passwd, db=db_name, connect_timeout=10) - - cursor = connection.cursor() - print cursor - - prepend ='' - if db_name != db_user and db_name != '': - prepend = '%s.' % (db_name) - - table_names = [] - query = " SHOW tables " - cursor.execute(query) - result = cursor.fetchall() - for column in result : - table_names.append(column[0].upper()) - - print len(table_names),'tables available' - trigger_keys= [] - # Get super Master keys - - if 'SUPER_MASTER_TABLE' not in table_names : - print 'SUPER_MASTER_TABLE not found in database' - cursor.close() - sys.exit(1) - else : - query = " SELECT %sSUPER_MASTER_TABLE.SMT_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - cursor.execute(query) - result = cursor.fetchall() - for column in result : - trigger_keys.append([column[0],0,0]) - - if 'HLT_PRESCALE_SET' not in table_names : - print 'HLT_PRESCALE_SET not found in database' - else : - for i in range(len(trigger_keys)) : - query = " SELECT %sHLT_PRESCALE_SET.HPS_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - query += " JOIN %sHLT_MASTER_TABLE ON (%sSUPER_MASTER_TABLE.SMT_HLT_MASTER_TABLE_ID = %sHLT_MASTER_TABLE.HMT_ID) " % (prepend, prepend, prepend) - query += " JOIN %sHLT_TM_TO_PS ON (%sHLT_MASTER_TABLE.HMT_TRIGGER_MENU_ID = %sHLT_TM_TO_PS.HTM2PS_TRIGGER_MENU_ID) " % (prepend, prepend, prepend) - query += " JOIN %sHLT_PRESCALE_SET ON (%sHLT_PRESCALE_SET.HPS_ID = %sHLT_TM_TO_PS.HTM2PS_PRESCALE_SET_ID) " % (prepend, prepend, prepend) - query += " WHERE %sSUPER_MASTER_TABLE.SMT_ID=:smt_id " % (prepend) - cursor.execute(query, smt_id=trigger_keys[i][0]) - result = cursor.fetchall() - for column in result : - trigger_keys[i][1]= column[0] - - if 'L1_PRESCALE_SET' not in table_names : - print 'L1_PRESCALE_SET not found in database' - else : - for i in range(len(trigger_keys)) : - query = " SELECT %sL1_PRESCALE_SET.L1PS_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - query += " JOIN %sL1_MASTER_TABLE ON (%sSUPER_MASTER_TABLE.SMT_L1_MASTER_TABLE_ID = %sL1_MASTER_TABLE.L1MT_ID) " % (prepend, prepend, prepend) - query += " JOIN %sL1_TM_TO_PS ON (%sL1_MASTER_TABLE.L1MT_TRIGGER_MENU_ID = %sL1_TM_TO_PS.L1TM2PS_TRIGGER_MENU_ID) " % (prepend, prepend, prepend) - query += " JOIN %sL1_PRESCALE_SET ON (%sL1_PRESCALE_SET.L1PS_ID = %sL1_TM_TO_PS.L1TM2PS_PRESCALE_SET_ID) " % (prepend, prepend, prepend) - query += " WHERE %sSUPER_MASTER_TABLE.SMT_ID=:smt_id " % (prepend) - cursor.execute(query, smt_id=trigger_keys[i][0]) - result = cursor.fetchall() - for column in result : - trigger_keys[i][2]= column[0] - - if len(trigger_keys) > 0 : - print 'Available trigger keys:' - print 'SMKey','\t','HLTPSK','\t','LVL1PSK' - for keys in trigger_keys : - print keys[0],'\t',keys[1],'\t',keys[2] - else : - print 'No Entries in SUPER_MASTER_TABLE' - - cursor.close() - - - \ No newline at end of file diff --git a/Trigger/TrigConfiguration/TrigConfOffline/tools/testOracleDBConnection.py b/Trigger/TrigConfiguration/TrigConfOffline/tools/testOracleDBConnection.py deleted file mode 100755 index b114002b4f6813f142caabb8a3236aa1ed135383..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/tools/testOracleDBConnection.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env python -########################################################################### -# Copyright (C) 2009 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Copyright: See COPYING file that comes with this distribution -# -########################################################################### - -import getopt, sys - -def usage(): - """Prints a help message""" - print "Usage: %s [database-options]" % \ - sys.argv[0].split('/')[-1] - print " -h|-?|--help Issues this help message" - print " Database options may be:" - print " -p|--password The user password to the DB" - print " -u|--user <string> The name of the user in the DB" - print " -n|--name <string> The name of the DB inside the server" - print " -m|--host <string> The name of ther host where the DB server is running" - - -if __name__ == '__main__': - import cx_Oracle - print dir(cx_Oracle) - print cx_Oracle.apilevel - print cx_Oracle.version - print cx_Oracle.SYSDBA - - db_user='atlas_trig_nozicka' - db_passwd='*******' - db_host='devdb10' - db_name = '' - - short_opt = "h?p:u:n:m:" - long_opt = ['help', 'password=', 'user=', 'name=', 'host='] - - if len(sys.argv) == 1: - print "Missing arguments" - usage() - sys.exit(1) - - #these are common bootstrap procedures for option processing - try: - opts, args = getopt.getopt(sys.argv[1:], short_opt, long_opt) - except getopt.GetoptError, exc: - print '\nError: '+exc.msg+'\n' - usage() - sys.exit(1) - - # The defaults - - #Read the options - for o, a in opts: - if o in ['-h', '-?', '--help']: - usage() - sys.exit(0) - if o in ['-p', '--password']: db_passwd = a - if o in ['-u', '--user']: db_user = a - if o in ['-n', '--name']: db_name = a - if o in ['-m', '--host']: db_host = a - - connection = cx_Oracle.Connection(db_user, db_passwd, db_host) - cursor = connection.cursor() - print cursor - - if db_name=='' : db_name=db_user - prepend ='' - if db_name != db_user and db_name != '': - prepend = '%s.' % (db_name) - - table_names = [] - query = " SELECT %sall_objects.object_name " % (prepend) - query += " FROM %sall_objects " % (prepend) - query += " WHERE %sall_objects.object_type='TABLE' " % (prepend) - query += " AND %sall_objects.owner='%s' " % (prepend,db_name.upper()) - cursor.execute(query) - result = cursor.fetchall() - for column in result : - table_names.append(column[0].upper()) - - print len(table_names),'tables available' - trigger_keys= [] - # Get super Master keys - if 'SUPER_MASTER_TABLE' not in table_names : - print 'SUPER_MASTER_TABLE not found in database' - cursor.close() - sys.exit(1) - else : - query = " SELECT %sSUPER_MASTER_TABLE.SMT_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - cursor.execute(query) - result = cursor.fetchall() - for column in result : - trigger_keys.append([column[0],[],[]]) - - if 'HLT_PRESCALE_SET' not in table_names : - print 'HLT_PRESCALE_SET not found in database' - else : - for i in range(len(trigger_keys)) : - query = " SELECT %sHLT_PRESCALE_SET.HPS_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - query += " JOIN %sHLT_MASTER_TABLE ON (%sSUPER_MASTER_TABLE.SMT_HLT_MASTER_TABLE_ID = %sHLT_MASTER_TABLE.HMT_ID) " % (prepend, prepend, prepend) - query += " JOIN %sHLT_TM_TO_PS ON (%sHLT_MASTER_TABLE.HMT_TRIGGER_MENU_ID = %sHLT_TM_TO_PS.HTM2PS_TRIGGER_MENU_ID) " % (prepend, prepend, prepend) - query += " JOIN %sHLT_PRESCALE_SET ON (%sHLT_PRESCALE_SET.HPS_ID = %sHLT_TM_TO_PS.HTM2PS_PRESCALE_SET_ID) " % (prepend, prepend, prepend) - query += " WHERE %sSUPER_MASTER_TABLE.SMT_ID=:smt_id " % (prepend) - cursor.execute(query, smt_id=trigger_keys[i][0]) - result = cursor.fetchall() - for column in result : - trigger_keys[i][1].append(column[0]) - - if 'L1_PRESCALE_SET' not in table_names : - print 'L1_PRESCALE_SET not found in database' - else : - for i in range(len(trigger_keys)) : - query = " SELECT %sL1_PRESCALE_SET.L1PS_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - query += " JOIN %sL1_MASTER_TABLE ON (%sSUPER_MASTER_TABLE.SMT_L1_MASTER_TABLE_ID = %sL1_MASTER_TABLE.L1MT_ID) " % (prepend, prepend, prepend) - query += " JOIN %sL1_TM_TO_PS ON (%sL1_MASTER_TABLE.L1MT_TRIGGER_MENU_ID = %sL1_TM_TO_PS.L1TM2PS_TRIGGER_MENU_ID) " % (prepend, prepend, prepend) - query += " JOIN %sL1_PRESCALE_SET ON (%sL1_PRESCALE_SET.L1PS_ID = %sL1_TM_TO_PS.L1TM2PS_PRESCALE_SET_ID) " % (prepend, prepend, prepend) - query += " WHERE %sSUPER_MASTER_TABLE.SMT_ID=:smt_id " % (prepend) - cursor.execute(query, smt_id=trigger_keys[i][0]) - result = cursor.fetchall() - for column in result : - trigger_keys[i][2].append(column[0]) - - if len(trigger_keys) > 0 : - print 'Available trigger keys:' - print 'SMKey','\t','HLTPSK','\t','LVL1PSK' - for keys in trigger_keys : - print keys[0],'\t',keys[1],'\t',keys[2] - - cursor.close() - - - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/tools/testSQLiteDBConnection.py b/Trigger/TrigConfiguration/TrigConfOffline/tools/testSQLiteDBConnection.py deleted file mode 100755 index 3f24cf3f81f42f1d0b2cf4842be1df122e6d021c..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/tools/testSQLiteDBConnection.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python -########################################################################### -# Copyright (C) 2009 by Miroslav Nozicka -# <nozicka@mail.desy.de> -# -# Copyright: See COPYING file that comes with this distribution -# -########################################################################### - -import getopt, sys - -def usage(): - """Prints a help message""" - print "Usage: %s [database-options]" % \ - sys.argv[0].split('/')[-1] - print " -h|-?|--help Issues this help message" - print " Database options may be:" - print " -f|--file <string> SQLite file name" - - -if __name__ == '__main__': - db_file='TriggerDB_schema.sqlite' - - short_opt = "h?f:" - long_opt = ['help', 'file='] - - if len(sys.argv) == 1: - print "Missing arguments" - usage() - sys.exit(1) - - #these are common bootstrap procedures for option processing - try: - opts, args = getopt.getopt(sys.argv[1:], short_opt, long_opt) - except getopt.GetoptError, exc: - print '\nError: '+exc.msg+'\n' - usage() - sys.exit(1) - - - # Read the options - for o, a in opts: - if o in ['-h', '-?', '--help']: - usage() - sys.exit(0) - if o in ['-f', '--file']: db_file = a - - from sqlite3 import dbapi2 as sqlite - print sqlite.apilevel - print sqlite.version - - connection = sqlite.connect(db_file) - connection_str = '%s' % (connection) - print connection_str - cursor = connection.cursor() - print cursor - print "_____________________________________________________________" - prepend ='' - table_names = [] - query = "SELECT * FROM sqlite_master WHERE type='table'" - cursor.execute(query) - result = cursor.fetchall() - for column in result : - # output ='' - # for item in column : - # output += '%s\t' % (item) - # print output - table_names.append(column[1].upper()) - - print len(table_names),'tables available' - trigger_keys= [] - # Get super Master keys - if 'SUPER_MASTER_TABLE' not in table_names : - print 'SUPER_MASTER_TABLE not found in database' - cursor.close() - sys.exit(1) - else : - query = " SELECT %sSUPER_MASTER_TABLE.SMT_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - cursor.execute(query) - result = cursor.fetchall() - for column in result : - trigger_keys.append([column[0],0,0]) - - if 'HLT_PRESCALE_SET' not in table_names : - print 'HLT_PRESCALE_SET not found in database' - else : - for i in range(len(trigger_keys)) : - query = " SELECT %sHLT_PRESCALE_SET.HPS_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - query += " JOIN %sHLT_MASTER_TABLE ON (%sSUPER_MASTER_TABLE.SMT_HLT_MASTER_TABLE_ID = %sHLT_MASTER_TABLE.HMT_ID) " % (prepend, prepend, prepend) - query += " JOIN %sHLT_TM_TO_PS ON (%sHLT_MASTER_TABLE.HMT_TRIGGER_MENU_ID = %sHLT_TM_TO_PS.HTM2PS_TRIGGER_MENU_ID) " % (prepend, prepend, prepend) - query += " JOIN %sHLT_PRESCALE_SET ON (%sHLT_PRESCALE_SET.HPS_ID = %sHLT_TM_TO_PS.HTM2PS_PRESCALE_SET_ID) " % (prepend, prepend, prepend) - query += " WHERE %sSUPER_MASTER_TABLE.SMT_ID=%d " % (prepend, trigger_keys[i][0]) - cursor.execute(query) - result = cursor.fetchall() - for column in result : - trigger_keys[i][1]= column[0] - - if 'L1_PRESCALE_SET' not in table_names : - print 'L1_PRESCALE_SET not found in database' - else : - for i in range(len(trigger_keys)) : - query = " SELECT %sL1_PRESCALE_SET.L1PS_ID " % (prepend) - query += " FROM %sSUPER_MASTER_TABLE " % (prepend) - query += " JOIN %sL1_MASTER_TABLE ON (%sSUPER_MASTER_TABLE.SMT_L1_MASTER_TABLE_ID = %sL1_MASTER_TABLE.L1MT_ID) " % (prepend, prepend, prepend) - query += " JOIN %sL1_TM_TO_PS ON (%sL1_MASTER_TABLE.L1MT_TRIGGER_MENU_ID = %sL1_TM_TO_PS.L1TM2PS_TRIGGER_MENU_ID) " % (prepend, prepend, prepend) - query += " JOIN %sL1_PRESCALE_SET ON (%sL1_PRESCALE_SET.L1PS_ID = %sL1_TM_TO_PS.L1TM2PS_PRESCALE_SET_ID) " % (prepend, prepend, prepend) - query += " WHERE %sSUPER_MASTER_TABLE.SMT_ID=%d " % (prepend, trigger_keys[i][0]) - cursor.execute(query) - result = cursor.fetchall() - for column in result : - trigger_keys[i][2]= column[0] - - if len(trigger_keys) > 0 : - print 'Available trigger keys:' - print 'SMKey','\t','HLTPSK','\t','LVL1PSK' - for keys in trigger_keys : - print keys[0],'\t',keys[1],'\t',keys[2] - else : - print 'No Entries in SUPER_MASTER_TABLE' - - cursor.close() - - - diff --git a/Trigger/TrigConfiguration/TrigConfOffline/xml/offline_setup_rules.xml b/Trigger/TrigConfiguration/TrigConfOffline/xml/offline_setup_rules.xml deleted file mode 100644 index 5e79a025548e72fb0868a012682510b0e3a4dfe3..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/xml/offline_setup_rules.xml +++ /dev/null @@ -1,779 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--File was modified by Miroslav Nozicka: nozicka@mail.desy.de --> -<!--Rules: Replace, Merge, Copy, Rename, Modify--> - -<!--Replace --> -<!-- Replace online components with offline --> - -<!--Merge --> -<!-- Merge L2 and EF parameters to offline parameter --> - -<!--Copy --> -<!-- Copy online parameter value corresponding to offline parameter value --> - -<!--Rename --> -<!-- Rename online algorithm or parameter to offline --> - -<!--Modify --> -<!-- Modify parameter by replacing online substring with offline substring --> - -<Rules> -<!-- Set the logger level for all algorithms to certain value - debugging purposes --> -<!-- <Replace name='OutputLevel-VERBOSE'> - <online> - <component alias="*" name="*"> - <parameter name="OutputLevel" value="*" op="set"/> - </component> - </online> - <offline> - <component alias="*" name="*"> - <parameter name="OutputLevel" value="1" op="set"/> - </component> - </offline> - </Replace>--> -<!-- Set the logger level for all algorithms to certain value - debugging purposes --> - -<!-- Remove python class and module - make pure C++ classes --> -<!-- <Replace name='NoPython'> - <online> - <component alias="*" name="*" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="*" name="*" py_name="" py_package=""/> - </offline> - </Replace>--> -<!-- End of: Remove python class and module - make pure C++ classes --> - - -<!-- Remove CoreDumpSvc and fix the references --> - <Replace name='CoreDumpSvc'> - <online> - <component alias="CoreDumpSvc" name="CoreDumpSvc" py_name="*" py_package="*"> - </component> - </online> - <offline> - </offline> - </Replace> - - <Modify name='ApplicationMgr.CreateSvc.CoreDumpSvc'> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\ACreateSvc\Z" value="['CoreDumpSvc/CoreDumpSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\ACreateSvc\Z" value="[]" op="set"/> - </component> - </offline> - </Modify> - -<!-- End of: Remove CoreDumpSvc and fix the references --> - -<!-- Remove DataFlowConfig --> - <Replace name='DataFlowConfig'> - <online> - <component alias="DataFlowConfig" name="IGNORE" py_name="*" py_package="*"> - </component> - </online> - <offline> - </offline> - </Replace> - -<!-- Replace HLTJobOptionsSvc with common JobOptionsSvc, fix the references--> - <Replace name='HLTJobOptionsSvc'> - <online> - <component alias="JobOptionsSvc" name="TrigConf::HLTJobOptionsSvc" py_name="*" py_package="*"> - <parameter name="TYPE" value="NONE" op="set"/> - <parameter name="PATH" value="../options/job.opts" op="set"/> - </component> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="JobOptionsSvcType" value="TrigConf::HLTJobOptionsSvc" op="set"/> - </component> - </online> - <offline> - <component alias="JobOptionsSvc" name="JobOptionsSvc" py_name="" py_package=""> - </component> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="JobOptionsSvcType" value="JobOptionsSvc" op="set"/> - </component> - </offline> - </Replace> - <Modify name="HLTJobOptionsSvc"> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\AExtSvc\Z" value="['TrigConf::HLTJobOptionsSvc/JobOptionsSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\AExtSvc\Z" value="['JobOptionsSvc/JobOptionsSvc']" op="set"/> - </component> - </offline> - </Modify> -<!-- End of: Replace HLTJobOptionsSvc with common JobOptionsSvc, fix the references--> - -<!-- Replace Lvl2ROBDataProviderSvc with RODDataProviderSvc and fix the references --> - <Replace name="Lvl2ROBDataProviderSvc"> - <online> - <component alias="ROBDataProviderSvc" name="Lvl2ROBDataProviderSvc" py_name="*" py_package="*"> - <parameter name="HistReceivedROBsPerCall" value=".*" op="set"/> - <parameter name="HistRequestedROBsPerCall" value=".*" op="set"/> - <parameter name="HistTimeROBretrieval" value=".*" op="set"/> - <parameter name="doDetailedROBMonitoring" value=".*" op="set"/> - <parameter name="doMonitoring" value=".*" op="set"/> - <parameter name="enabledROBs" value=".*" op="set"/> - <parameter name="ignoreROB" value=".*" op="set"/> - <parameter name="readROBfromOKS" value=".*" op="set"/> - </component> - </online> - <offline> - <component alias="ROBDataProviderSvc" name="ROBDataProviderSvc"> - </component> - </offline> - </Replace> - - <Modify name="Lvl2ROBDataProviderSvc"> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\ACreateSvc\Z" value="['Lvl2ROBDataProviderSvc/ROBDataProviderSvc']" op="set"/> - <parameter name="\AExtSvc\Z" value="['Lvl2ROBDataProviderSvc/ROBDataProviderSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\ACreateSvc\Z" value="[]" op="set"/> - <parameter name="\AExtSvc\Z" value="['ROBDataProviderSvc/ROBDataProviderSvc']" op="set"/> - </component> - </offline> - </Modify> -<!-- End of Replace Lvl2ROBDataProviderSvc with RODDataProviderSvc and fix the references --> - -<!-- Replace ByteStreamCnvSvcBase with ByteStreamCnvSvc, fix the references --> - <Replace name="ByteStreamCnvSvc"> - <online> - <component alias="ByteStreamCnvSvc" name="ByteStreamCnvSvcBase" py_name="*" py_package="*"> - </component> - </online> - <offline> - <component alias="ByteStreamCnvSvc" name="ByteStreamCnvSvc" py_name="" py_package=""> - <!--<parameter name="ByteStreamOutputSvc" value="" op="set"/> - <parameter name="ByteStreamOutputSvcList" value="[]" op="set"/> - <parameter name="GetDetectorMask" value="False" op="set"/> - <parameter name="IsCalibration" value="False" op="set"/> - <parameter name="IsSimulation" value="False" op="set"/> - <parameter name="IsTestbeam" value="False" op="set"/> - <parameter name="UserType" value="RawEvent" op="set"/>--> - </component> - </offline> - </Replace> - <Modify name="ByteStreamCnvSvc"> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\ACreateSvc\Z" value="['ByteStreamCnvSvcBase/ByteStreamCnvSvc']" op="set"/> - <parameter name="\AExtSvc\Z" value="['ByteStreamCnvSvcBase/ByteStreamCnvSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\ACreateSvc\Z" value="[]" op="set"/> - <parameter name="\AExtSvc\Z" value="['ByteStreamCnvSvc/ByteStreamCnvSvc']" op="set"/> - - </component> - </offline> - </Modify> -<!-- End of: Replace ByteStreamCnvSvcBase with ByteStreamCnvSvc, fix the references --> - -<!-- Replace EFEventLoopMgr by AthenaEventLoopMgr, fix the references, set the EventSelector and ByteStreamInputSvc --> - <Rename name="EFEventLoopMgr"> - <online> - <component alias="EFEventLoopMgr" name="EFEventLoopMgr" py_name=".*" py_package=".*"> - </component> - </online> - <offline> - <component alias="AthenaEventLoopMgr" name="EFEventLoopMgr" py_name="" py_package=""> - </component> - </offline> - </Rename> - <Replace name="EFEventLoopMgr"> - <online> - <component alias="AthenaEventLoopMgr" name="EFEventLoopMgr" py_name="*" py_package="*"> - <parameter name="AllowRunNumberUpdate" op="set" value="False"/> - <parameter name="ApplicationName" op="set" value="athenaPT"/> - <parameter name="ApplicationNodeID" op="set" value="0"/> - <!--<parameter name="AuditFinalize" op="set" value="False"/> - <parameter name="AuditInitialize" op="set" value="False"/> - <parameter name="AuditReInitialize" op="set" value="False"/> - <parameter name="AuditReStart" op="set" value="False"/> - <parameter name="AuditServices" op="set" value="False"/> - <parameter name="AuditStart" op="set" value="False"/> - <parameter name="AuditStop" op="set" value="False"/>--> - <parameter name="EFResultName" op="set" value="HLTResult_EF"/> - <parameter name="JobOptionsType" op="set" value="NONE"/> - <parameter name="Lvl1CTPROBid" op="set" value="7798784"/> - <!--<parameter name="OutStream" op="set" value="[]"/> - <parameter name="OutStreamType" op="set" value="AthenaOutputStream"/> - <parameter name="OutputLevel" op="set" value="3"/>--> - <parameter name="PartialEventBuildName" op="set" value="PEBInfo_EF"/> - <parameter name="PartitionName" op="set" value="NONE"/> - <!--<parameter name="TopAlg" op="set" value="['AthSequencer/AthMasterSeq']"/>--> - <parameter name="disableHLTResultHandle" op="set" value="False"/> - <parameter name="enabledROBs" op="set" value="[]"/> - <parameter name="enabledSubDetectors" op="set" value="[]"/> - <parameter name="predefinedDetectorMask" op="set" value="0"/> - <parameter name="predefinedLumiBlock" op="set" value="0"/> - <parameter name="predefinedRunNumber" op="set" value="0"/> - <parameter name="setConfigFromOKS" op="set" value="True"/> - <parameter name="setMagFieldFromIS" op="set" value="False"/> - </component> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name="*" py_package="*"> - <parameter name="EventLoop" value="EFEventLoopMgr" op="set"/> - <parameter name="EvtSel" value="NONE" op="set"/> - </component> - </online> - <offline> - <component alias="AthenaEventLoopMgr" name="AthenaEventLoopMgr" py_name="" py_package=""> - <parameter name="ClearStorePolicy" value="EndEvent" op="set"/> - <!--<parameter name="EvtSel" value="EventSelector" op="set"/>--> - <parameter name="FailureMode" value="1" op="set"/> - <parameter name="HistWriteInterval" value="0" op="set"/> - <!--<parameter name="HistogramPersistency" op="set" value="NONE"/>--> - <parameter name="TimeKeeper" value="" op="set"/> - </component> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="EventLoop" value="AthenaEventLoopMgr" op="set"/> - <parameter name="EvtSel" value="EventSelector" op="set"/> - </component> - <component alias="EventSelector" name="EventSelectorByteStream"> - <parameter name="ByteStreamInputSvc" value="ByteStreamInputSvc" op="set"/> - <parameter name="EventsPerLB" value="1000" op="set"/> - <parameter name="EventsPerRun" value="1000000" op="set"/> - <parameter name="FirstLB" value="0" op="set"/> - <parameter name="InitialTimeStamp" value="0" op="set"/> - <parameter name="OverrideRunNumber" value="False" op="set"/> - <parameter name="OverrideEventNumber" value="False" op="set"/> - <parameter name="OverrideTimeStamp" value="False" op="set"/> - <parameter name="pixel" value="True" op="set"/> - <parameter name="RunNumber" value="0" op="set"/> - <parameter name="sct" value="True" op="set"/> - <parameter name="SkipEvents" value="0" op="set"/> - <parameter name="trt" value="True" op="set"/> - <parameter name="TimeStampInterval" value="0" op="set"/> - </component> - <component alias="ByteStreamInputSvc" name="ByteStreamEventStorageInputSvc"> - <parameter name="FilePrefix" value="[]" op="set"/> - <parameter name="FirstFile" value="[]" op="set"/> - <parameter name="FullFileName" value="['/afs/cern.ch/atlas/project/trigger/pesa-sw/releases/data/daq.physics1E31.20090710devval.105200.Athena._0001.data']" op="set"/> - <parameter name="InputDirectory" value="[]" op="set"/> - <parameter name="NumFile" value="[]" op="set"/> - <parameter name="RunNumber" value="[]" op="set"/> - </component> - </offline> - </Replace> - <Modify name="EFEventLoopMgr"> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\AExtSvc\Z" value="['EFEventLoopMgr/EFEventLoopMgr']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\AExtSvc\Z" value="['AthenaEventLoopMgr/AthenaEventLoopMgr','ByteStreamEventStorageInputSvc/ByteStreamInputSvc','EventSelectorByteStream/EventSelector']" op="set"/> - </component> - </offline> - </Modify> -<!-- End of: Replace EFEventLoopMgr by AthenaEventLoopMgr, fix the references, set the EventSelector and ByteStreamInputSvc --> - -<!-- Replace Lvl2EventLoopMgr by AthenaEventLoopMgr, fix the references, set the EventSelector and ByteStreamInputSvc --> - <Rename name="Lvl2EventLoopMgr"> - <online> - <component alias="Lvl2EventLoopMgr" name="Lvl2EventLoopMgr" py_name=".*" py_package=".*"> - </component> - </online> - <offline> - <component alias="AthenaEventLoopMgr" name="Lvl2EventLoopMgr" py_name="" py_package=""> - </component> - </offline> - </Rename> - <Replace name="Lvl2EventLoopMgr"> - <online> - <component alias="AthenaEventLoopMgr" name="Lvl2EventLoopMgr" py_name="*" py_package="*"> - <parameter name="AllowRunNumberUpdate" value="False" op="set"/> - <parameter name="ApplicationName" op="set" value="athenaPT"/> - <parameter name="ApplicationNodeID" op="set" value="0"/> - <!--<parameter name="AuditFinalize" op="set" value="False"/> - <parameter name="AuditInitialize" op="set" value="False"/> - <parameter name="AuditReInitialize" op="set" value="False"/> - <parameter name="AuditReStart" op="set" value="False"/> - <parameter name="AuditServices" op="set" value="False"/> - <parameter name="AuditStart" op="set" value="False"/> - <parameter name="AuditStop" op="set" value="False"/>--> - <parameter name="ForceLvl2Accept" value="False" op="set"/> - <parameter name="ForceLvl2Reject" value="False" op="set"/> - <parameter name="JobOptionsType" op="set" value="NONE"/> - <parameter name="L2DebugStreamName" op="set" value="L2_PSC_DEBUG"/> - <parameter name="L2ForcedStreamName" op="set" value="L2_PSC_FORCED"/> - <parameter name="Lvl1CTPROBcheck" value="False" op="set"/> - <parameter name="Lvl1CTPROBid" value="7798785" op="set"/> - <parameter name="Lvl2ResultName" value="HLTResult_L2" op="set"/> - <!--<parameter name="OutStream" op="set" value="[]"/> - <parameter name="OutStreamType" op="set" value="AthenaOutputStream"/> - <parameter name="OutputLevel" op="set" value="3"/>--> - <parameter name="PartialEventBuildName" op="set" value="PEBInfo_EF"/> - <parameter name="PartitionName" op="set" value="NONE"/> - <!--<parameter name="TopAlg" op="set" value="['AthSequencer/AthMasterSeq']"/>--> - <parameter name="doMonitoring" value="False" op="set"/> - <parameter name="enabledROBs" op="set" value="[]"/> - <parameter name="enabledSubDetectors" op="set" value="[]"/> - <parameter name="predefinedDetectorMask" op="set" value="0"/> - <parameter name="predefinedLumiBlock" op="set" value="0"/> - <parameter name="predefinedRunNumber" op="set" value="0"/> - <parameter name="setConfigFromOKS" op="set" value="True"/> - <parameter name="setMagFieldFromIS" op="set" value="False"/> - <parameter name="predefinedRunNumber" value="0" op="set"/> - </component> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name="*" py_package="*"> - <parameter name="EventLoop" value="Lvl2EventLoopMgr" op="set"/> - <parameter name="EvtSel" value="NONE" op="set"/> - </component> - </online> - <offline> - <component alias="AthenaEventLoopMgr" name="AthenaEventLoopMgr" py_name="" py_package=""> - <parameter name="ClearStorePolicy" value="EndEvent" op="set"/> - <!--<parameter name="EvtSel" value="EventSelector" op="set"/>--> - <parameter name="FailureMode" value="1" op="set"/> - <parameter name="HistWriteInterval" value="0" op="set"/> - <!--<parameter name="HistogramPersistency" op="set" value="NONE"/>--> - <parameter name="TimeKeeper" value="" op="set"/> - </component> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="EventLoop" value="AthenaEventLoopMgr" op="set"/> - <parameter name="EvtSel" value="EventSelector" op="set"/> - </component> - <component alias="EventSelector" name="EventSelectorByteStream"> - <parameter name="ByteStreamInputSvc" value="ByteStreamInputSvc" op="set"/> - <parameter name="EventsPerLB" value="1000" op="set"/> - <parameter name="EventsPerRun" value="1000000" op="set"/> - <parameter name="FirstLB" value="0" op="set"/> - <parameter name="InitialTimeStamp" value="0" op="set"/> - <parameter name="OverrideRunNumber" value="False" op="set"/> - <parameter name="OverrideEventNumber" value="False" op="set"/> - <parameter name="OverrideTimeStamp" value="False" op="set"/> - <parameter name="pixel" value="True" op="set"/> - <parameter name="RunNumber" value="0" op="set"/> - <parameter name="sct" value="True" op="set"/> - <parameter name="SkipEvents" value="0" op="set"/> - <parameter name="trt" value="True" op="set"/> - <parameter name="TimeStampInterval" value="0" op="set"/> - </component> - <component alias="ByteStreamInputSvc" name="ByteStreamEventStorageInputSvc"> - <parameter name="FilePrefix" value="[]" op="set"/> - <parameter name="FirstFile" value="[]" op="set"/> - <parameter name="FullFileName" value="['/afs/cern.ch/atlas/project/trigger/pesa-sw/releases/data/daq.physics1E31.20090710devval.105200.Athena._0001.data']" op="set"/> - <parameter name="InputDirectory" value="[]" op="set"/> - <parameter name="NumFile" value="[]" op="set"/> - <parameter name="RunNumber" value="[]" op="set"/> - </component> - </offline> - </Replace> - <Modify name="ApplicationMgr.ExtSvc.Lvl2EventLoopMgr"> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\AExtSvc\Z" value="['Lvl2EventLoopMgr/Lvl2EventLoopMgr']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\AExtSvc\Z" value="['AthenaEventLoopMgr/AthenaEventLoopMgr','ByteStreamEventStorageInputSvc/ByteStreamInputSvc','EventSelectorByteStream/EventSelector']" op="set"/> - </component> - </offline> - </Modify> -<!-- End of: Replace Lvl2EventLoopMgr by AthenaEventLoopMgr, fix the references, set the EventSelector and ByteStreamInputSvc --> - -<!-- Replace TrigMessageSvc with common MessageSvc, fix the references --> - <Replace name="TrigMessageSvc"> - <online> - <component alias="MessageSvc" name="TrigMessageSvc" py_name="*" py_package="*"> - <parameter name="forceOutputLevel" value=".*" op="set"/> - <parameter name="printEventIDLevel" value=".*" op="set"/> - <parameter name="publishLevel" value=".*" op="set"/> - <parameter name="publishStats" value=".*" op="set"/> - <parameter name="resetStatsAtBeginRun" value=".*" op="set"/> - <parameter name="suppressRunningOnly" value=".*" op="set"/> - <parameter name="useErs" value=".*" op="set"/> - <parameter name="useErsAlways" value=".*" op="set"/> - <parameter name="useErsDebug" value=".*" op="set"/> - <parameter name="useErsError" value=".*" op="set"/> - <parameter name="useErsFatal" value=".*" op="set"/> - <parameter name="useErsInfo" value=".*" op="set"/> - <parameter name="useErsVerbose" value=".*" op="set"/> - <parameter name="useErsWarning" value=".*" op="set"/> - </component> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name="*" py_package="*"> - <parameter name="MessageSvcType" value="TrigMessageSvc" op="set"/> - </component> - </online> - <offline> - <component alias="MessageSvc" name="MessageSvc" py_name="" py_package=""> - <parameter name="loggedStreams" value="{ }" op="set"/> - </component> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="MessageSvcType" value="MessageSvc" op="set"/> - </component> - </offline> - </Replace> - <Modify name="TrigMessageSvc"> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\AExtSvc\Z" value="['TrigMessageSvc/MessageSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\AExtSvc\Z" value="['MessageSvc/MessageSvc']" op="set"/> - </component> - </offline> - </Modify> -<!-- End of: Replace TrigMessageSvc with common MessageSvc, fix the references --> - -<!-- Set ApplicationMgr.StatusCodeCheck and the AuditAlgorithms to True --> - <Replace name="ApplicationMgr.StatusCodeCheck"> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name="*" py_package="*"> - <parameter name="StatusCodeCheck" value="False" op="set"/> - <parameter name="AuditAlgorithms" value="False" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="StatusCodeCheck" value="True" op="set"/> - <parameter name="AuditAlgorithms" value="True" op="set"/> - </component> - </offline> - </Replace> - -<!-- Remove item ROBDataProviderSvc/ROBDataProviderSvc from ApplicationMgr.CreateSvc property --> - <Modify name='ApplicationMgr.CreateSvc.ROBDataProviderSvc'> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\ACreateSvc\Z" value="['ROBDataProviderSvc/ROBDataProviderSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\ACreateSvc\Z" value="[]" op="set"/> - </component> - </offline> - </Modify> - -<!-- Remove item ByteStreamAddressProviderSvc/ByteStreamAddressProviderSvc from ApplicationMgr.CreateSvc property --> - <Modify name='ApplicationMgr.CreateSvc.ByteStreamProviderSvc'> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\ACreateSvc\Z" value="['ByteStreamAddressProviderSvc/ByteStreamAddressProviderSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\ACreateSvc\Z" value="[]" op="set"/> - </component> - </offline> - </Modify> - -<!-- Remove item ByteStreamCnvSvc/ByteStreamCnvSvc from ApplicationMgr.CreateSvc property --> - <Modify name='ApplicationMgr.CreateSvc.ByteStreamCnvSvc'> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\ACreateSvc\Z" value="['ByteStreamCnvSvc/ByteStreamCnvSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\ACreateSvc\Z" value="[]" op="set"/> - </component> - </offline> - </Modify> - -<!-- Remove item ToolSvc/ToolSvc from ApplicationMgr.CreateSvc property --> - <Modify name='ApplicationMgr.CreateSvc.ToolSvc'> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\ACreateSvc\Z" value="['ToolSvc/ToolSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\ACreateSvc\Z" value="[]" op="set"/> - </component> - </offline> - </Modify> - -<!-- Remove item DetDescrCnvSvc/DetDescrCnvSvc from ApplicationMgr.CreateSvc property --> - <Modify name='ApplicationMgr.CreateSvc.DetDescrCnvSvc'> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\ACreateSvc\Z" value="['DetDescrCnvSvc/DetDescrCnvSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\ACreateSvc\Z" value="[]" op="set"/> - </component> - </offline> - </Modify> - -<!-- Add items GeoModelSvc, TileInfoLoader, SpecialPixelMapSvc/SpecialPixelMapSvc to ApplicationMgr.CreateSvc property --> - <Modify name='ApplicationMgr.CreateSvc.GeoModelSvc'> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\ACreateSvc\Z" value="[]" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\ACreateSvc\Z" value="['GeoModelSvc', 'TileInfoLoader', 'SpecialPixelMapSvc/SpecialPixelMapSvc']" op="set"/> - </component> - </offline> - </Modify> - -<!-- Set the update interval of IOVSvc to Event for offline --> - <Replace name="IOVSvc"> - <online> - <component alias="IOVSvc" name="IOVSvc" py_name="*" py_package="*"> - <parameter name="updateInterval" value="RUN" op="set"/> - </component> - </online> - <offline> - <component alias="IOVSvc" name="IOVSvc"> - <parameter name="updateInterval" value="Event" op="set"/> - </component> - </offline> - </Replace> - -<!-- Delete EvtSel from the AthenaEventLoopMgr - causes problems --> - <Replace name="AthenaEventLoopMgr.EvtSel"> - <online> - <component alias="AthenaEventLoopMgr" name="AthenaEventLoopMgr" py_name="*" py_package="*"> - <parameter name="EvtSel" value="EventSelector" op="set"/> - </component> - </online> - <offline> - <component alias="AthenaEventLoopMgr" name="AthenaEventLoopMgr"> - </component> - </offline> - </Replace> - -<!-- Set the muFast algorithm to offline --> - <Replace name="muFast.OnlineRun" comment="If the OnlineRun is set to True - crash in the hltinitialize"> - <online> - <component alias="*" name="muFast" py_name="*" py_package="*"> - <parameter name="OnlineRun" value="True" op="set"/> - </component> - </online> - <offline> - <component alias="*" name="muFast"> - <parameter name="OnlineRun" value="False" op="set"/> - </component> - </offline> - </Replace> - -<!-- Remove the IOVSvc.StoreGateSvc - causes problems: An alias is in use already by normal StoreGateSvc --> - <Replace name='IOVSvc.StoreGateSvc'> - <online> - <component alias="IOVSvc.StoreGateSvc" name="IOVSvcTool" py_name="*" py_package="*"/> - </online> - <offline> - </offline> - </Replace> - - <!-- <Rename name='IOVSvc.StoreGateSvc' comment='The Alias is in use already by normal StoreGateSvc'> - <online> - <component alias="IOVSvc.StoreGateSvc" name="IOVSvcTool"/> - </online> - <offline> - <component alias="IOVSvc.IOVSvcTool" name="IOVSvcTool"/> - </offline> - </Rename>--> - - <!-- Insert the Lvl1ConsistencyChecker if missing --> - <Replace name="Lvl1ConsistencyChecker" comment="Lvl1ConsistencyChecker missing"> - <online> - <component alias="TrigSteer_L2.Lvl1Converter" name="HLT::Lvl1Converter" py_name="*" py_package="*"> - </component> - </online> - <offline> - <component alias="TrigSteer_L2.Lvl1Converter" name="HLT::Lvl1Converter"> - </component> - <component alias="TrigSteer_L2.Lvl1Converter.Lvl1ConsistencyChecker" name="Lvl1ConsistencyChecker"> - </component> - </offline> - </Replace> - -<!-- Fix from 7.7.09 for 15.2.0.9 --> - <Replace name="H1WeightToolCSC12Generic"> - <online> - <component alias="*.H1WeightCone7H1Tower" name="H1WeightToolCSC12Generic" py_name="*" py_package="*"> - <parameter name="wtHec2" value="*" op="set"/> - <parameter name="wtHec1" value="*" op="set"/> - <parameter name="wtEME0" value="*" op="set"/> - <parameter name="wtEME1" value="*" op="set"/> - <parameter name="wtEME2" value="*" op="set"/> - <parameter name="wtEMB0" value="*" op="set"/> - <parameter name="wtEMB1" value="*" op="set"/> - <parameter name="wtEMB2" value="*" op="set"/> - <parameter name="wtTile1" value="*" op="set"/> - <parameter name="wtTile2" value="*" op="set"/> - </component> - </online> - <offline> - <component alias="*.H1WeightCone7H1Tower" name="H1WeightToolCSC12Generic"> - </component> - </offline> - </Replace> - -<!-- Replace TrigMonTHistSvc with common THistSvc, set the output root files, fix the refernces --> - <Replace name="TrigMonTHistSvc"> - <online> - <component alias="THistSvc" name="TrigMonTHistSvc" py_name="*" py_package="*"> - <parameter name="ExcludeName" op="set" value=".*\..*"/> - <parameter name="ExcludeType" op="set" value="()"/> - <parameter name="IncludeName" op="set" value="^/((run_[0-9]+/lb_[0-9]+)|(SHIFT)|(EXPERT)|(DEBUG)|(EXPRESS)|(RUNSTAT))/.+/.+"/> - <parameter name="IncludeType" op="set" value=".+"/> - <parameter name="Output" op="set" value="[]"/> - <parameter name="SumUpHistograms" op="set" value="True"/> - </component> - </online> - <offline> - <component alias="THistSvc" name="THistSvc" py_name="" py_package=""> - <parameter name="Output" op="set" value="["SHIFT DATAFILE='shift-monitoring.root' OPT='RECREATE'", "EXPERT DATAFILE='expert-monitoring.root' OPT='RECREATE'", "run_1 DATAFILE='lbn-monitoring.root' OPT='RECREATE'", "RUNSTAT DATAFILE='runstat-monitoring.root' OPT='RECREATE'", "DEBUG DATAFILE='debug-monitoring.root' OPT='RECREATE'"]"/> - </component> - </offline> - </Replace> - <Modify name="TrigMonTHistSvc"> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\AExtSvc\Z" value="['TrigMonTHistSvc/THistSvc']" op="set"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="\AExtSvc\Z" value="['THistSvc/THistSvc']" op="set"/> - </component> - </offline> - </Modify> -<!-- End of: Replace TrigMonTHistSvc with common THistSvc, fix the dependecies --> - -<!-- Handling the AthSequencers, merge the Members, copy its value to ApplicationMgr.TopAlg and remove it --> - <Merge> - <component alias="AthMasterSeq" name="AthSequencer" py_name=".*" py_package=".*"> - <parameter name="Members" value=".*"/> - </component> - <component alias="AthAlgSeq" name="AthSequencer" py_name=".*" py_package=".*"> - <parameter name="Members" value=".*"/> - </component> - <component alias="AthOutSeq" name="AthSequencer" py_name=".*" py_package=".*"> - <parameter name="Members" value=".*"/> - </component> - <component alias="AthRegSeq" name="AthSequencer" py_name=".*" py_package=".*"> - <parameter name="Members" value=".*"/> - </component> - <component alias="Streams" name="AthSequencer" py_name=".*" py_package=".*"> - <parameter name="Members" value=".*"/> - </component> - </Merge> - - <Copy name="ApplicationMgr.TopAlg"> - <online> - <component alias="AthAlgSeq" name="AthSequencer" py_name=".*" py_package=".*"> - <parameter name="Members" value=".*"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="TopAlg" value=".*" op="set"/> - </component> - </offline> - </Copy> - - <Replace name="AthSequencer"> - <online> - <component alias="*" name="AthSequencer" py_name="*" py_package="*"/> - </online> - <offline> - </offline> - </Replace> -<!-- End of: Handling the AthSequencers, merge the TopAlg, copy its value to ApplicationMgr and remove it --> - -<!-- Merge some of the list properties of particular algorithms --> - <Merge> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name=".*" py_package=".*"> - <parameter name="\ACreateSvc\Z" value=".*" op="set"/> - <parameter name="Dlls" value=".*" op="set"/> - <parameter name="\AExtSvc\Z" value=".*" op="set"/> - <parameter name="TopAlg" value=".*" op="set"/> - </component> - <component alias="ByteStreamAddressProviderSvc" name="ByteStreamAddressProviderSvc" py_name=".*" py_package=".*"> - <parameter name="TypeNames" value=".*" op="set"/> - </component> - <component alias="AthenaEventLoopMgr" name="AthenaEventLoopMgr" py_name=".*" py_package=".*"> - <parameter name="TopAlg" value=".*" op="set"/> - </component> - <component alias="EventPersistencySvc" name="EvtPersistencySvc" py_name=".*" py_package=".*"> - <parameter name="CnvServices" value=".*" op="set"/> - </component> - <component alias="ClassIDSvc" name="ClassIDSvc" py_name=".*" py_package=".*"> - <parameter name="CLIDDBFiles" value=".*" op="set"/> - </component> - <component alias="ProxyProviderSvc" name="ProxyProviderSvc" py_name=".*" py_package=".*"> - <parameter name="ProviderNames" value=".*" op="set"/> - </component> - <component alias="IOVDbSvc" name="IOVDbSvc" py_name=".*" py_package=".*"> - <parameter name="Folders" value=".*" op="set"/> - </component> - <component alias="MessageSvc" name="MessageSvc" py_name=".*" py_package=".*"> - <parameter name="setError" value=".*" op="set"/> - </component> - <component alias="ToolSvc.AtlasExtrapolator" name="Trk::Extrapolator" py_name=".*" py_package=".*"> - <parameter name="MultipleScatteringUpdators" value=".*" op="set"/> - <parameter name="EnergyLossUpdators" value=".*" op="set"/> - <parameter name="SubMEUpdators" value=".*" op="set"/> - <parameter name="SubPropagators" value=".*" op="set"/> - </component> - <component alias="ToolSvc.InDetTrigExtrapolator" name="Trk::Extrapolator" py_name=".*" py_package=".*"> - <parameter name="MultipleScatteringUpdators" value=".*" op="set"/> - <parameter name="EnergyLossUpdators" value=".*" op="set"/> - <parameter name="SubMEUpdators" value=".*" op="set"/> - <parameter name="SubPropagators" value=".*" op="set"/> - </component> - </Merge> -<!-- End of: Merge some of the list properties of particular algorithms --> - -<!-- Sort particular list type properties in order to have correct sequence --> - <Sort position='end' name='ApplicationMgr.TopAlg.TrigSteer_L2/EF'> - <component alias="*" name="*" py_name="*" py_package="*"> - <parameter name="TopAlg" value="['HLT::TrigSteer/TrigSteer_L2','HLT::TrigSteer/TrigSteer_EF']" op="set"/> - </component> - <component alias="*" name="AthSequencer" py_name="*" py_package="*"> - <parameter name="Members" value="['HLT::TrigSteer/TrigSteer_L2','HLT::TrigSteer/TrigSteer_EF']" op="set"/> - </component> - <component alias="ProxyProviderSvc" name="ProxyProviderSvc" py_name="*" py_package="*"> - <parameter name="ProviderNames" value="['ByteStreamAddressProviderSvc']" op="set"/> - </component> - </Sort> - -<!-- Copy the sorted value of the TopAlg to the AthenaEventLoopMgr --> - <Copy name="AthenaEventLoopMgr.TopAlg"> - <online> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name="*" py_package="*"> - <parameter name="TopAlg" value=".*"/> - </component> - </online> - <offline> - <component alias="AthenaEventLoopMgr" name="AthenaEventLoopMgr" py_name="*" py_package="*"> - <parameter name="TopAlg" value=".*" op="set"/> - </component> - </offline> - </Copy> - - -</Rules> diff --git a/Trigger/TrigConfiguration/TrigConfOffline/xml/offline_setup_rules_MC.xml b/Trigger/TrigConfiguration/TrigConfOffline/xml/offline_setup_rules_MC.xml deleted file mode 100644 index 32dd8601838561538403602c28ad9761a23099de..0000000000000000000000000000000000000000 --- a/Trigger/TrigConfiguration/TrigConfOffline/xml/offline_setup_rules_MC.xml +++ /dev/null @@ -1,1814 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Author : Miroslav Nozicka <nozicka@mail.desy.de> - Modified : 01.07. 2009 - Comment : Update of unknowns ---> -<!-- - MC Rules file for modification of the MC Trigger Configuration - Rules: Replace, Merge, Copy, Rename, Modify - - Replace: - Replace online components with offline - Merge: - Merge L2 and EF parameters to offline parameter - Copy: - Copy online parameter value corresponding to offline parameter value - Rename: - Rename online algorithm or parameter to offline - Modify: - Modify parameter by replacing online substring with offline substring ---> - -<Rules> - -<!-- Make All algorithms verbose - debugging purposes --> -<!-- <Replace name='OutputLevel-VERBOSE'> - <online> - <component alias="*" name="*"> - <parameter name="OutputLevel" value="*" op="set"/> - </component> - </online> - <offline> - <component alias="*" name="*"> - <parameter name="OutputLevel" value="1" op="set"/> - </component> - </offline> - </Replace>--> -<!-- End of: Make All algorithms verbose - debugging purposes --> - -<!-- Remove python class and module - make pure C++ classes --> -<!-- <Replace name='NoPython'> - <online> - <component alias="*" name="*" py_name="*" py_name="*"/> - </online> - <offline> - <component alias="*" name="*" py_name="" py_name=""/> - </offline> - </Replace>--> -<!-- End of: Remove python class and module - make pure C++ classes --> - - <Replace name='IOVSvc.StoreGateSvc'> - <online> - <component alias="IOVSvc.StoreGateSvc" name="IOVSvcTool"/> - </online> - <offline> - </offline> - </Replace> - - <Merge> - <component alias="ApplicationMgr" name="ApplicationMgr"> - <parameter name="CreateSvc" value="" op="set"/> - <parameter name="Dlls" value="" op="set"/> - <parameter name="ExtSvc" value="" op="set"/> - <parameter name="TopAlg" value="" op="set"/> - </component> - <component alias="ByteStreamAddressProviderSvc" name="ByteStreamAddressProviderSvc"> - <parameter name="TypeNames" value="" op="set"/> - </component> - <component alias="AthenaEventLoopMgr" name="AthenaEventLoopMgr"> - <parameter name="TopAlg" value="[]" op="set"/> - </component> - <component alias="EventPersistencySvc" name="EvtPersistencySvc"> - <parameter name="CnvServices" value="" op="set"/> - </component> - <component alias="ClassIDSvc" name="ClassIDSvc"> - <parameter name="CLIDDBFiles" value="[]" op="set"/> - </component> - <component alias="ProxyProviderSvc" name="ProxyProviderSvc"> - <parameter name="ProviderNames" value="['MetaDataSvc', 'IOVDbSvc', 'ByteStreamAddressProviderSvc']" op="set"/> - </component> - <component alias="IOVDbSvc" name="IOVDbSvc"> - <parameter name="Folders" value="[]" op="set"/> - </component> - <component alias="MessageSvc" name="MessageSvc"> - <parameter name="setError" value="[]" op="set"/> - </component> - <component alias="AthenaRootStreamerSvc" name="AthenaRootStreamerSvc"> - <parameter name="Streamers" value="[]" op="set"/> - </component> - <component alias="ToolSvc.AtlasExtrapolator" name="Trk::Extrapolator"> - <parameter name="MultipleScatteringUpdators" value="[]" op="set"/> - <parameter name="EnergyLossUpdators" value="[]" op="set"/> - <parameter name="SubMEUpdators" value="[]" op="set"/> - <parameter name="SubPropagators" value="[]" op="set"/> - </component> - <component alias="ToolSvc.InDetTrigExtrapolator" name="Trk::Extrapolator"> - <parameter name="MultipleScatteringUpdators" value="[]" op="set"/> - <parameter name="EnergyLossUpdators" value="[]" op="set"/> - <parameter name="SubMEUpdators" value="[]" op="set"/> - <parameter name="SubPropagators" value="[]" op="set"/> - </component> - </Merge> - - <Replace name="H1WeightToolCSC12Generic"> - <online> - <component alias="*.H1WeightCone7H1Tower" name="H1WeightToolCSC12Generic"> - <parameter name="wtHec2" value="*" op="set"/> - <parameter name="wtHec1" value="*" op="set"/> - <parameter name="wtEME0" value="*" op="set"/> - <parameter name="wtEME1" value="*" op="set"/> - <parameter name="wtEME2" value="*" op="set"/> - <parameter name="wtEMB0" value="*" op="set"/> - <parameter name="wtEMB1" value="*" op="set"/> - <parameter name="wtEMB2" value="*" op="set"/> - <parameter name="wtTile1" value="*" op="set"/> - <parameter name="wtTile2" value="*" op="set"/> - </component> - </online> - <offline> - <component alias="*.H1WeightCone7H1Tower" name="H1WeightToolCSC12Generic"> - </component> - </offline> - </Replace> - - <Copy name="ApplicationMgr.TopAlg"> - <online> - <component alias="AthAlgSeq" name="AthSequencer" py_name="" py_package=""> - <parameter name="Members" value="*"/> - </component> - </online> - <offline> - <component alias="ApplicationMgr" name="ApplicationMgr" py_name="" py_package=""> - <parameter name="TopAlg" value="['AthSequencer/AthMasterSeq']" op="set"/> - </component> - </offline> - </Copy> - - <Replace name="AthSequencer"> - <online> - <component alias="*" name="AthSequencer" py_name="*" py_package="*"/> - </online> - <offline> - </offline> - </Replace> - -<!-- Fix the unknowns from offline 01.07.09 nightly --> - <Rename name="ToolSvc.TileCondToolNoiseSample.TileCondProxyCool_NoiseAutoCr"> - <online> - <component alias="ToolSvc.TileCondToolNoiseSample.TileCondProxyCool_NoiseAutoCr" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TileCondToolNoiseSample.TileCondProxyCool_NoiseAutoCr" name="TileCondProxyCool<TileCalibDrawerFlt>" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.exToCalo"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.exToCalo" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.exToCalo" name="ExtrapolateToCaloTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.egammaExtrapolationTool"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.egammaExtrapolationTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.egammaExtrapolationTool" name="EMExtrapolationTools" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_TrigEgammaRec_eGamma.egammashowershape_TrigEgammaRec_eGamma"> - <online> - <component alias="ToolSvc.emshower_TrigEgammaRec_eGamma.egammashowershape_TrigEgammaRec_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_TrigEgammaRec_eGamma.egammashowershape_TrigEgammaRec_eGamma" name="egammaShowerShape" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_TrigEgammaRec_NoIDEF_eGamma.egammashowershape_TrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.emshower_TrigEgammaRec_NoIDEF_eGamma.egammashowershape_TrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_TrigEgammaRec_NoIDEF_eGamma.egammashowershape_TrigEgammaRec_NoIDEF_eGamma" name="egammaShowerShape" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.egammaQpoint_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault"> - <online> - <component alias="ToolSvc.egammaQpoint_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egammaQpoint_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault" name="CaloDepthTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MdtDriftCircleOnTrackCreatorAdjustableT0Moore"> - <online> - <component alias="ToolSvc.MdtDriftCircleOnTrackCreatorAdjustableT0Moore" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MdtDriftCircleOnTrackCreatorAdjustableT0Moore" name="Muon::MdtDriftCircleOnTrackCreator" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TRTSeededInDetTrigAmbiguityProcessor"> - <online> - <component alias="ToolSvc.TRTSeededInDetTrigAmbiguityProcessor" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TRTSeededInDetTrigAmbiguityProcessor" name="Trk::SimpleAmbiguityProcessorTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigConversionFinderTools"> - <online> - <component alias="ToolSvc.InDetTrigConversionFinderTools" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigConversionFinderTools" name="InDet::InDetConversionFinderTools" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigConversionPropagator"> - <online> - <component alias="ToolSvc.InDetTrigConversionPropagator" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigConversionPropagator" name="Trk::StraightLinePropagator" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TileCondToolPulseShape"> - <online> - <component alias="ToolSvc.TileCondToolPulseShape" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TileCondToolPulseShape" name="TileCondToolPulseShape" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TileCondToolPulseShape.TileCondProxyCool_PulseShapePhy"> - <online> - <component alias="ToolSvc.TileCondToolPulseShape.TileCondProxyCool_PulseShapePhy" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TileCondToolPulseShape.TileCondProxyCool_PulseShapePhy" name="TileCondProxyCool<TileCalibDrawerFlt>" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.IDScanHitFilter_Bphysics"> - <online> - <component alias="ToolSvc.IDScanHitFilter_Bphysics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.IDScanHitFilter_Bphysics" name="IDScanHitFilter" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigTauSeeds"> - <online> - <component alias="ToolSvc.TrigTauSeeds" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigTauSeeds" name="tauSeedBuilder" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TMEF_MuonAmbiProcessorCosmic"> - <online> - <component alias="ToolSvc.TMEF_MuonAmbiProcessorCosmic" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TMEF_MuonAmbiProcessorCosmic" name="Trk::SimpleAmbiguityProcessorTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.ShifterTool_Cosmics"> - <online> - <component alias="ToolSvc.ShifterTool_Cosmics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.ShifterTool_Cosmics" name="ShifterTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.IDScanHitFilter_Cosmics"> - <online> - <component alias="ToolSvc.IDScanHitFilter_Cosmics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.IDScanHitFilter_Cosmics" name="IDScanHitFilter" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.EventCnvSuperTool"> - <online> - <component alias="ToolSvc.EventCnvSuperTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.EventCnvSuperTool" name="Trk::EventCnvSuperTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTrackSummaryToolSharedHits"> - <online> - <component alias="ToolSvc.InDetTrigTrackSummaryToolSharedHits" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTrackSummaryToolSharedHits" name="Trk::TrackSummaryTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_muon"> - <online> - <component alias="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_muon" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_muon" name="InDet::TRT_TrackSegmentsMaker_ATLxk" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigMuGirlGlobalFitTool"> - <online> - <component alias="ToolSvc.TrigMuGirlGlobalFitTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigMuGirlGlobalFitTool" name="MuGirlNS::GlobalFitTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.IDScanZFinder_Cosmics"> - <online> - <component alias="ToolSvc.IDScanZFinder_Cosmics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.IDScanZFinder_Cosmics" name="IDScanZFinder" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_SeededTrackTool_photon"> - <online> - <component alias="ToolSvc.InDetTrigTRT_SeededTrackTool_photon" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_SeededTrackTool_photon" name="InDet::TRT_SeededTrackFinder_ATL" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TMEF_MuonSegmentTrackBuilderCosmic"> - <online> - <component alias="ToolSvc.TMEF_MuonSegmentTrackBuilderCosmic" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TMEF_MuonSegmentTrackBuilderCosmic" name="Muon::MuonSegmentTrackBuilder" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.egfourmom_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.egfourmom_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egfourmom_TrigEgammaRec_PhotonConversions" name="EMFourMomBuilder" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MisalignedBackExtrapolator"> - <online> - <component alias="ToolSvc.MisalignedBackExtrapolator" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MisalignedBackExtrapolator" name="TrigMuonBackExtrapolator" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.ExtrapolTrackToCaloToolshowerdefault"> - <online> - <component alias="ToolSvc.ExtrapolTrackToCaloToolshowerdefault" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.ExtrapolTrackToCaloToolshowerdefault" name="ExtrapolTrackToCaloTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigMuGirlParticleCreatorTool"> - <online> - <component alias="ToolSvc.TrigMuGirlParticleCreatorTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigMuGirlParticleCreatorTool" name="MuGirlNS::MuGirlParticleCreatorTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MCTBExtrapolatorBlendedMat"> - <online> - <component alias="ToolSvc.MCTBExtrapolatorBlendedMat" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MCTBExtrapolatorBlendedMat" name="Trk::Extrapolator" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MdtDriftCircleOnTrackCreatorAdjustableT0Mboy"> - <online> - <component alias="ToolSvc.MdtDriftCircleOnTrackCreatorAdjustableT0Mboy" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MdtDriftCircleOnTrackCreatorAdjustableT0Mboy" name="Muon::MdtDriftCircleOnTrackCreator" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonSegmentRegionRecoveryTool"> - <online> - <component alias="ToolSvc.MuonSegmentRegionRecoveryTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonSegmentRegionRecoveryTool" name="Muon::MuonSegmentRegionRecoveryTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_photon"> - <online> - <component alias="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_photon" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_photon" name="InDet::TRT_TrackSegmentsMaker_ATLxk" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.empid_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.empid_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.empid_TrigEgammaRec_PhotonConversions" name="EMPIDBuilder" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.ExtrapolTrackToCaloToolentrance"> - <online> - <component alias="ToolSvc.ExtrapolTrackToCaloToolentrance" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.ExtrapolTrackToCaloToolentrance" name="ExtrapolTrackToCaloTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TMEF_MuonPatternSegmentMakerCosmic"> - <online> - <component alias="ToolSvc.TMEF_MuonPatternSegmentMakerCosmic" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TMEF_MuonPatternSegmentMakerCosmic" name="Muon::MuonPatternSegmentMaker" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonSTEP_Extrapolator"> - <online> - <component alias="ToolSvc.MuonSTEP_Extrapolator" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonSTEP_Extrapolator" name="Trk::Extrapolator" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTrackSlimmingToolParams"> - <online> - <component alias="ToolSvc.InDetTrigTrackSlimmingToolParams" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTrackSlimmingToolParams" name="Trk::TrackSlimmingTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.egammaQgcld_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault"> - <online> - <component alias="ToolSvc.egammaQgcld_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egammaQgcld_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault" name="CaloDepthTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonChi2SLTrackFitter"> - <online> - <component alias="ToolSvc.MuonChi2SLTrackFitter" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonChi2SLTrackFitter" name="Trk::GlobalChi2Fitter" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTrackFitterTRT"> - <online> - <component alias="ToolSvc.InDetTrigTrackFitterTRT" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTrackFitterTRT" name="Trk::GlobalChi2Fitter" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_StandaloneScoringTool_tau"> - <online> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_tau" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_tau" name="InDet::InDetTrtTrackScoringTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonRK_Extrapolator"> - <online> - <component alias="ToolSvc.MuonRK_Extrapolator" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonRK_Extrapolator" name="Trk::Extrapolator" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.emshower_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_TrigEgammaRec_PhotonConversions" name="EMShowerBuilder" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_TrigEgammaRec_PhotonConversions.egammashowershape_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.emshower_TrigEgammaRec_PhotonConversions.egammashowershape_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_TrigEgammaRec_PhotonConversions.egammashowershape_TrigEgammaRec_PhotonConversions" name="egammaShowerShape" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.IDScanZFinder_Bphysics"> - <online> - <component alias="ToolSvc.IDScanZFinder_Bphysics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.IDScanZFinder_Bphysics" name="IDScanZFinder" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_StandaloneScoringTool_photon"> - <online> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_photon" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_photon" name="InDet::InDetTrtTrackScoringTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TMEF_MuonHoughPatternToolCosmic"> - <online> - <component alias="ToolSvc.TMEF_MuonHoughPatternToolCosmic" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TMEF_MuonHoughPatternToolCosmic" name="MuonHoughPatternTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TMEF_MdtDriftCircleOnTrackCreatorAdjustableT0Cosmic"> - <online> - <component alias="ToolSvc.TMEF_MdtDriftCircleOnTrackCreatorAdjustableT0Cosmic" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TMEF_MdtDriftCircleOnTrackCreatorAdjustableT0Cosmic" name="Muon::MdtDriftCircleOnTrackCreator" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TMEF_MuonChamberHoleRecoveryToolCosmic"> - <online> - <component alias="ToolSvc.TMEF_MuonChamberHoleRecoveryToolCosmic" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TMEF_MuonChamberHoleRecoveryToolCosmic" name="Muon::MuonChamberHoleRecoveryTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.Trk::FastVertexFitter"> - <online> - <component alias="ToolSvc.Trk::FastVertexFitter" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.Trk::FastVertexFitter" name="Trk::FastVertexFitter" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions.exToCalo"> - <online> - <component alias="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions.exToCalo" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions.exToCalo" name="ExtrapolateToCaloTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonStraightLineExtrapolator"> - <online> - <component alias="ToolSvc.MuonStraightLineExtrapolator" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonStraightLineExtrapolator" name="Trk::Extrapolator" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonHoleRecovery.CscClusterOnTrackCreator"> - <online> - <component alias="ToolSvc.MuonHoleRecovery.CscClusterOnTrackCreator" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonHoleRecovery.CscClusterOnTrackCreator" name="Muon::CscClusterOnTrackCreator" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions" name="EMTrackMatchBuilder" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.egammaExtrapolationTool"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.egammaExtrapolationTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.egammaExtrapolationTool" name="EMExtrapolationTools" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.exToCalo"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.exToCalo" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.exToCalo" name="ExtrapolateToCaloTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MuGirlStauCombinedMuonTrackBuilder"> - <online> - <component alias="ToolSvc.MuGirlStauCombinedMuonTrackBuilder" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuGirlStauCombinedMuonTrackBuilder" name="Rec::CombinedMuonTrackBuilder" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigAmbiguityProcessor_bphysics"> - <online> - <component alias="ToolSvc.InDetTrigAmbiguityProcessor_bphysics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigAmbiguityProcessor_bphysics" name="Trk::SimpleAmbiguityProcessorTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TileCondToolOfc"> - <online> - <component alias="ToolSvc.TileCondToolOfc" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TileCondToolOfc" name="TileCondToolOfc" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_electron"> - <online> - <component alias="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_electron" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_electron" name="InDet::TRT_TrackSegmentsMaker_ATLxk" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_tau"> - <online> - <component alias="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_tau" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_tau" name="InDet::TRT_TrackSegmentsMaker_ATLxk" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTrackFitterCosmics"> - <online> - <component alias="ToolSvc.InDetTrigTrackFitterCosmics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTrackFitterCosmics" name="Trk::GlobalChi2Fitter" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigMuGirlStauTool"> - <online> - <component alias="ToolSvc.TrigMuGirlStauTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigMuGirlStauTool" name="MuGirlNS::StauTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonKalmanTrackFitter"> - <online> - <component alias="ToolSvc.MuonKalmanTrackFitter" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonKalmanTrackFitter" name="Trk::KalmanFitter" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonChi2TrackFitter"> - <online> - <component alias="ToolSvc.MuonChi2TrackFitter" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonChi2TrackFitter" name="Trk::GlobalChi2Fitter" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TMEF_MuonCurvedSegmentCombinerCosmic"> - <online> - <component alias="ToolSvc.TMEF_MuonCurvedSegmentCombinerCosmic" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TMEF_MuonCurvedSegmentCombinerCosmic" name="Muon::MuonCurvedSegmentCombiner" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetL2_TRT_TrackSegmentsMaker"> - <online> - <component alias="ToolSvc.InDetL2_TRT_TrackSegmentsMaker" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetL2_TRT_TrackSegmentsMaker" name="InDet::TRT_TrackSegmentsMaker_ATLxk" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_StandaloneScoringTool_electron"> - <online> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_electron" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_electron" name="InDet::InDetTrtTrackScoringTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigParticleCreatorToolParams"> - <online> - <component alias="ToolSvc.InDetTrigParticleCreatorToolParams" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigParticleCreatorToolParams" name="Trk::TrackParticleCreatorTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonTrackExtrapolationTool"> - <online> - <component alias="ToolSvc.MuonTrackExtrapolationTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonTrackExtrapolationTool" name="Muon::MuonTrackExtrapolationTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigExtScoringTool_bphysics"> - <online> - <component alias="ToolSvc.InDetTrigExtScoringTool_bphysics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigExtScoringTool_bphysics" name="InDet::InDetAmbiScoringTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigMuGirlSelectionTool"> - <online> - <component alias="ToolSvc.TrigMuGirlSelectionTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigMuGirlSelectionTool" name="MuGirlNS::ANNSelectionTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigSiTrackMaker_bphysics"> - <online> - <component alias="ToolSvc.InDetTrigSiTrackMaker_bphysics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigSiTrackMaker_bphysics" name="InDet::SiTrackMaker_xk" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_StandaloneScoringTool_muon"> - <online> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_muon" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_muon" name="InDet::InDetTrtTrackScoringTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigZvertexMaker_bphysics"> - <online> - <component alias="ToolSvc.InDetTrigZvertexMaker_bphysics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigZvertexMaker_bphysics" name="InDet::SiZvertexMaker_xk" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TMEF_MuonCombinePatternToolCosmic"> - <online> - <component alias="ToolSvc.TMEF_MuonCombinePatternToolCosmic" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TMEF_MuonCombinePatternToolCosmic" name="MuonCombinePatternTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigMuGirlStauGlobalFitTool"> - <online> - <component alias="ToolSvc.TrigMuGirlStauGlobalFitTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigMuGirlStauGlobalFitTool" name="MuGirlNS::GlobalFitTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigMuGirlSAGlobalFitTool"> - <online> - <component alias="ToolSvc.TrigMuGirlSAGlobalFitTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigMuGirlSAGlobalFitTool" name="MuGirlNS::GlobalFitTool" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions" name="EMConversionBuilder" py_name="" py_package=""/> - </offline> - </Rename> - <Rename name="Streams"> - <online> - <component alias="Streams" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="Streams" name="AthSequencer" py_name="" py_package=""/> - </offline> - </Rename> - <!-- Fix unknowns release 15.5.1.1 --> - <Rename name="ToolSvc.egammaQpoint_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault"> - <online> - <component alias="ToolSvc.egammaQpoint_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egammaQpoint_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault" name="CaloDepthTool" py_name="CaloDepthToolBase" py_package="CaloDetDescr.CaloDepthToolBase"/> - </offline> - </Rename> - <Rename name="ToolSvc.empid_TrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.empid_TrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.empid_TrigEgammaRec_NoIDEF_eGamma" name="EMPIDBuilder" py_name="egammaEMPIDBuilderEF" py_package="TrigEgammaRec.EMPIDBuilderTrigEgammaRec"/> - </offline> - </Rename> - <Rename name="ToolSvc.egammaQpoint_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma.CaloDepthToolshowerdefault"> - <online> - <component alias="ToolSvc.egammaQpoint_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma.CaloDepthToolshowerdefault" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egammaQpoint_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma.CaloDepthToolshowerdefault" name="CaloDepthTool" py_name="CaloDepthToolBase" py_package="CaloDetDescr.CaloDepthToolBase"/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonTrackSelectorTool"> - <online> - <component alias="ToolSvc.MuonTrackSelectorTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonTrackSelectorTool" name="Muon::MuonTrackSelectorTool" py_name="MuonTrackSelectorTool" py_package="MuonRecExample.Moore"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetL2_TRT_TrackSegmentsMaker_BarrelCosmics"> - <online> - <component alias="ToolSvc.InDetL2_TRT_TrackSegmentsMaker_BarrelCosmics" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetL2_TRT_TrackSegmentsMaker_BarrelCosmics" name="InDet::TRT_TrackSegmentsMaker_BarrelCosmics" py_name="InDet__TRT_TrackSegmentsMaker_BarrelCosmics" py_package="TRT_TrackSegmentsTool_xk.TRT_TrackSegmentsTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.MuGirlStauCombinedMuonTrackBuilder"> - <online> - <component alias="ToolSvc.MuGirlStauCombinedMuonTrackBuilder" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuGirlStauCombinedMuonTrackBuilder" name="Rec::CombinedMuonTrackBuilder" py_name="Rec__CombinedMuonTrackBuilder" py_package="MuidTrackBuilder.MuidTrackBuilderConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.LArTrackingVolumeHelper"> - <online> - <component alias="ToolSvc.LArTrackingVolumeHelper" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.LArTrackingVolumeHelper" name="Trk::TrackingVolumeHelper" py_name="Trk__TrackingVolumeHelper" py_package="TrkDetDescrTools.TrkDetDescrToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTrackSummaryTool"> - <online> - <component alias="ToolSvc.InDetTrigTrackSummaryTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTrackSummaryTool" name="Trk::TrackSummaryTool" py_name="Trk__TrackSummaryTool" py_package="TrkTrackSummaryTool.TrkTrackSummaryToolConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigClusterMakerTool"> - <online> - <component alias="ToolSvc.InDetTrigClusterMakerTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigClusterMakerTool" name="InDet::ClusterMakerTool" py_name="InDet__ClusterMakerTool" py_package="SiClusterizationTool.SiClusterizationToolConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.L2MdtTool.MdtTimingTool"> - <online> - <component alias="ToolSvc.L2MdtTool.MdtTimingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.L2MdtTool.MdtTimingTool" name="MdtTimingTool" py_name="MdtTimingTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.emshower_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma" name="EMShowerBuilder" py_name="EMShowerBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma.egammashowershape_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.emshower_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma.egammashowershape_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma.egammashowershape_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma" name="egammaShowerShape" py_name="egammaShowerShape" py_package="egammaCaloTools.egammaCaloToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigTauCommonCalcVar"> - <online> - <component alias="ToolSvc.TrigTauCommonCalcVar" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigTauCommonCalcVar" name="TauCommonCalcVars" py_name="TauCommonCalcVars" py_package="tauRec.tauRecConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.MdtTimingTool"> - <online> - <component alias="ToolSvc.MdtTimingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MdtTimingTool" name="MdtTimingTool" py_name="MdtTimingTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigSiComTrackFinder"> - <online> - <component alias="ToolSvc.InDetTrigSiComTrackFinder" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigSiComTrackFinder" name="InDet::SiCombinatorialTrackFinder_xk" py_name="InDet__SiCombinatorialTrackFinder_xk" py_package="SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.L2DataLoader"> - <online> - <component alias="ToolSvc.L2DataLoader" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.L2DataLoader" name="L2DataLoader" py_name="L2DataLoader" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.egammaExtrapolationTool"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.egammaExtrapolationTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.egammaExtrapolationTool" name="EMExtrapolationTools" py_name="EMExtrapolationTools" py_package="egammaTrackTools.egammaTrackToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.egammaExtrapolationTool"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.egammaExtrapolationTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.egammaExtrapolationTool" name="EMExtrapolationTools" py_name="EMExtrapolationTools" py_package="egammaTrackTools.egammaTrackToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_TrigEgammaRec_eGamma"> - <online> - <component alias="ToolSvc.emshower_TrigEgammaRec_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_TrigEgammaRec_eGamma" name="EMShowerBuilder" py_name="EMShowerBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_TrigEgammaRec_eGamma.egammashowershape_TrigEgammaRec_eGamma"> - <online> - <component alias="ToolSvc.emshower_TrigEgammaRec_eGamma.egammashowershape_TrigEgammaRec_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_TrigEgammaRec_eGamma.egammashowershape_TrigEgammaRec_eGamma" name="egammaShowerShape" py_name="egammaShowerShape" py_package="egammaCaloTools.egammaCaloToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_TrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.emshower_TrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_TrigEgammaRec_NoIDEF_eGamma" name="EMShowerBuilder" py_name="EMShowerBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_TrigEgammaRec_NoIDEF_eGamma.egammashowershape_TrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.emshower_TrigEgammaRec_NoIDEF_eGamma.egammashowershape_TrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_TrigEgammaRec_NoIDEF_eGamma.egammashowershape_TrigEgammaRec_NoIDEF_eGamma" name="egammaShowerShape" py_name="egammaShowerShape" py_package="egammaCaloTools.egammaCaloToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.egammaQgcld_TrigEgammaRec_eGamma.CaloDepthToolshowerdefault"> - <online> - <component alias="ToolSvc.egammaQgcld_TrigEgammaRec_eGamma.CaloDepthToolshowerdefault" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egammaQgcld_TrigEgammaRec_eGamma.CaloDepthToolshowerdefault" name="CaloDepthTool" py_name="CaloDepthToolBase" py_package="CaloDetDescr.CaloDepthToolBase"/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonHoleRecovery.CscClusterOnTrackCreator"> - <online> - <component alias="ToolSvc.MuonHoleRecovery.CscClusterOnTrackCreator" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonHoleRecovery.CscClusterOnTrackCreator" name="Muon::CscClusterOnTrackCreator" py_name="Muon__CscClusterOnTrackCreator" py_package="MuonClusterOnTrackCreator.MuonClusterOnTrackCreatorConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigSiSpacePointMakerTool"> - <online> - <component alias="ToolSvc.InDetTrigSiSpacePointMakerTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigSiSpacePointMakerTool" name="InDet::SiSpacePointMakerTool" py_name="InDet__SiSpacePointMakerTool" py_package="SiSpacePointTool.SiSpacePointToolConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigMuGirlStauTool"> - <online> - <component alias="ToolSvc.TrigMuGirlStauTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigMuGirlStauTool" name="MuGirlNS::StauTool" py_name="MuGirlNS__StauToolConfig" py_package="MuGirlStau.MuGirlStauConfig"/> - </offline> - </Rename> - <Rename name="ToolSvc.L2MdtTool"> - <online> - <component alias="ToolSvc.L2MdtTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.L2MdtTool" name="L2MdtTool" py_name="L2MdtTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions.exToCalo"> - <online> - <component alias="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions.exToCalo" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions.exToCalo" name="ExtrapolateToCaloTool" py_name="ExtrapolateToCaloTool" py_package="TrackToCalo.TrackToCaloConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.empid_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.empid_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.empid_TrigEgammaRec_PhotonConversions" name="EMPIDBuilder" py_name="egammaEMPIDBuilderEF" py_package="TrigEgammaRec.EMPIDBuilderTrigEgammaRec"/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions" name="EMTrackMatchBuilder" py_name="EMTrackMatchBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.exToCalo"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.exToCalo" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_PhotonConversions.exToCalo" name="ExtrapolateToCaloTool" py_name="ExtrapolateToCaloTool" py_package="TrackToCalo.TrackToCaloConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigSCTSpacePointTool"> - <online> - <component alias="ToolSvc.InDetTrigSCTSpacePointTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigSCTSpacePointTool" name="InDet::SCT_TrigSpacePointTool" py_name="InDet__SCT_TrigSpacePointTool" py_package="SiTrigSpacePointFormation.SiTrigSpacePointFormationConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma" name="EMTrackMatchBuilder" py_name="EMTrackMatchBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.exToCalo"> - <online> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.exToCalo" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emtrackmatch_TrigEgammaRec_eGamma.exToCalo" name="ExtrapolateToCaloTool" py_name="ExtrapolateToCaloTool" py_package="TrackToCalo.TrackToCaloConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.egammaQgcld_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault"> - <online> - <component alias="ToolSvc.egammaQgcld_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egammaQgcld_TrigEgammaRec_PhotonConversions.CaloDepthToolshowerdefault" name="CaloDepthTool" py_name="CaloDepthToolBase" py_package="CaloDetDescr.CaloDepthToolBase"/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigCosmicsTauExtrapolateToCaloTool"> - <online> - <component alias="ToolSvc.TrigCosmicsTauExtrapolateToCaloTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigCosmicsTauExtrapolateToCaloTool" name="ExtrapolateToCaloTool" py_name="ExtrapolateToCaloTool" py_package="TrackToCalo.TrackToCaloConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.egfourmom_TrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.egfourmom_TrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egfourmom_TrigEgammaRec_NoIDEF_eGamma" name="EMFourMomBuilder" py_name="EMFourMomBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTrackFitterLowPt"> - <online> - <component alias="ToolSvc.InDetTrigTrackFitterLowPt" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTrackFitterLowPt" name="Trk::GlobalChi2Fitter" py_name="Trk__GlobalChi2Fitter" py_package="TrkGlobalChi2Fitter.TrkGlobalChi2FitterConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.Csc2dSegmentMaker"> - <online> - <component alias="ToolSvc.Csc2dSegmentMaker" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.Csc2dSegmentMaker" name="Csc2dSegmentMaker" py_name="Csc2dSegmentMaker" py_package="CscSegmentMakers.CscSegmentMakersConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.L2RpcTool"> - <online> - <component alias="ToolSvc.L2RpcTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.L2RpcTool" name="L2RpcTool" py_name="L2RpcTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigTauVertex"> - <online> - <component alias="ToolSvc.TrigTauVertex" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigTauVertex" name="TauCommonVertex" py_name="TauCommonVertex" py_package="tauRec.tauRecConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTrackFitterTRT"> - <online> - <component alias="ToolSvc.InDetTrigTrackFitterTRT" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTrackFitterTRT" name="Trk::GlobalChi2Fitter" py_name="Trk__GlobalChi2Fitter" py_package="TrkGlobalChi2Fitter.TrkGlobalChi2FitterConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigTauCosmicsTrackSelect"> - <online> - <component alias="ToolSvc.TrigTauCosmicsTrackSelect" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigTauCosmicsTrackSelect" name="InDet::InDetDetailedTrackSelectorTool" py_name="InDet__InDetDetailedTrackSelectorTool" py_package="InDetTrackSelectorTool.InDetTrackSelectorToolConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonTrackExtrapolationTool"> - <online> - <component alias="ToolSvc.MuonTrackExtrapolationTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonTrackExtrapolationTool" name="Muon::MuonTrackExtrapolationTool" py_name="MuonTrackExtrapolationTool" py_package="MuonRecExample.Moore"/> - </offline> - </Rename> - <Rename name="ToolSvc.MCTBExtrapolatorBlendedMat"> - <online> - <component alias="ToolSvc.MCTBExtrapolatorBlendedMat" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MCTBExtrapolatorBlendedMat" name="Trk::Extrapolator" py_name="MCTBExtrapolator" py_package="MuonRecExample.Moore"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetL2_TRT_TrackSegmentsMaker_BarrelCosmics_NoField"> - <online> - <component alias="ToolSvc.InDetL2_TRT_TrackSegmentsMaker_BarrelCosmics_NoField" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetL2_TRT_TrackSegmentsMaker_BarrelCosmics_NoField" name="InDet::TRT_TrackSegmentsMaker_BarrelCosmics" py_name="InDet__TRT_TrackSegmentsMaker_BarrelCosmics" py_package="TRT_TrackSegmentsTool_xk.TRT_TrackSegmentsTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.empid_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.empid_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.empid_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma" name="EMPIDBuilder" py_name="egammaEMPIDBuilderEF" py_package="TrigEgammaRec.EMPIDBuilderTrigEgammaRec"/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_TrigEgammaRec_PhotonConversions.egammashowershape_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.emshower_TrigEgammaRec_PhotonConversions.egammashowershape_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_TrigEgammaRec_PhotonConversions.egammashowershape_TrigEgammaRec_PhotonConversions" name="egammaShowerShape" py_name="egammaShowerShape" py_package="egammaCaloTools.egammaCaloToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigMuGirlStauGlobalFitTool"> - <online> - <component alias="ToolSvc.TrigMuGirlStauGlobalFitTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigMuGirlStauGlobalFitTool" name="MuGirlNS::GlobalFitTool" py_name="MuGirlNS__GlobalFitTool" py_package="MuGirlGlobalFit.MuGirlGlobalFitConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigMuGirlSAGlobalFitTool"> - <online> - <component alias="ToolSvc.TrigMuGirlSAGlobalFitTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigMuGirlSAGlobalFitTool" name="MuGirlNS::GlobalFitTool" py_name="MuGirlNS__GlobalFitTool" py_package="MuGirlGlobalFit.MuGirlGlobalFitConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.egammaQpoint_TrigEgammaRec_NoIDEF_eGamma.CaloDepthToolshowerdefault"> - <online> - <component alias="ToolSvc.egammaQpoint_TrigEgammaRec_NoIDEF_eGamma.CaloDepthToolshowerdefault" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egammaQpoint_TrigEgammaRec_NoIDEF_eGamma.CaloDepthToolshowerdefault" name="CaloDepthTool" py_name="CaloDepthToolBase" py_package="CaloDetDescr.CaloDepthToolBase"/> - </offline> - </Rename> - <Rename name="ToolSvc.egammaQpoint_TrigEgammaRec_eGamma.CaloDepthToolshowerdefault"> - <online> - <component alias="ToolSvc.egammaQpoint_TrigEgammaRec_eGamma.CaloDepthToolshowerdefault" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egammaQpoint_TrigEgammaRec_eGamma.CaloDepthToolshowerdefault" name="CaloDepthTool" py_name="CaloDepthToolBase" py_package="CaloDetDescr.CaloDepthToolBase"/> - </offline> - </Rename> - <Rename name="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emconversion_TrigEgammaRec_PhotonConversions" name="EMConversionBuilder" py_name="EMConversionBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.emshower_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_TrigEgammaRec_PhotonConversions" name="EMShowerBuilder" py_name="EMShowerBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.egfourmom_TrigEgammaRec_eGamma"> - <online> - <component alias="ToolSvc.egfourmom_TrigEgammaRec_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egfourmom_TrigEgammaRec_eGamma" name="EMFourMomBuilder" py_name="EMFourMomBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigAmbiTrackSelectionTool"> - <online> - <component alias="ToolSvc.InDetTrigAmbiTrackSelectionTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigAmbiTrackSelectionTool" name="InDet::InDetAmbiTrackSelectionTool" py_name="InDet__InDetAmbiTrackSelectionTool" py_package="InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.egfourmom_TrigEgammaRec_PhotonConversions"> - <online> - <component alias="ToolSvc.egfourmom_TrigEgammaRec_PhotonConversions" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egfourmom_TrigEgammaRec_PhotonConversions" name="EMFourMomBuilder" py_name="EMFourMomBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTrackFitter"> - <online> - <component alias="ToolSvc.InDetTrigTrackFitter" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTrackFitter" name="Trk::GlobalChi2Fitter" py_name="Trk__GlobalChi2Fitter" py_package="TrkGlobalChi2Fitter.TrkGlobalChi2FitterConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.empid_TrigEgammaRec_eGamma"> - <online> - <component alias="ToolSvc.empid_TrigEgammaRec_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.empid_TrigEgammaRec_eGamma" name="EMPIDBuilder" py_name="egammaEMPIDBuilderEF" py_package="TrigEgammaRec.EMPIDBuilderTrigEgammaRec"/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonSegmentMatchingTool"> - <online> - <component alias="ToolSvc.MuonSegmentMatchingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonSegmentMatchingTool" name="Muon::MuonSegmentMatchingTool" py_name="MuonSegmentMatchingTool" py_package="MuonRecExample.Moore"/> - </offline> - </Rename> - <Rename name="ToolSvc.egfourmom_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.egfourmom_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egfourmom_CosmicEgamma_V2TrigEgammaRec_NoIDEF_eGamma" name="EMFourMomBuilder" py_name="EMFourMomBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigSiDetElementsRoadMaker"> - <online> - <component alias="ToolSvc.InDetTrigSiDetElementsRoadMaker" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigSiDetElementsRoadMaker" name="InDet::SiDetElementsRoadMaker_xk" py_name="InDet__SiDetElementsRoadMaker_xk" py_package="SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigAmbiguityProcessor_minBias2"> - <online> - <component alias="ToolSvc.InDetTrigAmbiguityProcessor_minBias2" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigAmbiguityProcessor_minBias2" name="Trk::SimpleAmbiguityProcessorTool" py_name="Trk__SimpleAmbiguityProcessorTool" py_package="TrkAmbiguityProcessor.TrkAmbiguityProcessorConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigConversionFinderTools"> - <online> - <component alias="ToolSvc.InDetTrigConversionFinderTools" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigConversionFinderTools" name="InDet::InDetConversionFinderTools" py_name="InDet__InDetConversionFinderTools" py_package="InDetConversionFinderTools.InDetConversionFinderToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigAmbiguityProcessorLowPt"> - <online> - <component alias="ToolSvc.InDetTrigAmbiguityProcessorLowPt" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigAmbiguityProcessorLowPt" name="Trk::SimpleAmbiguityProcessorTool" py_name="Trk__SimpleAmbiguityProcessorTool" py_package="TrkAmbiguityProcessor.TrkAmbiguityProcessorConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_cosmicsN"> - <online> - <component alias="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_cosmicsN" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_TrackSegmentsMaker_cosmicsN" name="InDet::TRT_TrackSegmentsMaker_ATLxk" py_name="InDet__TRT_TrackSegmentsMaker_ATLxk" py_package="TRT_TrackSegmentsTool_xk.TRT_TrackSegmentsTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigZvertexMaker_cosmicsN"> - <online> - <component alias="ToolSvc.InDetTrigZvertexMaker_cosmicsN" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigZvertexMaker_cosmicsN" name="InDet::SiZvertexMaker_xk" py_name="InDet__SiZvertexMaker_xk" py_package="SiZvertexTool_xk.SiZvertexTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigExtScoringTool_cosmicsN"> - <online> - <component alias="ToolSvc.InDetTrigExtScoringTool_cosmicsN" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigExtScoringTool_cosmicsN" name="InDet::InDetAmbiScoringTool" py_name="InDet__InDetAmbiScoringTool" py_package="InDetTrackScoringTools.InDetTrackScoringToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigSiTrackMaker_minBias2"> - <online> - <component alias="ToolSvc.InDetTrigSiTrackMaker_minBias2" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigSiTrackMaker_minBias2" name="InDet::SiTrackMaker_xk" py_name="InDet__SiTrackMaker_xk" py_package="SiTrackMakerTool_xk.SiTrackMakerTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigTRT_DriftCircleProviderTool"> - <online> - <component alias="ToolSvc.TrigTRT_DriftCircleProviderTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigTRT_DriftCircleProviderTool" name="TrigTRT_DriftCircleProviderTool" py_name="TrigTRT_DriftCircleProviderTool" py_package="TrigOfflineDriftCircleTool.TrigOfflineDriftCircleToolConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigSiTrackMakerLowPt"> - <online> - <component alias="ToolSvc.InDetTrigSiTrackMakerLowPt" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigSiTrackMakerLowPt" name="InDet::SiTrackMaker_xk" py_name="InDet__SiTrackMaker_xk" py_package="SiTrackMakerTool_xk.SiTrackMakerTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigZvertexMakerLowPt"> - <online> - <component alias="ToolSvc.InDetTrigZvertexMakerLowPt" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigZvertexMakerLowPt" name="InDet::SiZvertexMaker_xk" py_name="InDet__SiZvertexMaker_xk" py_package="SiZvertexTool_xk.SiZvertexTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigZvertexMaker_minBias2"> - <online> - <component alias="ToolSvc.InDetTrigZvertexMaker_minBias2" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigZvertexMaker_minBias2" name="InDet::SiZvertexMaker_xk" py_name="InDet__SiZvertexMaker_xk" py_package="SiZvertexTool_xk.SiZvertexTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.TrigTRT_TrackExtensionTool.TrigTRT_DetElementRoadTool"> - <online> - <component alias="ToolSvc.TrigTRT_TrackExtensionTool.TrigTRT_DetElementRoadTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.TrigTRT_TrackExtensionTool.TrigTRT_DetElementRoadTool" name="TrigTRT_DetElementRoadTool" py_name="TrigTRT_DetElementRoadTool" py_package="TrigTRT_TrackExtensionTool.TrigTRT_TrackExtensionToolConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigAmbiguityProcessor_cosmicsN"> - <online> - <component alias="ToolSvc.InDetTrigAmbiguityProcessor_cosmicsN" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigAmbiguityProcessor_cosmicsN" name="Trk::SimpleAmbiguityProcessorTool" py_name="Trk__SimpleAmbiguityProcessorTool" py_package="TrkAmbiguityProcessor.TrkAmbiguityProcessorConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigScoringTool_cosmicsN"> - <online> - <component alias="ToolSvc.InDetTrigScoringTool_cosmicsN" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigScoringTool_cosmicsN" name="InDet::InDetAmbiScoringTool" py_name="InDet__InDetAmbiScoringTool" py_package="InDetTrackScoringTools.InDetTrackScoringToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.PixelClusterCacheTool.PixelRodDecoder"> - <online> - <component alias="ToolSvc.PixelClusterCacheTool.PixelRodDecoder" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.PixelClusterCacheTool.PixelRodDecoder" name="PixelRodDecoder" py_name="PixelRodDecoder" py_package="PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigParticleCreatorToolParams"> - <online> - <component alias="ToolSvc.InDetTrigParticleCreatorToolParams" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigParticleCreatorToolParams" name="Trk::TrackParticleCreatorTool" py_name="Trk__TrackParticleCreatorTool" py_package="TrkParticleCreator.TrkParticleCreatorConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTrackSlimmingToolParams"> - <online> - <component alias="ToolSvc.InDetTrigTrackSlimmingToolParams" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTrackSlimmingToolParams" name="Trk::TrackSlimmingTool" py_name="Trk__TrackSlimmingTool" py_package="TrkTrackSlimmingTool.TrkTrackSlimmingToolConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigCosmicScoringTool_TRT"> - <online> - <component alias="ToolSvc.InDetTrigCosmicScoringTool_TRT" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigCosmicScoringTool_TRT" name="InDet::InDetCosmicScoringTool" py_name="InDet__InDetCosmicScoringTool" py_package="InDetTrackScoringTools.InDetTrackScoringToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.SCT_ClusterCacheTool.SCT_RodDecoder"> - <online> - <component alias="ToolSvc.SCT_ClusterCacheTool.SCT_RodDecoder" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.SCT_ClusterCacheTool.SCT_RodDecoder" name="SCT_RodDecoder" py_name="SCT_RodDecoder" py_package="SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigSiTrackMaker_cosmicsN"> - <online> - <component alias="ToolSvc.InDetTrigSiTrackMaker_cosmicsN" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigSiTrackMaker_cosmicsN" name="InDet::SiTrackMaker_xk" py_name="InDet__SiTrackMaker_xk" py_package="SiTrackMakerTool_xk.SiTrackMakerTool_xkConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.ConfiguredOnlineSpacePointProviderTool"> - <online> - <component alias="ToolSvc.ConfiguredOnlineSpacePointProviderTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.ConfiguredOnlineSpacePointProviderTool" name="OnlineSpacePointProviderTool" py_name="ConfiguredOnlineSpacePointProviderTool" py_package="TrigOnlineSpacePointTool.TrigOnlineSpacePointTool_Config"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_StandaloneScoringTool_cosmicsN"> - <online> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_cosmicsN" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_cosmicsN" name="InDet::InDetTrtTrackScoringTool" py_name="InDet__InDetTrtTrackScoringTool" py_package="InDetTrackScoringTools.InDetTrackScoringToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigTRT_StandaloneScoringTool_photon"> - <online> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_photon" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigTRT_StandaloneScoringTool_photon" name="InDet::InDetTrtTrackScoringTool" py_name="InDet__InDetTrtTrackScoringTool" py_package="InDetTrackScoringTools.InDetTrackScoringToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.FixedErrorMuonClusterOnTrackCreator"> - <online> - <component alias="ToolSvc.FixedErrorMuonClusterOnTrackCreator" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.FixedErrorMuonClusterOnTrackCreator" name="Muon::MuonClusterOnTrackCreator" py_name="Muon__MuonClusterOnTrackCreator" py_package="MuonClusterOnTrackCreator.MuonClusterOnTrackCreatorConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonHoughPatternTool"> - <online> - <component alias="ToolSvc.MuonHoughPatternTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonHoughPatternTool" name="MuonHoughPatternTool" py_name="MuonHoughPatternTool" py_package="MuonHoughPatternTools.MuonHoughPatternToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonCombinePatternTool"> - <online> - <component alias="ToolSvc.MuonCombinePatternTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonCombinePatternTool" name="MuonCombinePatternTool" py_name="MuonCombinePatternTool" py_package="MuonCombinePatternTools.MuonCombinePatternToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.MuonSegmentMomentum"> - <online> - <component alias="ToolSvc.MuonSegmentMomentum" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.MuonSegmentMomentum" name="MuonSegmentMomentum" py_name="MuonSegmentMomentum" py_package="MuonSegmentMomentum.MuonSegmentMomentumConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2DataLoader"> - <online> - <component alias="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2DataLoader" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2DataLoader" name="L2DataLoader" py_name="L2DataLoader" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2RpcTool"> - <online> - <component alias="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2RpcTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2RpcTool" name="L2RpcTool" py_name="L2RpcTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2MdtTool"> - <online> - <component alias="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2MdtTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2MdtTool" name="L2MdtTool" py_name="L2MdtTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2MdtTool.MdtTimingTool"> - <online> - <component alias="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEF_V2TrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="MdtTimingTool" py_name="MdtTimingTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnly_V2TrigL2CosmicMuon.L2MdtTool.MdtTimingTool"> - <online> - <component alias="CosmicMuonOnly_V2TrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnly_V2TrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="MdtTimingTool" py_name="MdtTimingTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnly_V2TrigL2CosmicMuon.L2MdtTool"> - <online> - <component alias="CosmicMuonOnly_V2TrigL2CosmicMuon.L2MdtTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnly_V2TrigL2CosmicMuon.L2MdtTool" name="L2MdtTool" py_name="L2MdtTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnly_V2TrigL2CosmicMuon.L2DataLoader"> - <online> - <component alias="CosmicMuonOnly_V2TrigL2CosmicMuon.L2DataLoader" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnly_V2TrigL2CosmicMuon.L2DataLoader" name="L2DataLoader" py_name="L2DataLoader" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnly_V2TrigL2CosmicMuon.L2RpcTool"> - <online> - <component alias="CosmicMuonOnly_V2TrigL2CosmicMuon.L2RpcTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnly_V2TrigL2CosmicMuon.L2RpcTool" name="L2RpcTool" py_name="L2RpcTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_V2TrigL2CosmicMuon.L2MdtTool.MdtTimingTool"> - <online> - <component alias="CosmicMuon_V2TrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_V2TrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="MdtTimingTool" py_name="MdtTimingTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_V2TrigL2CosmicMuon.L2DataLoader"> - <online> - <component alias="CosmicMuon_V2TrigL2CosmicMuon.L2DataLoader" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_V2TrigL2CosmicMuon.L2DataLoader" name="L2DataLoader" py_name="L2DataLoader" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_V2TrigL2CosmicMuon.L2MdtTool"> - <online> - <component alias="CosmicMuon_V2TrigL2CosmicMuon.L2MdtTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_V2TrigL2CosmicMuon.L2MdtTool" name="L2MdtTool" py_name="L2MdtTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.egammaQpoint_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma.CaloDepthToolshowerdefault"> - <online> - <component alias="ToolSvc.egammaQpoint_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma.CaloDepthToolshowerdefault" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egammaQpoint_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma.CaloDepthToolshowerdefault" name="CaloDepthTool" py_name="CaloDepthToolBase" py_package="CaloDetDescr.CaloDepthToolBase"/> - </offline> - </Rename> - <Rename name="ToolSvc.empid_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.empid_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.empid_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma" name="EMPIDBuilder" py_name="egammaEMPIDBuilderEF" py_package="TrigEgammaRec.EMPIDBuilderTrigEgammaRec"/> - </offline> - </Rename> - <Rename name="ToolSvc.egfourmom_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.egfourmom_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.egfourmom_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma" name="EMFourMomBuilder" py_name="EMFourMomBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma.egammashowershape_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.emshower_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma.egammashowershape_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma.egammashowershape_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma" name="egammaShowerShape" py_name="egammaShowerShape" py_package="egammaCaloTools.egammaCaloToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.emshower_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma"> - <online> - <component alias="ToolSvc.emshower_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.emshower_CosmicEgammaTrigEgammaRec_NoIDEF_eGamma" name="EMShowerBuilder" py_name="EMShowerBuilder" py_package="egammaTools.egammaToolsConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnlyTrigL2CosmicMuon.L2MdtTool"> - <online> - <component alias="CosmicMuonOnlyTrigL2CosmicMuon.L2MdtTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnlyTrigL2CosmicMuon.L2MdtTool" name="L2MdtTool" py_name="L2MdtTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnlyTrigL2CosmicMuon.L2MdtTool.MdtTimingTool"> - <online> - <component alias="CosmicMuonOnlyTrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnlyTrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="MdtTimingTool" py_name="MdtTimingTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnlyTrigL2CosmicMuon.L2DataLoader"> - <online> - <component alias="CosmicMuonOnlyTrigL2CosmicMuon.L2DataLoader" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnlyTrigL2CosmicMuon.L2DataLoader" name="L2DataLoader" py_name="L2DataLoader" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnlyTrigL2CosmicMuon.L2RpcTool"> - <online> - <component alias="CosmicMuonOnlyTrigL2CosmicMuon.L2RpcTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnlyTrigL2CosmicMuon.L2RpcTool" name="L2RpcTool" py_name="L2RpcTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonTrigL2CosmicMuon.L2MdtTool"> - <online> - <component alias="CosmicMuonTrigL2CosmicMuon.L2MdtTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonTrigL2CosmicMuon.L2MdtTool" name="L2MdtTool" py_name="L2MdtTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonTrigL2CosmicMuon.L2MdtTool.MdtTimingTool"> - <online> - <component alias="CosmicMuonTrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonTrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="MdtTimingTool" py_name="MdtTimingTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonTrigL2CosmicMuon.L2DataLoader"> - <online> - <component alias="CosmicMuonTrigL2CosmicMuon.L2DataLoader" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonTrigL2CosmicMuon.L2DataLoader" name="L2DataLoader" py_name="L2DataLoader" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonTrigL2CosmicMuon.L2RpcTool"> - <online> - <component alias="CosmicMuonTrigL2CosmicMuon.L2RpcTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonTrigL2CosmicMuon.L2RpcTool" name="L2RpcTool" py_name="L2RpcTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2MdtTool"> - <online> - <component alias="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2MdtTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2MdtTool" name="L2MdtTool" py_name="L2MdtTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2MdtTool.MdtTimingTool"> - <online> - <component alias="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="MdtTimingTool" py_name="MdtTimingTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2RpcTool"> - <online> - <component alias="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2RpcTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2RpcTool" name="L2RpcTool" py_name="L2RpcTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2DataLoader"> - <online> - <component alias="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2DataLoader" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEF_TGCTrigL2CosmicMuon.L2DataLoader" name="L2DataLoader" py_name="L2DataLoader" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2RpcTool"> - <online> - <component alias="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2RpcTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2RpcTool" name="L2RpcTool" py_name="L2RpcTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2MdtTool"> - <online> - <component alias="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2MdtTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2MdtTool" name="L2MdtTool" py_name="L2MdtTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2MdtTool.MdtTimingTool"> - <online> - <component alias="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="MdtTimingTool" py_name="MdtTimingTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2DataLoader"> - <online> - <component alias="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2DataLoader" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuonOnly_TGCTrigL2CosmicMuon.L2DataLoader" name="L2DataLoader" py_name="L2DataLoader" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEFTrigL2CosmicMuon.L2RpcTool"> - <online> - <component alias="CosmicMuon_MuonEFTrigL2CosmicMuon.L2RpcTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEFTrigL2CosmicMuon.L2RpcTool" name="L2RpcTool" py_name="L2RpcTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEFTrigL2CosmicMuon.L2MdtTool.MdtTimingTool"> - <online> - <component alias="CosmicMuon_MuonEFTrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEFTrigL2CosmicMuon.L2MdtTool.MdtTimingTool" name="MdtTimingTool" py_name="MdtTimingTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEFTrigL2CosmicMuon.L2MdtTool"> - <online> - <component alias="CosmicMuon_MuonEFTrigL2CosmicMuon.L2MdtTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEFTrigL2CosmicMuon.L2MdtTool" name="L2MdtTool" py_name="L2MdtTool" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="CosmicMuon_MuonEFTrigL2CosmicMuon.L2DataLoader"> - <online> - <component alias="CosmicMuon_MuonEFTrigL2CosmicMuon.L2DataLoader" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="CosmicMuon_MuonEFTrigL2CosmicMuon.L2DataLoader" name="L2DataLoader" py_name="L2DataLoader" py_package="TrigL2CosmicMuon.TrigL2CosmicMuonConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetTrigExtScoringTool_bjet"> - <online> - <component alias="ToolSvc.InDetTrigExtScoringTool_bjet" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetTrigExtScoringTool_bjet" name="InDet::InDetAmbiScoringTool" py_name="InDet__InDetAmbiScoringTool" py_package="InDetTrackScoringTools.InDetTrackScoringToolsConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetVKalVxInJetTool.VertexFitterTool"> - <online> - <component alias="ToolSvc.InDetVKalVxInJetTool.VertexFitterTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetVKalVxInJetTool.VertexFitterTool" name="Trk::TrkVKalVrtFitter" py_name="Trk__TrkVKalVrtFitter" py_package="TrkVKalVrtFitter.TrkVKalVrtFitterConf"/> - </offline> - </Rename> - <Rename name="ToolSvc.InDetVKalVxInJetTool"> - <online> - <component alias="ToolSvc.InDetVKalVxInJetTool" name="unknown" py_name="*" py_package="*"/> - </online> - <offline> - <component alias="ToolSvc.InDetVKalVxInJetTool" name="InDet::InDetVKalVxInJetTool" py_name="InDet__InDetVKalVxInJetTool" py_package="InDetVKalVxInJetTool.InDetVKalVxInJetToolConf"/> - </offline> - </Rename> -<!-- End of fix unknowns release 15.5.1.1 --> - -</Rules> diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py index a8cdee2c2876dba78da988401fb5613e46b9e0f7..2eb9914f588b0243b5c3c50834ef261f7088972a 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging @@ -779,23 +779,6 @@ class readMenuFromTriggerDb(JobProperty): # TriggerFlags.readHLTconfigFromXML = True _flags.append(readMenuFromTriggerDb) -# trigger configuration source list -class readConfigFromTriggerDb(JobProperty): - """ define the TriggerDb to be the source of the LVL1 and HLT trigger menu""" - statusOn=False - allowedType=['bool'] - StoredValue=False - - def _do_action(self): - """ setup reading from DB requires menu readingFromXML """ - if self.get_Value() is True: - # readMenuFromTriggerDb dumps only the HLTMenu to an XML file - it is of no use since HLTConfigSvc is set for the DB - TriggerFlags.readMenuFromTriggerDb = False - TriggerFlags.readLVL1configFromXML = False - TriggerFlags.readHLTconfigFromXML = False - -_flags.append(readConfigFromTriggerDb) - class triggerDbKeys(JobProperty): """ define the keys [Configuration, LVL1Prescale, HLTPrescale, L1BunchGroupSet] in that order!""" statusOn=False diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py index f5a2d287caea93a651ef9ccf8a4a804598bf21a0..3abdbe3c5a8cdcf00189fb69225690e6e03443eb 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from AthenaCommon.GlobalFlags import jobproperties from AthenaCommon.AthenaCommonFlags import jobproperties @@ -66,11 +66,6 @@ class TriggerGetter(Configured): if recAlgs.doTrigger(): - # setup the trigger from the DB - if TF.readConfigFromTriggerDb(): - return self.configureTriggerFromDB() - - if ((TF.doLVL1()==True or TF.doLVL2()==True or TF.doEF()==True or TF.doHLT()==True) and TF.doTriggerConfigOnly()==False): log.info("generating menu") # trigger menu files generation @@ -165,52 +160,3 @@ class TriggerGetter(Configured): hltouput = HLTTriggerResultGetter() return True - - def configureTriggerFromDB(self): - """ configures trigger from the DB """ - log = logging.getLogger( "TriggerGetter.py") - log.info("configureTriggerFromDb") - from TrigConfOffline.HLTConfOffline import HLTConfOffline - hltConfOffline = HLTConfOffline() - # Set the properties - hltConfOffline.setupSource = 'db' - hltConfOffline.OutputLevel = 1 - # Set the connection to the DB - if TF.triggerDbConnection.statusOn : - hltConfOffline.dbType = TF.triggerDbConnection()['dbType'] - hltConfOffline.dbHost = TF.triggerDbConnection()['dbServer'] - hltConfOffline.dbUser = TF.triggerDbConnection()['dbUser'] - hltConfOffline.dbName = TF.triggerDbConnection()['dbName'] - hltConfOffline.dbPasswd = TF.triggerDbConnection()['dbPasswd'] - else: - # try to get connection parameters from authentication files - if not hltConfOffline.setDbConnectionFromAuthFile() : - log.error('failed to set HLTConfOffline service') - return False - - if TF.triggerDbKeys.statusOn : - hltConfOffline.SMKey = TF.triggerDbKeys()[0] - hltConfOffline.LVL1PrescaleKey = TF.triggerDbKeys()[1] - hltConfOffline.HLTPrescaleKey = TF.triggerDbKeys()[2] - else: - log.error( 'missing DB keys, set the TriggerFlags.triggerDBKeys flag') - return False - - if TF.doLVL2() and TF.doEF() : - hltConfOffline.Level = 'BOTH' - elif TF.doLVL2() : - hltConfOffline.Level = 'L2' - elif TF.doEF() : - hltConfOffline.Level = 'EF' - elif TF.doHLT() : - hltConfOffline.Level = 'HLT' - else: - hltConfOffline.Level = None - log.error( 'no trigger level set') - return False - - # Load the setup and set the services on this place - hltConfOffline.load() - - return True -