class IsolationConfiguration(): userVariables = { "algorithm" : ["cone","sumpt"] } def __init__(self): self.algorithm = 'cone' self.isolation = IsolationCone() def Display(self): self.user_DisplayParameter("algorithm") self.isolation.Display() def user_DisplayParameter(self,parameter): if parameter=="algorithm": logging.getLogger('MA5').info(" isolation algorithm : "+self.algorithm) else: self.isolation.user_DisplayParameter(parameter) def user_GetParameters(self): table = IsolationConfiguration.userVariables.keys() table.extend(self.isolation.user_GetParameters()) return table def user_GetValues(self,variable): table = [] try: table.extend(IsolationConfiguration.userVariables[variable]) except: pass try: table.extend(self.isolation.user_GetValues(variable)) except: pass return table def user_SetParameter(self,parameter,value): # algorithm if parameter=="algorithm": if value=='cone': self.algorithm='cone' self.isolation=IsolationCone() elif value=='sumpt': self.algorithm='sumpt' self.isolation=IsolationSumPt() else: logging.getLogger('MA5').error("Specified algorithm for muon isolation is not correct. "+\ "Only possible ones are : 'cone' and 'sumpt'.") return False # other else: self.isolation.user_SetParameter(parameter,value)
class IsolationConfiguration(): userVariables = { "algorithm" : ["cone","sumpt"] } def __init__(self): self.algorithm = 'cone' self.isolation = IsolationCone() def Display(self): self.user_DisplayParameter("algorithm") self.isolation.Display() def user_DisplayParameter(self,parameter): if parameter=="algorithm": logging.info(" isolation algorithm : "+self.algorithm) else: self.isolation.user_DisplayParameter(parameter) def user_GetParameters(self): table = IsolationConfiguration.userVariables.keys() table.extend(self.isolation.user_GetParameters()) return table def user_GetValues(self,variable): table = [] try: table.extend(IsolationConfiguration.userVariables[variable]) except: pass try: table.extend(self.isolation.user_GetValues(variable)) except: pass return table def user_SetParameter(self,parameter,value): # algorithm if parameter=="algorithm": if value=='cone': self.algorithm='cone' self.isolation=IsolationCone() elif value=='sumpt': self.algorithm='sumpt' self.isolation=IsolationSumPt() else: logging.error("Specified algorithm for muon isolation is not correct. "+\ "Only possible ones are : 'cone' and 'sumpt'.") return False # other else: self.isolation.user_SetParameter(parameter,value)