def __setattr__(self, name, n_value): if name=='StoredValue' and not(self._locked): for element in n_value: if not type(element) == float : raise ValueError( ' %s is not the expected type (float) for an element of SignalPatternForSteppingCache' % (element) ) if element < 0.0 : raise ValueError( ' Negative elements (%s) are not allowed in SignalPatternForSteppingCache' % (element) ) JobProperty.__setattr__(self, name, n_value)
def __setattr__(self, name, n_value): """ Ensure that _VALIDATION layout tags get through the first level of checking. """ #print name, n_value if name == "StoredValue": if type(n_value) == str and n_value.endswith("_VALIDATION"): n_value = n_value.replace("_VALIDATION", "") if n_value not in self.allowedValues: self.allowedValues.append(n_value) JobProperty.__setattr__(self, name, n_value)
def __setattr__(self, name, n_value): """ Ensure that _VALIDATION layout tags get through the first level of checking. """ #print (name, n_value) if name == "StoredValue": if type(n_value) == int or type(n_value) == float: if abs(n_value) > 600: raise ValueError( 'THE Y VALUE MUST BE IN [-600,600] !!! The selected value %s is not in the range.' % n_value) JobProperty.__setattr__(self, name, n_value)
def __setattr__(self, name, n_value): """ Ensure that _VALIDATION layout tags get through the first level of checking. """ #print (name, n_value) if name == "StoredValue": if type(n_value) == int or type(n_value) == float: import math if math.fabs(n_value) > 8.5: raise ValueError( 'THE PHI VALUE MUST BE IN [-8.5,8.5]!!! The selected value %s not in range.' % n_value) JobProperty.__setattr__(self, name, n_value)
def __setattr__(self, name, n_value): """ Ensure that _VALIDATION layout tags get through the first level of checking. """ #print (name, n_value) if name == "StoredValue": if type(n_value) == int or type(n_value) == float: import math if abs(n_value) > 60. and not (abs(abs(n_value) - 90.0) < 0.01): raise ValueError( 'THETA MUST BE IN [-60,60] or +/-90 !!! The selected value %s is not in the range.' % n_value) JobProperty.__setattr__(self, name, n_value)
def __setattr__(self, name, n_value): KeysRequired=('run','lb','starttstamp','evts','mu','force_new') if name=='StoredValue' and not(self._locked): def noEventsInLumiBlock(element): return element['evts'] == 0 for element in n_value: if not type(element) == dict : raise ValueError( ' %s is not the expected type (dict) for an element of RunAndLumiOverrideList' % (element.__str__()) ) if not set(element) >= set(KeysRequired): raise ValueError( 'Not all required keys for RunAndLumiOverrideList (%s) were found in %s' % (KeysRequired.__repr__(), element.__repr__()) ) if noEventsInLumiBlock(element): logDigitizationFlags.warning('Found lumiblock with no events! This lumiblock will not be used:\n (%s)' % (element.__str__()) ) from itertools import ifilterfalse n_value[:] = ifilterfalse(noEventsInLumiBlock, n_value) JobProperty.__setattr__(self, name, n_value)
def __setattr__(self, name, n_value): """ Ensure that _VALIDATION physics lists get through the first level of checking. """ #print name, n_value if name == "StoredValue": if type(n_value) == str and n_value.endswith("_VALIDATION"): n_value = n_value.replace("_VALIDATION", "") if n_value not in self.allowedValues: self.allowedValues.append(n_value) if n_value == 'FTFP_BERT_G4Precompound': _sflog.warning('Setting G4CASCADE_USE_PRECOMPOUND for use of ' + 'precompound model' ) os.environ['G4CASCADE_USE_PRECOMPOUND'] = '1' n_value = 'FTFP_BERT' elif 'G4CASCADE_USE_PRECOMPOUND' in os.environ: _sflog.warning('Setting G4CASCADE_USE_PRECOMPOUND back to 0 ' + '(why was it set?)') os.environ['G4CASCADE_USE_PRECOMPOUND'] = '0' JobProperty.__setattr__(self, name, n_value)
def print_JobProperty(self,mode='minimal'): """ Prints the information of the JobProperty """ Indent='' obj_p=object.__getattribute__(self, 'StoredValue') if self.statusOn: obj_ps=obj_p else: obj_ps=None for i in range(self._context_name.count('.')-2): Indent+='-' if self.is_locked(): Indent+='x' else: Indent+='-' if mode=='minimal': import pprint self._log.info(" %s-> %s = %s ",Indent, self._context_name,pprint.pformat(str(obj_ps)) ) elif(mode=='print_v'): return JobProperty.print_JobProperty(self, mode) else: JobProperty.print_JobProperty(self, mode)
def get_Value(self): if self.statusOn: return JobProperty.get_Value(self) else: from RecExConfig.RecFlags import rec return rec.doTruth()