Exemple #1
0
def fromString(*args):
    ''' Make a list of Variables from the input arguments
    '''
    from RootTools.core.TreeVariable import TreeVariable
    args = sum( [ [s] if type(s)==type("") else s for s in args if s is not None], [])
    if not all(type(s)==type("") or isinstance(s, TreeVariable) for s in args):
        raise ValueError( "Need string or TreeVariable instance or list of these as argument, got %r"%args)
    return tuple(map(lambda s:TreeVariable.fromString(s) if type(s)==type("") else s, args))
Exemple #2
0
def fromString(*args):
    ''' Make a list of Variables from the input arguments
    '''
    from RootTools.core.TreeVariable import TreeVariable
    args = sum( [ [s] if type(s)==type("") else s for s in args if s is not None], [])
    if not all(type(s)==type("") or isinstance(s, TreeVariable) for s in args):
        raise ValueError( "Need string or TreeVariable instance or list of these as argument, got %r"%args)
    return tuple(map(lambda s:TreeVariable.fromString(s) if type(s)==type("") else s, args))
Exemple #3
0
 def tree_variables(self):
     variables = [attribute for attribute in self.attributes if isinstance(attribute, ScalarTreeVariable)]
     for var in self.read_variables:
         if isinstance(var, TreeVariable):
             variables.append(var)
         elif isinstance(var, str):
             variables.append(TreeVariable.fromString(var))
         else:
             raise ValueError("Don't know what to do with %r." % var)
     return variables
Exemple #4
0
 def tree_variables( self ):
     variables = [attribute for attribute in self.attributes if isinstance( attribute, ScalarTreeVariable) ]
     for var in self.read_variables:
         if isinstance(var, TreeVariable):
             variables.append( var )
         elif isinstance(var, str):
             variables.append( TreeVariable.fromString( var ) )
         else:
             raise ValueError( "Don't know what to do with %r." % var )            
     return variables
    def __init__(self, variables):

        if not type(variables) == type([]):
            raise ValueError("Argument 'variables' must be list. Got %r" %
                             variables)

        self.variables = map(
            lambda v: v
            if isinstance(v, TreeVariable) else TreeVariable.fromString(v),
            variables)

        # Keep track of uuids in order to clean up
        self.classUUIDs = []

        # directory where the class is compiled
        self.tmpDir = '/tmp/'

        self._eList = None

        super(FlatTreeLooperBase, self).__init__()